Jelajahi Sumber

fix(demandList): 优化提交按钮显示逻辑,新增subBtnShow方法处理售后类型为3时的特殊条件

yusheng 7 bulan lalu
induk
melakukan
33cce73982
1 mengubah file dengan 514 tambahan dan 497 penghapusan
  1. 514 497
      src/views/salesServiceManagement/demandList/index.vue

+ 514 - 497
src/views/salesServiceManagement/demandList/index.vue

@@ -61,7 +61,9 @@
             type="primary"
             :underline="false"
             @click="handleCommand('handleAudit', row)"
-            v-if="btnShow(row) && $hasPermission('eom:aftersalesdemand:submit')"
+            v-if="
+              subBtnShow(row) && $hasPermission('eom:aftersalesdemand:submit')
+            "
             >提交</el-link
           >
           <el-popconfirm
@@ -92,10 +94,10 @@
       :dialogTitle="addDialogTitle"
       @refresh="reload"
     />
-    
+
     <SubmitDialog ref="submitRef" @savExit="reload" />
     <dispatchDialog ref="dispatchRef" @savExit="reload" />
-    
+
     <!-- 流程提交对话框 -->
     <process-submit-dialog
       :isNotNeedProcess="false"
@@ -109,536 +111,551 @@
 </template>
 
 <script>
-const workOrderStatus = [
-  { code: 0, label: '待执行' },
-  { code: 1, label: '已接收' },
-  { code: 2, label: '执行中' },
-  { code: 3, label: '待验收' },
-  { code: 4, label: '待评价' },
-  { code: 5, label: '已完成' },
-  { code: 6, label: '验收不通过' }
-];
-import {
-  getPageSalesDemand,
-  deleteSalesDemand,
-  auditSalesDemand,
-  revokeSalesDemand,
-  closeDemand,
-  getSalesDemandById,
-  demandSubmit
-} from '@/api/salesServiceManagement/index.js';
-import search from './components/searchTable.vue';
-import AddDialog from './components/addDialog.vue';
-import { getByCode } from '@/api/system/dictionary-data';
-import dictMixins from '@/mixins/dictMixins';
-import SubmitDialog from './components/submitDialog.vue';
-import dispatchDialog from './components/dispatchDialog.vue';
-import { contactDetail } from '@/api/saleManage/contact';
-import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
-import { getCurrentUser } from '@/utils/token-util';
+  const workOrderStatus = [
+    { code: 0, label: '待执行' },
+    { code: 1, label: '已接收' },
+    { code: 2, label: '执行中' },
+    { code: 3, label: '待验收' },
+    { code: 4, label: '待评价' },
+    { code: 5, label: '已完成' },
+    { code: 6, label: '验收不通过' }
+  ];
+  import {
+    getPageSalesDemand,
+    deleteSalesDemand,
+    auditSalesDemand,
+    revokeSalesDemand,
+    closeDemand,
+    getSalesDemandById,
+    demandSubmit
+  } from '@/api/salesServiceManagement/index.js';
+  import search from './components/searchTable.vue';
+  import AddDialog from './components/addDialog.vue';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import dictMixins from '@/mixins/dictMixins';
+  import SubmitDialog from './components/submitDialog.vue';
+  import dispatchDialog from './components/dispatchDialog.vue';
+  import { contactDetail } from '@/api/saleManage/contact';
+  import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+  import { getCurrentUser } from '@/utils/token-util';
+  import { reviewStatus } from '@/enum/dict';
 
