فهرست منبع

修改放行单审批

695593266@qq.com 6 ماه پیش
والد
کامیت
0fae31ae23

+ 50 - 8
src/views/bpm/handleTask/components/mesWorkOrderChecklist/detailDialog.vue

@@ -1,12 +1,6 @@
 <template>
   <div style="margin-top: 10px; padding: 0 20px">
-    <el-form
-      ref="formRef"
-      :model="form"
-      :rules="rules"
-      label-width="100px"
-      disabled
-    >
+    <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
       <header-title title="基本信息"></header-title>
 
       <el-row :gutter="10">
@@ -21,7 +15,11 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="放行单名称" prop="name">
-            <el-input v-model="form.name" placeholder="请输入"></el-input>
+            <el-input
+              v-model="form.name"
+              placeholder="请输入"
+              disabled
+            ></el-input>
           </el-form-item>
         </el-col>
       </el-row>
@@ -397,6 +395,50 @@
         } catch (error) {
           this.loading = false;
         }
+      },
+
+      getValidate() {
+        return Promise.all([
+          new Promise((resolve, reject) => {
+            this.$refs.form.validate((valid) => {
+              if (!valid) {
+                reject(false);
+              } else {
+                resolve(true);
+              }
+            });
+          }),
+          new Promise((resolve, reject) => {
+            this.$refs.inventoryTable.validateForm((valid) => {
+              if (!valid) {
+                reject(false);
+              } else {
+                resolve(true);
+              }
+            });
+          })
+        ]);
+      },
+
+      async getTableValue() {
+        try {
+          const invalidItem = this.form.details.find(
+            (item) => item.isPass !== 0 && item.isPass !== 1
+          );
+
+          if (invalidItem) {
+            this.$message.warning('请先完成所有放行规则的审核结果选择');
+            return false;
+          }
+
+          const commitData = {
+            formData: this.form
+          };
+          return commitData;
+        } catch (error) {
+          console.log(error);
+          return false;
+        }
       }
     }
   };

+ 36 - 24
src/views/bpm/handleTask/components/mesWorkOrderChecklist/submit.vue

@@ -3,7 +3,6 @@
     <el-form label-width="100px" ref="formRef" :model="form">
       <el-form-item
         label="审批建议"
-
         style="margin-bottom: 20px"
         :rules="{
           required: true,
@@ -31,24 +30,34 @@
         type="danger"
         size="mini"
         @click="handleAudit(0)"
-
         >驳回
       </el-button>
 
-      <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
-        <span class="el-dropdown-link">更多<i class="el-icon-arrow-down el-icon--right"></i></span>
+      <el-dropdown
+        @command="(command) => handleCommand(command)"
+        style="margin-left: 30px"
+      >
+        <span class="el-dropdown-link"
+          >更多<i class="el-icon-arrow-down el-icon--right"></i
+        ></span>
         <el-dropdown-menu slot="dropdown">
           <el-dropdown-item command="cancel">作废</el-dropdown-item>
         </el-dropdown-menu>
       </el-dropdown>
-
     </div>
   </el-col>
 </template>
 
 <script>
-  import { UpdateInformation, cancel } from '@/api/bpm/components/contractManage/contractBook';
-  import {approveTaskWithVariables, rejectTask,cancelTask} from '@/api/bpm/task';
+  import {
+    UpdateInformation,
+    cancel
+  } from '@/api/bpm/components/contractManage/contractBook';
+  import {
+    approveTaskWithVariables,
+    rejectTask,
+    cancelTask
+  } from '@/api/bpm/task';
   import { listAllUserBind } from '@/api/system/organization';
 
   // 流程实例的详情页,可用于审批
@@ -81,7 +90,6 @@
       };
     },
     created() {
-
       this.userOptions = [];
       listAllUserBind().then((data) => {
         this.userOptions.push(...data);
@@ -97,12 +105,13 @@
         this.$emit('handleBackList');
       },
 
-
       async handleAudit(status) {
         let variables = {
           pass: !!status
         };
 
+        let { formData } = await this.getTableValue();
+
         let API = !!status ? approveTaskWithVariables : rejectTask;
         API({
           id: this.taskId,
@@ -129,25 +138,28 @@
       //更多
       handleCommand(command) {
         if (command === 'cancel') {
-          this.$confirm("是否确认作废?", {
+          this.$confirm('是否确认作废?', {
             type: 'warning',
             cancelButtonText: '取消',
             confirmButtonText: '确定'
-          }).then(() => {
-            cancelTask({
-              id: this.id,
-              taskId: this.taskId,
-              reason: this.form.reason,
-              businessId: this.businessId,
-            }).then(() => {
-              this.$emit('handleClose');
-            }).catch(() => {
-              this.$message.error("流程作废失败");
-            });
-          }).catch(() => {});
+          })
+            .then(() => {
+              cancelTask({
+                id: this.id,
+                taskId: this.taskId,
+                reason: this.form.reason,
+                businessId: this.businessId
+              })
+                .then(() => {
+                  this.$emit('handleClose');
+                })
+                .catch(() => {
+                  this.$message.error('流程作废失败');
+                });
+            })
+            .catch(() => {});
         }
-      },
-
+      }
     }
   };
 </script>