Explorar el Código

“配置事项”改为“生产前生产后配置”批量配置

lucw hace 8 meses
padre
commit
dc147d7910

+ 1 - 6
src/views/technology/production/components/user-setting-matter-process.vue

@@ -346,10 +346,7 @@
             (item) => item.id !== matter.id
           );
           this.updatePOs.push({
-            ...matter,
-            produceTaskId: this.produceTaskId,
-            produceTaskName: this.produceTaskName,
-            reportWorkType: this.reportWorkType
+            ...matter
           });
         } else {
           // 如果是临时id,直接更新addPOs
@@ -407,8 +404,6 @@
               };
             }),
             deletedIds: this.deletedIds,
-            produceTaskId: this.produceTaskId,
-            produceTaskName: this.produceTaskName,
             updatePOs: this.updatePOs.map((i) => {
               return {
                 ...i,

+ 49 - 27
src/views/technology/production/components/user-setting-matter.vue

@@ -25,6 +25,9 @@
       :datasource="datasource"
       :need-page="false"
       class="table_list"
+      row-key="id"
+      cache-key="user-setting-matter-2510241427"
+      @refresh="getMatterList"
     >
       <template v-slot:toolbar>
         <el-button
@@ -109,6 +112,11 @@
             width: 45,
             align: 'center'
           },
+          {
+            prop: 'produceTaskName',
+            label: '工序名称',
+            align: 'center'
+          },
           {
             prop: 'itemType',
             label: '类型',
@@ -140,8 +148,8 @@
             slot: 'action'
           }
         ],
-        // 当前行数据
-        currentRow: null,
+        // 配置工序数据
+        currentRows: [],
         // 添加事项列表
         addPOs: [],
         deletedIds: [],
@@ -169,20 +177,36 @@
       updateVisible(val) {
         this.visible = val;
       },
-      openSetting(row) {
-        console.log('row', row);
-        this.currentRow = row;
+      openSetting(rows) {
+        console.log('rows', rows);
+
+        if (Array.isArray(rows)) {
+          this.currentRows = rows;
+        } else {
+          this.currentRows = [rows];
+        }
+
         this.visible = true;
-        this.getMatterList(row);
+        this.getMatterList();
+        // if (rows.length > 1) {
+        //   this.bankColumns.splice(1, 0, {
+        //     prop: 'produceTaskName',
+        //     label: '工序名称',
+        //     align: 'center'
+        //   });
+        // } else {
+        //   this.bankColumns = this.bankColumns.filter(
+        //     (col) => col.prop !== 'produceTaskName'
+        //   );
+        // }
       },
       // 查询事项数据
       async getMatterList() {
         const { list } = await produceTaskRecordRules({
-          produceTaskId: this.currentRow.id,
+          produceTaskIds: this.currentRows.map((row) => row.id),
           pageNum: 1,
           size: 9999,
           isTemplate: 0
-          // reportWorkType: this.reportWorkType
         });
         console.log('list', list);
         // 表格数据
@@ -216,20 +240,23 @@
         console.log('matter', matter);
         const id = 'tem' + new Date().getTime();
         // 添加事项
-        this.matterList.push({
-          ...matter,
-          id: id,
-          produceTaskId: this.currentRow.id,
-          produceTaskName: this.currentRow.name,
-          reportWorkType: this.reportWorkType
-        });
-        this.addPOs.push({
-          ...matter,
-          id: id,
-          produceTaskId: this.currentRow.id,
-          produceTaskName: this.currentRow.name,
-          reportWorkType: this.reportWorkType
+        this.currentRows.forEach((task) => {
+          this.matterList.push({
+            ...matter,
+            id: id + task.id,
+            produceTaskId: task.id,
+            produceTaskName: task.name,
+            reportWorkType: this.reportWorkType
+          });
+          this.addPOs.push({
+            ...matter,
+            id: id + task.id,
+            produceTaskId: task.id,
+            produceTaskName: task.name,
+            reportWorkType: this.reportWorkType
+          });
         });
+
         this.handleSort();
       },
       editMatter(matter) {
@@ -251,10 +278,7 @@
             (item) => item.id !== matter.id
           );
           this.updatePOs.push({
-            ...matter,
-            produceTaskId: this.currentRow.id,
-            produceTaskName: this.currentRow.name,
-            reportWorkType: this.reportWorkType
+            ...matter
           });
         } else {
           // 如果是临时id,直接更新addPOs
@@ -306,8 +330,6 @@
           await produceTaskRecordRulesBatchSave({
             addPOs: this.addPOs,
             deletedIds: this.deletedIds,
-            produceTaskId: this.currentRow.id,
-            produceTaskName: this.currentRow.name,
             updatePOs: this.updatePOs
           });
           this.$message.success('保存成功');

+ 16 - 13
src/views/technology/production/index.vue

@@ -58,6 +58,14 @@
           >
             批量修改工作中心
           </el-button>
+          <el-button
+            size="small"
+            type="primary"
+            class="ele-btn-icon"
+            @click="batchSettingMatter"
+          >
+            生产前生产后配置
+          </el-button>
         </template>
 
         <template v-slot:name="{ row }">
@@ -106,15 +114,6 @@
             </template>
           </el-popconfirm>
 
-          <el-link
-            type="primary"
-            :underline="false"
-            icon="el-icon-setting"
-            @click="openSettingMatter(row)"
-          >
-            配置事项
-          </el-link>
-
           <el-link
             type="primary"
             :underline="false"
@@ -269,7 +268,7 @@
           {
             columnKey: 'action',
             label: '操作',
-            width: 280,
+            width: 210,
             align: 'center',
             resizable: false,
             slot: 'action',
@@ -372,8 +371,13 @@
       this.requestDict('记录规则事项类型');
     },
     methods: {
-      openSettingMatter(row) {
-        this.$refs.userSettingMatterRef.openSetting(row);
+      // 批量配置事项
+      batchSettingMatter() {
+        if (this.selection.length == 0) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        this.$refs.userSettingMatterRef.openSetting(this.selection);
       },
       openSettingMatterProcess(row) {
         this.$refs.userSettingMatterProcessDrawerRef.open(row);
@@ -384,7 +388,6 @@
           this.typeList.find((m) => m.value == type).label
         );
       },
-
       /*配置工艺参数 */
       openSetting(row) {
         this.current = row;