Kaynağa Gözat

售后服务工单新增是否生成采购订单,是否外包,售后工单新增打印功能

hezhanp 8 ay önce
ebeveyn
işleme
bddadfea41

+ 0 - 1
src/views/purchasingManage/purchaseOrder/invoice/components/detailDialog.vue

@@ -575,7 +575,6 @@
               label: '质检人',
               slot: 'qualityName',
               align: 'center',
-              fixed: 'right',
               show: v == 2
             },
             {

+ 117 - 9
src/views/salesServiceManagement/components/info.vue

@@ -336,12 +336,74 @@
           </el-select>
         </el-form-item>
       </el-col>
+      <el-col :span="6">
+        <el-form-item
+          label="是否外包:"
+          prop="outsource"
+          :rules="{
+            required: true,
+            message: '请选择是否外包',
+            trigger: 'change'
+          }"
+        >
+          <el-select
+            style="width: 100%"
+            v-model="form.outsource"
+            placeholder="请选择是否外包"
+            :disabled="type == 'view'"
+          >
+            <el-option
+              v-for="item in outsourceList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="6" v-if="form.outsource == 1">
+        <el-form-item
+          label="供应商名称:"
+          prop="supplierName"
+          :rules="{
+            required: true,
+            message: '请选择供应商名称',
+            trigger: ['blur', 'change']
+          }"
+        >
+          <el-input
+            v-model="form.supplierName"
+            placeholder="请选择供应商名称"
+            :disabled="type == 'view'"
+            @click.native="handParent"
+            ref="supplierInput"
+          ></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="是否生成采购订单:" prop="isCreatePurchaseOrder">
+          <el-select
+            style="width: 100%"
+            v-model="form.isCreatePurchaseOrder"
+            placeholder="请选择是否生成采购订单"
+            :disabled="type == 'view'"
+          >
+            <el-option
+              v-for="item in isCreatePurchaseOrderList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
     </el-row>
 
     <headerTitle
-      title="配件信息"
+      title="售后方案"
       style="margin-top: 10px"
-      v-if="form.part == 1 && isPurchaseNeed"
+      v-if="isPurchaseNeed"
     ></headerTitle>
     <spareParts
       ref="sparePartsRef"
@@ -349,7 +411,7 @@
       :source="source"
       obtain="仓库"
       :is-after-sales="true"
-      v-if="form.part == 1 && isPurchaseNeed"
+      v-if="isPurchaseNeed"
     />
     <div class="after_sales_target" v-if="salesShow">
       <headerTitle
@@ -859,6 +921,12 @@
       @update:processSubmitDialogFlag="(val) => (processSubmitDialogFlag = val)"
       @formSubmit="handleFormSubmit"
     ></process-submit-dialog>
+
+    <GYSparentList
+      ref="GYSparentRef"
+      @changeParent="GYSchangeParent"
+      :classType="2"
+    ></GYSparentList>
   </el-form>
 </template>
 
@@ -877,6 +945,7 @@ import { getToken } from '@/utils/token-util';
 import processSubmitDialog from '@/views/salesServiceManagement/components/processSubmitDialog/processSubmitDialog.vue';
 import { getByCode } from '@/api/system/dictionary-data';
 
