Răsfoiți Sursa

售后服务新增校验是否带配件

hezhanp 8 luni în urmă
părinte
comite
06572b82c7

+ 41 - 32
src/views/salesServiceManagement/components/processSubmitDialog/processSubmitDialog.vue

@@ -11,9 +11,7 @@
     :maxable="true"
     :resizable="true"
   >
-    <!-- 核心流程布局:表单区 + 流程选择区 + 切换按钮 -->
     <div style="display: flex; height: 100%; justify-content: space-between">
-      <!-- 左侧表单区(保留原表单结构) -->
       <div class="form-box">
         <fm-generate-form
           :data="formSchema"
@@ -24,7 +22,6 @@
         ></fm-generate-form>
       </div>
 
-      <!-- 中间流程区切换按钮 -->
       <div
         style="
           align-self: center;
@@ -36,16 +33,12 @@
         @click="() => (isRight = !isRight)"
       >
         <span
-          style="
-            align-self: center;
-            transform: scale(1.5);
-          "
+          style="align-self: center; transform: scale(1.5)"
           :class="isRight ? 'el-icon-caret-left' : 'el-icon-caret-right'"
         ></span>
         <span style="writing-mode: vertical-rl">选择流程</span>
       </div>
 
-      <!-- 右侧流程选择核心区(流程分类、发起流程、执行人、流程图) -->
       <div style="flex: 1" v-if="isRight">
         <el-form
           ref="processForm"
@@ -53,7 +46,6 @@
           :model="form"
           label-width="80px"
         >
-          <!-- 流程分类 + 发起流程 -->
           <el-row>
             <el-col :span="12">
               <el-form-item label="流程分类">
@@ -91,7 +83,6 @@
             </el-col>
           </el-row>
 
-          <!-- 流程名称 + 流程标识 -->
           <el-row>
             <el-col :span="12">
               <el-form-item label="流程名称">
@@ -105,7 +96,6 @@
             </el-col>
           </el-row>
 
-          <!-- 流程执行人表格 + 流程图 -->
           <headerTitle
             title="流程执行人/流程图"
             style="margin-top: 30px"
@@ -148,7 +138,11 @@
                 </div>
                 <el-tag
                   size="medium"
-                  v-if="scope.row.type === 60 || scope.row.type === 70 || scope.row.type === 80"
+                  v-if="
+                    scope.row.type === 60 ||
+                    scope.row.type === 70 ||
+                    scope.row.type === 80
+                  "
                 >
                   {{ getAssignRuleOptionName(scope.row) }}
                 </el-tag>
@@ -194,7 +188,6 @@ import { topLevel1, topLevel2, topLevel3 } from '@/enum/dict';
 import { getToken } from '@/utils/token-util';
 import { mapGetters } from 'vuex';
 
-
 export default {
   name: 'processSubmitDialog',
   mixins: [dictMixins],
@@ -317,7 +310,7 @@ export default {
         processTypeId
       });
       // 过滤出有流程定义的流程(排除无效数据)
