Procházet zdrojové kódy

refactor(programRulesDialog): 简化班组和部门显示条件判断逻辑

liujt před 6 měsíci
rodič
revize
ca07d0a1f8

+ 6 - 3
src/views/batchRecord/components/programRulesDialog.vue

@@ -85,7 +85,7 @@
           </el-form-item>
         </el-col>
         
-        <el-col :span="8" v-if="((addForm.autoOrder && (type == 'add' || type == 'edit' || type == 'detail')) || (!addForm.autoOrder && type == 'dispatch')) && addForm.type == 1">
+        <el-col :span="8" v-if="dispatchStatus && addForm.type == 1">
           <el-form-item label="班组" prop="teamId">
             <el-select
               v-model="addForm.teamId"
@@ -102,7 +102,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="((addForm.autoOrder && (type == 'add' || type == 'edit' || type == 'detail')) || (!addForm.autoOrder && type == 'dispatch')) && addForm.type == 0">
+        <el-col :span="8" v-if="dispatchStatus && addForm.type == 0">
           <el-form-item label="部门" prop="groupId">
             <deptSelect
               v-model="addForm.groupId"
@@ -110,7 +110,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="8" v-if="((addForm.autoOrder && (type == 'add' || type == 'edit' || type == 'detail')) || (!addForm.autoOrder && type == 'dispatch')) && addForm.type == 0">
+        <el-col :span="8" v-if="dispatchStatus && addForm.type == 0">
           <el-form-item label="负责人" prop="executeIdList">
             <el-select
               v-model="addForm.executeIdList"
@@ -672,6 +672,9 @@
       };
     },
     computed: {
+      dispatchStatus() {
+        return ((this.addForm.autoOrder && (this.type == 'add' || this.type == 'edit' || this.type == 'detail')) || (((!this.addForm.autoOrder && this.addForm.status == 0) || (this.addForm.autoOrder && this.addForm.status == 4)) && this.type == 'dispatch'))
+      },
       // 当前用户信息
       loginUser() {
         return this.$store.state.user?.info;