zhengnaiwen_citu 6 месяцев назад
Родитель
Сommit
e29818c443
2 измененных файлов с 29 добавлено и 23 удалено
  1. 2 2
      src/views/salary/calculate/index.vue
  2. 27 21
      src/views/system/workflow/workflowApproved.vue

+ 2 - 2
src/views/salary/calculate/index.vue

@@ -41,11 +41,11 @@ export default {
     handleClick () {
       this.$router.push(`${this.$route.path}?name=${this.activeName}`)
       this.$nextTick(() => {
-        this.$refs[this.activeName][0].onInit()
+        this.$refs[this.activeName] && this.$refs[this.activeName][0].onInit && this.$refs[this.activeName][0].onInit()
       })
     },
     onComponentMounted () {
-      this.$refs[this.activeName] && this.$refs[this.activeName][0].onInit()
+      this.$refs[this.activeName] && this.$refs[this.activeName][0].onInit && this.$refs[this.activeName][0].onInit()
     }
   }
 }

+ 27 - 21
src/views/system/workflow/workflowApproved.vue

@@ -1,19 +1,22 @@
 <template>
-  <m-dialog :title="`${item.workFlowTmplate?.name} 审批配置`" ref="dialog" @sure="onSure">
-    <el-form ref="form" inline :model="formValues" label-width="80px" >
+  <m-dialog title="审批配置" ref="dialog" @sure="onSure">
+    <el-form ref="form" inline :model="formValues" label-width="100px" >
+      <el-form-item label="工作流">
+        <el-tag>{{ item.workFlowTmplate?.name }}</el-tag>
+      </el-form-item>
       <m-card
         v-for="(item, index) in formValues.items"
         :key="item.key"
         shadow="never"
         class="mb-3 cardBox"
       >
-        <el-form-item label="处理对象">
+        <el-form-item label="处理对象" required :prop="`items.${index}.handleType`">
           <el-select v-model="item.handleType" placeholder="请选择处理对象" @change="onChange(item)">
             <el-option label="指定人" :value="0"></el-option>
             <el-option label="指定部室岗位" :value="1"></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="处理方">
+        <el-form-item label="处理方" required :prop="`items.${index}.handleValue`">
           <el-cascader
             v-model="item.handleValue"
             :ref="`cascader_${index}`"
@@ -176,24 +179,27 @@ export default {
         postName: node.value
       }
     },
-    async onSure () {
-      try {
-        await saveWorkflow({
-          workFlowTmplateItems: this.formValues.items.map((e, index) => {
-            return {
-              handleType: e.handleType,
-              handleValue: e.handleValueData,
-              sort: index
+    onSure () {
+      this.$refs.form.validate(async valid => {
+        if (!valid) return
+        try {
+          await saveWorkflow({
+            workFlowTmplateItems: this.formValues.items.map((e, index) => {
+              return {
+                handleType: e.handleType,
+                handleValue: e.handleValueData,
+                sort: index
+              }
+            }),
+            workFlowTmplate: {
+              workFlowTmplateId: this.item.workFlowTmplate.workFlowTmplateId
             }
-          }),
-          workFlowTmplate: {
-            workFlowTmplateId: this.item.workFlowTmplate.workFlowTmplateId
-          }
-        })
-        this.$message.success('保存成功')
-      } catch (error) {
-        this.$message.error(error)
-      }
+          })
+          this.$message.success('保存成功')
+        } catch (error) {
+          this.$message.error(error)
+        }
+      })
     }
   }
 }