Explorar o código

解决修改、查看详情操作,派车类型未转换

hezhanp hai 8 meses
pai
achega
9a788c84c6

+ 81 - 44
src/views/salesServiceManagement/components/info.vue

@@ -249,6 +249,7 @@
             style="width: 100%"
             v-model="form.charge"
             placeholder="请选择"
+            :disabled="type == 'view'"
           >
             <el-option
               v-for="item in chargeList"
@@ -273,6 +274,7 @@
             style="width: 100%"
             v-model="form.part"
             placeholder="请选择"
+            :disabled="type == 'view'"
           >
             <el-option
               v-for="item in partList"
@@ -297,6 +299,7 @@
             style="width: 100%"
             v-model="form.car"
             placeholder="请选择是否派车"
+            :disabled="type == 'view'"
           >
             <el-option
               v-for="item in carList"
@@ -321,8 +324,8 @@
             style="width: 100%"
             v-model="form.pietype"
             placeholder="请选择"
-            :disabled="type == 'view'"
             @change="selectpietype"
+            :disabled="type == 'view'"
           >
             <el-option
               v-for="item in pietypeList"
@@ -335,13 +338,6 @@
       </el-col>
     </el-row>
 
-    <!-- <spareInfo
-      ref="spareInfoRef"
-      :types="type"
-      v-if="form.part == 1"
-      title="配件信息"
-      :detailList="detailList"
-    /> -->
     <spareParts
       ref="sparePartsRef"
       :type="type"
@@ -870,12 +866,12 @@ import parentList from '@/views/saleManage/contact/components/parentList.vue';
 import invoiceDialog from './invoiceDialog.vue';
 import SaleorderDialog from './saleorderDialog.vue';
 import ProductDialog from './productDialog.vue';
-// import spareInfo from '@/views/salesServiceManagement/accessory/components/spareInfo.vue';
-
 import spareParts from '@/views/salesServiceManagement/components/sparePartsList.vue';
 import { getToken } from '@/utils/token-util';
-
 import processSubmitDialog from '@/views/salesServiceManagement/components/processSubmitDialog/processSubmitDialog.vue';
