From 967de5f211a1e7c5b320e3d54b3df0229e3e13f7 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 27 六月 2025 16:23:54 +0800
Subject: [PATCH] 报工页面取工序的自动报告选项

---
 pages/product/report/index.vue |  226 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 177 insertions(+), 49 deletions(-)

diff --git a/pages/product/report/index.vue b/pages/product/report/index.vue
index d66fafe..ad3137a 100644
--- a/pages/product/report/index.vue
+++ b/pages/product/report/index.vue
@@ -43,8 +43,8 @@
       <u-form-item label="闆朵欢鎻忚堪" :border-bottom="false" prop="partName">
         <u-input v-model="form.partName" placeholder="" disabled />
       </u-form-item>
-      <u-form-item label="鎵归噺澶у皬" :border-bottom="false" prop="qtyrequired">
-        <u-input v-model="form.qtyrequired" placeholder="" disabled />
+      <u-form-item label="鎵归噺澶у皬" :border-bottom="false" prop="qtyRequired">
+        <u-input v-model="form.qtyRequired" placeholder="" disabled />
       </u-form-item>
       <u-form-item
         label="鍓╀綑鏁伴噺"
@@ -68,26 +68,32 @@
           <u-radio name="part">鏇夸唬闆朵欢</u-radio>
         </u-radio-group>
       </u-form-item>
-      <u-form-item label="鐗╂枡" prop="materialcost">
-        <u-radio-group v-model="form.materialcost" :disabled="true">
+      <u-form-item label="鐗╂枡" prop="materialCost">
+        <u-radio-group v-model="form.materialCost" :disabled="true">
           <u-radio name="鍊掑啿">鍊掑啿</u-radio>
           <u-radio name="鎶曟枡">鎶曟枡</u-radio>
         </u-radio-group>
       </u-form-item>
-      <u-form-item label="宸ュ簭" prop="value1">
+	  <u-form-item label="绠�鍖栫墿鏂欐鏌�" prop="simplifyMaterials">
+	    <u-radio-group v-model="form.simplifyMaterials" :disabled="subdisabled || simplifyDisabled" @change="radioChange">
+	      <u-radio name="true">鏄�</u-radio>
+	      <u-radio name="false">鍚�</u-radio>
+	    </u-radio-group>
+	  </u-form-item>
+<!--      <u-form-item label="宸ュ簭">
         <u-checkbox-group>
           <u-checkbox
             :name="item.name"
             v-for="(item, index) in checkboxList"
             :key="index"
-            v-model="item.value1"
+            v-model="item.value"
             @change="changeCheckbox"
             :disabled="subdisabled || item.disabled"
           >
             {{ item.name }}
           </u-checkbox>
         </u-checkbox-group>
-      </u-form-item>
+      </u-form-item> -->
       <u-form-item label="浜у嚭鍒楄〃" :border-bottom="false"></u-form-item>
     </u-form>
     <view class="wrap">
@@ -101,6 +107,7 @@
             v-for="(item, index) in InventoryReceiptList"
             :key="index"
             :index="index"
+            @click="cancelReport(item)"
           >
             <view class="content-header">
               <view class="content-header-title">{{ index + 1 }}</view>
@@ -111,7 +118,7 @@
                   <view class="_label-name">鎵瑰彿锛�</view>
                 </view>
                 <view class="_content">
-                  {{ item.productNo }}
+                  {{ item.outBatchNo }}
                 </view>
               </view>
               <view class="row-list">
@@ -150,6 +157,54 @@
       :operationTaskList="this.form"
       @update="handleUpdate"
     />