-      this.processList = list.filter(item => item.processDefinition);
+      this.processList = list.filter((item) => item.processDefinition);
     },
 
     /**
@@ -327,7 +320,8 @@ export default {
       if (!val) return;
 
       // 找到当前选中的流程信息
-      const selectedProcess = this.processList.find(item => item.id === val) || {};
+      const selectedProcess =
+        this.processList.find((item) => item.id === val) || {};
       const processDef = selectedProcess.processDefinition || {};
 
       // 更新流程基础信息
@@ -366,31 +360,39 @@ export default {
     getAssignRuleOptionName(row, option) {
       // 角色类型(10)
       if (row.type === 10) {
-        const role = this.roleOptions.find(item => item.id === option);
+        const role = this.roleOptions.find((item) => item.id === option);
         return role?.name || `未知角色(${option})`;
       }
       // 部门类型(20/21)
       else if (row.type === 20 || row.type === 21) {
-        const dept = this.deptOptions.find(item => item.id === option);
+        const dept = this.deptOptions.find((item) => item.id === option);
         return dept?.name || `未知部门(${option})`;
       }
       // 工种类型(22)
       else if (row.type === 22) {
-        return this.getDictV(this.dictEnum['工种类型'], option + '') || `未知工种(${option})`;
+        return (
+          this.getDictV(this.dictEnum['工种类型'], option + '') ||
+          `未知工种(${option})`
+        );
       }
       // 用户类型(30/31/32)
       else if (row.type === 30 || row.type === 31 || row.type === 32) {
-        const user = this.userOptions.find(item => item.id === option);
+        const user = this.userOptions.find((item) => item.id === option);
         return user?.nickname || user?.name || `未知用户(${option})`;
       }
       // 用户组类型(40)
       else if (row.type === 40) {
-        const group = this.userGroupOptions.find(item => item.id === option);
+        const group = this.userGroupOptions.find((item) => item.id === option);
         return group?.name || `未知用户组(${option})`;
       }
       // 自定义脚本类型(50)
       else if (row.type === 50) {
-        return this.getDictV(this.dictEnum['工作流任务分配自定义脚本'], option + '') || `未知脚本(${option})`;
+        return (
+          this.getDictV(
+            this.dictEnum['工作流任务分配自定义脚本'],
+            option + ''
+          ) || `未知脚本(${option})`
+        );
       }
       // 变量类型(60)
       else if (row.type === 60) {
@@ -400,10 +402,16 @@ export default {
       else if (row.type === 70) {
         const data = JSON.parse(row.variableName || '{}');
         const levelList = data.direction === 1 ? topLevel2 : topLevel1;
-        return levelList.find(item => item.value === data.topLevel)?.label || '未知层级';
+        return (
+          levelList.find((item) => item.value === data.topLevel)?.label ||
+          '未知层级'
+        );
       } else if (row.type === 80) {
         const data = JSON.parse(row.variableName || '{}');
-        return topLevel3.find(item => item.value === data.topLevel)?.label || '未知层级';
+        return (
+          topLevel3.find((item) => item.value === data.topLevel)?.label ||
+          '未知层级'
+        );
       }
       // 默认值
       return `未知类型(${option || '无'})`;
@@ -414,7 +422,9 @@ export default {
      */
     getDictV(dictCode, val) {
       if (!this.dictList[dictCode]) return '';
-      return this.dictList[dictCode].find(item => item.value === val)?.label || '';
+      return (
+        this.dictList[dictCode].find((item) => item.value === val)?.label || ''
+      );
     },
 
     /**
@@ -422,7 +432,7 @@ export default {
      */
     async getDictList(dictCode) {
       const { data: res } = await getByCode(dictCode);
-      this.dictList[dictCode] = res.map(item => {
+      this.dictList[dictCode] = res.map((item) => {
         const keys = Object.keys(item);
         return {
           value: keys[0],
@@ -432,24 +442,23 @@ export default {
     },
 
     generateFormValid(validate = true) {
-      return this.$refs.generateForm.getData(validate).then(data => data);
+      return this.$refs.generateForm.getData(validate).then((data) => data);
     },
 
-        async submit() {
+    async submit() {
       try {
         this.form.valueJson = await this.generateFormValid();
 
         const submitData = {
-          ...this.form, 
-          ...this.carByTemplate, 
-          processType: '1', 
-          variables: { ...this.form.valueJson } 
+          ...this.form,
+          ...this.carByTemplate,
+          processType: '1',
+          variables: { ...this.form.valueJson }
         };
 
         this.$emit('formSubmit', submitData);
 
         this.cancel();
-
       } catch (error) {
         console.error('表单验证失败:', error);
         this.$message.warning('表单验证失败,请检查填写内容');

+ 5 - 0
src/views/salesServiceManagement/demandList/components/addDialog.vue

@@ -213,10 +213,15 @@ export default {
     async handleParameter() {
       let data = this.$refs.infoRef.getValue();
       let sparePartsData = this.$refs.infoRef.getSpareInfoData();
+      console.log(sparePartsData.length);
       if (!data.contactInfoVOS?.length) {
         this.$message.warning('联系人信息至少有1条');
         return false;
       }
+      if (data.part === 1 && sparePartsData.length === 0) {
+        this.$message.warning('请添加配件信息');
+        return false;
+      }
       try {
         let valid = await this.$refs.infoRef.getValidate();
         let expectedTime = data.expectedTime