-export default {
-  mixins: [dictMixins],
-  components: {
-    search,
-    AddDialog,
-    SubmitDialog,
-    dispatchDialog,
-    processSubmitDialog
-  },
-  data() {
-    return {
-      // 表格列配置
-      columns: [
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          slot: 'code',
-          prop: 'code',
-          label: '编码',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'name',
-          label: '需求名称',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 150
-        },
-        {
-          prop: 'contactCode',
-          label: '客户编码',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'contactName',
-          label: '客户名称',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          slot: 'faultLevel',
-          prop: 'faultLevel',
-          label: '故障等级',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (row) => {
-            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: '创建人',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (_row, _column, cellValue) => {
-            return this.$util.toDateString(cellValue);
+  export default {
+    mixins: [dictMixins],
+    components: {
+      search,
+      AddDialog,
+      SubmitDialog,
+      dispatchDialog,
+      processSubmitDialog
+    },
+    data() {
+      return {
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            slot: 'code',
+            prop: 'code',
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'name',
+            label: '需求名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150
+          },
+          {
+            prop: 'contactCode',
+            label: '客户编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'contactName',
+            label: '客户名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            slot: 'faultLevel',
+            prop: 'faultLevel',
+            label: '故障等级',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              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: '创建人',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (_row, _column, cellValue) => {
+              return this.$util.toDateString(cellValue);
+            }
+          },
+          {
+            prop: 'demandStatus',
+            label: '需求状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (_row, _column, cellValue) => {
+              if (_row.afterSalesType == 3) {
+                return reviewStatus[_row.approvalResult];
+              } else {
+                return cellValue == 0
+                  ? '待提交'
+                  : cellValue == 1
+                  ? '已提交'
+                  : cellValue == 2
+                  ? '已关闭'
+                  : cellValue == 3
+                  ? '已完成'
+                  : '';
+              }
+            }
+          },
+          {
+            prop: 'planStatus',
+            label: '计划状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (item) => {
+              return {
+                0: '待派单',
+                1: '已派单',
+                2: '执行中',
+                3: '已完成',
+                4: '已撤回',
+                5: '已驳回'
+              }[item.planStatus];
+            }
+          },
+          {
+            prop: 'orderStatus',
+            label: '工单状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              return workOrderStatus.find(
+                (item) => item.code == row.orderStatus
+              )?.label;
+            }
+          },
+          {
+            columnKey: 'action',
+            slot: 'action',
+            label: '操作',
+            align: 'center',
+            width: 230,
+            resizable: false,
+            showOverflowTooltip: true
           }
+        ],
+        // 加载状态
+        loading: false,
+        infoData: {},
+        repairInfoLogs: [],
+        addDialogTitle: '新建售后需求',
+        rowData: {},
+        formData: {
+          approvalResult: null,
+          rejectCause: '',
+          approvalUserId: '',
+          approvalUserName: ''
         },
-        {
-          prop: 'demandStatus',
-          label: '需求状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (_row, _column, cellValue) => {
-            return cellValue == 0
-              ? '待提交'
-              : cellValue == 1
-              ? '已提交'
-              : cellValue == 2
-              ? '已关闭'
-              : cellValue == 3
-              ? '已完成'
-              : '';
-          }
+        approvalResultOptions: [
+          { label: '驳回', value: 0 },
+          { label: '同意', value: 1 }
+        ],
+        levelData: {},
+        levelList: [],
+        contractInfo: {},
+        dispatchForm: {
+          contractInfo: {},
+          tableList: [],
+          contactInfoVOS: [],
+          faultDetailList: [],
+          associationType: '1'
         },
-        {
-          prop: 'planStatus',
-          label: '计划状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (item) => {
-            return {
-              0: '待派单',
-              1: '已派单',
-              2: '执行中',
-              3: '已完成',
-              4: '已撤回',
-              5: '已驳回'
-            }[item.planStatus];
+        kkform: {},
+        afterSalesTypeMap: {},
+        afterSalesTypeList: [],
+        // 流程对话框相关
+        processSubmitDialogFlag: false,
+        processedData: null,
+        currentRow: null
+      };
+    },
+    computed: {
+      btnShow() {
+        return (row) => {
+          return row.demandStatus == 0;
+        };
+      },
+      subBtnShow() {
+        return (row) => {
+          if (row.afterSalesType == 3) {
+            return row.approvalResult == 0||row.approvalResult == 3
+          } else {
+            return row.demandStatus == 0;
           }
-        },
-        {
-          prop: 'orderStatus',
-          label: '工单状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (row) => {
-            return workOrderStatus.find((item) => item.code == row.orderStatus)
-              ?.label;
+        };
+      },
+      dispatchShow() {
+        return (row) => {
+          return !row.planStatus && row.afterSalesType !== 3;
+        };
+      }
+    },
+    created() {
+      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;
           }
-        },
-        {
-          columnKey: 'action',
-          slot: 'action',
-          label: '操作',
-          align: 'center',
-          width: 230,
-          resizable: false,
-          showOverflowTooltip: true
+        } catch (err) {
+          this.$message.error(`获取售后类型字典失败:${err.message}`);
         }
-      ],
-      // 加载状态
-      loading: false,
-      infoData: {},
-      repairInfoLogs: [],
-      addDialogTitle: '新建售后需求',
-      rowData: {},
-      formData: {
-        approvalResult: null,
-        rejectCause: '',
-        approvalUserId: '',
-        approvalUserName: ''
       },
