Răsfoiți Sursa

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

yusheng 11 luni în urmă
părinte
comite
53c9c0eb84

+ 25 - 8
src/views/salesServiceManagement/demandList/components/addDialog.vue

@@ -15,16 +15,28 @@
     <SubmitDialog ref="submitRef" @savExit="savExit" />
     <dispatchDialog ref="dispatchRef" @savExit="savExit" />
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="submitAdd" v-if="type != 'view'"
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="submitAdd"
+        v-if="type != 'view'"
         >保存</el-button
       >
-      <el-button type="primary" @click="submit" v-if="type != 'view'"
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="submit"
+        v-if="type != 'view'"
         >提交</el-button
       >
-      <el-button type="primary" @click="dispatch" v-if="type != 'view'"
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="dispatch"
+        v-if="type != 'view'"
         >派单</el-button
       >
-      <el-button @click="handleClose">返回</el-button>
+      <el-button @click="handleClose" :loading="loading">返回</el-button>
     </div>
   </ele-modal>
 </template>
@@ -63,7 +75,8 @@
         addRepairNotesDialog: false,
         type: 'add',
         form: {},
-        demandList: []
+        demandList: [],
+        loading: false
       };
     },
     created() {
@@ -176,10 +189,10 @@
               return item;
             }),
             contactInfoVOS: data.contactInfoVOS,
-            associationType:data.associationType
+            associationType: data.associationType
           };
           // 如果选的销售订单并且 没有售后对象数据
-          if(pData.associationType == '2' && pData.productDetail.length == 0){
+          if (pData.associationType == '2' && pData.productDetail.length == 0) {
             delete pData.productDetail;
             pData.faultDetailList = data.faultDetailList;
           }
@@ -197,15 +210,19 @@
           if (!pData) {
             return;
           }
+          this.loading = true;
           let requestname =
             this.title === '新增' ? saveSalesDemand : updateSalesDemand;
           const res = await requestname(pData);
+          this.loading = false;
           if (res) {
             this.$message.success('操作成功!');
             this.$emit('refresh');
             this.handleClose();
           }
-        } catch (error) {}
+        } catch (error) {
+          this.loading = false;
+        }
       }
     }
   };

+ 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;
       },

+ 23 - 7
src/views/salesServiceManagement/toDoList/components/addOrUpdateDialog.vue

@@ -106,11 +106,11 @@
         </el-col>
         <el-col :span="6">
           <el-form-item
-            label="执行人"
+            label="工单执行人"
             prop="executeUserId"
             :rules="{
               required: true,
-              message: '请选择执行人',
+              message: '请选择工单执行人',
               trigger: 'change'
             }"
           >
@@ -186,14 +186,26 @@
       </el-tabs>
     </div>
     <template v-slot:footer>
-      <el-button @click="handleClose">取消</el-button>
-      <el-button type="primary" @click="save('')" v-if="type != 'view'"
+      <el-button @click="handleClose" :loading="loading">取消</el-button>
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="save('')"
+        v-if="type != 'view'"
         >保存</el-button
       >
-      <el-button type="primary" @click="save('派单')" v-if="type == 'edit'"
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="save('派单')"
+        v-if="type == 'edit'"
         >派单</el-button
       >
-      <el-button type="primary" @click="save('')" v-if="isDispatch"
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="save('')"
+        v-if="isDispatch"
         >派单</el-button
       >
     </template>
@@ -382,14 +394,18 @@
               // *** 新增参数
               let obj = this.infoData(data);
               this.addForm.salesDemandUpdatePO = obj;
+              this.loading = true;
               const res = await requestName(this.addForm);
+              this.loading = false;
               if (!res) return;
               this.$message.success('操作成功');
               this.visible = false;
               this.$emit('reload');
             }
           });
-        } catch (error) {}
+        } catch (error) {
+          this.loading = false;
+        }
       },
       // *** 需求信息参数
       infoData(data) {

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

@@ -148,7 +148,7 @@
           },
           {
             prop: 'planExecuteUserName',
-            label: '执行人',
+            label: '计划执行人',
             align: 'center',
             showOverflowTooltip: true
           },

+ 39 - 18
src/views/salesServiceManagement/workOrder/components/declarationDialog.vue

@@ -279,14 +279,22 @@
     </el-form>
 
     <div slot="footer" class="footer">
-      <el-button type="primary" @click="submitAdd" v-if="type != 'view'">{{
-        type == 'edit' ? '保存' : '报工'
-      }}</el-button>
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="submitAdd"
+        v-if="type != 'view'"
+        >{{ type == 'edit' ? '保存' : '报工' }}</el-button
+      >
 
-      <el-button type="primary" @click="saveAdd" v-if="type == 'report'"
+      <el-button
+        type="primary"
+        :loading="loading"
+        @click="saveAdd"
+        v-if="type == 'report'"
         >保存</el-button
       >
-      <el-button @click="handleClose">取消</el-button>
+      <el-button @click="handleClose" :loading="loading">取消</el-button>
     </div>
   </ele-modal>
 </template>
@@ -363,7 +371,8 @@
           dispatchUserName: '',
           dispatchTime: ''
         },
-        detailList: []
+        detailList: [],
+        loading: false
       };
     },
     created() {},
@@ -546,12 +555,18 @@
             // let api = this.type == 'edit' ? updateScheme : reportWorkingSalesWorkOrder;
             let api =
               type == 'edit' ? updateScheme : reportWorkingSalesWorkOrder;
