Эх сурвалжийг харах

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

yusheng 7 сар өмнө
parent
commit
e920256fcd

+ 7 - 0
src/views/salesServiceManagement/accessory/components/search.vue

@@ -56,6 +56,13 @@ export default {
           type: 'input',
           placeholder: ''
         },
+        {
+          label: '售后需求编码:',
+          value: 'demandCode',
+          width: 380,
+          type: 'input',
+          placeholder: ''
+        },
         {
           label: '设备名称:',
           value: 'deviceName',

+ 6 - 0
src/views/salesServiceManagement/accessory/index.vue

@@ -130,6 +130,12 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'demandCode',
+            label: '售后需求编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
           {
             prop: 'orderCode',
             label: '工单编码',

+ 297 - 140
src/views/salesServiceManagement/components/info.vue

@@ -162,13 +162,23 @@
         </el-form-item>
       </el-col>
       <el-col :span="6">
-        <el-form-item label="业务员:" prop="salesmanName">
-          <personSelect
-            ref="directorRef"
-            v-model="form.salesmanName"
-            @selfChange="changeUserInfo"
+        <el-form-item label="业务员:" prop="salespersonName">
+          <el-select
+            style="width: 100%"
+            v-model="form.salespersonId"
+            placeholder="请选择业务员"
+            filterable
+            clearable
             :disabled="type == 'view'"
-          />
+            @change="changeUserInfo"
+          >
+            <el-option
+              v-for="item in userList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            ></el-option>
+          </el-select>
         </el-form-item>
       </el-col>
       <el-col :span="6">
@@ -210,7 +220,6 @@
           ></el-date-picker>
         </el-form-item>
       </el-col>
-
       <el-col :span="6">
         <el-form-item
           label="售后类型:"
@@ -225,6 +234,7 @@
             style="width: 100%"
             v-model="form.aftertype"
             placeholder="请选择"
+            @change="selectaftertype"
             :disabled="type == 'view'"
           >
             <el-option
@@ -362,7 +372,6 @@
           </el-select>
         </el-form-item>
       </el-col>
-
       <el-col :span="6" v-if="form.isOutsource == 1">
         <el-form-item
           label="供应商名称:"
@@ -399,6 +408,42 @@
           </el-select>
         </el-form-item>
       </el-col>
+      <el-col :span="6">
+        <el-form-item
+          label="涉及事业部门:"
+          prop="involveDeptId"
+          :rules="{
+            required: true,
+            message: '请选择涉及事业部门',
+            trigger: 'change'
+          }"
+        >
+          <ele-tree-select
+            v-model="form.involveDeptId"
+            :data="deptTreeData"
+            label-key="name"
+            value-key="id"
+            clearable
+            default-expand-all
+            placeholder="请选择"
+            ref="deptTreeSelect"
+            :disabled="type == 'view'"
+            @node-click="handleDeptNodeClick"
+            @change="handleDeptChange"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="备注说明:" prop="remark" class="remark-input">
+          <el-input
+            :disabled="type == 'view'"
+            v-model="form.remark"
+            type="textarea"
+            rows="2"
+            placeholder="请输入备注信息(选填)"
+          ></el-input>
+        </el-form-item>
+      </el-col>
     </el-row>
 
     <headerTitle
@@ -485,17 +530,26 @@
                   :prop="`tableList.${$index}.faultDetails.${idx}.type`"
                   :rules="{
                     required: true,
-                    message: '请选择故障类型',
+                    message:
+                      form.aftertype === '3'
+                        ? '请选择质量类型'
+                        : '请选择故障类型',
                     trigger: 'change'
                   }"
                 >
                   <el-select
                     v-model="row.type"
                     :disabled="change_permission"
-                    :placeholder="`请选择`"
+                    :placeholder="
+                      form.aftertype === '3'
+                        ? '请选择质量类型'
+                        : '请选择故障类型'
+                    "
                   >
                     <el-option
-                      v-for="item in typeOptions"
+                      v-for="item in form.aftertype === '3'
+                        ? qualityTypeOptions
+                        : typeOptions"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value"
@@ -508,7 +562,10 @@
                   :prop="`tableList.${$index}.faultDetails.${idx}.faultPhenomenon`"
                   :rules="{
                     required: true,
-                    message: '请输入故障现象',
+                    message:
+                      form.aftertype === '3'
+                        ? '请输入质量问题反馈'
+                        : '请输入故障现象',
                     trigger: 'change'
                   }"
                 >
@@ -527,7 +584,10 @@
                   :prop="`tableList.${$index}.faultDetails.${idx}.faultReason`"
                   :rules="{
                     required: true,
-                    message: '请输入故障原因',
+                    message:
+                      form.aftertype === '3'
+                        ? '请输入质量问题分析'
+                        : '请输入故障原因',
                     trigger: 'change'
                   }"
                 >
@@ -553,7 +613,10 @@
                   :prop="`tableList.${$index}.faultDetails.${idx}.maintenanceProcess`"
                   :rules="{
                     required: true,
-                    message: '请输入维修过程',
+                    message:
+                      form.aftertype === '3'
+                        ? '请输入质量处理方式'
+                        : '请输入维修过程',
                     trigger: 'change'
                   }"
                 >
@@ -582,7 +645,7 @@
               <template v-slot:action="{ row: data, $index }">
                 <el-popconfirm
                   class="ele-action"
-                  title="确定要删除当前故障吗?"
+                  title="确定要删除当前记录吗?"
                   @confirm="delSon(row, $index)"
                 >
                   <template v-slot:reference>
@@ -598,22 +661,30 @@
               </template>
 
               <template v-slot:headerType="{ column }">
-                <span class="is-required">{{ column.label }}</span>
+                <span class="is-required">{{
+                  form.aftertype === '3' ? '质量类型' : column.label
+                }}</span>
               </template>
               <template v-slot:headerPhenomenon="{ column }">
-                <span class="is-required">{{ column.label }}</span>
+                <span class="is-required">{{
+                  form.aftertype === '3' ? '质量问题反馈' : column.label
+                }}</span>
               </template>
               <template
                 v-slot:headerMaintenance="{ column }"
                 v-if="source == '报工信息'"
               >
-                <span class="is-required">{{ column.label }}</span>
+                <span class="is-required">{{
+                  form.aftertype === '3' ? '质量处理方式' : column.label
+                }}</span>
               </template>
               <template
                 v-slot:headerFaultReason="{ column }"
                 v-if="source == '报工信息'"
               >
-                <span class="is-required">{{ column.label }}</span>
+                <span class="is-required">{{
+                  form.aftertype === '3' ? '质量问题分析' : column.label
+                }}</span>
               </template>
             </ele-pro-table>
           </div>
@@ -630,10 +701,17 @@
           <el-link
             type="primary"
             :underline="false"
-            v-if="tableOperate"
+            v-if="tableOperate && form.aftertype !== '3'"
             @click="addProblem(row)"
             >添加故障</el-link
           >
+          <el-link
+            type="primary"
+            :underline="false"
+            v-if="form.aftertype === '3'"
+            @click="addProblem(row)"
+            >添加质量反馈</el-link
+          >
           <el-link
             type="danger"
             :underline="false"
@@ -646,7 +724,16 @@
       </ele-pro-table>
     </div>
     <div class="fault_infor" v-else>
-      <headerTitle title="故障信息" style="margin-top: 10px"></headerTitle>
+      <headerTitle
+        title="故障信息"
+        style="margin-top: 10px"
+        v-if="form.aftertype !== '3'"
+      ></headerTitle>
+      <headerTitle
+        title="质量反馈信息"
+        style="margin-top: 10px"
+        v-if="form.aftertype === '3'"
+      ></headerTitle>
 
       <ele-pro-table
         :columns="faultList"
@@ -657,26 +744,40 @@
         :toolkit="[]"
       >
         <template v-slot:toolbar>
