yyb
10 天以前 76486524892abdfd3039eedc28d83cbbfb56d042
pages/product/WorkshopOrderIssued/index.vue
@@ -2,8 +2,14 @@
<template>
   <view class="page">
      <view class="packing-registration-bg" />
      <u-navbar title="订单下发" :background="background" :border-bottom="false" :title-bold="true" title-color="#000"
         back-icon-color="#000" />
    <u-navbar
      title="订单下发"
      :background="background"
      :border-bottom="false"
      :title-bold="true"
      title-color="#000"
      back-icon-color="#000"
    />
      <view class="packing-registration-param">
         <view class="packing-registration-param-view">
            <view class="packing-registration-param-item param-extra">
@@ -14,8 +20,13 @@
                  <text class="item-one item-two" @click="seachPersonnelNo()">{{
              registerInfo.moNo == "" ? "点击选择" : registerInfo.moNo
            }}</text>
                  <u-icon name="arrow-right" color="#687792" size="28" @click="seachPersonnelNo()"
                     v-show="registerInfo.moNo == ''"></u-icon>
            <u-icon
              name="arrow-right"
              color="#687792"
              size="28"
              @click="seachPersonnelNo()"
              v-show="registerInfo.moNo == ''"
            ></u-icon>
               </view>
            </view>
            <view class="packing-registration-param-item param-extra">
@@ -26,8 +37,13 @@
                  <text class="item-one item-two" @click="seachComp()">{{
              registerInfo.value2 == "" ? "点击选择" : registerInfo.value2
            }}</text>
                  <u-icon name="arrow-right" color="#687792" size="28" @click="seachComp()"
                     v-show="registerInfo.value2 == ''"></u-icon>
            <u-icon
              name="arrow-right"
              color="#687792"
              size="28"
              @click="seachComp()"
              v-show="registerInfo.value2 == ''"
            ></u-icon>
               </view>
            </view>
            <view class="packing-registration-param-item param-extra">
@@ -47,9 +63,17 @@
      </view>
      <view class="wrap">
         <scroll-view class="packing-registration-scroll-list" scroll-y="true">
            <u-cell-group class="packing-registration-scroll-list-group" :border="false">
        <u-cell-group
          class="packing-registration-scroll-list-group"
          :border="false"
        >
               <!-- <div class="tip" style="text-align: center;" v-if="hasScanSnList.length==0">-请扫码-</div> -->
               <view class="content" v-for="(item, index) in hasScanSnList" :key="index" :index="index">
          <view
            class="content"
            v-for="(item, index) in hasScanSnList"
            :key="index"
            :index="index"
          >
                  <view class="content-header">
                     <view class="content-header-title">{{ index + 1 }}</view>
                  </view>
@@ -76,8 +100,14 @@
         </scroll-view>
         <scan></scan>
      </view>
      <u-modal v-model="showModal" title="" :show-cancel-button="true" :show-confirm-button="true" @confirm="confirm"
         @cancel="cancel">
    <u-modal
      v-model="showModal"
      title=""
      :show-cancel-button="true"
      :show-confirm-button="true"
      @confirm="confirm"
      @cancel="cancel"
    >
         <view class="popup-content">
            <view class="packing-registration-param">
               <view class="packing-registration-param-view">
@@ -86,7 +116,7 @@
                        <text class="item-one">批号</text>
                     </view>
                     <view class="packing-registration-param-item-right">
                        <text class="item-one item-two">{{ modalList.value }}</text>
                <text class="item-one item-two">{{ modalList.moNO }}</text>
                     </view>
                  </view>
                  <view class="packing-registration-param-item param-extra">
@@ -125,8 +155,8 @@
            },
            // 弹窗列表
            modalList: {
               value: "",
               value1: "",
        partNo: "",
        moNo: "",
            },
            //   主页面列表
            registerInfo: {
@@ -136,12 +166,13 @@
            },
            //   下发记录列表
            hasScanSnList: [],
      codeInfoId: "",
         };
      },
      onShow() {
         let that = this;
         uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器
         if ((registerInfo.moNO = null)) {
    if (registerInfo.moNO == null) {
            uni.showToast({
               icon: "none",
               title: "请先选择子件!",
@@ -151,21 +182,40 @@
         }
         uni.$on("scan", function(data) {
            console.log("onscan");
            //扫码成功后的回调,你可以写自己的逻辑代码在这里
            console.log("扫码结果:", data.code);
      if (data.code) {
        let codeInfo = JSON.parse(data.code);
        this.codeInfoId = codeInfo.id;
        if (codeInfo.moOn) {
          // 扫描报工单二维码
            that.scanHandle(data.code);
            that.$forceUpdate();
          that.getHandelList();
        }
      }
      //扫码成功后的回调,你可以写自己的逻辑代码在这里
      console.log("扫码结果:", data.code);
         });
      },
      methods: {
    getHandelList() {
      this.$u.api.workReporting
        .getProductMainV1({
          current: 1,
          size: -1,
          id: this.codeInfoId,
        })
        .then((res) => {
          this.hasScanSnList = res.data.productOutputList;
        });
    },
         // 点击确认后获取下发记录
         confirm() {
            // 处理确认逻辑
            this.showModal = false;
            this.$u.api.workReporting
            ._({}).then((res) => {
      this.$u.api.workReporting._(this.modalList).then((res) => {
               console.log("res", res);
               this.hasScanSnList = res.data.records;
      this.showModal = false;
             this.getHandelList();
            });
         },
         // 模态框取消
@@ -192,7 +242,7 @@
         },
         //子件
         seachComp() {
            if (this.registerInfo.value1 == null || this.registerInfo.value1 == "") {
      if (this.registerInfo.moNO == null) {
               this.$u.toast("请选择订单号");
               return;
            }
@@ -202,12 +252,10 @@
            });
         },
         // 扫码后数据回显
         scanHandle(scanresult) {
            this.$u.api.workReporting
            ._({}).then((res) => {
               this.modalList = res.data.records;
    scanHandle(val) {
      let { moNo } = val;
      this.modalList.moNo = moNo;
               this.showModal = true;
            });
         },
      },
   };