lucw 7 månader sedan
förälder
incheckning
35e7576c88

+ 43 - 14
src/components/selectReleaseRules/select-release-rules.vue

@@ -17,6 +17,16 @@
         :datasource="datasource"
         :selection.sync="selection"
       >
+        <!-- 单选列 -->
+        <template v-slot:radio="{ row }">
+          <el-radio
+            class="radio"
+            v-model="currentRowId"
+            :label="row.id"
+            @change="radioChange($event, row)"
+            ><i></i
+          ></el-radio>
+        </template>
       </ele-pro-table>
     </el-card>
     <template v-slot:footer>
@@ -53,21 +63,14 @@
     },
     computed: {
       columns() {
-        return [
+        const list = [
           {
             columnKey: 'index',
             label: '序号',
             type: 'index',
             width: 55,
             align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center'
+            showOverflowTooltip: true
           },
           {
             prop: 'code',
@@ -190,6 +193,25 @@
             }
           }
         ];
+
+        if (this.multiple) {
+          list.unshift({
+            type: 'selection',
+            width: 50,
+            align: 'center',
+            fixed: 'left'
+          });
+        } else {
+          list.unshift({
+            prop: 'radio',
+            width: 50,
+            align: 'center',
+            fixed: 'left',
+            slot: 'radio'
+          });
+        }
+
+        return list;
       }
     },
     data() {
@@ -198,7 +220,9 @@
         visible: false,
         selection: [],
         produceTaskId: '',
-        reportWorkType: '' // 记录规则报工类型 产前、过程、产后
+        reportWorkType: '', // 记录规则报工类型 产前、过程、产后
+        currentRowId: null,
+        currentRow: null
       };
     },
     created() {
@@ -212,6 +236,8 @@
 
         this.visible = true;
         this.selection = [];
+        this.currentRowId = null;
+        this.currentRow = null;
         this.reportWorkType = reportWorkType || '';
         this.produceTaskId = produceTaskId || '';
         this.reload(); // 刷新表格
@@ -244,21 +270,24 @@
         });
       },
       confirmSelection() {
-        if (this.selection.length === 0) {
+        if (this.multiple && this.selection.length === 0) {
           this.$message.warning('请先选择记录规则');
           return;
         }
 
-        if (!this.multiple && this.selection.length > 1) {
-          this.$message.warning('只能选择一条记录规则');
+        if (!this.multiple && !this.currentRow) {
+          this.$message.warning('请先选择记录规则');
           return;
         }
 
         this.$emit(
           'chooseRules',
-          this.multiple ? this.selection : this.selection[0]
+          this.multiple ? this.selection : this.currentRow
         );
         this.visible = false;
+      },
+      radioChange(_, row) {
+        this.currentRow = row;
       }
     }
   };

+ 9 - 1
src/views/rulesManagement/components/MaterialAdd.vue

@@ -25,7 +25,6 @@
             :highlight-current="true"
             node-key="id"
             @node-click="handleNodeClick"
-            :default-checked-keys="checkedKeys"
           ></el-tree>
         </div>
 
@@ -192,6 +191,15 @@
           this.treeLoading = false;
           if (res?.code === '0') {
             this.treeList = res.data;
+
+            // 默认选中第一个节点
+            if (this.treeList.length > 0) {
+              this.$nextTick(() => {
+                this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
+                this.handleNodeClick(this.treeList[0]);
+              });
+            }
+
             return this.treeList;
           }
         } catch (error) {}

+ 3 - 3
src/views/rulesManagement/releaseRules/components/permitAdd.vue

@@ -810,7 +810,9 @@
           return i.executeMethodTitle;
         });
         // 去重
-        data.executeMethodList = [...new Set(data.executeMethodList)];
+        data.executeMethodList = [...new Set(data.executeMethodList)].filter(
+          (i) => i
+        );
 
         data.details = info.produceTaskConfigRuleDetails;
         if (data.executeMethodList.length) {
@@ -869,8 +871,6 @@
           this.formData.reportWorkType = this.formData.reportWorkType + '';
 
           if (this.type == 'change') {
-            this.formData.name = this.formData.name + '-副本';
-
             this.formData.fromId = id;
             this.formData.id = null;
           }

+ 17 - 0
src/views/rulesManagement/releaseRules/components/search.vue

@@ -65,6 +65,23 @@
                 value: '2'
               }
             ]
+          },
+          {
+            label: '是否启用:',
+            value: 'enable',
+            type: 'select',
+            placeholder: '是否启用',
+            // 0-草稿,1-已发布,2-已撤销
+            planList: [
+              {
+                label: '启用',
+                value: '1'
+              },
+              {
+                label: '停用',
+                value: '0'
+              }
+            ]
           }
         ];
       }

+ 7 - 0
src/views/rulesManagement/releaseRules/index.vue

@@ -162,6 +162,13 @@
             showOverflowTooltip: true,
             minWidth: 110
           },
+          {
+            prop: 'name',
+            label: '执行方式',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
           {
             prop: 'classify',
             label: '记录规则分类',

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

@@ -44,6 +44,7 @@
         </el-link>
 
         <el-link
+          v-if="row.itemType == 2"
           type="primary"
           :underline="false"
           icon="el-icon-edit"

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

@@ -205,7 +205,8 @@
         const { list } = await produceTaskRecordRules({
           produceTaskIds: this.currentRows.map((row) => row.id),
           pageNum: 1,
-          size: 9999
+          size: 9999,
+          reportWorkTypes: [1, 3]
         });
         console.log('list', list);
         // 表格数据