-          <el-button type="primary" v-if="tableOperate" @click="addFaults"
+          <el-button
+            type="primary"
+            v-if="tableOperate && form.aftertype !== '3'"
+            @click="addFaults"
             >添加故障</el-button
           >
+          <el-button
+            type="primary"
+            v-if="tableOperate && form.aftertype === '3'"
+            @click="addFaults"
+            >添加质量反馈</el-button
+          >
         </template>
         <template v-slot:type="{ row, $index: idx }">
           <el-form-item
             :prop="`faultDetailList.${idx}.type`"
             :rules="{
               required: true,
-              message: '请选择故障类型',
+              message:
+                form.aftertype === '3' ? '请选择质量类型' : '请选择故障类型',
               trigger: 'change'
             }"
           >
             <el-select
               v-model="row.type"
               :disabled="change_permission"
-              :placeholder="`请选择`"
+              :placeholder="
+                form.aftertype === '3' ? '请选择质量类型' : '请选择故障类型'
+              "
             >
               <el-option
-                v-for="item in typeOptions"
+                v-for="item in form.aftertype === '3'
+                  ? qualityTypeOptions
+                  : typeOptions"
                 :key="item.value"
                 :label="item.label"
                 :value="item.value"
@@ -689,7 +790,10 @@
             :prop="`faultDetailList.${idx}.faultPhenomenon`"
             :rules="{
               required: true,
-              message: '请输入故障现象',
+              message:
+                form.aftertype === '3'
+                  ? '请输入质量问题反馈'
+                  : '请输入故障现象',
               trigger: 'change'
             }"
           >
@@ -708,7 +812,10 @@
             :prop="`faultDetailList.${idx}.faultReason`"
             :rules="{
               required: true,
-              message: '请输入故障原因',
+              message:
+                form.aftertype === '3'
+                  ? '请输入质量问题分析'
+                  : '请输入故障原因',
               trigger: 'change'
             }"
           >
@@ -734,7 +841,10 @@
             :prop="`faultDetailList.${idx}.maintenanceProcess`"
             :rules="{
               required: true,
-              message: '请输入维修过程',
+              message:
+                form.aftertype === '3'
+                  ? '请输入质量处理方式'
+                  : '请输入维修过程',
               trigger: 'change'
             }"
           >
@@ -763,7 +873,7 @@
         <template v-slot:action="{ row: data, $index }">
           <el-popconfirm
             class="ele-action"
-            title="确定要删除当前故障吗?"
+            title="确定要删除当前记录吗?"
             @confirm="faultDel($index)"
           >
             <template v-slot:reference>
@@ -775,22 +885,30 @@
         </template>
 
         <template v-slot:headerType="{ column }">
-          <span class="is-required">{{ column.label }}</span>
+          <span class="is-required">{{
+            form.aftertype === '3' ? '质量类型' : column.label
+          }}</span>
         </template>
         <template v-slot:headerPhenomenon="{ column }">
-          <span class="is-required">{{ column.label }}</span>
+          <span class="is-required">{{
+            form.aftertype === '3' ? '质量问题反馈' : column.label
+          }}</span>
         </template>
         <template
           v-slot:headerMaintenance="{ column }"
           v-if="source == '报工信息'"
         >
-          <span class="is-required">{{ column.label }}</span>
+          <span class="is-required">{{
+            form.aftertype === '3' ? '质量处理方式' : column.label
+          }}</span>
         </template>
         <template
           v-slot:headerFaultReason="{ column }"
           v-if="source == '报工信息'"
         >
-          <span class="is-required">{{ column.label }}</span>
+          <span class="is-required">{{
+            form.aftertype === '3' ? '质量问题分析' : column.label
+          }}</span>
         </template>
       </ele-pro-table>
     </div>
@@ -915,13 +1033,6 @@
     ></invoiceDialog>
     <SaleorderDialog ref="saleorderDialogRef" @changeParent="saleorderChange" />
     <ProductDialog ref="productDialogRef" @changeParent="productChange" />
-    <process-submit-dialog
-      :process-submit-dialog-flag="processSubmitDialogFlag"
-      :form-schema="formSchema"
-      :carByTemplate="carByTemplate"
-      @update:processSubmitDialogFlag="(val) => (processSubmitDialogFlag = val)"
-      @formSubmit="handleFormSubmit"
-    ></process-submit-dialog>
     <GYSparentList
       ref="GYSparentRef"
       @changeParent="GYSchangeParent"
@@ -942,10 +1053,9 @@ import SaleorderDialog from './saleorderDialog.vue';
 import ProductDialog from './productDialog.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';