+// 新增:导入字典接口(用于获取售后/派车类型)
+import { getByCode } from '@/api/system/dictionary-data';
+
 export default {
   mixins: [dictMixins],
   components: {
@@ -885,7 +881,6 @@ export default {
     SaleorderDialog,
     fileMain,
     ProductDialog,
-    // spareInfo,
     processSubmitDialog,
     spareParts
   },
@@ -1206,38 +1201,19 @@ export default {
     demandList: {
       type: Array,
       default: () => []
-    },
-    aftertypeList: {
-      type: Array,
-      default: () => []
-    },
-    pietypeList: {
-      type: Array,
-      default: () => []
     }
+    // 删除:不再接收父组件传递的 aftertypeList 和 pietypeList
   },
   watch: {
+    // 保留:仅监听需求名称列表(父组件仍传递)
     demandList: {
       handler(val) {
         this.demandList = val;
       },
       deep: true,
       immediate: true
-    },
-    aftertypeList: {
-      handler(val) {
-        this.aftertypeList = val;
-      },
-      deep: true,
-      immediate: true
-    },
-    pietypeList: {
-      handler(val) {
-        this.pietypeList = val;
-      },
-      deep: true,
-      immediate: true
     }
+    // 删除:删除对 aftertypeList 和 pietypeList 的监听(已自行维护)
   },
   data() {
     return {
@@ -1293,26 +1269,60 @@ export default {
       carByTemplate: {},
       processSubmitDialogFlag: false,
       formSchema: {},
-      carFormData: {}
+      carFormData: {},
+      // 新增:自行维护售后类型和派车类型列表
+      aftertypeList: [],
+      pietypeList: []
     };
   },
-  created() {},
+  created() {
+    // 新增:页面创建时主动获取售后类型和派车类型
+    this.getAftertypeCode('after_sales_type');
+    this.getPietypeCode('pie_car_type');
+  },
   methods: {
-    // getSpareInfoData() {
-    //   if (this.$refs.spareInfoRef) {
-    //     return this.$refs.spareInfoRef.getSpareData() || [];
-    //   }
-    //   return [];
-    // },
+    // 新增:获取售后类型字典(原父组件的 getaftertypeCode 逻辑)
+    async getAftertypeCode(code) {
+      try {
+        const res = await getByCode(code);
+        if (res.code == 0) {
+          let list = Object.values(res.data).map((el) => {
+            let k = Object.keys(el)[0];
+            let v = Object.values(el)[0];
+            return { label: v, value: k };
+          });
+          this.aftertypeList = list;
+        }
+      } catch (err) {
+        this.$message.error(err.message);
+      }
+    },
+    // 新增:获取派车类型字典(原父组件的 getpietypeCode 逻辑)
+    async getPietypeCode(code) {
+      try {
+        const res = await getByCode(code);
+        if (res.code == 0) {
+          let list = Object.values(res.data).map((el) => {
+            let k = Object.keys(el)[0];
+            let v = Object.values(el)[0];
+            return { label: v, value: k };
+          });
+          this.pietypeList = list;
+        }
+      } catch (err) {
+        this.$message.error(err.message);
+      }
+    },
+
+    // 获取配件信息
     getSpareInfoData() {
       if (this.$refs.sparePartsRef) {
-        // 调用spareParts的getTableValue获取配件列表数据
         return this.$refs.sparePartsRef.getTableValue() || [];
       }
       return [];
     },
+    // 初始化数据
     async init(res) {
-      // 原有字段初始化
       let productDetail = res.productDetail ? res.productDetail : [];
       this.$set(this.form, 'tableList', productDetail);
       this.$set(this.form, 'orderCode', res.orderCode);
@@ -1357,25 +1367,31 @@ export default {
         }
       });
     },
+    // 获取表单值
     getValue() {
       return this.form;
     },
+    // 查看图片
     seeImage(row) {
       this.phoneList = row.imageUrl || [];
       this.phoneVisible = true;
     },
+    // 关闭图片预览
     closePhone() {
       this.phoneList = [];
       this.phoneVisible = false;
     },
+    // 选择客户
     handHead() {
       if (this.type != 'view') {
         this.$refs.parentRef.open();
       }
     },
+    // 客户选择回调
     changeParent(res) {
       this.contactDetail(res.id);
     },
+    // 获取客户详情
     async contactDetail(id, type) {
       if (!id) {
         this.contractInfo = {};
@@ -1410,6 +1426,7 @@ export default {
         }
       }
     },
+    // 发货单选择回调
     invoiceChange(data) {
       this.$set(this.form, 'orderCode', data.orderCode);
       this.$set(this.form, 'orderId', data.orderId);
@@ -1420,6 +1437,7 @@ export default {
       );
       this.$set(this.form, 'tableList', list);
     },
+    // 打开发货单选择弹窗
     invoiceDialogOpen() {
       if (!this.form?.contractInfo?.id) {
         this.$message.warning('请先选择客户名称!');
@@ -1435,9 +1453,11 @@ export default {
         this.$refs.invoiceDialogRef.open(this.form.contractInfo.id, obj);
       }
     },
+    // 数量输入处理
     totalCountChange(data, name) {
       data[name] = data[name].replace(/[^\d]/g, '').replace(/^0+/, '') || '1';
     },
+    // 添加联系人
     addBank() {
       this.form.contactInfoVOS.push({
         contactName: '',
@@ -1445,6 +1465,7 @@ export default {
         remark: ''
       });
     },
+    // 添加故障
     addProblem(row) {
       if (!row.faultDetails) this.$set(row, 'faultDetails', []);
       let len = row.faultDetails.length;
@@ -1454,13 +1475,16 @@ export default {
         faultPhenomenon: ''
       });
     },
+    // 删除子故障
     delSon(row, idx) {
       row.faultDetails.splice(idx, 1);
       this.$forceUpdate();
     },
+    // 联系人选择回调
     handleSelectionChange(rows) {
       this.selection = rows;
     },
+    // 批量删除联系人
     delContact() {
       if (this.selection.length == 0) {
         this.$message.warning('请至少选择一条联系人信息');
@@ -1470,12 +1494,15 @@ export default {
         (row) => !this.selection.includes(row)
       );
     },
+    // 删除单个联系人
     handleBankDel(row, index) {
       this.form.contactInfoVOS.splice(index, 1);
     },
+    // 删除售后对象
     del(row, index) {
       this.form.tableList.splice(index, 1);
     },
+    // 表单验证
     getValidate() {
       return new Promise((resolve, reject) => {
         this.$refs.form.validate((valid, obj) => {
@@ -1493,6 +1520,7 @@ export default {
         });
       });
     },
+    // 重置表单
     catch() {
       this.form = {
         tableList: [],
@@ -1510,6 +1538,7 @@ export default {
       };
       this.$refs.form.resetFields();
     },
+    // 打开销售订单选择弹窗
     saleorderDialogOpen() {
       if (!this.form?.contractInfo?.id) {
         this.$message.warning('请先选择客户名称!');
@@ -1525,6 +1554,7 @@ export default {
         this.$refs.saleorderDialogRef.open(this.form.contractInfo.id, obj);
       }
     },
+    // 销售订单选择回调
     saleorderChange(data) {
       this.$set(this.form, 'orderCode', data.orderCode);
       this.$set(this.form, 'orderId', data.orderId);
@@ -1540,9 +1570,11 @@ export default {
         this.$set(this.form, 'faultDetailList', []);
       }
     },
+    // 打开产品选择弹窗
     customersDialogOpen() {
       this.$refs.productDialogRef.open();
     },
+    // 产品选择回调
     productChange(data) {
       this.$set(this.form, 'faultDetailList', []);
       this.$set(this.form, 'orderCode', data.orderCode);
@@ -1554,6 +1586,7 @@ export default {
       );
       this.$set(this.form, 'tableList', list);
     },
+    // 添加故障(独立故障列表)
     addFaults() {
       this.form.faultDetailList.push({
         maintenanceProcess: '',
@@ -1561,9 +1594,11 @@ export default {
         faultPhenomenon: ''
       });
     },
+    // 删除故障
     faultDel(index) {
       this.form.faultDetailList.splice(index, 1);
     },
+    // 关联类型选择回调
     selectType(e) {
       this.$set(this.form, 'tableList', []);
       this.$set(this.form, 'faultDetailList', []);
@@ -1573,6 +1608,7 @@ export default {
         this.isOrder = false;
       }
     },
+    // 派车类型选择回调
     async selectpietype(e) {
       if (e == '1' || e == '2') {
         this.defaultTemplateList = await getBpmCustomFormList({ status: 1 });
@@ -1593,6 +1629,7 @@ export default {
         this.processSubmitDialogFlag = true;
       }
     },
+    // 流程表单提交回调
     handleFormSubmit(data) {
       this.carFormData = data;
     }

+ 28 - 67
src/views/salesServiceManagement/demandList/components/addDialog.vue

@@ -10,12 +10,10 @@
     append-to-body
     @close="handleClose"
   >
-    <!-- :fullscreen="fullscreen" -->
+    <!-- 移除:不再传递 aftertypeList 和 pietypeList  props -->
     <info
       ref="infoRef"
       :demandList="demandList"
-      :aftertypeList="aftertypeList"
-      :pietypeList="pietypeList"
       :type="type"
     ></info>
     <SubmitDialog ref="submitRef" @savExit="savExit" />
@@ -53,7 +51,7 @@ import modalTitle from '@/BIZComponents/modalTitle.vue';
 import customerDialog from '@/views/financialManage/components/customerListDialog.vue';
 import SubmitDialog from './submitDialog.vue';
 import dispatchDialog from './dispatchDialog.vue';
-import { getByCode } from '@/api/system/dictionary-data';
+// 删除:不再导入 getByCode(info 组件已自行导入)
 import {
   saveSalesDemand,
   updateSalesDemand,
@@ -66,7 +64,6 @@ export default {
   components: {
     modalTitle,
     customerDialog,
-    // fileMain,
     info,
     SubmitDialog,
     dispatchDialog
@@ -81,29 +78,18 @@ export default {
       addRepairNotesDialog: false,
       type: 'add',
       form: {},
+      // 删除:不再维护 aftertypeList 和 pietypeList(info 组件自行维护)
       demandList: [],
-      aftertypeList: [],
-      pietypeList: [],
       loading: false
     };
   },
   created() {
-    this.getLevelCode('requirement_name'); //需求名称字典查询
-    this.getaftertypeCode('after_sales_type');
-    this.getpietypeCode('pie_car_type');
+    // 保留:仅获取需求名称字典
+    this.getLevelCode('requirement_name');
+    // 删除:删除售后类型和派车类型的获取调用
   },
   methods: {
-    // 初始化数据(父组件调用)
-    init(row, type) {
-      this.addRepairNotesDialog = true;
-      this.type = type;
-      this.title = type == 'add' ? '新增' : type == 'view' ? '详情' : '修改';
-      if (row?.id) {
-        this.getDetail(row.id);
-      } else {
-      }
-    },
-    //
+    // 保留:获取需求名称字典(原逻辑不变)
     async getLevelCode(code) {
       try {
         const res = await getByCode(code);
@@ -122,43 +108,21 @@ export default {
         this.$message.error(err.message);
       }
     },
-    async getaftertypeCode(code) {
-      try {
-        const res = await getByCode(code);
-        if (res.code == 0) {
-          let list = Object.values(res.data).map((el) => {
-            let k = Object.keys(el)[0];
-            let v = Object.values(el)[0];
-            return {
-              label: v,
-              value: k
-            };
-          });
-          this.aftertypeList = list;
-        }
-      } catch (err) {
-        this.$message.error(err.message);
-      }
-    },
-    async getpietypeCode(code) {
-      try {
-        const res = await getByCode(code);
-        if (res.code == 0) {
-          let list = Object.values(res.data).map((el) => {
-            let k = Object.keys(el)[0];
-            let v = Object.values(el)[0];
-            return {
-              label: v,
-              value: k
-            };
-          });
-          this.pietypeList = list;
-        }
-      } catch (err) {
-        this.$message.error(err.message);
+    // 删除:删除 getaftertypeCode 方法(info 组件已自行实现)
+    // 删除:删除 getpietypeCode 方法(info 组件已自行实现)
+
+    // 初始化弹窗(父组件调用)
+    init(row, type) {
+      this.addRepairNotesDialog = true;
+      this.type = type;
+      this.title = type == 'add' ? '新增' : type == 'view' ? '详情' : '修改';
+      if (row?.id) {
+        this.getDetail(row.id);
+      } else {
       }
     },
-    // 提交
+
+    // 提交(打开提交弹窗)
     async submit() {
       let pData = await this.handleParameter();
       if (!pData) {
@@ -166,31 +130,30 @@ export default {
       }
       this.$refs.submitRef.open(pData, this.type);
     },
-    // 派单
+    // 派单(打开派单弹窗)
     async dispatch() {
       let pData = await this.handleParameter();
-      console.log(pData);
-      debugger;
       if (!pData) {
         return;
       }
       this.$refs.dispatchRef.open(pData, this.type);
     },
+    // 获取详情
     async getDetail(id) {
       const res = await getSalesDemandById(id);
       this.$nextTick(() => {
         this.$refs.infoRef.init(res);
       });
-
       this.form = res;
     },
 
+    // 关闭弹窗
     handleClose() {
       this.addRepairNotesDialog = false;
       this.form = {};
       this.$refs.infoRef.catch();
     },
-    // 标准时间函数 ***
+    // 时间格式化
     formatDate(dateString) {
       const isStandardFormat = /^\d{4}-\d{1,2}-\d{1,2}$/.test(dateString);
       if (isStandardFormat) {
@@ -209,7 +172,7 @@ export default {
         return dateString; // 转换失败时返回原始字符串
       }
     },
-    // 提取公共 参数
+    // 提取公共参数
     async handleParameter() {
       let data = this.$refs.infoRef.getValue();
       let sparePartsData = (this.$refs.infoRef.getSpareInfoData() || []).map(
@@ -219,8 +182,7 @@ export default {
           name: item?.categoryName
         })
       );
-      
-  console.log("加工后配件数据:", sparePartsData)
+
       if (!data.contactInfoVOS?.length) {
         this.$message.warning('联系人信息至少有1条');
         return false;
@@ -260,7 +222,6 @@ export default {
           costListVOS: sparePartsData,
           formJson: this.$refs.infoRef.carFormData
         };
-        console.log(pData);
         // 如果选的销售订单并且 没有售后对象数据
         if (pData.associationType == '2' && pData.productDetail.length == 0) {
           delete pData.productDetail;
@@ -273,6 +234,7 @@ export default {
         return pData;
       } catch (err) {}
     },
+    // 保存/提交后关闭弹窗
     savExit() {
       this.$emit('refresh');
       this.handleClose();
@@ -325,7 +287,6 @@ export default {
 
 .btns {
   text-align: right;
-  // margin: 10px 0;
 }
 
 .main_container {
@@ -333,4 +294,4 @@ export default {
   display: flex;
   justify-content: space-between;
 }
-</style>
+</style>