Преглед изворни кода

提交售后服务流程故障等级字典

hezhanp пре 7 месеци
родитељ
комит
b5cff203a2

+ 77 - 22
src/views/bpm/handleTask/components/salesServiceManagement/demand/salesServiceDialog.vue

@@ -142,11 +142,19 @@
 
       <el-col :span="6">
         <el-form-item label="故障等级:">
-          <DictSelection
-            dictName="故障等级"
-            disabled
+          <el-select
+            style="width: 100%"
             v-model="form.faultLevel"
-          ></DictSelection>
+            placeholder="请选择故障等级"
+            disabled
+          >
+            <el-option
+              v-for="item in faultLevelList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
         </el-form-item>
       </el-col>
       <el-col :span="6">
@@ -897,6 +905,7 @@ export default {
   },
   data() {
     return {
+      faultLevelList: [],
       userList: [],
       pickerOptions: {
         disabledDate(time) {
@@ -974,13 +983,18 @@ export default {
     // 独立加载每个字典,单独捕获错误,不阻塞整体流程
     await this.loadDict('after_sales_type', 'aftertypeList', '售后类型');
     await this.loadDict('pie_car_type', 'pietypeList', '派车类型');
-    await this.loadDict('after_sale_quality_type', 'qualityTypeOptions', '质量类型');
-    
+    await this.loadDict(
+      'after_sale_quality_type',
+      'qualityTypeOptions',
+      '质量类型'
+    );
+    await this.loadDict('fault_level', 'faultLevelList', '故障等级');
+
     // 其他初始化操作
-    await this.getUserList().catch(err => {
+    await this.getUserList().catch((err) => {
       this.$message.error(`获取用户列表失败:${err.message}`);
     });
-    await this.getDeptTreeData().catch(err => {
+    await this.getDeptTreeData().catch((err) => {
       this.$message.error(`获取部门数据失败:${err.message}`);
     });
   },
@@ -1010,8 +1024,13 @@ export default {
       try {
         const res = await getByCode(dictCode);
         // 1. 基础校验:接口是否返回成功且有数据
-        if (res.code !== '0' || !res.data) { // 注意:接口返回code是字符串"0",需匹配类型
-          throw new Error(`接口返回异常(code: ${res.code},data: ${res.data ? '存在' : '不存在'})`);
+        if (res.code !== '0' || !res.data) {
+          // 注意:接口返回code是字符串"0",需匹配类型
+          throw new Error(
+            `接口返回异常(code: ${res.code},data: ${
+              res.data ? '存在' : '不存在'
+            })`
+          );
         }
 
         // 2. 核心修改:兼容数组/对象两种格式的data
@@ -1025,13 +1044,13 @@ export default {
         }
 
         // 3. 解析字典数据:提取键值对,确保value为字符串
-        const dictData = dictItems.map(el => {
+        const dictData = dictItems.map((el) => {
           // 每个el是单个键值对对象(如{ "1": "工时" })
           const key = Object.keys(el)[0];
           const value = Object.values(el)[0];
-          return { 
+          return {
             label: value || '', // 防止label为空
-            value: String(key)  // 强制转为字符串,与表单value类型匹配
+            value: String(key) // 强制转为字符串,与表单value类型匹配
           };
         });
 
@@ -1064,25 +1083,61 @@ export default {
       this.$set(this.form, 'orderId', res.orderId);
       this.$set(this.form, 'contactInfoVOS', res.contactInfoVOS || []);
       this.$set(this.form, 'name', res.name);
-      this.$set(this.form, 'faultLevel', res.faultLevel ? String(res.faultLevel) : '');
+      this.$set(
+        this.form,
+        'faultLevel',
+        res.faultLevel ? String(res.faultLevel) : ''
+      );
       this.$set(this.form, 'code', res.code);
       this.$set(this.form, 'expectedTime', res.expectedTime);
       this.$set(this.form, 'contactAddress', res.contactAddress || '');
 
       this.contactDetail(res.contactId, 'init');
-      this.form.associationType = res.associationType ? String(res.associationType) : '1';
+      this.form.associationType = res.associationType
+        ? String(res.associationType)
+        : '1';
       this.$set(this.form, 'faultDetailList', res.faultDetailList || []);
       this.isOrder = res.faultDetailList?.length > 0;
 
-      this.$set(this.form, 'aftertype', res.afterSalesType ? String(res.afterSalesType) : '');
-      this.$set(this.form, 'charge', res.isFee !== undefined ? String(res.isFee) : '');
-      this.$set(this.form, 'part', res.isWithAccessories !== undefined ? String(res.isWithAccessories) : '');
-      this.$set(this.form, 'car', res.isPieCar !== undefined ? String(res.isPieCar) : '');
-      this.$set(this.form, 'pietype', res.pieCarType ? String(res.pieCarType) : '');
+      this.$set(
+        this.form,
+        'aftertype',
+        res.afterSalesType ? String(res.afterSalesType) : ''
+      );
+      this.$set(
+        this.form,
+        'charge',
+        res.isFee !== undefined ? String(res.isFee) : ''
+      );
+      this.$set(
+        this.form,
+        'part',
+        res.isWithAccessories !== undefined ? String(res.isWithAccessories) : ''
+      );
+      this.$set(
+        this.form,
+        'car',
+        res.isPieCar !== undefined ? String(res.isPieCar) : ''
+      );
+      this.$set(
+        this.form,
+        'pietype',
+        res.pieCarType ? String(res.pieCarType) : ''
+      );
       this.$set(this.form, 'salespersonName', res.salespersonName || '');
       this.$set(this.form, 'salespersonId', res.salespersonId || '');
-      this.$set(this.form, 'isOutsource', res.isOutsource !== undefined ? String(res.isOutsource) : '0');
-      this.$set(this.form, 'isCreatePurchaseOrder', res.isCreatePurchaseOrder !== undefined ? String(res.isCreatePurchaseOrder) : '0');
+      this.$set(
+        this.form,
+        'isOutsource',
+        res.isOutsource !== undefined ? String(res.isOutsource) : '0'
+      );
+      this.$set(
+        this.form,
+        'isCreatePurchaseOrder',
+        res.isCreatePurchaseOrder !== undefined
+          ? String(res.isCreatePurchaseOrder)
+          : '0'
+      );
       this.$set(this.form, 'remark', res.remark || '');
       this.$set(this.form, 'involveDeptId', res.involveDeptId ?? '');
       this.$set(this.form, 'involveDeptName', res.involveDeptName ?? '');