Jelajahi Sumber

需求列表提交bug修复

jingshuyong 11 bulan lalu
induk
melakukan
32fa7a544f

+ 16 - 11
src/views/salesServiceManagement/demandList/components/dispatchDialog.vue

@@ -148,8 +148,8 @@
       </el-row>
     </el-form>
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="handleSubmit">确认</el-button>
-      <el-button @click="handleClose">取消</el-button>
+      <el-button type="primary" @click="handleSubmit" :loading="loading">确认</el-button>
+      <el-button @click="handleClose" :loading="loading">取消</el-button>
     </div>
   </ele-modal>
 </template>
@@ -178,6 +178,7 @@
           durationUnit: '1',
           remark: ''
         },
+        loading:false,
         executorList: [],
         submitSource: 1 // 提交/派单来源(1:新增;2:修改)
       };
@@ -256,15 +257,19 @@
               planAddPO: this.addForm,
               submitSource: this.submitSource
             };
-            demanDispatch(data).then((res) => {
-              if (res) {
-                this.$message.success('操作成功');
-                this.handleClose();
-                this.$emit('savExit');
-              }
-            }).catch((err)=>{
-
-            })
+            this.loading = true;
+            demanDispatch(data)
+              .then((res) => {
+                if (res) {
+                  this.loading = false;
+                  this.$message.success('操作成功');
+                  this.handleClose();
+                  this.$emit('savExit');
+                }
+              })
+              .catch((err) => {
+                this.loading = false;
+              });
           } else {
             return false;
           }

+ 32 - 11
src/views/salesServiceManagement/demandList/components/submitDialog.vue

@@ -8,7 +8,7 @@
     append-to-body
     @close="handleClose"
   >
-    <el-form ref="form" :model="formData" label-width="80px">
+    <el-form ref="form" :model="formData" label-width="80px" style="height: 200px;">
       <el-form-item
         label="部门"
         prop="planExecuteGroupId"
@@ -49,8 +49,10 @@
       </el-form-item>
     </el-form>
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="handleSubmit">确认</el-button>
-      <el-button @click="handleClose">取消</el-button>
+      <el-button type="primary" @click="handleSubmit" :loading="loading"
+        >确认</el-button
+      >
+      <el-button @click="handleClose" :loading="loading">取消</el-button>
     </div>
   </ele-modal>
 </template>
@@ -58,7 +60,11 @@
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
   import { getUserPage } from '@/api/system/organization';
   import { getCurrentUser } from '@/utils/token-util';
-  import { demandSubmit } from '@/api/salesServiceManagement/index';
+  import {
+    demandSubmit,
+    getSalesDemandById
+  } from '@/api/salesServiceManagement/index';
+
   let submitData = {};
   export default {
     components: { deptSelect },
@@ -75,8 +81,9 @@
           planExecuteUserId: '',
           planExecuteGroupId: ''
         },
+        loading: false,
         executorList: [],
-        submitSource: 1 // 提交/派单来源(1:新增;2:修改) none( 不需要这个字段 )
+        submitSource: 1 // 提交/派单来源(1:新增;2:修改; 列表: 3) none( 不需要这个字段 )
       };
     },
     methods: {
@@ -87,9 +94,15 @@
         };
         this.$refs.form.resetFields();
       },
-      open(data, type) {
-        this.submitSource = type == 'add' ? 1 : type == 'edit' ? 2 : 'none';
+      async open(data, type, source) {
+        this.submitSource = type == 'add' ? 1 : type == 'edit' ? 2 : 3;
         this.auditDialog = true;
+        // if (source) {
+        //   const res = await getSalesDemandById(data.id);
+        //   submitData = res;
+        // }else{
+        //    submitData = data;
+        // }
         submitData = data;
         let currentUser = getCurrentUser();
         if (
@@ -142,22 +155,30 @@
         this.$refs.form.validate((valid) => {
           if (valid) {
             let data = {
-              ...submitData,
               ...this.formData,
               submitSource: this.submitSource
             };
-            if (this.submitSource == 'none') {
-              delete data.submitSource;
+            if (data.submitSource == 3) {
+              data.id = submitData.id;
+            } else {
+              data = { ...submitData, ...data };
             }
+            // if (this.submitSource == 'none') {
+            //   delete data.submitSource;
+            // }
+            this.loading = true;
             demandSubmit(data)
               .then((res) => {
                 if (res) {
+                  this.loading = false;
                   this.$message.success('操作成功');
                   this.handleClose();
                   this.$emit('savExit');
                 }
               })
-              .catch((err) => {});
+              .catch((err) => {
+                this.loading = false;
+              });
           } else {
             return false;
           }

+ 1 - 1
src/views/salesServiceManagement/demandList/index.vue

@@ -402,7 +402,7 @@
         });
       },
       handleAudit(row) {
-        this.$refs.submitRef.open(row, 'edit');
+        this.$refs.submitRef.open(row, 'list','列表');
         // this.auditDialog = true;
         // this.rowData = row;
       },