+import GYSparentList from '@/views/purchasingManage/supplierManage/components/parentList.vue';
 export default {
   mixins: [dictMixins],
   components: {
@@ -887,7 +956,8 @@ export default {
     fileMain,
     ProductDialog,
     processSubmitDialog,
-    spareParts
+    spareParts,
+    GYSparentList
   },
   computed: {
     ...mapGetters(['getDictValue']),
@@ -1262,7 +1332,14 @@ export default {
         { label: '保养', value: '2' },
         { label: '安装', value: '3' }
       ],
-
+      outsourceList: [
+        { label: '是', value: 1 },
+        { label: '否', value: 0 }
+      ],
+      isCreatePurchaseOrderList: [
+        { label: '是', value: 1 },
+        { label: '否', value: 0 }
+      ],
       sxtList: [
         {
           label: '自制件',
@@ -1291,7 +1368,12 @@ export default {
         charge: '',
         part: '',
         car: '',
-        pietype: ''
+        pietype: '',
+        outsource: '',
+        isCreatePurchaseOrder: '',
+        supplierName: '',
+        supplierId: '',
+        supplierCode: ''
       },
       rules: {},
       radio: null,
@@ -1362,7 +1444,6 @@ export default {
     },
     // 初始化数据
     async init(res) {
-      
       let productDetail = res.productDetail ? res.productDetail : [];
       this.$set(this.form, 'tableList', productDetail);
       this.$set(this.form, 'orderCode', res.orderCode);
@@ -1399,7 +1480,11 @@ export default {
         'pietype',
         res.pieCarType ? String(res.pieCarType) : ''
       );
-
+      this.$set(this.form, 'outsource', res.isOutsource ?? '');
+      this.$set(this.form, 'isCreatePurchaseOrder', res.isCreatePurchaseOrder ?? '');
+      this.$set(this.form, 'supplierId', res.supplierId ?? '');
+      this.$set(this.form, 'supplierName', res.supplierName ?? '');
+      this.$set(this.form, 'supplierCode', res.supplierCode ?? '');
       this.$set(this, 'detailList', res.costListVOS || []);
       this.$nextTick(() => {
         if (this.$refs.sparePartsRef && this.detailList.length > 0) {
@@ -1431,6 +1516,21 @@ export default {
     changeParent(res) {
       this.contactDetail(res.id);
     },
+
+    handParent() {
+      this.$refs.GYSparentRef.open();
+    },
+    async GYSchangeParent(obj) {
+      this.$set(this.form, 'supplierId', obj.id);
+      this.$set(this.form, 'supplierName', obj.name);
+      this.$set(this.form, 'supplierCode', obj.code);
+      this.$nextTick(() => {
+        if (this.$refs.supplierInput) {
+          this.$refs.supplierInput.blur();
+        }
+        this.$refs.form.validateField('supplierName');
+      });
+    },
     // 获取客户详情
     async contactDetail(id, type) {
       if (!id) {
@@ -1574,8 +1674,16 @@ export default {
         charge: '',
         part: '',
         car: '',
-        pietype: ''
+        pietype: '',
+        outsource: '',
+        isCreatePurchaseOrder: '',
+        supplierName: '',
+        supplierId: '',
+        supplierCode: ''
       };
+      if (this.$refs.sparePartsRef) {
+        this.$refs.sparePartsRef.clearList();
+      }
       this.$refs.form.resetFields();
     },
     // 打开销售订单选择弹窗

+ 63 - 31
src/views/salesServiceManagement/components/sparePartsList.vue

@@ -21,6 +21,7 @@
             <span class="total_price">总计: {{ totalPrice }} (元)</span>
           </div>
         </template>
+
         <template v-slot:typeId="scope">
           <el-form-item
             style="margin-bottom: 20px"
@@ -41,6 +42,26 @@
                 :value="item.value"
               ></el-option>
             </el-select>
+          </el-form-item> </template
+        ><template v-slot:feeType="scope">
+          <el-form-item
+            style="margin-bottom: 20px"
+            :prop="'tableList.' + scope.$index + '.feeType'"
+          >
+            <el-select
+              v-model="scope.row.feeType"
+              placeholder="请选择"
+              class="w100"
+              :disabled="schemeTableTool(scope.row)"
+            >
+              <!-- :disabled="type == 'view' || scope.row.isApply == 1" -->
+              <el-option
+                v-for="item in feeTypeList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              ></el-option>
+            </el-select>
           </el-form-item>
         </template>
         <template v-slot:code="scope">
@@ -286,11 +307,7 @@ export default {
     obtain: {
       type: String,
       default: '主数据'
-    },
-    isAfterSales: {
-    type: Boolean,
-    default: false // 默认不是售后服务页面
-  }
+    }
   },
   data() {
     return {
@@ -299,7 +316,11 @@ export default {
         tableList: []
       },
       totalPrice: 0,
-      typeIdList: []
+      typeIdList: [],
+      feeTypeList: [
+        { label: '收入', value: '1' },
+        { label: '支出', value: '2' }
+      ]
     };
   },
   created() {
@@ -332,6 +353,14 @@ export default {
           minWidth: 150,
           showOverflowTooltip: true
         },
+        {
+          prop: 'feeType',
+          label: '费用类别',
+          align: 'center',
+          slot: 'feeType',
+          minWidth: 150,
+          showOverflowTooltip: true
+        },
 
         {
           prop: 'name',
@@ -397,7 +426,6 @@ export default {
           align: 'center',
           showOverflowTooltip: true
         },
-
         {
           prop: 'singlePrice',
           slot: 'singlePrice',
@@ -406,7 +434,6 @@ export default {
           align: 'center',
           showOverflowTooltip: true
         },
-
         {
           prop: 'settlementPrice',
           width: 80,
@@ -495,35 +522,30 @@ export default {
     if (this.detailList.length > 0) {
       this.form.tableList = this.detailList;
     }
-    if (this.isAfterSales) {
-    this.typeIdList = [{ label: '零配件', value: '2' }];
-  }
   },
   methods: {
     init(row) {},
-async getLevelCode(code) {
-  try {
-    const res = await getByCode(code);
-    if (res.code == 0) {
-      let list = Object.values(res.data).map((el) => {
-        let k = Object.keys(el)[0];
-        let v = Object.values(el)[0];
-        return { label: v, value: k };
-      });
+    async getLevelCode(code) {
+      try {
+        const res = await getByCode(code);
+        if (res.code == 0) {
+          let list = Object.values(res.data).map((el) => {
+            let k = Object.keys(el)[0];
+            let v = Object.values(el)[0];
+            return { label: v, value: k };
+          });
 
-      if (this.isAfterSales) {
-        list = list.filter(item => item.value === '2'); 
+          this.typeIdList = list;
+        }
+      } catch (err) {
+        this.$message.error(err.message);
       }
-
-      this.typeIdList = list;
-    }
-  } catch (err) {
-    this.$message.error(err.message);
-  }
-},
+    },
     typeIdChange(row, index) {
+      const defaultFeeType = row.typeId === '5' ? '2' : '1';
       let obj = {
         typeId: row.typeId,
+        feeType: defaultFeeType, // 这里根据typeId动态设置默认值
         code: '',
         name: '',
         categoryModel: '',
@@ -535,7 +557,7 @@ async getLevelCode(code) {
         settlementPrice: ''
       };
       let o = this.typeIdList.find((item) => item.value == row.typeId);
-      if (o.value != 2) {
+      if (o && o.value != 2) {
         obj.name = o.label;
       }
       this.$set(this.form.tableList, index, obj);
@@ -560,6 +582,7 @@ async getLevelCode(code) {
     addBank() {
       this.form.tableList.push({
         typeId: '2',
+        feeType: '1',
         code: '',
         name: '',
         categoryModel: '',
@@ -589,6 +612,9 @@ async getLevelCode(code) {
       const tableList = JSON.parse(JSON.stringify(val));
       for (let i = 0; i < tableList.length; i++) {
         const item = tableList[i];
+        if (!item.feeType) {
+          item.feeType = '1';
+        }
         item.categoryCode = item.categoryCode || item.code;
         item.categoryName = item.categoryName || item.name;
         if (item.typeId == 2) {
@@ -635,7 +661,13 @@ async getLevelCode(code) {
       this.form.tableList.splice(index, 1);
     },
     async confirmChoose(data) {
-      this.$set(this.form.tableList, this.currentIndex, data[0]);
+      const originalRow = this.form.tableList[this.currentIndex] || {};
+      const newRow = {
+        ...data[0],
+        feeType: data[0].feeType || originalRow.feeType || '1'
+      };
+      // 用合并后的新对象更新行数据
+      this.$set(this.form.tableList, this.currentIndex, newRow);
       this.$set(
         this.form.tableList[this.currentIndex],
         'categoryModel',

+ 7 - 1
src/views/salesServiceManagement/demandList/components/addDialog.vue

@@ -210,7 +210,13 @@ export default {
           pieCarType: data.pietype,
           isWithAccessories: data.part,
           costListVOS: sparePartsData,
-          formJson: this.$refs.infoRef.carFormData
+          formJson: this.$refs.infoRef.carFormData,
+          
+          isOutsource: data.outsource,
+          isCreatePurchaseOrder:data.isCreatePurchaseOrder,
+          supplierId: data.supplierId,
+          supplierName: data.supplierName,
+          supplierCode: data.supplierCode
         };
         // 如果选的销售订单并且 没有售后对象数据
         if (pData.associationType == '2' && pData.productDetail.length == 0) {

+ 433 - 437
src/views/salesServiceManagement/demandList/index.vue

@@ -181,475 +181,471 @@
 </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
-  } 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';
+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
+} 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 dispatchDialog from './components/dispatchDialog.vue';
 
-  import { contactDetail } from '@/api/saleManage/contact';
-  export default {
-    mixins: [dictMixins],
-    components: {
-      search,
-      AddDialog,
-      SubmitDialog,
-      dispatchDialog
-    },
-    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] || '';
-            }
-          },
-          {
-            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) => {
-              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
+import { contactDetail } from '@/api/saleManage/contact';
+export default {
+  mixins: [dictMixins],
+  components: {
+    search,
+    AddDialog,
+    SubmitDialog,
+    dispatchDialog
+  },
+  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] || '';
           }
-        ],
-        // 加载状态
-        loading: false,
-        infoData: {},
-        repairInfoLogs: [],
-        addDialogTitle: '新建售后需求',
-        // auditDialog: false,
-
-        rowData: {},
-        formData: {
-          approvalResult: null,
-          rejectCause: '',
-          approvalUserId: '',
-          approvalUserName: ''
         },
-        approvalResultOptions: [
-          { label: '驳回', value: 0 },
-          { label: '同意', value: 1 }
-        ],
-        levelData: {},
-        levelList: [],
-        contractInfo: {},
-        dispatchForm: {
-          contractInfo: {},
-          tableList: [],
-          contactInfoVOS: [],
-          faultDetailList: [],
-          associationType: '1'
+        {
+          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) => {
+            return cellValue == 0
+              ? '待提交'
+              : cellValue == 1
+              ? '已提交'
+              : cellValue == 2
+              ? '已关闭'
+              : cellValue == 3
+              ? '已完成'
+              : '';
+          }
         },
-        kkform: {}
+        {
+          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: '新建售后需求',
+      // auditDialog: false,
+
+      rowData: {},
+      formData: {
+        approvalResult: null,
+        rejectCause: '',
+        approvalUserId: '',
+        approvalUserName: ''
+      },
+      approvalResultOptions: [
+        { label: '驳回', value: 0 },
+        { label: '同意', value: 1 }
+      ],
+      levelData: {},
+      levelList: [],
+      contractInfo: {},
+      dispatchForm: {
+        contractInfo: {},
+        tableList: [],
+        contactInfoVOS: [],
+        faultDetailList: [],
+        associationType: '1'
+      },
+      kkform: {}
+    };
+  },
+  computed: {
+    btnShow() {
+      return (row) => {
+        // let flag = row.demandStatus  == 0;
+        return row.demandStatus == 0;
       };
     },
-    computed: {
-      btnShow() {
-        return (row) => {
-          // let flag = row.demandStatus  == 0;
-          return row.demandStatus == 0;
-        };
-      },
-      dispatchShow() {
-        return (row) => {
-          return !row.planStatus;
-          // console.log(row);
-        };
-      }
+    dispatchShow() {
+      return (row) => {
+        return !row.planStatus;
+        // console.log(row);
+      };
+    }
+  },
+  created() {
+    this.requestDict('报修来源');
+    this.requestDict('报修状态');
+    this.getLevelCode('fault_level');
+  },
+  methods: {
+    /* 表格数据源 */
+    datasource({ page, limit, where, order }) {
+      return getPageSalesDemand({ pageNum: page, size: limit, ...where });
     },
-    created() {
-      this.requestDict('报修来源');
-      this.requestDict('报修状态');
-      this.getLevelCode('fault_level');
+    async changeEnable(row) {
+      const res = await putRoles(row);
+      if (res.code == 0) {
+        this.$message({
+          type: 'success',
+          message: '修改成功',
+          customClass: 'ele-message-border'
+        });
+        this.reload();
+      }
     },
-    methods: {
-      /* 表格数据源 */
-      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]
-            });
-            obj = { ...obj, ...el };
+    //查询问题等级字典
+    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]
           });
-          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);
-      },
-
-      handleRemove(row) {
-        deleteSalesDemand([row.id]).then((res) => {
-          this.$message.success('删除成功!');
-          this.reload();
+          obj = { ...obj, ...el };
         });
-      },
-      handleAudit(row) {
-        this.$refs.submitRef.open(row, 'list', '列表');
-        // this.auditDialog = true;
-        // this.rowData = row;
-      },
-      // handleClose() {
-      //   this.auditDialog = false;
-      // },
-      // async handleSubmit() {
-      //   this.$refs.form.validate(async (valid) => {
-      //     if (valid) {
-      //       const data = this.$store.state.user.info;
+        this.levelList = arr;
+        this.levelData = obj;
+      }
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where });
+      this.$emit('getToDoReminder');
+    },
 
-      //       let pdata = {
-      //         id: this.rowData.id,
-      //         approvalResult: this.formData.approvalResult,
-      //         rejectCause: this.formData.rejectCause,
-      //         approvalUserId: data.userId,
-      //         approvalUserName: data.name
-      //       };
-      //       const res = await auditSalesDemand(pdata);
-      //       if (res) {
-      //         this.$message.success('审核成功!');
-      //         this.auditDialog = false;
-      //         this.reload();
-      //       }
-      //     }
-      //   });
-      // },
-      //
-      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('撤回成功!');
+    openEdit(row, type) {
+      this.$refs.addDialogRef.init(row, type);
+    },
+
+    handleRemove(row) {
+      deleteSalesDemand([row.id]).then((res) => {
+        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);
+      });
+    },
+    handleAudit(row) {
+      this.$refs.submitRef.open(row, 'list', '列表');
+      // this.auditDialog = true;
+      // this.rowData = row;
+    },
+    // handleClose() {
+    //   this.auditDialog = false;
+    // },
+    // async handleSubmit() {
+    //   this.$refs.form.validate(async (valid) => {
+    //     if (valid) {
+    //       const data = this.$store.state.user.info;
 
-        this.dispatchForm = res;
-        // detailForm = res;
-        let productDetail = res.productDetail ? res.productDetail : [];
-        let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
-        let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
+    //       let pdata = {
+    //         id: this.rowData.id,
+    //         approvalResult: this.formData.approvalResult,
+    //         rejectCause: this.formData.rejectCause,
+    //         approvalUserId: data.userId,
+    //         approvalUserName: data.name
+    //       };
+    //       const res = await auditSalesDemand(pdata);
+    //       if (res) {
+    //         this.$message.success('审核成功!');
+    //         this.auditDialog = false;
+    //         this.reload();
+    //       }
+    //     }
+    //   });
+    // },
+    //
+    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);
 
-        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);
-        // if (faultDetailList.length > 0) {
-        //   this.isOrder = true;
-        // }
-      },
+      this.dispatchForm = res;
+      // detailForm = res;
+      let productDetail = res.productDetail ? res.productDetail : [];
+      let faultLevel = res.faultLevel ? String(res.faultLevel) : '';
+      let faultDetailList = res.faultDetailList ? res.faultDetailList : [];
 
-      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.$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);
+      // if (faultDetailList.length > 0) {
+      //   this.isOrder = true;
+      // }
+    },
 
-        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);
+    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 : [];
 
-        // await this.dispatchFormFn(row.id);
-        let pData = await this.handleParameter();
+      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);
 
-        if (!pData) {
-          return;
-        }
+      // await this.dispatchFormFn(row.id);
+      let pData = await this.handleParameter();
 
-        console.log(pData);
+      if (!pData) {
+        return;
+      }
 
-        this.$refs.dispatchRef.open(pData, 'dispatch');
+      console.log(pData);
 
-        // console.log(this.$refs.addDialogRef);
-      },
-      savExit() {
+      this.$refs.dispatchRef.open(pData, 'dispatch');
 
-      },
-      async contactDetail(id, type) {
-        if (!id) {
-          // this.contractInfo = {};
-          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;
+      // console.log(this.$refs.addDialogRef);
+    },
+    savExit() {},
+    async contactDetail(id, type) {
+      if (!id) {
+        // this.contractInfo = {};
+        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 valid = await this.$refs.infoRef.getValidate();
+        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;
         }
-        this.$set(this.dispatchForm, 'contractInfo', base);
-      },
-      async handleParameter() {
-        let data = this.dispatchForm;
-        if (!data.contactInfoVOS?.length) {
-          this.$message.warning('联系人信息至少有1条');
-          return false;
+        if (pData.associationType == '3' && pData.productDetail.length == 0) {
+          delete pData.productDetail;
+          pData.faultDetailList = data.faultDetailList;
         }
-        try {
-          // let valid = await this.$refs.infoRef.getValidate();
-          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; // 转换失败时返回原始字符串
+        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; // 转换失败时返回原始字符串
       }
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .el-dropdown-link {
-    cursor: pointer;
-    color: var(--color-primary-5);
-  }
+.el-dropdown-link {
+  cursor: pointer;
+  color: var(--color-primary-5);
+}
 
-  .el-icon-arrow-down {
-    font-size: 12px;
-  }
+.el-icon-arrow-down {
+  font-size: 12px;
+}
 
-  ::v-deep .seep-search {
-    .el-input__inner::placeholder {
-      font-size: 13px;
-    }
-    .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>

+ 458 - 394
src/views/salesServiceManagement/workOrder/index.vue

@@ -21,9 +21,29 @@
         :datasource="datasource"
         cache-key="systemRoleTable"
         :pageSize="20"
+        @cell-click="cellClick"
       >
-        <!-- 表头工具栏 -->
-        <template v-slot:toolbar></template>
+        <template v-slot:single="{ row }">
+          <el-radio class="radio" v-model="radioId" :label="row.id">
+            <i></i>
+          </el-radio>
+        </template>
+
+        <template v-slot:toolbar>
+          <el-dropdown trigger="click" :disabled="!radioId">
+            <el-button type="primary" class="el-icon-printer" size="small">
+              打印<i class="el-icon-arrow-down el-icon--right"></i>
+            </el-button>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item @click.native="quotation('service')"
+                >服务派工单</el-dropdown-item
+              >
+              <el-dropdown-item @click.native="quotation('technical')"
+                >技术派工单</el-dropdown-item
+              >
+            </el-dropdown-menu>
+          </el-dropdown>
+        </template>
         <template v-slot:code="{ row }">
           <el-link
             type="primary"
@@ -169,425 +189,469 @@
       </div>
     </ele-modal>
     <addDialog ref="addDialogRef" @success="reload"></addDialog>
+
+    <jimureportBrowse
+      @cancelQuo="cancelQuo"
+      v-if="browseShow"
+      :browseShow="browseShow"
+      :businessId="currentRow.id"
+      :businessCode="currentBusinessCode"
+    ></jimureportBrowse>
   </div>
 </template>
 
 <script>
-  // import fileMain from '@/components/addDoc/index.vue';
-  import workSearch from './components/work-search.vue';
-  import detailDialog from './components/detailDialog.vue';
-  import applyForSpare from '../components/applyForSpare.vue';
-  import declarationDialog from './components/declarationDialog.vue';
-  import redeployOther from './components/redeployOther2.vue';
-  import addDialog from '@/views/salesServiceManagement/evaluate/components/addDialog.vue';
+// import fileMain from '@/components/addDoc/index.vue';
+import workSearch from './components/work-search.vue';
+import detailDialog from './components/detailDialog.vue';
+import applyForSpare from '../components/applyForSpare.vue';
+import declarationDialog from './components/declarationDialog.vue';
+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 {
-    getSalesWorkOrder,
-    deleteSalesWorkOrder,
-    receiveSalesWorkOrder,
-    checkAndAccept,
-    getSalesWorkOrderById,
-    checkByWorkId,
-    afterSalesEvaluation
-  } from '@/api/salesServiceManagement/index';
-  import { getByCode } from '@/api/system/dictionary-data';
-  import dictMixins from '@/mixins/dictMixins';
-  export default {
-    mixins: [dictMixins],
-    components: {
-      workSearch,
-      detailDialog,
-      applyForSpare,
-      declarationDialog,
-      redeployOther,
-      addDialog,
-      // fileMain
-    },
-    data() {
-      return {
-        visibleCheckAndAccept: false,
-        form: {
-          accepterUserId: '',
-          accepterUserName: '',
-          accepterRemark: ''
+import {
+  getSalesWorkOrder,
+  deleteSalesWorkOrder,
+  receiveSalesWorkOrder,
+  checkAndAccept,
+  getSalesWorkOrderById,
+  checkByWorkId,
+  afterSalesEvaluation
+} from '@/api/salesServiceManagement/index';
+import { getByCode } from '@/api/system/dictionary-data';
+import dictMixins from '@/mixins/dictMixins';
+export default {
+  mixins: [dictMixins],
+  components: {
+    workSearch,
+    detailDialog,
+    applyForSpare,
+    declarationDialog,
+    redeployOther,
+    addDialog,
+    jimureportBrowse
+    // fileMain
+  },
+  data() {
+    return {
+      visibleCheckAndAccept: false,
+      form: {
+        accepterUserId: '',
+        accepterUserName: '',
+        accepterRemark: ''
+      },
+      currentBusinessCode: '',
+      contactInfoVOS: [],
+      workOrderStatus: [
+        // { code: 0, label: '待接收' },
+        { code: 0, label: '待执行' },
+        { code: 1, label: '已接收' },
+        { code: 2, label: '执行中' },
+        { code: 3, label: '待验收' },
+        { code: 4, label: '待评价' },
+        { code: 5, label: '已完成' },
+        { code: 6, label: '验收不通过' }
+      ],
+      resultStatus: [
+        { code: 5, label: '未修复' },
+        { code: 4, label: '已修复' }
+      ],
+      // 表格列配置
+      columns: [
+        {
+          columnKey: 'index',
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
         },
-        contactInfoVOS: [],
-        workOrderStatus: [
-          // { code: 0, label: '待接收' },
-          { code: 0, label: '待执行' },
-          { code: 1, label: '已接收' },
-          { code: 2, label: '执行中' },
-          { code: 3, label: '待验收' },
-          { code: 4, label: '待评价' },
-          { code: 5, label: '已完成' },
-          { code: 6, label: '验收不通过' }
-        ],
-        resultStatus: [
-          { code: 5, label: '未修复' },
-          { code: 4, label: '已修复' }
-        ],
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            prop: 'code',
-            slot: 'code',
-            label: '工单编号',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 150
-          },
-          {
-            prop: 'planCode',
-            label: '计划单号',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'planName',
-            label: '计划名称',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'executeUserName',
-            label: '报工人',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'accepterUserName',
-            label: '验收人',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            slot: 'faultLevel',
-            prop: 'faultLevel',
-            label: '故障等级',
-            align: 'center',
-            showOverflowTooltip: true,
-            formatter: (row) => {
-              return this.levelData[row.faultLevel] || '';
-            }
-          },
-          {
-            prop: 'contactName',
-            label: '客户名称',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'categoryName',
-            label: '设备名称',
-            align: 'center',
-            minWidth: 110,
-            showOverflowTooltip: true,
-            formatter: (row) => {
-              if (!row.deviceDetails) return '';
-              let str = '';
-              row.deviceDetails.map((el, idx) => {
-                if (idx + 1 == row.deviceDetails.length) {
-                  str += el.categoryName;
-                } else {
-                  str = str + '' + el.categoryName + ',';
-                }
-              });
-              return str;
-            }
-          },
-          {
-            prop: 'accepterTime',
-            label: '验收时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'acceptTime',
-            label: '开始时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'finishTime',
-            label: '结束时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'planFinishTime',
-            label: '计划完成时间',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'totalCost',
-            label: '费用( 元 )',
-            align: 'center',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            columnKey: 'inFactDuration',
-            label: '工时',
-            align: 'center',
-            resizable: false,
-            showOverflowTooltip: true,
-            minWidth: 120,
-            formatter: (row) => {
-              if (row.inFactDuration || row.inFactDuration == 0) {
-                let str = ((row.inFactDuration - 0) / 60).toFixed(1);
-                return str + '  小时';
+        {
+          action: 'single',
+          slot: 'single',
+          align: 'center',
+          label: '选择',
+          width: 50
+        },
+        {
+          prop: 'code',
+          slot: 'code',
+          label: '工单编号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 150
+        },
+        {
+          prop: 'planCode',
+          label: '计划单号',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'planName',
+          label: '计划名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'executeUserName',
+          label: '报工人',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'accepterUserName',
+          label: '验收人',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          slot: 'faultLevel',
+          prop: 'faultLevel',
+          label: '故障等级',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter: (row) => {
+            return this.levelData[row.faultLevel] || '';
+          }
+        },
+        {
+          prop: 'contactName',
+          label: '客户名称',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'categoryName',
+          label: '设备名称',
+          align: 'center',
+          minWidth: 110,
+          showOverflowTooltip: true,
+          formatter: (row) => {
+            if (!row.deviceDetails) return '';
+            let str = '';
+            row.deviceDetails.map((el, idx) => {
+              if (idx + 1 == row.deviceDetails.length) {
+                str += el.categoryName;
+              } else {
+                str = str + '' + el.categoryName + ',';
               }
+            });
+            return str;
+          }
+        },
+        {
+          prop: 'accepterTime',
+          label: '验收时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'acceptTime',
+          label: '开始时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'finishTime',
+          label: '结束时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'planFinishTime',
+          label: '计划完成时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'totalCost',
+          label: '费用( 元 )',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          columnKey: 'inFactDuration',
+          label: '工时',
+          align: 'center',
+          resizable: false,
+          showOverflowTooltip: true,
+          minWidth: 120,
+          formatter: (row) => {
+            if (row.inFactDuration || row.inFactDuration == 0) {
+              let str = ((row.inFactDuration - 0) / 60).toFixed(1);
+              return str + '  小时';
             }
-          },
-          {
-            prop: 'orderStatus',
-            label: '状态',
-            align: 'center',
-            showOverflowTooltip: true,
-            formatter: (row) => {
-              return this.workOrderStatus.find(
-                (item) => item.code == row.orderStatus
-              )?.label;
-            }
-          },
-
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 240,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true
           }
-        ],
-        // 加载状态
-        loading: false,
-        row: {},
-        levelData: {},
-        levelList: [],
-        orderStatus: 'all'
+        },
+        {
+          prop: 'orderStatus',
+          label: '状态',
+          align: 'center',
+          showOverflowTooltip: true,
+          formatter: (row) => {
+            return this.workOrderStatus.find(
+              (item) => item.code == row.orderStatus
+            )?.label;
+          }
+        },
+
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 240,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ],
+      // 加载状态
+      loading: false,
+      row: {},
+      levelData: {},
+      levelList: [],
+      orderStatus: 'all',
+      radioId: '',
+      currentRow: {},
+      browseShow: false
+    };
+  },
+
+  computed: {
+    // 评价
+    evaluateShow() {
+      return (row) => {
+        return row.orderStatus == 4;
       };
     },
-
-    computed: {
-      // 评价
-      evaluateShow() {
-        return (row) => {
-          return row.orderStatus == 4;
-        };
-      },
-      // 验收
-      acceptShow() {
-        return (row) => {
-          return row.orderStatus == 3 || row.orderStatus == 6;
-        };
+    // 验收
+    acceptShow() {
+      return (row) => {
+        return row.orderStatus == 3 || row.orderStatus == 6;
+      };
+    }
+  },
+  created() {
+    this.getLevelCode('fault_level');
+  },
+  methods: {
+    quotation(type) {
+      console.log(this.currentRow.id);
+      if (!this.currentRow.id) {
+        this.$message.warning('请先选择计划');
+        return;
       }
+      this.currentBusinessCode =
+        type === 'technical'
+          ? 'eomTechnicalDispatchOrder' // 技术派工单
+          : 'eomServiceDispatchOrder'; // 服务派工单
+      this.browseShow = true;
     },
-    created() {
-      this.getLevelCode('fault_level');
+    cancelQuo() {
+      this.browseShow = false;
     },
-    methods: {
-      handleClick(e) {
-        let where = this.$refs.workSearch.$refs.seekPage.defaultWhere || {};
-        this.reload(where);
-      },
-      //查询问题等级字典
-      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 };
+    cellClick(row) {
+      this.currentRow = row;
+      this.radioId = row.id;
+    },
+    handleClick(e) {
+      let where = this.$refs.workSearch.$refs.seekPage.defaultWhere || {};
+      this.reload(where);
+    },
+    //查询问题等级字典
+    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]
           });
-          this.levelList = arr;
-          this.levelData = obj;
-        }
-      },
-      /* 表格数据源 */
-      datasource({ page, limit, where, order }) {
-        return getSalesWorkOrder({ pageNum: page, size: limit, ...where });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        // 判断如果是选择的全部 不用传参
-        if (this.orderStatus == 'all') {
-          // where = where ? delete where.orderStatus : '';
-          if (where) {
-            delete where.orderStatus;
-          }
-          return this.$refs.table.reload({ page: 1, where });
-        }
-        // 不是的话 赋值工单状态
-        if (!where) {
-          where = { orderStatus: this.orderStatus };
-        } else {
-          where.orderStatus = this.orderStatus;
-        }
-        this.$refs.table.reload({ page: 1, where });
-        this.$emit('getToDoReminder')
+          obj = { ...obj, ...el };
+        });
+        this.levelList = arr;
+        this.levelData = obj;
+      }
+    },
+    /* 表格数据源 */
+    datasource({ page, limit, where, order }) {
+      return getSalesWorkOrder({ pageNum: page, size: limit, ...where });
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.radioId = ''; // 翻页/刷新时清空选中状态
+      this.currentRow = {}; // 同步清空当前行
 
-      },
-      async cancel(row) {
-        const res = await deleteSalesWorkOrder([row.id]);
-        if (res) {
-          this.$message.success('删除成功');
-          this.reload();
+      // 判断如果是选择的全部 不用传参
+      if (this.orderStatus == 'all') {
+        // where = where ? delete where.orderStatus : '';
+        if (where) {
+          delete where.orderStatus;
         }
-      },
-      async addSpareItems(row) {
-        let data = await getSalesWorkOrderById(row.id);
-        let dataP = {
-          receivingDeptName: data.executeGroupName,
-          receivingDeptId: data.executeGroupId,
-          recipientName: data.executeUserName,
-          recipientId: data.executeUserId,
-          name: data.name,
-          receptionUserId: data.receptionUserId,
-          id: data.id,
-          userId: data.executeUserId,
-          userName: data.executeUserName,
-          details: data.costListVOS.filter((item) => {
-            if (item.typeId == 2 && item.isApply != 1) {
-              item.totalPrice = item.settlementPrice;
-              item.categoryCode = item.code;
-              item.categoryName = item.name;
+        return this.$refs.table.reload({ page: 1, where });
+      }
+      // 不是的话 赋值工单状态
+      if (!where) {
+        where = { orderStatus: this.orderStatus };
+      } else {
+        where.orderStatus = this.orderStatus;
+      }
+      this.$refs.table.reload({ page: 1, where });
 
-              return item;
-            }
-          })
-        };
-        this.$refs.edit.open(JSON.parse(JSON.stringify(dataP)), 'work');
-      },
-      //接收
-      async handleReceive(row) {
-        const res = await receiveSalesWorkOrder(row);
-        if (!res) return;
-        this.$message.success('操作成功');
-        this.reload();
-      },
-      //验收
-      async checkAndAccept(accepterStatus) {
-        if (!this.form.accepterUserId) {
-          this.$message.warning('请选择验收人!');
-          return;
-        }
-        const res = await checkAndAccept({
-          id: this.row.id,
-          ...this.form,
-          accepterStatus
-        });
-        if (!res) return;
-        this.$message.success('操作成功');
-        this.visibleCheckAndAccept = false;
+      this.$emit('getToDoReminder');
+    },
+    async cancel(row) {
+      const res = await deleteSalesWorkOrder([row.id]);
+      if (res) {
+        this.$message.success('删除成功');
         this.reload();
-      },
-      accepterUserChange(item) {
-        this.form.accepterUserName = item.contactName;
-      },
+      }
+    },
+    async addSpareItems(row) {
+      let data = await getSalesWorkOrderById(row.id);
+      let dataP = {
+        receivingDeptName: data.executeGroupName,
+        receivingDeptId: data.executeGroupId,
+        recipientName: data.executeUserName,
+        recipientId: data.executeUserId,
+        name: data.name,
+        receptionUserId: data.receptionUserId,
+        id: data.id,
+        userId: data.executeUserId,
+        userName: data.executeUserName,
+        details: data.costListVOS.filter((item) => {
+          if (item.typeId == 2 && item.isApply != 1) {
+            item.totalPrice = item.settlementPrice;
+            item.categoryCode = item.code;
+            item.categoryName = item.name;
 
-      // 转派
-      async toRedeploy(row) {
-        this.$refs.redeployOtherRef.open(row, 'transfer');
-      },
-      //报工
-      async declarationForm(row, type) {
-        if (type !== 'view') {
-          let flag = await this.permission(row);
-          if (!flag) return;
-        }
-        this.$refs.declarationDialogRef.open(row, type);
-      },
-      // 校验
-      async permission(row, command) {
-        // 点评论/验收的话不走这个方法
-        if (command == 'evaluate' || command == 'checkAndAccept') {
-          return true;
-        }
-        try {
-          await checkByWorkId(row.id);
-          return true;
-        } catch {
-          return false;
-        }
-      },
-      goDetail(row) {
-        this.$refs.declarationDialogRef.open(row, 'view');
-      },
-      async handleCommand(command, row) {
-        let flag = await this.permission(row, command);
+            return item;
+          }
+        })
+      };
+      this.$refs.edit.open(JSON.parse(JSON.stringify(dataP)), 'work');
+    },
+    //接收
+    async handleReceive(row) {
+      const res = await receiveSalesWorkOrder(row);
+      if (!res) return;
+      this.$message.success('操作成功');
+      this.reload();
+    },
+    //验收
+    async checkAndAccept(accepterStatus) {
+      if (!this.form.accepterUserId) {
+        this.$message.warning('请选择验收人!');
+        return;
+      }
+      const res = await checkAndAccept({
+        id: this.row.id,
+        ...this.form,
+        accepterStatus
+      });
+      if (!res) return;
+      this.$message.success('操作成功');
+      this.visibleCheckAndAccept = false;
+      this.reload();
+    },
+    accepterUserChange(item) {
+      this.form.accepterUserName = item.contactName;
+    },
+
+    // 转派
+    async toRedeploy(row) {
+      this.$refs.redeployOtherRef.open(row, 'transfer');
+    },
+    //报工
+    async declarationForm(row, type) {
+      if (type !== 'view') {
+        let flag = await this.permission(row);
         if (!flag) return;
-        if (command === 'addSpareItems') {
-          this.addSpareItems(row);
-        }
-        if (command === 'handleReceive') {
-          this.handleReceive(row);
-        }
-        if (command === 'toRedeploy') {
-          this.toRedeploy(row);
-        }
-        if (command == 'evaluate') {
-          try {
-            await afterSalesEvaluation(row.id);
-            this.$refs.addDialogRef.open(row, 'add');
-          } catch (err) {}
-        }
-        if (command == 'checkAndAccept') {
-          try {
-            await afterSalesEvaluation(row.id);
-            this.visibleCheckAndAccept = true;
-            this.form = {
-              accepterUserId: '',
-              accepterUserName: '',
-              accepterRemark: ''
-            };
-            const { afterSalesDemandVO } = await getSalesWorkOrderById(row.id);
-            this.contactInfoVOS = afterSalesDemandVO.contactInfoVOS || [];
-            this.row = row;
-          } catch (err) {}
-        }
+      }
+      this.$refs.declarationDialogRef.open(row, type);
+    },
+    // 校验
+    async permission(row, command) {
+      // 点评论/验收的话不走这个方法
+      if (command == 'evaluate' || command == 'checkAndAccept') {
+        return true;
+      }
+      try {
+        await checkByWorkId(row.id);
+        return true;
+      } catch {
+        return false;
+      }
+    },
+    goDetail(row) {
+      this.$refs.declarationDialogRef.open(row, 'view');
+    },
+    async handleCommand(command, row) {
+      let flag = await this.permission(row, command);
+      if (!flag) return;
+      if (command === 'addSpareItems') {
+        this.addSpareItems(row);
+      }
+      if (command === 'handleReceive') {
+        this.handleReceive(row);
+      }
+      if (command === 'toRedeploy') {
+        this.toRedeploy(row);
+      }
+      if (command == 'evaluate') {
+        try {
+          await afterSalesEvaluation(row.id);
+          this.$refs.addDialogRef.open(row, 'add');
+        } catch (err) {}
+      }
+      if (command == 'checkAndAccept') {
+        try {
+          await afterSalesEvaluation(row.id);
+          this.visibleCheckAndAccept = true;
+          this.form = {
+            accepterUserId: '',
+            accepterUserName: '',
+            accepterRemark: ''
+          };
+          const { afterSalesDemandVO } = await getSalesWorkOrderById(row.id);
+          this.contactInfoVOS = afterSalesDemandVO.contactInfoVOS || [];
+          this.row = row;
+        } catch (err) {}
       }
     }
-  };
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .el-dropdown-link {
-    cursor: pointer;
-    color: var(--color-primary-5);
-  }
+.el-dropdown-link {
+  cursor: pointer;
+  color: var(--color-primary-5);
+}
 
-  .el-icon-arrow-down {
-    font-size: 12px;
-  }
+.el-icon-arrow-down {
+  font-size: 12px;
+}
 
-  ::v-deep .seep-search {
-    .el-input__inner {
-      padding: 0 5px 0 10px;
-    }
+::v-deep .seep-search {
+  .el-input__inner {
+    padding: 0 5px 0 10px;
   }
+}
 </style>