Browse Source

feat(homogeneityInspectDialog): 新增一键勾选缺料功能并优化按钮显示条件

yusheng 6 tháng trước cách đây
mục cha
commit
8c03bdc71d

+ 17 - 2
src/views/productionPlan/components/homogeneityInspectDialog.vue

@@ -170,12 +170,18 @@
                         >下发采购计划</el-button
                       >
                       <el-button
-                        v-if="produceType !=2 && formInline.bomType != 1"
+                        v-if="produceType != 2 && formInline.bomType != 1"
                         type="primary"
                         @click="issuePlan"
                         size="medium"
                         >下发生产计划</el-button
                       >
+                      <el-button
+                        type="primary"
+                        @click="isAllChecked"
+                        size="medium"
+                        >一键勾选缺料</el-button
+                      >
                     </div>
                     <div class="tool_r">
                       <el-form
@@ -715,7 +721,6 @@
     },
     mounted() {},
     methods: {
-      onSubmit() {},
       async handleNodeClick(data) {
         this.planInfo = data;
         try {
@@ -958,6 +963,16 @@
           (item) => item.finalState === e
         );
       },
+      isAllChecked() {
+        let datasourceList = this.datasourceList.filter(
+          (el) => el.finalStateText == '缺料' && !el.hasIssued
+        );
+        if (datasourceList.length) {
+          this.$refs.table.setSelectedRowKeys(
+            datasourceList.map((el) => el.code)
+          );
+        }
+      },
       // 批量采购
       async bulkPurchase() {
         if (this.selection.length == 0) {

+ 17 - 0
src/views/saleOrder/components/orderHomogeneityInspectDialog.vue

@@ -154,6 +154,7 @@
                 :init-load="false"
                 :datasource="datasourceList"
                 :selection.sync="selection"
+                row-key="code"
               >
                 <template v-slot:default>
                   <div class="tool">
@@ -165,6 +166,12 @@
                         size="medium"
                         >下发采购计划</el-button
                       >
+                      <el-button
+                        type="primary"
+                        @click="isAllChecked"
+                        size="medium"
+                        >一键勾选缺料</el-button
+                      >
                     </div>
                     <div class="tool_r">
                       <el-form
@@ -673,6 +680,16 @@
       }
     },
     methods: {
+      isAllChecked() {
+        let datasourceList = this.datasourceList.filter(
+          (el) => el.finalStateText == '缺料' && !el.hasIssued
+        );
+        if (datasourceList.length) {
+          this.$refs.table.setSelectedRowKeys(
+            datasourceList.map((el) => el.code)
+          );
+        }
+      },
       reload(where) {
         this.$nextTick(() => {
           this.$refs.table.reload({ page: 1, where });