-
-import personSelect from '@/components/CommomSelect/person-select.vue';
+import { getByCode } from '@/api/system/dictionary-data'; // 字典接口
+import { listOrganizations } from '@/api/system/organization';
+import { getUserPage } from '@/api/system/organization';
 import GYSparentList from '@/views/purchasingManage/supplierManage/components/parentList.vue';
 export default {
   mixins: [dictMixins],
@@ -956,10 +1066,8 @@ export default {
     SaleorderDialog,
     fileMain,
     ProductDialog,
-    processSubmitDialog,
     spareParts,
-    GYSparentList,
-    personSelect
+    GYSparentList
   },
   computed: {
     ...mapGetters(['getDictValue']),
@@ -1159,7 +1267,7 @@ export default {
         {
           columnKey: 'action',
           label: '操作',
-          width: 150,
+          minWidth: 180,
           align: 'center',
           resizable: false,
           slot: 'action',
@@ -1168,6 +1276,7 @@ export default {
       ];
     },
     faultList() {
+      const isQualityScene = this.form.aftertype === '3';
       return [
         {
           type: 'index',
@@ -1178,7 +1287,7 @@ export default {
         {
           prop: 'type',
           slot: 'type',
-          label: '故障类型',
+          label: isQualityScene ? '质量类型' : '故障类型',
           align: 'center',
           headerSlot: 'headerType',
           showOverflowTooltip: true,
@@ -1188,7 +1297,7 @@ export default {
           prop: 'faultPhenomenon',
           slot: 'faultPhenomenon',
           headerSlot: 'headerPhenomenon',
-          label: '故障现象',
+          label: isQualityScene ? '质量问题反馈' : '故障现象',
           align: 'center',
           minWidth: 240
         },
@@ -1196,7 +1305,7 @@ export default {
           prop: 'faultReason',
           slot: 'faultReason',
           headerSlot: 'headerFaultReason',
-          label: '故障原因',
+          label: isQualityScene ? '质量问题分析' : '故障原因',
           align: 'center',
           minWidth: 340
         },
@@ -1204,7 +1313,7 @@ export default {
           prop: 'maintenanceProcess',
           slot: 'maintenanceProcess',
           headerSlot: 'headerMaintenance',
-          label: '维修过程',
+          label: isQualityScene ? '质量处理方式' : '维修过程',
           align: 'center',
           width: 340
         },
@@ -1298,7 +1407,6 @@ export default {
     }
   },
   watch: {
-    // 仅监听需求名称列表
     demandList: {
       handler(val) {
         this.demandList = val;
@@ -1309,6 +1417,7 @@ export default {
   },
   data() {
     return {
+      userList: [],
       tableList: [],
       selection: [],
       pickerOptions: {
@@ -1316,7 +1425,7 @@ export default {
           return time.getTime() < new Date().setHours(0, 0, 0, 0);
         }
       },
-      detailList: [], // 配件数据列表
+      detailList: [],
       chargeList: [
         { label: '是', value: 1 },
         { label: '否', value: 0 }
@@ -1334,6 +1443,8 @@ export default {
         { label: '保养', value: '2' },
         { label: '安装', value: '3' }
       ],
+      // 质量类型选项
+      qualityTypeOptions: [],
       outsourceList: [
         { label: '是', value: 1 },
         { label: '否', value: 0 }
@@ -1343,22 +1454,10 @@ export default {
         { label: '否', value: 0 }
       ],
       sxtList: [
-        {
-          label: '自制件',
-          value: 1
-        },
-        {
-          label: '采购件',
-          value: 2
-        },
-        {
-          label: '外协件',
-          value: 3
-        },
-        {
-          label: '受托件',
-          value: 4
-        }
+        { label: '自制件', value: 1 },
+        { label: '采购件', value: 2 },
+        { label: '外协件', value: 3 },
+        { label: '受托件', value: 4 }
       ],
       form: {
         contractInfo: {},
@@ -1367,7 +1466,8 @@ export default {
         faultDetailList: [],
         associationType: '1',
         aftertype: '',
-        salesmanName:'',
+        salespersonName: '',
+        salespersonId: '',
         charge: '',
         part: '',
         car: '',
@@ -1376,7 +1476,10 @@ export default {
         isCreatePurchaseOrder: 0,
         supplierName: '',
         supplierId: '',
-        supplierCode: ''
+        supplierCode: '',
+        involveDeptId: '',
+        involveDeptName: '',
+        remark: ''
       },
       rules: {},
       radio: null,
@@ -1388,27 +1491,109 @@ export default {
         { value: '3', label: '客户' }
       ],
       isOrder: false,
-      defaultTemplateList: [],
-      jsonData: {},
-      carByTemplate: {},
-      processSubmitDialogFlag: false,
-      formSchema: {},
-      carFormData: {},
-      // 自行维护售后类型和派车类型列表
       aftertypeList: [],
-      pietypeList: []
+      pietypeList: [],
+      deptTreeData: []
     };
   },
   created() {
-    // 页面创建时主动获取售后类型和派车类型
     this.getAftertypeCode('after_sales_type');
     this.getPietypeCode('pie_car_type');
+    this.getQualityTypeCode('after_sale_quality_type');
+    this.getUserList();
+    this.getDeptTreeData();
   },
   methods: {
-    changeUserInfo(val, info) {
-      this.form.salesmanName = info.name;
+    async getQualityTypeCode(code) {
+      try {
+        const res = await getByCode(code);
+        if (res.code == 0) {
+          this.qualityTypeOptions = Object.values(res.data).map((el) => {
+            const key = Object.keys(el)[0];
+            const value = Object.values(el)[0];
+            return { label: value, value: key };
+          });
+        }
+      } catch (err) {
+        this.$message.error(`获取质量类型字典失败:${err.message}`);
+      }
+    },
+
+    async getDeptTreeData() {
+      try {
+        const deptRes = await listOrganizations();
+        this.deptTreeData = this.$util.toTreeData({
+          data: deptRes || [],
+          idField: 'id',
+          parentIdField: 'parentId'
+        });
+      } catch (error) {
+        console.error('获取涉及事业部门数据失败:', error);
+        this.$message.error('获取涉及事业部门数据失败');
+      }
+    },
+
+    handleDeptNodeClick(node) {
+      if (node && node.id) {
+        this.form.involveDeptId = node.id;
+        this.form.involveDeptName = node.name;
+      }
+    },
+
+    handleDeptChange(val) {
+      if (!val) {
+        this.form.involveDeptName = '';
+        return;
+      }
+
+      if (!this.deptTreeData || this.deptTreeData.length === 0) {
+        console.warn('部门树数据未加载');
+        return;
+      }
+
+      const findDeptName = (treeData, deptId) => {
+        for (const node of treeData) {
+          if (node.id === deptId) {
+            return node.name;
+          }
+          if (node.children && node.children.length > 0) {
+            const found = findDeptName(node.children, deptId);
+            if (found) return found;
+          }
+        }
+        return '';
+      };
+
+      const deptName = findDeptName(this.deptTreeData, val);
+      this.form.involveDeptName = deptName;
+    },
+    async getUserList() {
+      try {
+        const res = await getUserPage({
+          pageNum: 1,
+          pageSize: -1
+        });
+        this.userList = res?.list || [];
+      } catch (error) {
+        console.error('获取用户列表失败:', error);
+        this.$message.error('获取用户列表失败');
+      }
+    },
+    changeUserInfo(userId) {
+      if (userId) {
+        const selectedUser = this.userList.find((user) => user.id === userId);
+        if (selectedUser) {
+          this.form.salespersonName = selectedUser.name;
+          this.form.salespersonId = userId;
+        } else {
+          console.warn('未找到对应的用户信息,ID:', userId);
+          this.form.salespersonName = '';
+        }
+      } else {
+        this.form.salespersonName = '';
+        this.form.salespersonId = '';
+      }
     },
-    // 获取售后类型字典
     async getAftertypeCode(code) {
       try {
         const res = await getByCode(code);
@@ -1424,7 +1609,6 @@ export default {
         this.$message.error(err.message);
       }
     },
-    // 获取派车类型字典
     async getPietypeCode(code) {
       try {
         const res = await getByCode(code);
@@ -1441,14 +1625,12 @@ export default {
       }
     },
 
-    // 获取配件信息
     getSpareInfoData() {
       if (this.$refs.sparePartsRef) {
         return this.$refs.sparePartsRef.getTableValue() || [];
       }
       return [];
     },
-    // 初始化数据
     async init(res) {
       let productDetail = res.productDetail ? res.productDetail : [];
       this.$set(this.form, 'tableList', productDetail);
@@ -1479,8 +1661,7 @@ export default {
         res.afterSalesType ? String(res.afterSalesType) : ''
       );
       this.$set(this.form, 'charge', res.isFee ?? '');
-      
-      this.$set(this.form, 'salesmanName', res.salesmanName ?? '');
+
       this.$set(this.form, 'part', res.isWithAccessories ?? '');
       this.$set(this.form, 'car', res.isPieCar ?? '');
       this.$set(
@@ -1488,12 +1669,17 @@ export default {
         'pietype',
         res.pieCarType ? String(res.pieCarType) : ''
       );
-      this.$set(this.form, 'isOutsource', res.isOutsource ?? '');
+      this.$set(this.form, 'salespersonName', res.salespersonName || '');
+      this.$set(this.form, 'salespersonId', res.salespersonId || '');
       this.$set(
         this.form,
         'isCreatePurchaseOrder',
         res.isCreatePurchaseOrder ?? ''
       );
+
+      this.$set(this.form, 'remark', res.remark || '');
+      this.$set(this.form, 'involveDeptId', res.involveDeptId ?? '');
+      this.$set(this.form, 'involveDeptName', res.involveDeptName ?? '');
       this.$set(this.form, 'supplierId', res.supplierId ?? '');
       this.$set(this.form, 'supplierName', res.supplierName ?? '');
       this.$set(this.form, 'supplierCode', res.supplierCode ?? '');
@@ -1504,27 +1690,22 @@ 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);
     },
@@ -1543,7 +1724,6 @@ export default {
         this.$refs.form.validateField('supplierName');
       });
     },
-    // 获取客户详情
     async contactDetail(id, type) {
       if (!id) {
         this.contractInfo = {};
@@ -1578,7 +1758,6 @@ export default {
         }
       }
     },
-    // 发货单选择回调
     invoiceChange(data) {
       this.$set(this.form, 'orderCode', data.orderCode);
       this.$set(this.form, 'orderId', data.orderId);
@@ -1589,7 +1768,6 @@ export default {
       );
       this.$set(this.form, 'tableList', list);
     },
-    // 打开发货单选择弹窗
     invoiceDialogOpen() {
       if (!this.form?.contractInfo?.id) {
         this.$message.warning('请先选择客户名称!');
@@ -1605,11 +1783,9 @@ 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: '',
@@ -1617,7 +1793,6 @@ export default {
         remark: ''
       });
     },
-    // 添加故障
     addProblem(row) {
       if (!row.faultDetails) this.$set(row, 'faultDetails', []);
       let len = row.faultDetails.length;
@@ -1627,16 +1802,13 @@ 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('请至少选择一条联系人信息');
@@ -1646,15 +1818,12 @@ 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) => {
@@ -1672,7 +1841,6 @@ export default {
         });
       });
     },
-    // 重置表单
     catch() {
       this.form = {
         tableList: [],
@@ -1683,7 +1851,10 @@ export default {
         orderId: '',
         associationType: '1',
         aftertype: '',
-        salesmanName:'',
+        salespersonName: '',
+        salespersonId: '',
+        involveDeptId: '',
+        involveDeptName: '',
         charge: '',
         part: '',
         car: '',
@@ -1692,14 +1863,14 @@ export default {
         isCreatePurchaseOrder: 0,
         supplierName: '',
         supplierId: '',
-        supplierCode: ''
+        supplierCode: '',
+        remark: ''
       };
       if (this.$refs.sparePartsRef) {
         this.$refs.sparePartsRef.clearList();
       }
       this.$refs.form.resetFields();
     },
-    // 打开销售订单选择弹窗
     saleorderDialogOpen() {
       if (!this.form?.contractInfo?.id) {
         this.$message.warning('请先选择客户名称!');
@@ -1715,7 +1886,6 @@ 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);
@@ -1731,11 +1901,9 @@ 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);
@@ -1747,7 +1915,6 @@ export default {
       );
       this.$set(this.form, 'tableList', list);
     },
-    // 添加故障
     addFaults() {
       this.form.faultDetailList.push({
         maintenanceProcess: '',
@@ -1755,11 +1922,9 @@ export default {
         faultPhenomenon: ''
       });
     },
-    // 删除故障
     faultDel(index) {
       this.form.faultDetailList.splice(index, 1);
     },
-    // 关联类型选择回调
     selectType(e) {
       this.$set(this.form, 'tableList', []);
       this.$set(this.form, 'faultDetailList', []);
@@ -1769,30 +1934,11 @@ export default {
         this.isOrder = false;
       }
     },
-    // 派车类型选择回调
-    async selectpietype(e) {
-      if (e == '1' || e == '2') {
-        this.defaultTemplateList = await getBpmCustomFormList({ status: 1 });
-        this.carByTemplate = this.defaultTemplateList.find(
-          (item) => item?.code === 'carBy'
-        );
-        if (this.carByTemplate && this.carByTemplate.formJson?.makingJson) {
-          this.formSchema = JSON.parse(this.carByTemplate.formJson.makingJson);
-          this.formSchema.config.dataSource &&
-            this.formSchema.config.dataSource.forEach((item) => {
-              item.headers = {
-                Authorization: getToken()
-              };
-            });
-        } else {
-          this.formSchema = {};
-        }
-        this.processSubmitDialogFlag = true;
-      }
+    selectaftertype(e) {
+      console.log(e);
     },
-    // 流程表单提交回调
-    handleFormSubmit(data) {
-      this.carFormData = data;
+    async selectpietype(e) {
+      console.log(this.form.pietype);
     }
   }
 };
@@ -1809,4 +1955,15 @@ export default {
   margin-left: 16px;
   color: #e6a23c;
 }
+:deep(.el-row) {
+  display: flex;
+  flex-wrap: wrap; /* 确保列超出时换行,而非错位 */
+}
+:deep(.remark-input .el-textarea__inner) {
+  color: #f56c6c !important;
+}
+
+:deep(.remark-input .el-textarea.is-disabled .el-textarea__inner) {
+  color: #f56c6c !important;
+}
 </style>

+ 12 - 1
src/views/salesServiceManagement/components/processSubmitDialog/api.js

@@ -80,7 +80,18 @@ export async function getModel(id) {
   const res = await request({
     url: '/bpm/model/get?id=' + id,
     method: 'get'
-  })
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+export async function savePieCarMonad(data) {
+  const res = await request({
+    url: '/eom/afterSalesWorkOrder/savePieCarMonad',
+    method: 'post',
+    data
+  });
   if (res.data.code == 0) {
     return res.data.data;
   }

+ 156 - 126
src/views/salesServiceManagement/components/processSubmitDialog/processSubmitDialog.vue

@@ -19,6 +19,16 @@
           :remote="remoteFuncs"
           ref="generateForm"
           class="el-form-box"
+        >
+          <template v-slot:manage_workorder="scope">
+            <div class="manage_workorder">
+              <el-input
+                v-model="scope.model.manage_workorder.code"
+                style="width: 100%"
+                @click.native="addWorkOrder('manage_workorder')"
+                placeholder="点击选择关联工单"
+              ></el-input>
+            </div> </template
         ></fm-generate-form>
       </div>
 
@@ -150,7 +160,6 @@
             </el-table-column>
           </el-table>
 
-          <!-- 流程图展示 -->
           <my-process-viewer
             style="min-width: 100%; height: 200px"
             key="designer"
@@ -160,23 +169,27 @@
       </div>
     </div>
 
-    <!-- 底部:仅保留流程提交/关闭按钮 -->
     <div slot="footer">
       <el-button type="primary" size="small" @click="submit">提交</el-button>
       <el-button size="small" @click="cancel">关闭</el-button>
     </div>
+
+    <SHGDListDialog
+      ref="SHGDListDialogRef"
+      @changeParent="getSHGDData"
+    ></SHGDListDialog>
   </ele-modal>
 </template>
 
 <script>
-// 引入流程核心依赖
 import {
   getModelPage,
   getProcessDefinitionBpmnXML,
   getTaskAssignRuleList,
   listAllUserBind,
   listSimpleUserGroups,
-  getModel
+  getModel,
+  savePieCarMonad
 } from './api';
 import { treeClassifyCodeEnum } from '@/enum/dict';
 import { listRoles } from '@/api/system/role';
@@ -187,10 +200,14 @@ import { getProduceTreeByCode } from '@/api/main';
 import { topLevel1, topLevel2, topLevel3 } from '@/enum/dict';
 import { getToken } from '@/utils/token-util';
 import { mapGetters } from 'vuex';
+import SHGDListDialog from '@/views/salesServiceManagement/workOrder/components/drawer.vue';
 
 export default {
   name: 'processSubmitDialog',
   mixins: [dictMixins],
+  components: {
+    SHGDListDialog
+  },
   props: {
     processSubmitDialogFlag: {
       type: Boolean,
@@ -203,6 +220,10 @@ export default {
     carByTemplate: {
       type: Object,
       default: () => ({})
+    },
+    workOrderData: {
+      type: Object,
+      default: () => ({ id: '', code: '', name: '' })
     }
   },
   data() {
@@ -210,25 +231,25 @@ export default {
       title: '用车',
       isRight: false,
       remoteFuncs: {},
-
-      // 流程核心数据:key默认值设为TYCSLC
       form: {
-        LCFL: '', // 流程分类ID
-        FQLC: '', // 发起流程ID(流程模型ID)
-        processDefinitionId: '', // 流程定义ID
-        name: '', // 流程名称
-        key: 'TYCSLC', // 流程标识默认值
-        valueJson: {}, // 表单提交数据
-        processModelId: '' // 流程模型ID
+        LCFL: '',
+        FQLC: '',
+        processDefinitionId: '',
+        name: '',
+        key: 'TYCSLC',
+        valueJson: {
+          manage_workorder: {
+            code: '',
+            id: '',
+            name: ''
+          }
+        },
+        processModelId: ''
       },
-
-      // 流程基础选项列表
       LCFLList: [],
       processList: [],
       datasource: [],
       bpmnXML: null,
-
-      // 执行人解析依赖数据
       roleOptions: [],
       deptOptions: [],
       userOptions: [],
@@ -236,161 +257,137 @@ export default {
       dictList: {}
     };
   },
+  watch: {
+    processSubmitDialogFlag(newVal) {
+      if (newVal) {
+        this.initDefaultProcessByKey('TYCSLC');
+        if (this.workOrderData.id) {
+          this.form.valueJson.manage_workorder = {
+            id: this.workOrderData.id,
+            code: this.workOrderData.code,
+            name: this.workOrderData.name
+          };
+          if (this.$refs.generateForm) {
+            this.$refs.generateForm.setData({
+              manage_workorder: this.form.valueJson.manage_workorder
+            });
+          }
+        }
+      }
+    }
+  },
   computed: {
     ...mapGetters(['user'])
   },
   async created() {
-    // 1. 初始化基础数据(分类、角色、部门等)
     await this.initProcessBaseData();
-    // 2. 通过流程标识(TYCSLC)查询关联的流程模型,自动赋值相关字段
     await this.initDefaultProcessByKey('TYCSLC');
   },
   methods: {
-    /**
-     * 1. 初始化流程基础数据(分类、角色、部门、用户组)
-     */
+    getSHGDData(workOrder) {
+      if (!workOrder?.code) {
+        this.$message.warning('选中的工单缺少编码,请重新选择');
+        return;
+      }
+      this.$refs.generateForm.getData(false).then((currentFormData) => {
+        currentFormData.manage_workorder = {
+          code: workOrder.code,
+          id: workOrder.id || '',
+          name: workOrder.name || ''
+        };
+        this.$refs.generateForm.setData({
+          manage_workorder: currentFormData.manage_workorder
+        });
+        this.form.valueJson.manage_workorder = currentFormData.manage_workorder;
+      });
+    },
+    addWorkOrder() {
+      this.$refs.SHGDListDialogRef.open();
+    },
     async initProcessBaseData() {
-      // 加载流程分类列表
       const typeObj = await getProduceTreeByCode(
         treeClassifyCodeEnum['PROCESSTYPE']
       );
       this.LCFLList = typeObj[0]?.children || [];
-
-      // 加载角色、部门、用户、用户组(用于执行人解析)
       await this.initBaseOptions();
     },
-
-    /**
-     * 2. 初始化角色/部门/用户/用户组选项
-     */
     async initBaseOptions() {
-      // 角色列表
       const roleRes = await listRoles({ current: 1, size: 9999 });
       this.roleOptions = roleRes.list || [];
 
-      // 部门列表
       const deptRes = await listOrganizations();
       this.deptOptions = deptRes || [];
 
-      // 用户列表
       const userRes = await listAllUserBind();
       this.userOptions = userRes || [];
 
-      // 用户组列表
       const userGroupRes = await listSimpleUserGroups();
       this.userGroupOptions = userGroupRes || [];
 
-      // 加载流程相关字典
       await this.getDictList(this.dictEnum['工作流任务分配自定义脚本']);
       await this.getDictList(this.dictEnum['工种类型']);
     },
-
-    /**
-     * 3. 新增:通过流程标识(key)查询关联流程模型,自动赋值分类、名称等字段
-     * @param {string} targetKey - 目标流程标识(如TYCSLC)
-     */
     async initDefaultProcessByKey(targetKey) {
       try {
-        // 调用接口:按流程标识筛选流程模型(只查1条匹配数据)
         const { list } = await getModelPage({
           pageNo: 1,
           pageSize: 1,
-          key: targetKey // 核心筛选条件:流程标识
+          key: targetKey
         });
-
         if (list.length === 0) {
-          this.$message.warning(`未找到标识为【${targetKey}】的流程模型,请检查配置`);
+          this.$message.warning(
+            `未找到标识为【${targetKey}】的流程模型,请检查配置`
+          );
           return;
         }
-
-        // 获取匹配的流程模型
         const defaultModel = list[0];
-        // 自动赋值核心字段
-        this.form.LCFL = defaultModel.category; // 流程分类(模型的分类ID)
-        this.form.FQLC = defaultModel.id; // 发起流程(模型ID)
-        this.form.name = defaultModel.name; // 流程名称(模型名称)
-        this.form.processModelId = defaultModel.id; // 保存模型ID
-
-        // 加载该分类下的流程列表(让“发起流程”下拉框显示可选项)
+        this.form.LCFL = defaultModel.category;
+        this.form.FQLC = defaultModel.id;
+        this.form.name = defaultModel.name;
+        this.form.processModelId = defaultModel.id;
         await this.getProcessList(defaultModel.category);
-        // 加载流程图和执行人列表(让默认流程显示完整信息)
         await this.changeFQLC(defaultModel.id);
       } catch (error) {
-        console.error('通过流程标识初始化默认流程失败:', error);
+        console.error(error);
         this.$message.error('默认流程加载失败,请手动选择流程');
       }
     },
-
-    /**
-     * 4. 切换流程分类:加载对应流程列表(修复清空key和name的问题)
-     */
     async changeLCFL(val) {
       this.bpmnXML = null;
       this.form.processDefinitionId = '';
       this.form.FQLC = '';
-      // 保留流程标识和名称,不清空
-      // this.form.name = ''; 
-      // this.form.key = '';
-
-      // 加载当前分类下的流程列表
       await this.getProcessList(val);
     },
-
-    /**
-     * 5. 获取指定分类下的流程列表
-     */
     async getProcessList(processTypeId) {
       const { list } = await getModelPage({
         pageNo: 1,
         pageSize: 999,
         processTypeId
       });
-      // 过滤出有流程定义的有效流程
       this.processList = list.filter((item) => item.processDefinition);
     },
-
-    /**
-     * 6. 切换发起流程:加载流程图和执行人列表
-     */
     async changeFQLC(val) {
       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 || {};
-
-      // 更新流程信息(选中流程时覆盖名称和标识)
       this.form.name = selectedProcess.name || this.title;
-      this.form.key = selectedProcess.key || 'TYCSLC'; // 无key时 fallback 到默认值
+      this.form.key = selectedProcess.key || 'TYCSLC';
       this.form.processDefinitionId = processDef.id || '';
       this.form.processModelId = val;
-
-      // 加载流程图
       await this.getProcessDefinitionBpmnXMLInfo(val);
-      // 加载执行人列表
       await this.getTaskAssignRuleListInfo({
         modelId: val,
         processDefinitionId: processDef.id
       });
     },
-
-    /**
-     * 7. 加载流程图XML数据
-     */
     async getProcessDefinitionBpmnXMLInfo(modelId) {
       const res = await getModel(modelId);
       this.bpmnXML = res.bpmnXml;
     },
-
-    /**
-     * 8. 加载流程执行人列表
-     */
     async getTaskAssignRuleListInfo(params) {
       this.datasource = await getTaskAssignRuleList(params);
     },
-
-    /**
-     * 9. 解析执行人显示名称
-     */
     getAssignRuleOptionName(row, option) {
       if (row.type === 10) {
         const role = this.roleOptions.find((item) => item.id === option);
@@ -399,7 +396,10 @@ export default {
         const dept = this.deptOptions.find((item) => item.id === option);
         return dept?.name || `未知部门(${option})`;
       } else if (row.type === 22) {
-        return this.getDictV(this.dictEnum['工种类型'], option + '') || `未知工种(${option})`;
+        return (
+          this.getDictV(this.dictEnum['工种类型'], option + '') ||
+          `未知工种(${option})`
+        );
       } else if (row.type === 30 || row.type === 31 || row.type === 32) {
         const user = this.userOptions.find((item) => item.id === option);
         return user?.nickname || user?.name || `未知用户(${option})`;
@@ -407,31 +407,36 @@ export default {
         const group = this.userGroupOptions.find((item) => item.id === option);
         return group?.name || `未知用户组(${option})`;
       } else if (row.type === 50) {
-        return this.getDictV(this.dictEnum['工作流任务分配自定义脚本'], option + '') || `未知脚本(${option})`;
+        return (
+          this.getDictV(
+            this.dictEnum['工作流任务分配自定义脚本'],
+            option + ''
+          ) || `未知脚本(${option})`
+        );
       } else if (row.type === 60) {
         return row.variableName || '变量执行人';
       } 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 || '无'})`;
     },
-
-    /**
-     * 10. 获取字典标签
-     */
     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 || ''
+      );
     },
-
-    /**
-     * 11. 加载字典列表
-     */
     async getDictList(dictCode) {
       const { data: res } = await getByCode(dictCode);
       this.dictList[dictCode] = res.map((item) => {
@@ -439,54 +444,79 @@ export default {
         return { value: keys[0], label: item[keys[0]] };
       });
     },
-
-    /**
-     * 12. 表单验证
-     */
     generateFormValid(validate = true) {
       return this.$refs.generateForm.getData(validate).then((data) => data);
     },
-
-    /**
-     * 13. 提交流程
-     */
+    // async submit() {
+    //   try {
+    //     this.form.valueJson = await this.generateFormValid();
+    //     const submitData = {
+    //       ...this.form,
+    //       ...this.carByTemplate,
+    //       processType: '1',
+    //       variables: { ...this.form.valueJson }
+    //     };
+    //     console.log(submitData.formJson.makingJson)
+    //     this.$emit('formSubmit', submitData);
+    //     await savePieCarMonad(submitData);
+    //     this.cancel();
+    //   } catch (error) {
+    //     console.error(error);
+    //     this.$message.warning('表单验证失败,请检查填写内容');
+    //   }
+    // },
     async submit() {
       try {
-        this.form.valueJson = await this.generateFormValid();
+        const formValue = await this.generateFormValid();
+        this.form.valueJson = formValue;
 
+        const workOrderId = this.form.valueJson.manage_workorder.id;
+        if (!workOrderId) {
+          this.$message.warning('请先选择关联工单');
+          return;
+        }
         const submitData = {
           ...this.form,
           ...this.carByTemplate,
           processType: '1',
           variables: { ...this.form.valueJson }
         };
+        const submitParams = {
+          id: workOrderId,
+          formJson: submitData
+        };
+
+        this.loading = true;
+        await savePieCarMonad(submitParams);
+        this.$message.success('提交成功');
 
-        this.$emit('formSubmit', submitData);
         this.cancel();
       } catch (error) {
-        console.error('表单验证失败:', error);
-        this.$message.warning('表单验证失败,请检查填写内容');
+        console.error('提交失败:', error);
+        this.$message.error('提交失败,请重试');
+      } finally {
+        this.loading = false;
       }
     },
-
-    /**
-     * 14. 关闭弹窗:重置数据(保留key默认值)
-     */
     cancel() {
       this.$emit('update:processSubmitDialogFlag', false);
       this.isRight = false;
       this.bpmnXML = null;
       this.datasource = [];
-      // 重置时保留流程标识默认值TYCSLC
       this.form = {
-        LCFL: '',
+        ...this.form,
         FQLC: '',
         processDefinitionId: '',
         name: '',
-        key: 'TYCSLC', // 保留默认值
-        valueJson: {},
-        processModelId: ''
+        processModelId: '',
+        valueJson: {
+          ...this.form.valueJson,
+          manage_workorder: { code: '', id: '', name: '' }
+        }
       };
+      if (this.$refs.generateForm) this.$refs.generateForm.reset();
+      if (this.$refs.processForm) this.$refs.processForm.resetFields();
+      this.remoteFuncs = {};
     }
   }
 };

+ 13 - 12
src/views/salesServiceManagement/cost/component/costDialog.vue

@@ -55,7 +55,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="8">
+        <!-- <el-col :span="8">
           <el-form-item
             label="费用类别:"
             prop="feeType"
@@ -78,10 +78,8 @@
               />
             </el-select>
           </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row>
-        <el-col :span="8">
+        </el-col> -->
+         <el-col :span="8">
           <el-form-item label="原因">
             <el-input
               v-model="form.remarks"
@@ -92,6 +90,9 @@
           </el-form-item>
         </el-col>
       </el-row>
+      <!-- <el-row>
+       
+      </el-row> -->
       <spareParts
         obtain="仓库"
         ref="sparePartsRef"
@@ -152,7 +153,7 @@ export default {
       form: {
         remarks: '',
         workOrderName: '',
-        feeType: ''
+        // feeType: ''
       },
       source: 0,
       activeComp: 'main',
@@ -161,10 +162,10 @@ export default {
         { key: 'main', name: '费用详情' },
         { key: 'bpm', name: '流程详情' }
       ],
-      costTypeOptions: [
-        { label: '收入', value: '1' },
-        { label: '支出', value: '2' }
-      ]
+      // costTypeOptions: [
+      //   { label: '收入', value: '1' },
+      //   { label: '支出', value: '2' }
+      // ]
     };
   },
   methods: {
@@ -185,7 +186,7 @@ export default {
       this.form.workOrderCode = res.workOrderCode;
       this.form.workOrderId = res.workOrderId;
       this.$set(this.form, 'remarks', res.remarks);
-  this.$set(this.form, 'feeType', res.feeType?.toString() || ''); 
+  // this.$set(this.form, 'feeType', res.feeType?.toString() || ''); 
       this.form.id = data.id;
       this.source = res.source || 0;
       this.$set(this.form, 'code', res.code);
@@ -195,7 +196,7 @@ export default {
       this.form = {
         remarks: '',
         workOrderName: '',
-        feeType:''
+        // feeType:''
       };
       this.$refs.recyleFormRef.resetFields();
       this.$refs.sparePartsRef.setTableValue([]);

+ 5 - 1
src/views/salesServiceManagement/cost/component/search.vue

@@ -34,10 +34,14 @@
             value: 'contactName',
             type: 'input',
             placeholder: ''
+          }, {
+            label: '售后需求编码:',
+            value: 'demandCode',
+            type: 'input',
+            placeholder: ''
           },
           {
             label: '流程状态:',
-            width: 380,
             value: 'approvalStatus',
             type: 'select',
             planList: this.approvalList,

+ 24 - 12
src/views/salesServiceManagement/cost/index.vue

@@ -176,6 +176,12 @@ export default {
           align: 'center',
           showOverflowTooltip: true
         },
+        {
+          prop: 'demandCode',
+          label: '售后需求编码',
+          align: 'center',
+          showOverflowTooltip: true
+        },
         {
           prop: 'createTime',
           label: '创建时间',
@@ -195,20 +201,26 @@ export default {
           showOverflowTooltip: true
         },
         {
-          prop: 'feeType',
-          label: '费用类别',
+          prop: 'totalPrice',
+          label: '费用',
           align: 'center',
-          showOverflowTooltip: true,
-          formatter: (item) => {
-            let obj = this.costTypeOptions.find(
-              (el) => el.value == item.feeType
-            );
-            if (obj) {
-              return obj.label;
-            }
-            return '';
-          }
+          showOverflowTooltip: true
         },
+        // {
+        //   prop: 'feeType',
+        //   label: '费用类别',
+        //   align: 'center',
+        //   showOverflowTooltip: true,
+        //   formatter: (item) => {
+        //     let obj = this.costTypeOptions.find(
+        //       (el) => el.value == item.feeType
+        //     );
+        //     if (obj) {
+        //       return obj.label;
+        //     }
+        //     return '';
+        //   }
+        // },
         {
           prop: 'approvalStatus',
           label: '流程状态',

+ 125 - 59
src/views/salesServiceManagement/demandList/components/addDialog.vue

@@ -11,8 +11,15 @@
     @close="handleClose"
   >
     <info ref="infoRef" :demandList="demandList" :type="type"></info>
-    <SubmitDialog ref="submitRef" @savExit="savExit" />
+    <!-- <SubmitDialog ref="submitRef" @savExit="savExit" /> -->
     <dispatchDialog ref="dispatchRef" @savExit="savExit" />
+    <process-submit-dialog
+      :isNotNeedProcess="false"
+      :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      v-if="processSubmitDialogFlag"
+      ref="processSubmitDialogRef"
+      @reload="savExit"
+    ></process-submit-dialog>
     <div slot="footer" class="footer">
       <el-button
         type="primary"
@@ -32,7 +39,7 @@
         type="primary"
         :loading="loading"
         @click="dispatch"
-        v-if="type != 'view'"
+        v-if="type != 'view' && !isAftertypeThree"
         >派单</el-button
       >
       <el-button @click="handleClose" :loading="loading">返回</el-button>
@@ -49,21 +56,39 @@ import dispatchDialog from './dispatchDialog.vue';
 import {
   saveSalesDemand,
   updateSalesDemand,
-  getSalesDemandById
+  getSalesDemandById,
+  demandSubmit,
+  salesrealcostinfo
 } from '@/api/salesServiceManagement/index';
 
 import info from '@/views/salesServiceManagement/components/info.vue';
 import { getByCode } from '@/api/system/dictionary-data';
+import { getCurrentUser } from '@/utils/token-util';
+import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
 
 export default {
   components: {
     modalTitle,
     customerDialog,
     info,
-    SubmitDialog,
-    dispatchDialog
+    // SubmitDialog,
+    dispatchDialog,
+
+    processSubmitDialog
+  },
+  watch: {
+    // 监听对话框打开状态,当打开时开始监听子组件数据
+    addRepairNotesDialog: {
+      handler(newVal) {
+        if (newVal) {
+          this.$nextTick(() => {
+            this.startWatchingAftertype();
+          });
+        }
+      },
+      immediate: true
+    }
   },
-  watch: {},
   computed: {
     ...mapGetters(['getDictValue'])
   },
@@ -74,13 +99,43 @@ export default {
       type: 'add',
       form: {},
       demandList: [],
-      loading: false
+      loading: false,
+      isAftertypeThree: false,
+      watchInterval: null,
+
+      processSubmitDialogFlag: false
     };
   },
   created() {
     this.getLevelCode('requirement_name');
   },
+  beforeDestroy() {
+    // 组件销毁前清除定时器
+    this.stopWatchingAftertype();
+  },
   methods: {
+    // 开始监听 aftertype 变化
+    startWatchingAftertype() {
+      this.stopWatchingAftertype(); // 先清除之前的监听
+
+      this.watchInterval = setInterval(() => {
+        if (this.$refs.infoRef && this.$refs.infoRef.form) {
+          const currentAftertype = this.$refs.infoRef.form.aftertype;
+          if (currentAftertype !== undefined) {
+            this.isAftertypeThree = currentAftertype === '3';
+          }
+        }
+      }, 100); // 每100ms检查一次
+    },
+
+    // 停止监听
+    stopWatchingAftertype() {
+      if (this.watchInterval) {
+        clearInterval(this.watchInterval);
+        this.watchInterval = null;
+      }
+    },
+
     async getLevelCode(code) {
       console.log(code);
       try {
@@ -106,16 +161,51 @@ export default {
       this.title = type == 'add' ? '新增' : type == 'view' ? '详情' : '修改';
       if (row?.id) {
         this.getDetail(row.id);
-      } else {
       }
     },
 
     async submit() {
-      let pData = await this.handleParameter();
-      if (!pData) {
-        return;
+      try {
+        this.loading = true;
+        const pData = await this.handleParameter();
+        if (!pData) return;
+
+        const submitParams = {
+          ...pData,
+          submitSource: this.type === 'add' ? 1 : 2
+        };
+
+        const res = await demandSubmit(submitParams);
+        if (!res) return; 
+
+        const businessId = res; 
+        console.log(businessId)
+        if (!businessId) {
+          console.log("未获取到id")
+          return;
+        }
+
+        const currentAftertype =
+          this.$refs.infoRef?.form?.aftertype || this.form.aftertype;
+        if (currentAftertype === '3') {
+          const processParams = {
+            businessId: businessId, 
+            businessKey: 'after_sale_fee_payable',
+            formCreateUserId: getCurrentUser().id
+          };
+          // 打开流程弹窗并初始化
+          this.processSubmitDialogFlag = true;
+          this.$nextTick(() => {
+            this.$refs.processSubmitDialogRef.init(processParams);
+          });
+        } else {
+          this.$message.success('提交成功!');
+          this.savExit();
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
       }
-      this.$refs.submitRef.open(pData, this.type);
     },
     async dispatch() {
       let pData = await this.handleParameter();
@@ -129,6 +219,10 @@ export default {
       const res = await getSalesDemandById(id);
       this.$nextTick(() => {
         this.$refs.infoRef.init(res);
+        // 详情加载后立即检查 aftertype
+        if (this.$refs.infoRef && this.$refs.infoRef.form) {
+          this.isAftertypeThree = this.$refs.infoRef.form.aftertype === '3';
+        }
       });
       this.form = res;
     },
@@ -137,7 +231,11 @@ export default {
     handleClose() {
       this.addRepairNotesDialog = false;
       this.form = {};
-      this.$refs.infoRef.catch();
+      this.isAftertypeThree = false;
+      this.stopWatchingAftertype();
+      if (this.$refs.infoRef) {
+        this.$refs.infoRef.catch();
+      }
     },
     // 时间格式化
     formatDate(dateString) {
@@ -155,23 +253,24 @@ export default {
         const day = String(date.getDate()).padStart(2, '0');
         return `${year}-${month}-${day}`;
       } catch (error) {
-        return dateString; // 转换失败时返回原始字符串
+        return dateString;
       }
     },
     // 提取公共参数
     async handleParameter() {
       let data = this.$refs.infoRef.getValue();
+      console.log('提交前的data:', data.salespersonId, data.salespersonName);
       let sparePartsData = (this.$refs.infoRef.getSpareInfoData() || []).map(
         (item) => ({
           ...item,
           typeId: item.typeId,
           code: item.code,
           name: item.name,
-          feeType: item.feeType, //费用类别
-          modelType: item.categoryModel, //型号
-          specification: item.specification, //规格
-          content: item.content, //详情内容
-          totalCount: item.totalCount, //数量
+          feeType: item.feeType,
+          modelType: item.categoryModel,
+          specification: item.specification,
+          content: item.content,
+          totalCount: item.totalCount,
           measureUnit: item.measureUnit,
           singlePrice: item.singlePrice,
           settlementPrice: item.settlementPrice
@@ -182,10 +281,6 @@ export default {
         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
@@ -215,15 +310,18 @@ export default {
           pieCarType: data.pietype,
           isWithAccessories: data.part,
           costListVOS: sparePartsData,
-          formJson: this.$refs.infoRef.carFormData,
-
+          salespersonId: data.salespersonId,
+          salespersonName: data.salespersonName,
+          involveDeptId: data.involveDeptId,
+          involveDeptName: data.involveDeptName,
+          remark: data.remark,
           isOutsource: data.isOutsource,
           isCreatePurchaseOrder: data.isCreatePurchaseOrder,
           supplierId: data.supplierId,
           supplierName: data.supplierName,
           supplierCode: data.supplierCode
         };
-        // 如果选的销售订单并且 没有售后对象数据
+        console.log(pData);
         if (pData.associationType == '2' && pData.productDetail.length == 0) {
           delete pData.productDetail;
           pData.faultDetailList = data.faultDetailList;
@@ -263,36 +361,4 @@ export default {
     }
   }
 };
-</script>
-
-<style lang="scss" scoped>
-.dialog_top {
-  margin-bottom: 10px;
-  display: flex;
-  align-items: center;
-
-  span {
-    margin-left: 50px;
-  }
-
-  .name {
-    font-weight: 800;
-    color: #40a9ff;
-  }
-}
-
-::v-deep .el-row {
-  display: flex;
-  flex-wrap: wrap;
-}
-
-.btns {
-  text-align: right;
-}
-
-.main_container {
-  width: 100%;
-  display: flex;
-  justify-content: space-between;
-}
-</style>
+</script>

+ 35 - 2
src/views/salesServiceManagement/demandList/index.vue

@@ -254,7 +254,7 @@ export default {
           label: '客户名称',
           align: 'center',
           showOverflowTooltip: true
-        },
+        }, 
         {
           slot: 'faultLevel',
           prop: 'faultLevel',
@@ -265,6 +265,16 @@ export default {
             return this.levelData[row.faultLevel] || '';
           }
         },
+        {
+          slot: 'afterSalesType',
+          prop: 'afterSalesType',
+          label: '售后类型',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter: (row) => {
+    return this.afterSalesTypeMap[row.afterSalesType] || row.afterSalesType;
+  }
+        },
         {
           prop: 'createUserName',
           label: '创建人',
@@ -361,7 +371,10 @@ export default {
         faultDetailList: [],
         associationType: '1'
       },
-      kkform: {}
+      kkform: {},
+      
+    afterSalesTypeMap: {}, 
+    afterSalesTypeList: [] 
     };
   },
   computed: {
@@ -382,8 +395,28 @@ export default {
     this.requestDict('报修来源');
     this.requestDict('报修状态');
     this.getLevelCode('fault_level');
+  this.getAfterSalesTypeDict();
   },
   methods: {
+    async getAfterSalesTypeDict() {
+    try {
+      const res = await getByCode('after_sales_type');
+      if (res?.code === '0') {
+        const typeMap = {};
+        const typeList = [];
+        res.data.forEach(el => {
+          const value = Object.keys(el)[0];
+          const label = Object.values(el)[0];
+          typeMap[value] = label;
+          typeList.push({ value, label });
+        });
+        this.afterSalesTypeMap = typeMap;
+        this.afterSalesTypeList = typeList;
+      }
+    } catch (err) {
+      this.$message.error(`获取售后类型字典失败:${err.message}`);
+    }
+  },
     /* 表格数据源 */
     datasource({ page, limit, where, order }) {
       return getPageSalesDemand({ pageNum: page, size: limit, ...where });

+ 11 - 4
src/views/salesServiceManagement/evaluate/components/search.vue

@@ -25,7 +25,7 @@ export default {
           value: 'keyWord',
           type: 'input',
           placeholder: '编码/工单编码/客户名称/客户编码',
-          class:'123'
+          class: '123'
         },
         {
           label: '编码:',
@@ -46,6 +46,13 @@ export default {
           type: 'input',
           placeholder: ''
         },
+        {
+          label: '售后需求编码:',
+          value: 'demandCode',
+          width: 380,
+          type: 'input',
+          placeholder: ''
+        },
         {
           label: '客户编码:',
           value: 'contactCode',
@@ -57,7 +64,7 @@ export default {
           label: '服务态度评分:',
           value: 'attitudeRating',
           width: 370,
-          labelWidth:'130',
+          labelWidth: '130',
           type: 'select',
           planList: this.serviceList,
           placeholder: '请选择'
@@ -66,7 +73,7 @@ export default {
           label: '响应速度评分:',
           value: 'responseSpeed',
           width: 370,
-          labelWidth:'130',
+          labelWidth: '130',
           type: 'select',
           planList: this.serviceList,
           placeholder: '请选择'
@@ -87,7 +94,7 @@ export default {
           placeholder: '',
           width: 380,
           valueAr: ['endTime', 'endTime']
-        },
+        }
       ];
     }
   },

+ 6 - 0
src/views/salesServiceManagement/evaluate/index.vue

@@ -89,6 +89,12 @@
             label: '客户编码',
             align: 'center',
             showOverflowTooltip: true
+          },{
+            
+          prop: 'demandCode',
+          label: '售后需求编码',
+          align: 'center',
+          showOverflowTooltip: true
           },
           {
             prop: 'attitudeRating',

+ 7 - 0
src/views/salesServiceManagement/recycle/component/search.vue

@@ -35,6 +35,13 @@
             type: 'input',
             placeholder: ''
           },
+          {
+            label: '售后需求编码:',
+            value: 'demandCode',
+            type: 'input',
+            placeholder: '',
+            width: 380,
+          },
           {
             label: '回收人',
             value: 'recycleName',

+ 6 - 0
src/views/salesServiceManagement/recycle/index.vue

@@ -103,6 +103,12 @@
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'demandCode',
+            label: '售后需求编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
           {
             prop: 'categoryName',
             label: '物品名称',

+ 63 - 1
src/views/salesServiceManagement/workOrder/index.vue

@@ -84,6 +84,18 @@
             @click="handleCommand('handleReceive', row)"
             >接收</el-link
           >
+
+          <el-link
+            type="primary"
+            v-if="
+              (row.pieCarType == 1 || row.pieCarType == 2) &&
+              $hasPermission('eom:aftersalesworkorder:vehicle')
+            "
+            :underline="false"
+            @click="handlevehicle(row)"
+            >用车申请</el-link
+          >
+
           <el-link
             type="primary"
             v-if="
@@ -198,6 +210,14 @@
       :businessCode="currentBusinessCode"
       :role-name="roleName"
     ></jimureportBrowse>
+    <process-submit-dialog
+      :process-submit-dialog-flag="processSubmitDialogFlag"
+      :form-schema="formSchema"
+      :carByTemplate="carByTemplate"
+      :work-order-data="currentVehicleWorkOrder"
+      @update:processSubmitDialogFlag="(val) => (processSubmitDialogFlag = val)"
+      @formSubmit="handleFormSubmit"
+    ></process-submit-dialog>
   </div>
 </template>
 
@@ -211,6 +231,9 @@ import redeployOther from './components/redeployOther2.vue';
 import addDialog from '@/views/salesServiceManagement/evaluate/components/addDialog.vue';
 import { enterprisePage } from '@/api/contractManage/contractBook';
 import jimureportBrowse from '@/components/jimureport/browseModal.vue';
+import processSubmitDialog from '@/views/salesServiceManagement/components/processSubmitDialog/processSubmitDialog.vue';
+import { getBpmCustomFormList } from '@/api/saleManage/contact';
+import { getToken } from '@/utils/token-util';
 
 import {
   getSalesWorkOrder,
@@ -233,7 +256,9 @@ export default {
     declarationDialog,
     redeployOther,
     addDialog,
-    jimureportBrowse
+    jimureportBrowse,
+
+    processSubmitDialog
     // fileMain
   },
   data() {
@@ -247,6 +272,13 @@ export default {
       roleName: '',
       currentBusinessCode: '',
       contactInfoVOS: [],
+
+      currentVehicleWorkOrder: {},
+      defaultTemplateList: [], // 模板列表
+      carByTemplate: {}, // 用车相关模板
+      processSubmitDialogFlag: false, // 弹窗显示/隐藏标识
+      formSchema: {}, // 弹窗表单配置
+      carFormData: {}, // 弹窗提交的表单数据
       workOrderStatus: [
         // { code: 0, label: '待接收' },
         { code: 0, label: '待执行' },
@@ -622,6 +654,36 @@ export default {
     goDetail(row) {
       this.$refs.declarationDialogRef.open(row, 'view');
     },
+    async handlevehicle(row) {
+      this.currentVehicleWorkOrder = {
+        id: row.id, // 列表工单ID
+        code: row.code, // 列表工单编号(要显示的code)
+        name: row.planName // 列表工单名称(可选,根据弹窗需求传递)
+      };
+
+      const e = row.pieCarType;
+      if (e == '1' || e == '2') {
+        this.defaultTemplateList = await getBpmCustomFormList({ status: 1 });
+        this.carByTemplate = this.defaultTemplateList.find(
+          (item) => item?.code === 'carBy'
+        );
+        console.log(this.carByTemplate)
+        if (this.carByTemplate && this.carByTemplate.formJson?.makingJson) {
+          this.formSchema = JSON.parse(this.carByTemplate.formJson.makingJson);
+          this.formSchema.config.dataSource &&
+            this.formSchema.config.dataSource.forEach((item) => {
+              item.headers = { Authorization: getToken() };
+            });
+        } else {
+          this.formSchema = {};
+        }
+        this.processSubmitDialogFlag = true; // 打开弹窗
+      }
+    },
+    handleFormSubmit(data) {
+      this.carFormData = data;
+      console.log(this.carFormData);
+    },
     async handleCommand(command, row) {
       let flag = await this.permission(row, command);
       if (!flag) return;