-      approvalResultOptions: [
-        { label: '驳回', value: 0 },
-        { label: '同意', value: 1 }
-      ],
-      levelData: {},
-      levelList: [],
-      contractInfo: {},
-      dispatchForm: {
-        contractInfo: {},
-        tableList: [],
-        contactInfoVOS: [],
-        faultDetailList: [],
-        associationType: '1'
+      /* 表格数据源 */
+      datasource({ page, limit, where, order }) {
+        return getPageSalesDemand({ pageNum: page, size: limit, ...where });
       },
-      kkform: {},
-      afterSalesTypeMap: {},
-      afterSalesTypeList: [],
-      // 流程对话框相关
-      processSubmitDialogFlag: false,
-      processedData: null,
-      currentRow: null
-    };
-  },
-  computed: {
-    btnShow() {
-      return (row) => {
-        return row.demandStatus == 0;
-      };
-    },
-    dispatchShow() {
-      return (row) => {
-        return !row.planStatus && row.afterSalesType !== 3;
-      };
-    }
-  },
-  created() {
-    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 });
+      async changeEnable(row) {
+        const res = await putRoles(row);
+        if (res.code == 0) {
+          this.$message({
+            type: 'success',
+            message: '修改成功',
+            customClass: 'ele-message-border'
           });
-          this.afterSalesTypeMap = typeMap;
-          this.afterSalesTypeList = typeList;
+          this.reload();
         }
-      } catch (err) {
-        this.$message.error(`获取售后类型字典失败:${err.message}`);
-      }
-    },
-    /* 表格数据源 */
-    datasource({ page, limit, where, order }) {
-      return getPageSalesDemand({ pageNum: page, size: limit, ...where });
-    },
-    async changeEnable(row) {
-      const res = await putRoles(row);
-      if (res.code == 0) {
-        this.$message({
-          type: 'success',
-          message: '修改成功',
-          customClass: 'ele-message-border'
-        });
-        this.reload();
-      }
-    },
-    //查询问题等级字典
-    async getLevelCode(code) {
-      const res = await getByCode(code);
-      if (res?.code === '0') {
-        let obj = {};
-        let arr = [];
-        res.data.map((el) => {
-          arr.push({
-            label: Object.values(el)[0],
-            value: Object.keys(el)[0]
+      },
+      //查询问题等级字典
+      async getLevelCode(code) {
+        const res = await getByCode(code);
+        if (res?.code === '0') {
+          let obj = {};
+          let arr = [];
+          res.data.map((el) => {
+            arr.push({
+              label: Object.values(el)[0],
+              value: Object.keys(el)[0]
+            });
+            obj = { ...obj, ...el };
           });
-          obj = { ...obj, ...el };
-        });
-        this.levelList = arr;
-        this.levelData = obj;
-      }
-    },
-    /* 刷新表格 */
-    reload(where) {
-      this.$refs.table.reload({ page: 1, where });
-      this.$emit('getToDoReminder');
-    },
+          this.levelList = arr;
+          this.levelData = obj;
+        }
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where });
+        this.$emit('getToDoReminder');
+      },
 
