diff --git a/src/api/wel/index.js b/src/api/wel/index.js index 25d115ac..17228b74 100644 --- a/src/api/wel/index.js +++ b/src/api/wel/index.js @@ -168,3 +168,15 @@ export const postSignforData = data => { data, }); }; +/** + * 异常数据 + * @param {Object} data + * @returns + */ +export const $_aftersalesData = params => { + return request({ + url: '/api/logpm-report/warehouseIndex/aftersalesData', + method: 'get', + params, + }); +}; diff --git a/src/views/aftersales/aftersalesWorkOrder.vue b/src/views/aftersales/aftersalesWorkOrder.vue index 8073915f..6ed504ec 100644 --- a/src/views/aftersales/aftersalesWorkOrder.vue +++ b/src/views/aftersales/aftersalesWorkOrder.vue @@ -2848,6 +2848,7 @@ const exportReport = () => { ids: details.selectionList.length ? details.selectionList.map(item => item.id).join(',') : undefined, + ...details.query, }; switch (TabPermissions.value) { diff --git a/src/views/aftersales/aftersalesWorkOrderInfo.vue b/src/views/aftersales/aftersalesWorkOrderInfo.vue index aebd0106..5bcbbba7 100644 --- a/src/views/aftersales/aftersalesWorkOrderInfo.vue +++ b/src/views/aftersales/aftersalesWorkOrderInfo.vue @@ -1186,6 +1186,13 @@ const Completionpermissions = computed(() => { } return false; }); + +const processedText=(inputtxt)=>{ + if (inputtxt.endsWith('\n') && !inputtxt.endsWith('\n ')) { + return inputtxt.slice(0, -1); + } + return inputtxt; +} const onLoad = async () => { pageState.value = true; //开启页面加载 if (await localStorage.getItem('my_data')) { @@ -1271,12 +1278,12 @@ const onLoad = async () => { // res.data.data.personResponsibleVOS.forEach(item => { // sum = Number(item.responsibilityRatio) + sum; // }); - FangAddList.value = res.data.data.personResponsibleVOS.map(res => { + FangAddList.value = res.data.data.personResponsibleVOS.map(res => { return { businessName: res.businessId, //责任人ID personResponsibleName: res.personResponsibleName, //责任人名称 responsibilityRatio: res.responsibilityRatio, //占比 - description: res.description, //说明 + description: processedText(res.description), //说明 tripartite: res.tripartite, //三方责任人 }; }); @@ -1390,6 +1397,7 @@ const onLoad = async () => { Paymentmethod.value = res.data.data; }); }; + onMounted(() => { watch( () => $route.path, // 只监听路由参数 diff --git a/src/views/desk/DataBoard.vue b/src/views/desk/DataBoard.vue index b4e9f7bd..edf5aa2e 100644 --- a/src/views/desk/DataBoard.vue +++ b/src/views/desk/DataBoard.vue @@ -804,7 +804,17 @@ 待处理
- {{ abnormal_Info.noDealNum }} + {{ abnormal_Info.noDealNum }}
@@ -1492,6 +1502,7 @@ import { postAllocationDataByWarehouseId, postHandOrderDataByWarehouseId, postTrunklineCarsDataByWarehouseId, + $_aftersalesData, } from '@/api/wel/index'; import { exportExcelByDom } from '@/utils/export'; import * as echarts from 'echarts'; @@ -1569,14 +1580,16 @@ const details = reactive({ }, /** 异常卸车数据 */ unloadAbnormalDataInfo: { - abnormalDayRate: '0', - abnormalMonthRate: '0', + abnormalDayRate: 0, + abnormalMonthRate: 0, noDealDayNum: 0, noDealMonthNum: 0, sendDayNum: 0, sendMonthNum: 0, unloadDayNum: 0, unloadMonthNum: 0, + dayData: [], + monthData: [], }, /** 配送数据 */ deliveryDataInfo: {}, @@ -1756,15 +1769,48 @@ const initTrunklineCarsData = async () => { details.loadingObj.trunklineCarsData = false; } }; +function accumulateData(targetInfo, dataArray, isMonthly) { + for (let i = 0; i < dataArray.length; i++) { + const item = dataArray[i]; + if (isMonthly) { + targetInfo.sendMonthNum += item.totalNum; //发起数 + targetInfo.noDealMonthNum += item.unCompleteNum; //待处理 + targetInfo.abnormalMonthRate += item.completeNum; //异常率 + } else { + targetInfo.sendDayNum += item.totalNum; //发起数 + targetInfo.noDealDayNum += item.unCompleteNum; //待处理 + targetInfo.abnormalDayRate += item.completeNum; //异常率 + } + } +} -/** 卸车异常数据 */ +/**异常数据 */ const initUnloadAbnormalData = async () => { + return try { details.loadingObj.unloadAbnormalData = true; - const res = await postUnloadAbnormalData({}); + const res = await $_aftersalesData({}); + console.log('resw:>> ', res); + const { code, data } = res.data; if (code !== 200) return; - details.unloadAbnormalDataInfo = data || {}; + console.log(data, '异常数据'); + + // 处理 dayData + await accumulateData(details.unloadAbnormalDataInfo, data.dayData, false); + + // 处理 monthData + await accumulateData(details.unloadAbnormalDataInfo, data.monthData, true); + + // 计算异常率 + details.unloadAbnormalDataInfo.abnormalMonthRate = + (details.unloadAbnormalDataInfo.abnormalMonthRate / + details.unloadAbnormalDataInfo.sendMonthNum) * + 100; + + details.unloadAbnormalDataInfo.abnormalDayRate = + (details.unloadAbnormalDataInfo.abnormalDayRate / details.unloadAbnormalDataInfo.sendDayNum) * + 100; } catch (error) { console.log('error :>> ', error); } finally { @@ -2251,7 +2297,6 @@ const handleDetails = async (type, title, optionObj: OptionObjType) => { case 'trunklineCarsDataColumn': res = await postTrunklineCarsDataByWarehouseId({}); break; - default: break; } @@ -2284,6 +2329,23 @@ const handleShowDeliveryDetail = ( const { data } = details.deliveryDataInfo[type]; + handleShowEcharts(data, title, optionObj); +}; +/** 显示售后异常数据 */ + +const handleShowAbnormalData = (title, type: 'noDealNum', optionObj: any = {}) => { + details.popUpShow.isShow = true; + details.title = title; + console.log(optionObj, 'optionObj'); + console.log(type, 'type'); + console.log(title, 'title'); + + if (getObjType(details.unloadAbnormalDataInfo[type]) !== 'object') return; + + + const { data } = details.deliveryDataInfo[type]; + + handleShowEcharts(data, title, optionObj); };