+    <u-modal
+      width="720rpx"
+      v-model="showModal"
+      title=""
+      :show-cancel-button="true"
+      :show-confirm-button="true"
+      @confirm="confirmModle"
+      @cancel="cancelModle"
+    >
+      <view class="popup-content">
+        <view class="packing-registration-param">
+          <view class="packing-registration-param-view">
+            <view class="packing-registration-param-item param-extra">
+              <view class="packing-registration-param-item-left">
+                <text class="item-one">鎵瑰彿</text>
+              </view>
+              <view class="packing-registration-param-item-right">
+                <text class="item-one">{{ detailedList.outBatchNo }}</text>
+              </view>
+            </view>
+            <view class="packing-registration-param-item param-extra">
+              <view class="packing-registration-param-item-left">
+                <text class="item-one">闆朵欢鍙�</text>
+              </view>
+              <view class="packing-registration-param-item-right">
+                <text class="item-one">{{ detailedList.partNo }}</text>
+              </view>
+            </view>
+            <view class="packing-registration-param-item param-extra">
+              <view class="packing-registration-param-item-left">
+                <text class="item-one">闆朵欢鎻忚堪</text>
+              </view>
+              <view class="packing-registration-param-item-right">
+                <span class="item-one">{{ detailedList.partName }}</span>
+              </view>
+            </view>
+            <view class="packing-registration-param-item param-extra">
+              <view class="packing-registration-param-item-left">
+                <text class="item-one">鍙栨秷鎺ユ敹鏁伴噺</text>
+              </view>
+              <view class="packing-registration-param-item-right">
+                <span class="item-one">{{ detailedList.netWeight }}</span>
+              </view>
+            </view>
+          </view>
+        </view>
+      </view>
+    </u-modal>
     <scan></scan>
   </div>
 </template>
@@ -166,18 +221,19 @@
   },
   data() {
     return {
-      checkboxList: [
-        {
-          name: "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�",
-          value: false,
-          disabled: false,
-        },
-        {
-          name: "绠�鍖栫墿鏂欐鏌�",
-          value: false,
-          disabled: false,
-        },
-      ],
+		simplifyDisabled:false,
+      // checkboxList: [
+      //   {
+      //     name: "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�",
+      //     value: false,
+      //     disabled: false,
+      //   },
+      //   {
+      //     name: "绠�鍖栫墿鏂欐鏌�",
+      //     value: false,
+      //     disabled: false,
+      //   },
+      // ],
       InventoryReceiptList: [],
       form: {
         workstationId: "",
@@ -187,14 +243,14 @@
         moOn: "",
         partNo: "",
         partName: "",
-        qtyrequired: "",
+        qtyRequired: "",
         Jianqtyfinished: "",
         proposedLocation: "",
         productType: "dep",
         receive: "mo",
-        materialcost: "",
-        autoReport: false,
-        simplifyMaterials: false,
+        materialCost: "",
+        // autoReport: false,
+        simplifyMaterials: 'false',
       },
       rules: {
         work: [
@@ -243,6 +299,9 @@
       showSave: false,
       operationTaskId: "",
       subdisabled: false,
+      codeInfoId: "",
+      detailedList: {},
+      showModal: false,
     };
   },
   // 鐐瑰嚮鎻愪氦鎸夐挳鐨勪簨浠跺鐞嗗嚱鏁�
@@ -259,6 +318,7 @@
             id: this.form.id,
           })
           .then((res) => {
+            res.data.name = this.form.name;
             this.$refs.saveForm.open(res);
             uni.hideLoading();
           });
@@ -279,17 +339,14 @@
       if (data.code) {
         let codeInfo = JSON.parse(data.code);
         if (codeInfo.moOn) {
+           that.codeInfoId = codeInfo.id;
           // 鎵弿鎶ュ伐鍗曚簩缁寸爜
           that.saveForm(codeInfo);
-          that.$u.api.workReporting
-            .getProductMainV1({
-              current: 1,
-              size: -1,
-              id: codeInfo.id,
-            })
-            .then((res) => {
-              that.InventoryReceiptList = res.data.productOutputList;
-            });
+          that.getHandelList();
+        }
+        if (codeInfo.BN) {
+          // 鎵弿鎶ュ伐鍗曚簩缁寸爜
+          that.CopperReportingWork(codeInfo);
         }
       }
     });
