diff --git a/src/components/Tableexportcomponent/Tableexportcomponent.vue b/src/components/Tableexportcomponent/Tableexportcomponent.vue index bd35295b..2c7b8f49 100644 --- a/src/components/Tableexportcomponent/Tableexportcomponent.vue +++ b/src/components/Tableexportcomponent/Tableexportcomponent.vue @@ -159,6 +159,8 @@ const exportToExcel = () => { // 生成并下载文件 XLSX.writeFile(workbook, `${exportFileName.value}.xlsx`); + emit('update:tcTableexport', false); + ElMessage.success('导出成功'); }; // 定义一个事件发射器来通知父组件 const emit = defineEmits(['update:tcTableexport']); diff --git a/src/views/aftersales/aftersalesWorkOrder.vue b/src/views/aftersales/aftersalesWorkOrder.vue index d6f9470e..99f64aa5 100644 --- a/src/views/aftersales/aftersalesWorkOrder.vue +++ b/src/views/aftersales/aftersalesWorkOrder.vue @@ -1053,7 +1053,7 @@ const ButtonPermissions = computed(() => { add: false, //新增按钮 batchReject: false, //批量打回 assignment: false, //工单指派 - applyArbitration: true, //客服介入 + applyArbitration: false, //客服介入 batchFinish: false, //批量完结 Batchdetermination: false, //批量确定 ManagerConfirmed: false, //处理完毕下面的客服经理批量确定 @@ -2575,7 +2575,6 @@ const WorkOrderAssignment = () => { * @return {void} 无返回值 */ const CustomerServiceIntervention = () => { - if (!details.selectionList.length) { // 提示用户选择数据 ElMessage({ @@ -2584,11 +2583,6 @@ const CustomerServiceIntervention = () => { }); return; } - ElMessage({ - message: '功能维护中...', - type: 'warning', - }); - return; CustomerServiceForm.value.loadingCustomer = true; CustomerServiceForm.value.reasonRemarks = ''; }; @@ -2799,49 +2793,87 @@ const DestroyWindow = () => { const ExportSelection = () => { ExportObjects.value.ExportSelection = true; }; +/** + *获取当前时间 + */ +const getCurrentTime = () => { + const currentDate = new Date(); + const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1) + .toString() + .padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}${currentDate + .getHours() + .toString() + .padStart(2, '0')}${currentDate.getMinutes().toString().padStart(2, '0')}${currentDate + .getSeconds() + .toString() + .padStart(2, '0')}`; + return formattedDate; +}; // 导出表格 const exportReport = () => { - console.log('12312'); - ElMessageBox.confirm('是否导出报表?', { + ElMessageBox.confirm('是否确认导出数据?', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', }) .then(() => { - console.log(details.query, ''); - - let dataID = { + PageLoading.value = true; + const dataID = { workOrderStatus: workOrderStatus.value, + ids: details.selectionList.length + ? details.selectionList.map(item => item.id).join(',') + : undefined, }; - if (details.selectionList.length) { - dataID.ids = details.selectionList.map(item => item.id).join(','); - } - // JExportAll(dataID); + switch (TabPermissions.value) { case 0: - ExportAll(dataID); //全部 + exportData(dataID, '导出全部工单数据'); break; case 1: - ExportingDuringProcessing(dataID); + exportData(dataID, '导出处理中工单数据'); break; case 2: - ProcessedExported(dataID); + exportData(dataID, '导出处理完毕工单数据'); break; case 4: - // 理赔金额未出 - ExportClaimAmount(dataID); + exportData(dataID, '导出理赔金额工单数据'); break; - case 6: - // 完结 - CompleteExport(dataID); + case 6: + exportData(dataID, '导出完结工单数据'); break; default: - ExportAll(dataID); + exportData(dataID, '导出全部工单数据'); break; } }) .catch(() => {}); }; +/** + *导出数据 + */ + +const exportData = async (dataID, fileNamePrefix) => { + const exportFunctionMap = { + 0: $_exportWorkOrder0, + 1: $_exportWorkOrder1, + 2: $_exportWorkOrder3, + 4: $_exportWorkOrder2, + 6: $_exportWorkOrder4, + }; + + try { + const exportFunction = exportFunctionMap[TabPermissions.value] || $_exportWorkOrder0; + const res = await exportFunction(dataID); + downloadXls(res.data, `${fileNamePrefix}${getCurrentTime()}.xlsx`); + ExportObjects.value.ExportSelection = false; + ElMessage.success('导出成功'); + } catch (e) { + console.log(e); + } finally { + PageLoading.value = false; + } +}; + // 更新本地导出显示状态 const updateTcTableexport = newValue => { ExportObjects.value.tcTableexport = newValue; @@ -2849,6 +2881,7 @@ const updateTcTableexport = newValue => { // 本地导出 const LocalExport = () => { ExportObjects.value.tcTableexport = true; + ExportObjects.value.ExportSelection = false; }; // 网络导出 const NetworkExport = () => { @@ -2861,124 +2894,13 @@ const JExportAll = async dataID => { try { PageLoading.value = true; let res = await $_exportAftersalesWorkOrder(dataID); - const currentDate = new Date(); - const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1) - .toString() - .padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}${currentDate - .getHours() - .toString() - .padStart(2, '0')}${currentDate.getMinutes().toString().padStart(2, '0')}${currentDate - .getSeconds() - .toString() - .padStart(2, '0')}`; - downloadXls(res.data, `导出工单数据${formattedDate}.xlsx`); + downloadXls(res.data, `导出工单数据${getCurrentTime()}.xlsx`); PageLoading.value = false; } catch (e) { console.log(e); } finally { } }; - -// 全部导出 -const ExportAll = async dataID => { - try { - let res = await $_exportWorkOrder0(dataID); - const currentDate = new Date(); - const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1) - .toString() - .padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}${currentDate - .getHours() - .toString() - .padStart(2, '0')}${currentDate.getMinutes().toString().padStart(2, '0')}${currentDate - .getSeconds() - .toString() - .padStart(2, '0')}`; - downloadXls(res.data, `导出工单数据${formattedDate}.xlsx`); - } catch (e) { - console.log(e); - } finally { - } -}; -// 处理中导出 -const ExportingDuringProcessing = async dataID => { - try { - let res = await $_exportWorkOrder1(dataID); - const currentDate = new Date(); - const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1) - .toString() - .padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}${currentDate - .getHours() - .toString() - .padStart(2, '0')}${currentDate.getMinutes().toString().padStart(2, '0')}${currentDate - .getSeconds() - .toString() - .padStart(2, '0')}`; - downloadXls(res.data, `导出工单数据${formattedDate}.xlsx`); - } catch (e) { - console.log(e); - } finally { - } -}; -// 理赔金未出导出 -const ExportClaimAmount = async dataID => { - try { - let res = await $_exportWorkOrder2(dataID); - const currentDate = new Date(); - const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1) - .toString() - .padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}${currentDate - .getHours() - .toString() - .padStart(2, '0')}${currentDate.getMinutes().toString().padStart(2, '0')}${currentDate - .getSeconds() - .toString() - .padStart(2, '0')}`; - downloadXls(res.data, `导出工单数据${formattedDate}.xlsx`); - } catch (e) { - console.log(e); - } finally { - } -}; -// 完结导出 -const CompleteExport = async dataID => { - try { - let res = await $_exportWorkOrder4(dataID); - const currentDate = new Date(); - const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1) - .toString() - .padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}${currentDate - .getHours() - .toString() - .padStart(2, '0')}${currentDate.getMinutes().toString().padStart(2, '0')}${currentDate - .getSeconds() - .toString() - .padStart(2, '0')}`; - downloadXls(res.data, `导出工单数据${formattedDate}.xlsx`); - } catch (e) { - console.log(e); - } finally { - } -}; -// 处理完毕导出 -const ProcessedExported = async dataID => { - try { - let res = await $_exportWorkOrder3(dataID); - const currentDate = new Date(); - const formattedDate = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1) - .toString() - .padStart(2, '0')}${currentDate.getDate().toString().padStart(2, '0')}${currentDate - .getHours() - .toString() - .padStart(2, '0')}${currentDate.getMinutes().toString().padStart(2, '0')}${currentDate - .getSeconds() - .toString() - .padStart(2, '0')}`; - downloadXls(res.data, `导出工单数据${formattedDate}.xlsx`); - } catch (e) { - console.log(e); - } finally { - } -};