-            await api(data).then((res) => {
-              if (!res) return;
-              this.$message.success('操作成功');
-              this.visibleDialog = false;
-              this.$emit('reload');
-            });
+            this.loading = true;
+            await api(data)
+              .then((res) => {
+                this.loading = false;
+                if (!res) return;
+                this.$message.success('操作成功');
+                this.visibleDialog = false;
+                this.$emit('reload');
+              })
+              .catch((err) => {
+                this.loading = false;
+              });
           } else {
             return false;
           }
@@ -597,12 +612,18 @@
               };
               data.accessoryApply = accessoryApply;
             }
-            await updateScheme(data).then((res) => {
-              if (!res) return;
-              this.$message.success('操作成功');
-              this.visibleDialog = false;
-              this.$emit('reload');
-            });
+            this.loading = true;
+            await updateScheme(data)
+              .then((res) => {
+                this.loading = false;
+                if (!res) return;
+                this.$message.success('操作成功');
+                this.visibleDialog = false;
+                this.$emit('reload');
+              })
+              .catch((err) => {
+                this.loading = false;
+              });
           }
         });
       },

+ 42 - 28
src/views/salesServiceManagement/workOrder/index.vue

@@ -38,40 +38,58 @@
             type="primary"
             :underline="false"
             @click="declarationForm(row, 'edit')"
-            v-if="(row.orderStatus == 1 || row.orderStatus == 6) && $hasPermission('eom:aftersalesworkorder:update')"
+            v-if="
+              (row.orderStatus == 1 || row.orderStatus == 6) &&
+              $hasPermission('eom:aftersalesworkorder:update')
+            "
             >修改</el-link
-          > 
+          >
           <el-link
             type="primary"
             :underline="false"
             @click="declarationForm(row, 'report')"
-            v-if="(row.orderStatus == 1 || row.orderStatus == 6) && $hasPermission('eom:aftersalesworkorder:reportWorking')"
+            v-if="
+              (row.orderStatus == 1 || row.orderStatus == 6) &&
+              $hasPermission('eom:aftersalesworkorder:reportWorking')
+            "
             >报工</el-link
           >
           <el-link
             type="primary"
-            v-if="row.orderStatus == 0 && $hasPermission('eom:aftersalesworkorder:receive')"
+            v-if="
+              row.orderStatus == 0 &&
+              $hasPermission('eom:aftersalesworkorder:receive')
+            "
             :underline="false"
             @click="handleCommand('handleReceive', row)"
             >接收</el-link
           >
           <el-link
             type="primary"
-            v-if="(row.orderStatus == 0 || row.orderStatus == 1) && $hasPermission('eom:aftersalesworkorder:reassignment')"
+            v-if="
+              (row.orderStatus == 0 || row.orderStatus == 1) &&
+              $hasPermission('eom:aftersalesworkorder:reassignment')
+            "
             :underline="false"
             @click="handleCommand('toRedeploy', row)"
             >转派</el-link
           >
           <el-link
             type="primary"
-            v-if="(row.orderStatus == 1 || row.orderStatus == 2) && $hasPermission('eom:sparepartsapply:save')"
+            v-if="
+              (row.orderStatus == 1 || row.orderStatus == 2) &&
+              $hasPermission('eom:sparepartsapply:save')
+            "
             :underline="false"
             @click="handleCommand('addSpareItems', row)"
             >申请配件</el-link
           >
           <el-link
             type="primary"
-            v-if="acceptShow(row) && $hasPermission('eom:aftersalesworkorder:checkAndAccept')"
+            v-if="
+              acceptShow(row) &&
+              $hasPermission('eom:aftersalesworkorder:checkAndAccept')
+            "
             :underline="false"
             @click="handleCommand('checkAndAccept', row)"
             >验收</el-link
@@ -79,7 +97,10 @@
           <!--    v-if="row.orderStatus == 4" -->
           <el-link
             type="primary"
-            v-if="evaluateShow(row) && $hasPermission('eom:aftersalesworkorder:comment')"
+            v-if="
+              evaluateShow(row) &&
+              $hasPermission('eom:aftersalesworkorder:comment')
+            "
             :underline="false"
             @click="handleCommand('evaluate', row)"
             >评价</el-link
@@ -179,7 +200,7 @@
       applyForSpare,
       declarationDialog,
       redeployOther,
-      addDialog
+      addDialog,
       // fileMain
     },
     data() {
@@ -369,25 +390,15 @@
     },
 
     computed: {
-      // 登录人id
-      loginPersonId() {
-        return this.$store.state.user?.info.id;
-      },
       // 评价
       evaluateShow() {
         return (row) => {
-          if (row.executeUserId == this.loginPersonId) {
-            return false;
-          }
           return row.orderStatus == 4;
         };
       },
       // 验收
       acceptShow() {
         return (row) => {
-          if (row.executeUserId == this.loginPersonId) {
-            return false;
-          }
           return row.orderStatus == 3 || row.orderStatus == 6;
         };
       }
@@ -544,15 +555,18 @@
           } catch (err) {}
         }
         if (command == 'checkAndAccept') {
-          this.visibleCheckAndAccept = true;
-          this.form = {
-            accepterUserId: '',
-            accepterUserName: '',
-            accepterRemark: ''
-          };
-          const { afterSalesDemandVO } = await getSalesWorkOrderById(row.id);
-          this.contactInfoVOS = afterSalesDemandVO.contactInfoVOS || [];
-          this.row = row;
+          try {
+            await afterSalesEvaluation(row.id);
+            this.visibleCheckAndAccept = true;
+            this.form = {
+              accepterUserId: '',
+              accepterUserName: '',
+              accepterRemark: ''
+            };
+            const { afterSalesDemandVO } = await getSalesWorkOrderById(row.id);
+            this.contactInfoVOS = afterSalesDemandVO.contactInfoVOS || [];
+            this.row = row;
+          } catch (err) {}
         }
       }
     }