@@ -297,20 +354,89 @@
   watch: {
     "form.taskNo": function (newVal, oldVal) {
       this.subdisabled = false;
+      this.checkboxList[1].value = false;
+      this.checkboxList[0].value = false;
     },
   },
   methods: {
-    // 澶氶�夊鐞�
-    changeCheckbox(val) {
-      if (val.name === "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�") {
-        this.form.autoReport = val.value;
-      }
-      if (val.name === "绠�鍖栫墿鏂欐鏌�") {
-        this.form.simplifyMaterials = val.value;
-      }
+    // 閾滄潌鎶ュ伐
+    CopperReportingWork(val) {
+      const copperList = {};
+      copperList.outBatchNo = val.BN
+      copperList.partNo = val.PN
+      copperList.weighingClerk = val.WC
+      copperList.executiveStandard = val.ES
+      copperList.netWeight = val.NW
+      copperList.specificationType = val.ST
+      copperList.grossWeight = val.TR
+      copperList.operationTaskId = this.form.id
+      this.form.productOutputList = [];
+      this.form.operationTaskId = this.form.id;
+      this.form.productOutputList.push(copperList);
+      console.log('this.form',this.form)
+      this.$u.api.workReporting.submitPDA(this.form).then((res) => {
+        this.subdisabled = true;
+        this.getHandelList();
+        this.$u.toast("鎶ュ伐鎴愬姛");
+      });
     },
+    // 鐐瑰嚮纭鍚庤幏鍙栧彇娑堟姤宸ヨ褰�
+    confirmModle() {
+      console.log("鐐瑰嚮纭鍚庤幏鍙栧彇娑堟姤宸ヨ褰�");
+      // 澶勭悊纭閫昏緫
+      this.$u.api.cancelReporting
+        .cancelDTAOfWorkApplication({
+          outBatchNo: this.detailedList.outBatchNo,
+        })
+        .then((res) => {
+          console.log("res", res);
+          this.showModal = false;
+          this.getHandelList();
+          this.$u.toast("鍙栨秷鎶ュ伐鎴愬姛");
+        });
+    },
+    cancelModle() {
+      this.showModal = false; // 鍏抽棴寮圭獥
+    },
+    // 鍙栨秷鎶ュ伐
+    cancelReport(item) {
+      let that = this;
+      uni.showModal({
+        title: "鎻愮ず",
+        content: "鏄惁纭鍙栨秷鎵规" + item.outBatchNo + "鐨勬姤宸�",
+        success: function (res) {
+          if (res.confirm) {
+            that.detailedList = item;
+            that.showModal = true;
+          } else if (res.cancel) {
+            return;
+          }
+        },
+      });
+    },
+    getHandelList() {
+      this.$u.api.workReporting
+        .getProductMainV1({
+          current: 1,
+          size: -1,
+          id: this.codeInfoId,
+        })
+        .then((res) => {
+          this.InventoryReceiptList = res.data.productOutputList;
+        });
+    },
+    // 澶氶�夊鐞�
+    // changeCheckbox(val) {
+      // if (val.name === "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�") {
+      //   this.form.autoReport = val.value;
+      // }
+      // if (val.name === "绠�鍖栫墿鏂欐鏌�") {
+      //   this.form.simplifyMaterials = val.value;
+      // }
+    // },
     handleUpdate() {
       this.subdisabled = true;
+      this.getHandelList();
     },
     // 鎵撳紑寮规--鍚庨潰杩橀渶瑕佺洃鍚壂鐮佹灙鎵爜缁撴灉锛岃祴鍊肩粰鎶ュ伐鍗曞彿瀛楁锛岀劧鍚庢墦寮�寮规閫夋嫨璁㈠崟鍙风瓑鎿嶄綔
     open() {
@@ -346,17 +472,19 @@
         moOn: val.moOn,
         partNo: val.partNo,
         partName: val.partName,
-        qtyrequired: val.qtyrequired,
-        Jianqtyfinished: val.qtyrequired - val.qtyfinished,
+        qtyRequired: val.qtyRequired,
+        Jianqtyfinished: val.qtyRequired - val.qtyFinished,
         proposedLocation: val.proposedLocation,
         productType: "dep",
-        receive: "mo", // 澶嶉�夋缁勭殑鍊�
-        materialcost: val.materialcost,
-        autoReport: false,
-        simplifyMaterials: false,
+        receive: "mo",
+        materialCost: val.materialCost,
+        // autoReport: false,
+        simplifyMaterials: 'false',
       };
-      if (this.form.materialcost == "鍊掑啿") {
-        this.checkboxList[1].disabled = true;
+      this.checkboxList[1].value = false;
+      this.checkboxList[0].value = false;
+      if (this.form.materialCost == "鍊掑啿") {
+        this.simplifyDisabled = true;
       }
     },
   },

--
Gitblit v1.9.3