Procházet zdrojové kódy

fix:表单提交校验

ly před 11 měsíci
rodič
revize
e933c1f8b5

+ 27 - 16
src/views/business/production/onceWork/resultDialog.vue

@@ -1,8 +1,8 @@
 <template>
   <el-dialog v-loading.fullscreen.lock="fullscreenLoading" :close-on-click-modal = "false"
-             v-model="outerVisible" title="结果情况" width="600">
+             v-model="outerVisible" title="任务结果" width="600">
     <el-form :model="sumbitForm" label-width="auto" ref="workDetailForm" style="max-width: 600px">
-      <el-form-item v-if="handlerId === useUserStore().user.userId" label="任务结果">
+      <el-form-item v-if="handlerId === useUserStore().user.userId" prop="resultStatus" label="任务结果">
         <div v-if="sumbitForm.recordStatus === 3 || sumbitForm.recordStatus === 4 ">
           {{sumbitForm.resultStatus === 2?'暂停办理':sumbitForm.resultStatus === 0?'终止任务':'完成任务'}}
         </div>
@@ -130,7 +130,7 @@ const { selectStatus } = toRefs(data);
 const form = reactive({
     recordStatus:0,
     file:Blob,
-    resultStatus:0
+    resultStatus:-1
 })
 type Tform = typeof form;
 const sumbitForm = reactive<Tform>({
@@ -190,23 +190,34 @@ function openView(id,status,userId,resultStatus){
   })
 }
 const onsumbit = () => {
-  if(fileList.value.length===0){
-    updateRecordStatus(workOrderId.value,sumbitForm.resultStatus,fileEntity).then(response => {
-      proxy.$alert(
-          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-          "提交完成" +
-          "</div>",
-          { dangerouslyUseHTMLString: true }
-      );
-      outerVisible.value = false;
-      fileEntity= {};
-      FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
-        filesTable.value = response.data
+  console.log(sumbitForm.resultStatus)
+  if(sumbitForm.resultStatus != -1){
+    if(fileList.value.length===0){
+      updateRecordStatus(workOrderId.value,sumbitForm.resultStatus,fileEntity).then(response => {
+        proxy.$alert(
+            "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+            "提交完成" +
+            "</div>",
+            { dangerouslyUseHTMLString: true }
+        );
+        outerVisible.value = false;
+        fileEntity= {};
+        FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
+          filesTable.value = response.data
+        })
       })
-    })
+    }
+  }else{
+    proxy.$alert(
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+        "请选择任务结果" +
+        "</div>",
+        { dangerouslyUseHTMLString: true }
+    );
   }
   proxy.$refs['upload'].submit()
   getList.value();
+  outerVisible.value = false;
 }
 function handleBeforeUpload(file) {
   //const formData = new FormData();