123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516 |
- <template>
- <view class="page-container uni-column">
- <view class="consultation-container uni-column">
- <view class="title uni-row">箱号:{{ lot.carrierCode }}</view>
- <view class="info-row uni-row">
- <view class="label">批次号</view>
- <view class="value">{{ lot.lotCode }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">产品描述</view>
- <view class="value">{{ lot.productDescription }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">当前工序</view>
- <view class="value">{{ lot.processAlias }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">投产数量</view>
- <view class="value">{{ lot.pudName }}</view>
- </view>
- <view class="info-row uni-row">
- <view class="label">所有箱号</view>
- <view class="value">{{ lot.allCarrierName }}</view>
- </view>
- <input type="text" v-model="carrierCode" placeholder="请输入箱号" />
- <view class="btn uni-row" style="background-color: #ff5555;" @click.stop="handleScanCode">
- <uni-icons type="scan" size="16" style="color: #ffffff; margin-right: 8rpx;" />
- <text>扫描箱码</text>
- </view>
- <view class="btn uni-row" style="margin-top: 48rpx;" @click.stop="handleConfirm">确定</view>
- </view>
- <dialog-processInspection ref='selectProcessInspection'
- @handleSelectProcessInspection='handleSelectProcessInspection'></dialog-processInspection>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from 'vue'
- import {
- onLoad,
- onReady,
- onUnload,
- onShow
- } from '@dcloudio/uni-app'
- import {
- getLotInfo,
- getCarrierInfoProcess
- } from '@/api/business/processInspection.js'
- import {
- store
- } from '../../store';
- const carrierCode = ref('')
- const lot = ref({})
- const query = ref({})
- const selectProcessInspection = ref(null)
- // 页面生命周期函数
- onLoad(() => {})
- // 扫码
- /*
- const handleScanCode = () => {
- // 引入原生插件
- const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
- if (mpaasScanModule) {
- // 调用插件的 mpaasScan 方法
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,
- // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
- scanType: ["qrCode", "barCode"],
- // 是否隐藏相册,默认false不隐藏
- hideAlbum: false,
- },
- (ret) => {
- console.log(ret);
- const result = JSON.parse(ret.resp_result);
- if (!result.carrierId || result.carrierId == "") {
- uni.showToast({
- icon: "none",
- title: "请扫载具码",
- duration: 1000
- })
- return;
- }
- getCarrierInfo(result).then(resqust => {
- if (resqust.code == 200) {
- //返回数据大于一条,跳转选择批次弹窗
- if (resqust.data.length > 1) {
- query.value = result;
- console.log("查询箱号信息", resqust)
- selectProcessInspection.value.open(resqust.data)
- } else {
- uni.showLoading({
- title: '加载中'
- });
- // 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
- // 需要定义一个请求方法, 从后端获取
- getLotInfo(result).then(res => {
- if (res.code == 200) {
- lot.value = res.data;
- lot.value.carrierCode = result.carrierCode
- carrierCode.value = result.carrierCode;
- console.log("res", res);
- uni.hideLoading();
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- }).catch(err => {
- uni.showToast({
- icon: 'none',
- title: err.message,
- duration: 2000
- })
- })
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: resqust.msg,
- duration: 2000
- })
- }
- }).catch(err => {
- uni.showToast({
- icon: 'none',
- title: err.message,
- duration: 2000
- })
- })
- }
- );
- }
- // else{
- // const result = {carrierCode: '000191'}
- // getCarrierInfo({carrierCode: '000191'}).then(resqust => {
- // if (resqust.code == 200) {
- // //返回数据大于一条,跳转选择批次弹窗
- // if (resqust.data.length > 1) {
- // query.value = result;
- // console.log("查询箱号信息", resqust)
- // selectProcessInspection.value.open(resqust.data)
- // } else {
- // uni.showLoading({
- // title: '加载中'
- // });
- // // 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
- // // 需要定义一个请求方法, 从后端获取
- // getLotInfo(result).then(res => {
- // if (res.code == 200) {
- // lot.value = res.data;
- // lot.value.carrierCode = result.carrierCode
- // carrierCode.value = result.carrierCode;
- // console.log("res", res);
- // uni.hideLoading();
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: res.msg,
- // duration: 2000
- // })
- // }
- // }).catch(err => {
- // uni.showToast({
- // icon: 'none',
- // title: err.message,
- // duration: 2000
- // })
- // })
-
- // }
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: resqust.msg,
- // duration: 2000
- // })
- // }
- // }).catch(err => {
- // uni.showToast({
- // icon: 'none',
- // title: err.message,
- // duration: 2000
- // })
- // })
- // }
- }
- */
- const handleScanCode = () => {
- // 引入原生插件
- const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
- if (mpaasScanModule) {
- // 调用插件的 mpaasScan 方法
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,
- // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
- scanType: ["qrCode", "barCode"],
- // 是否隐藏相册,默认false不隐藏
- hideAlbum: false,
- },
- (ret) => {
- console.log(ret);
- const result = {
- carrierCode: ret.resp_result
- };
- if (!result.carrierCode || result.carrierCode == "") {
- uni.showToast({
- icon: "none",
- title: "请扫载具码",
- duration: 1000
- })
- return;
- }
- getCarrierInfoProcess(result).then(resqust => {
- if (resqust.code == 200) {
- //返回数据大于一条,跳转选择批次弹窗
- if (resqust.data.length > 1) {
- query.value = result;
- console.log("查询箱号信息", resqust)
- selectProcessInspection.value.open(resqust.data)
- } else {
- uni.showLoading({
- title: '加载中'
- });
- // 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
- // 需要定义一个请求方法, 从后端获取
- getLotInfo(result).then(res => {
- if (res.code == 200) {
- lot.value = res.data;
- lot.value.carrierCode = result.carrierCode
- carrierCode.value = result.carrierCode;
- console.log("res", res);
- uni.hideLoading();
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- }).catch(err => {
- uni.showToast({
- icon: 'none',
- title: err.message,
- duration: 2000
- })
- })
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: resqust.msg,
- duration: 2000
- })
- }
- }).catch(err => {
- uni.showToast({
- icon: 'none',
- title: err.message,
- duration: 2000
- })
- })
- }
- );
- }
- }
- //选择批号弹窗带回
- function handleSelectProcessInspection(data) {
- console.log("带回", data)
- query.value.lotCode = data
- uni.showLoading({
- title: '加载中'
- });
- getLotInfo(query.value).then(res => {
- if (res.code == 200) {
- lot.value = res.data;
- lot.value.carrierCode = query.value.carrierCode
- carrierCode.value = query.value.carrierCode;
- console.log("res", res);
- uni.hideLoading();
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- });
- }
- // 确定后,将批次id,批次号,传递过去
- const handleConfirm = () => {
- if (lot.carrierCode || carrierCode.value !== "") {
- lot.value.carrierCode = carrierCode.value
- const result = {
- ...lot.value
- }
- if (lot.value.lotCode == "" || lot.value.lotCode == null || lot.value.carrierCode != carrierCode.value) {
- getCarrierInfoProcess(result).then(resqust => {
- if (resqust.code == 200) {
- //返回数据大于一条,跳转选择批次弹窗
- if (resqust.data.length > 1) {
- query.value = result;
- console.log("查询箱号信息", resqust)
- selectProcessInspection.value.open(resqust.data)
- } else {
- uni.showLoading({
- title: '加载中'
- });
- // 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
- // 需要定义一个请求方法, 从后端获取
- getLotInfo(result).then(res => {
- if (res.code == 200) {
- lot.value = res.data;
- lot.value.carrierCode = result.carrierCode
- carrierCode.value = result.carrierCode;
- console.log("res", res);
- uni.hideLoading();
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- }
- }).catch(err => {
- uni.showToast({
- icon: 'none',
- title: err.message,
- duration: 2000
- })
- })
- }
- } else {
- uni.showToast({
- icon: 'none',
- title: resqust.msg,
- duration: 2000
- })
- }
- }).catch(err => {
- uni.showToast({
- icon: 'none',
- title: err.message,
- duration: 2000
- })
- })
- return
- }
- uni.showLoading({
- title: '加载中'
- });
- console.log("加载", lot.value);
- getLotInfo(lot.value).then(res => {
- if (res.code == 200) {
- lot.value = res.data;
- lot.value.carrierCode = carrierCode.value
- store.processInspection = null;
- uni.hideLoading();
- uni.navigateTo({
- url: "/pages/processInspection/form",
- success: (res) => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit("processInspectionFrom", {
- data: lot.value
- })
- }
- })
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- duration: 2000
- })
- return;
- }
- })
- // console.log(result)
- // getCarrierInfo(result).then(resqust => {
- // if (resqust.code == 200) {
- // //返回数据大于一条,跳转选择批次弹窗
- // if (resqust.data.length > 1) {
- // query.value = result;
- // console.log("查询箱号信息", resqust)
- // selectProcessInspection.value.open(resqust.data)
- // } else {
- // uni.showLoading({
- // title: '加载中'
- // });
- // // 此处根据拿到的箱子id, 获取到相对应的【 lot_id】,【 lot_code】, 以及该批次关联的其它箱号
- // // 需要定义一个请求方法, 从后端获取
- // getLotInfo(result).then(res => {
- // if (res.code == 200) {
- // lot.value = res.data;
- // lot.value.carrierCode = result.carrierCode
- // carrierCode.value = result.carrierCode;
- // console.log("res", res);
- // uni.hideLoading();
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: res.msg,
- // duration: 2000
- // })
- // }
- // }).catch(err => {
- // uni.showToast({
- // icon: 'none',
- // title: err.message,
- // duration: 2000
- // })
- // })
- // }
- // } else {
- // uni.showToast({
- // icon: 'none',
- // title: resqust.msg,
- // duration: 2000
- // })
- // }
- // }).catch(err => {
- // uni.showToast({
- // icon: 'none',
- // title: err.message,
- // duration: 2000
- // })
- // })
- } else {
- uni.showToast({
- icon: 'none',
- title: "请输入箱号或扫描箱码",
- duration: 2000
- })
- return;
- }
- }
- </script>
- <style lang="scss">
- .page-container {
- height: 100%;
- background-color: #ececec;
- font-size: 28rpx;
- padding: 24rpx;
- box-sizing: border-box;
- }
- .consultation-container {
- background-color: #ffffff;
- padding: 24rpx;
- border-radius: 12rpx;
- .title {
- justify-content: center;
- font-size: 32rpx;
- font-weight: 700;
- }
- .info-row {
- margin-top: 24rpx;
- .label {
- width: 160rpx;
- }
- .value {
- flex: 1;
- textarea {
- flex: 1;
- border: 1px solid #888888;
- box-sizing: border-box;
- padding: 16rpx;
- }
- }
- }
- .btn {
- background-color: #1684fc;
- color: #ffffff;
- border-radius: 8rpx;
- margin: 4rpx 24rpx 24rpx 24rpx;
- height: 64rpx;
- justify-content: center;
- align-items: center;
- }
- input {
- margin: 48rpx 24rpx 0 24rpx;
- height: 64rpx;
- border: 1px solid #888888;
- text-align: center;
- }
- }
- </style>
|