-    openEdit(row, type) {
-      this.$refs.addDialogRef.init(row, type);
-    },
+      openEdit(row, type) {
+        this.$refs.addDialogRef.init(row, type);
+      },
 
-    handleRemove(row) {
-      deleteSalesDemand([row.id]).then((res) => {
-        this.$message.success('删除成功!');
-        this.reload();
-      });
-    },
-    handleAudit(row) {
-      // 判断售后类型是否为3
-      if (row.afterSalesType === '3' || row.afterSalesType === 3) {
-        this.currentRow = row;
-        this.prepareProcessSubmit();
-      } else {
-        this.$refs.submitRef.open(row, 'list', '列表');
-      }
-    },
-    // 准备流程提交
-    async prepareProcessSubmit() {
-      try {
-        const detailRes = await getSalesDemandById(this.currentRow.id);
-        if (!detailRes) {
-          this.$message.error('获取详情失败');
-          return;
-        }
-        
-        this.processedData = {
-          id: this.currentRow.id,
-          submitSource: 3 // 标识来自列表提交
-        };
-        
-        this.processSubmitDialogFlag = true;
-        this.$nextTick(() => {
-          const processParams = {
-            businessKey: 'after_sale_quality_issues_feedback',
-            formCreateUserId: getCurrentUser().id
-          };
-          this.$refs.processSubmitDialogRef.init(processParams);
+      handleRemove(row) {
+        deleteSalesDemand([row.id]).then((res) => {
+          this.$message.success('删除成功!');
+          this.reload();
         });
-      } catch (error) {
-        this.$message.error('准备提交失败:' + (error.message || '未知错误'));
-      }
-    },
-    // 流程对话框的回调函数
-    async processCallBack() {
-      try {
-        if (!this.processedData || !this.currentRow) {
-          this.$message.error('未获取到提交数据');
-          return 1;
+      },
+      handleAudit(row) {
+        // 判断售后类型是否为3
+        if (row.afterSalesType === '3' || row.afterSalesType === 3) {
+          this.currentRow = row;
+          this.prepareProcessSubmit();
+        } else {
+          this.$refs.submitRef.open(row, 'list', '列表');
         }
+      },
+      // 准备流程提交
+      async prepareProcessSubmit() {
+        try {
+          const detailRes = await getSalesDemandById(this.currentRow.id);
+          if (!detailRes) {
+            this.$message.error('获取详情失败');
+            return;
+          }
 
-        // 调用提交接口
-        const businessId = await demandSubmit(this.processedData);
-        if (!businessId) {
-          this.$message.error('提交失败,未获取到业务ID');
-          return 1;
-        }
+          this.processedData = {
+            id: this.currentRow.id,
+            submitSource: 3 // 标识来自列表提交
+          };
 
-        // 获取详情
-        const detailRes = await getSalesDemandById(businessId);
-        if (!detailRes) {
-          this.$message.error('获取详情失败');
-          return 1;
+          this.processSubmitDialogFlag = true;
+          this.$nextTick(() => {
+            const processParams = {
+              businessKey: 'after_sale_quality_issues_feedback',
+              formCreateUserId: getCurrentUser().id
+            };
+            this.$refs.processSubmitDialogRef.init(processParams);
+          });
+        } catch (error) {
+          this.$message.error('准备提交失败:' + (error.message || '未知错误'));
         }
+      },
+      // 流程对话框的回调函数
+      async processCallBack() {
+        try {
+          if (!this.processedData || !this.currentRow) {
+            this.$message.error('未获取到提交数据');
+            return 1;
+          }
 
-        // 更新流程对话框的表单数据
-        this.$refs.processSubmitDialogRef.form.businessId = businessId;
-        this.$refs.processSubmitDialogRef.form.variables = {
-          businessCode: detailRes.code,
-          businessName: detailRes.name,
-          businessType: '质量问题反馈'
-        };
+          // 调用提交接口
+          const businessId = await demandSubmit(this.processedData);
+          if (!businessId) {
+            this.$message.error('提交失败,未获取到业务ID');
+            return 1;
+          }
 
-        return 0; // 返回0表示成功
-      } catch (error) {
-        this.$message.error('提交失败:' + (error.message || '未知错误'));
-        return 1; // 返回1表示失败
-      }
-    },
-    async closeRevoke(row) {
-      const res = await closeDemand(row.id);
-      if (!res) return;
-      this.$message.success('关闭成功!');
-      this.reload();
-    },
-    async handleRevoke(row) {
-      const res = await revokeSalesDemand({ id: row.id });
-      if (!res) return;
-      this.$message.success('撤回成功!');
-      this.reload();
-    },
-    handleCommand(command, row) {
-      if (command === 'handleRevoke') {
-        this.handleRevoke(row);
-      }
-      if (command === 'handleAudit') {
-        this.handleAudit(row);
-      }
-    },
-    async dispatchFormFn(id) {
-      const res = await getSalesDemandById(id);
+          // 获取详情
+          const detailRes = await getSalesDemandById(businessId);
+          if (!detailRes) {
+            this.$message.error('获取详情失败');
+            return 1;
+          }
 
-      this.dispatchForm = res;
-      let productDetail = res.productDetail ? res.productDetail : [];
-      let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
-      let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
+          // 更新流程对话框的表单数据
+          this.$refs.processSubmitDialogRef.form.businessId = businessId;
+          this.$refs.processSubmitDialogRef.form.variables = {
+            businessCode: detailRes.code,
+            businessName: detailRes.name,
+            businessType: '质量问题反馈'
+          };
 
-      this.$set(this.dispatchForm, 'tableList', productDetail);
-      this.$set(this.dispatchForm, 'orderCode', res.orderCode);
-      this.$set(this.dispatchForm, 'orderId', res.orderId);
-      this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
-      this.$set(this.dispatchForm, 'name', res.name);
-      this.$set(this.dispatchForm, 'faultLevel', faultLevel);
-      this.$set(this.dispatchForm, 'code', res.code);
-      this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
-      if (res.contactAddress) {
-        this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
-      }
-      this.contactDetail(res.contactId, 'init');
-      this.dispatchForm.associationType = res.associationType
-        ? String(res.associationType)
-        : '1';
-      this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
-    },
+          return 0; // 返回0表示成功
+        } catch (error) {
+          this.$message.error('提交失败:' + (error.message || '未知错误'));
+          return 1; // 返回1表示失败
+        }
+      },
+      async closeRevoke(row) {
+        const res = await closeDemand(row.id);
+        if (!res) return;
+        this.$message.success('关闭成功!');
+        this.reload();
+      },
+      async handleRevoke(row) {
+        const res = await revokeSalesDemand({ id: row.id });
+        if (!res) return;
+        this.$message.success('撤回成功!');
+        this.reload();
+      },
+      handleCommand(command, row) {
+        if (command === 'handleRevoke') {
+          this.handleRevoke(row);
+        }
+        if (command === 'handleAudit') {
+          this.handleAudit(row);
+        }
+      },
+      async dispatchFormFn(id) {
+        const res = await getSalesDemandById(id);
 
-    async dispatchFn(row) {
-      const res = await getSalesDemandById(row.id);
-      this.kkform = res;
-      let productDetail = res.productDetail ? res.productDetail : [];
-      let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
-      let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
+        this.dispatchForm = res;
+        let productDetail = res.productDetail ? res.productDetail : [];
+        let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
+        let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
 
-      this.$set(this.dispatchForm, 'tableList', productDetail);
-      this.$set(this.dispatchForm, 'orderCode', res.orderCode);
-      this.$set(this.dispatchForm, 'orderId', res.orderId);
-      this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
-      this.$set(this.dispatchForm, 'name', res.name);
-      this.$set(this.dispatchForm, 'faultLevel', faultLevel);
-      this.$set(this.dispatchForm, 'code', res.code);
-      this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
-      if (res.contactAddress) {
-        this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
-      }
-      this.contactDetail(res.contactId, 'init');
-      this.dispatchForm.associationType = res.associationType
-        ? String(res.associationType)
-        : '1';
-      this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
+        this.$set(this.dispatchForm, 'tableList', productDetail);
+        this.$set(this.dispatchForm, 'orderCode', res.orderCode);
+        this.$set(this.dispatchForm, 'orderId', res.orderId);
+        this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
+        this.$set(this.dispatchForm, 'name', res.name);
+        this.$set(this.dispatchForm, 'faultLevel', faultLevel);
+        this.$set(this.dispatchForm, 'code', res.code);
+        this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
+        if (res.contactAddress) {
+          this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
+        }
+        this.contactDetail(res.contactId, 'init');
+        this.dispatchForm.associationType = res.associationType
+          ? String(res.associationType)
+          : '1';
+        this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
+      },
 
-      let pData = await this.handleParameter();
+      async dispatchFn(row) {
+        const res = await getSalesDemandById(row.id);
+        this.kkform = res;
+        let productDetail = res.productDetail ? res.productDetail : [];
+        let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
+        let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
 
-      if (!pData) {
-        return;
-      }
+        this.$set(this.dispatchForm, 'tableList', productDetail);
+        this.$set(this.dispatchForm, 'orderCode', res.orderCode);
+        this.$set(this.dispatchForm, 'orderId', res.orderId);
+        this.$set(this.dispatchForm, 'contactInfoVOS', res.contactInfoVOS);
+        this.$set(this.dispatchForm, 'name', res.name);
+        this.$set(this.dispatchForm, 'faultLevel', faultLevel);
+        this.$set(this.dispatchForm, 'code', res.code);
+        this.$set(this.dispatchForm, 'expectedTime', res.expectedTime);
+        if (res.contactAddress) {
+          this.$set(this.dispatchForm, 'contactAddress', res.contactAddress);
+        }
+        this.contactDetail(res.contactId, 'init');
+        this.dispatchForm.associationType = res.associationType
+          ? String(res.associationType)
+          : '1';
+        this.$set(this.dispatchForm, 'faultDetailList', faultDetailList);
 
-      this.$refs.dispatchRef.open(pData, 'dispatch');
-    },
-    savExit() {},
-    async contactDetail(id, type) {
-      if (!id) {
-        return;
-      }
-      let { base, other, linkList } = await contactDetail(id);
-      base.contactName = base.name;
-      let addressName = '';
-      if (other.addressName) {
-        addressName += other.addressName;
-      }
-      if (other.address) {
-        addressName += other.address;
-      }
-      this.$set(this.dispatchForm, 'contractInfo', base);
-    },
-    async handleParameter() {
-      let data = this.dispatchForm;
-      if (!data.contactInfoVOS?.length) {
-        this.$message.warning('联系人信息至少有1条');
-        return false;
-      }
-      try {
-        let expectedTime = data.expectedTime
-          ? this.formatDate(data.expectedTime)
-          : '';
-        let pData = {
-          ...this.kkform,
-          name: data.name,
-          faultLevel: data.faultLevel,
-          expectedTime: expectedTime,
-          contactId: data.contractInfo.id,
-          contactCode: data.contractInfo.code,
-          contactName: data.contractInfo.name,
-          orderCode: data.orderCode,
-          orderId: data.orderId,
-          contactAddress: data.contactAddress,
-          productDetail: data.tableList.map((item) => {
-            item['produceTime'] = item['produceTime'] || null;
-            return item;
-          }),
-          contactInfoVOS: data.contactInfoVOS,
-          associationType: data.associationType
-        };
-        if (pData.associationType == '2' && pData.productDetail.length == 0) {
-          delete pData.productDetail;
-          pData.faultDetailList = data.faultDetailList;
+        let pData = await this.handleParameter();
+
+        if (!pData) {
+          return;
+        }
+
+        this.$refs.dispatchRef.open(pData, 'dispatch');
+      },
+      savExit() {},
+      async contactDetail(id, type) {
+        if (!id) {
+          return;
         }
-        if (pData.associationType == '3' && pData.productDetail.length == 0) {
-          delete pData.productDetail;
-          pData.faultDetailList = data.faultDetailList;
+        let { base, other, linkList } = await contactDetail(id);
+        base.contactName = base.name;
+        let addressName = '';
+        if (other.addressName) {
+          addressName += other.addressName;
         }
-        return pData;
-      } catch (err) {}
-    },
-    formatDate(dateString) {
-      const isStandardFormat = /^\d{4}-\d{1,2}-\d{1,2}$/.test(dateString);
-      if (isStandardFormat) {
-        return dateString;
-      }
-      try {
-        const date = new Date(dateString);
-        if (isNaN(date.getTime())) {
-          throw new Error('Invalid date');
+        if (other.address) {
+          addressName += other.address;
+        }
+        this.$set(this.dispatchForm, 'contractInfo', base);
+      },
+      async handleParameter() {
+        let data = this.dispatchForm;
+        if (!data.contactInfoVOS?.length) {
+          this.$message.warning('联系人信息至少有1条');
+          return false;
+        }
+        try {
+          let expectedTime = data.expectedTime
+            ? this.formatDate(data.expectedTime)
+            : '';
+          let pData = {
+            ...this.kkform,
+            name: data.name,
+            faultLevel: data.faultLevel,
+            expectedTime: expectedTime,
+            contactId: data.contractInfo.id,
+            contactCode: data.contractInfo.code,
+            contactName: data.contractInfo.name,
+            orderCode: data.orderCode,
+            orderId: data.orderId,
+            contactAddress: data.contactAddress,
+            productDetail: data.tableList.map((item) => {
+              item['produceTime'] = item['produceTime'] || null;
+              return item;
+            }),
+            contactInfoVOS: data.contactInfoVOS,
+            associationType: data.associationType
+          };
+          if (pData.associationType == '2' && pData.productDetail.length == 0) {
+            delete pData.productDetail;
+            pData.faultDetailList = data.faultDetailList;
+          }
+          if (pData.associationType == '3' && pData.productDetail.length == 0) {
+            delete pData.productDetail;
+            pData.faultDetailList = data.faultDetailList;
+          }
+          return pData;
+        } catch (err) {}
+      },
+      formatDate(dateString) {
+        const isStandardFormat = /^\d{4}-\d{1,2}-\d{1,2}$/.test(dateString);
+        if (isStandardFormat) {
+          return dateString;
+        }
+        try {
+          const date = new Date(dateString);
+          if (isNaN(date.getTime())) {
+            throw new Error('Invalid date');
+          }
+          const year = date.getFullYear();
+          const month = String(date.getMonth() + 1).padStart(2, '0');
+          const day = String(date.getDate()).padStart(2, '0');
+          return `${year}-${month}-${day}`;
+        } catch (error) {
+          return dateString;
         }
-        const year = date.getFullYear();
-        const month = String(date.getMonth() + 1).padStart(2, '0');
-        const day = String(date.getDate()).padStart(2, '0');
-        return `${year}-${month}-${day}`;
-      } catch (error) {
-        return dateString;
       }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.el-dropdown-link {
-  cursor: pointer;
-  color: var(--color-primary-5);
-}
-
-.el-icon-arrow-down {
-  font-size: 12px;
-}
+  .el-dropdown-link {
+    cursor: pointer;
+    color: var(--color-primary-5);
+  }
 
-::v-deep .seep-search {
-  .el-input__inner::placeholder {
-    font-size: 13px;
+  .el-icon-arrow-down {
+    font-size: 12px;
   }
-  .el-input__inner {
-    padding: 0 5px 0 10px;
+
+  ::v-deep .seep-search {
+    .el-input__inner::placeholder {
+      font-size: 13px;
+    }
+    .el-input__inner {
+      padding: 0 5px 0 10px;
+    }
   }
-}
-</style>
+</style>