+
+
{{ billSignforData.clerkOverTimeScale ? billSignforData.clerkOverTimeScale : 0 }}
%
@@ -1459,7 +1581,16 @@ const details = reactive({
/** 配送数据 */
deliveryDataInfo: {},
/** 签收数据 */
- signforDataInfo: [],
+ signforDataInfo: {
+ /** 当日签收数据 */
+ daySignData: {},
+ /** 当月签收数据 */
+ monthSignData: {},
+ /** 当日自提签收数据 */
+ dayBillLadingSignData: {},
+ /** 当月自提签收数据 */
+ monthBillLadingSignData: {},
+ },
loadingObj: {
/** 开单数据 */
openOrderData: false,
@@ -1529,10 +1660,12 @@ const delivery_status = ref<
const abnormal_status = ref<'day' | 'month'>('day');
/** 签收数据状态 */
-const signforData_status = ref<'1' | '2'>('1');
+const signforData_status = ref<'daySignData' | 'monthSignData'>('daySignData');
/** 自提签收数据状态 */
-const billSignforData_status = ref<'3' | '4'>('3');
+const billSignforData_status = ref<'dayBillLadingSignData' | 'monthBillLadingSignData'>(
+ 'dayBillLadingSignData'
+);
/** 请求开单数据 */
const initOpenOrderData = async () => {
@@ -1782,15 +1915,112 @@ const initDeliveryData = async () => {
/** 签收数据 */
const initSignforData = async () => {
+ const _keyArr = [
+ 'signNum',
+ 'unSignNum',
+ 'signScale',
+ 'clerkSignNum',
+ 'clerkSignforScale',
+ 'clerkOverTimeSignfoNum',
+ 'clerkOverTimeScale',
+ ];
+
+ const _obj = {
+ daySignData: { data: [] },
+ monthSignData: { data: [] },
+ dayBillLadingSignData: { data: [] },
+ monthBillLadingSignData: { data: [] },
+ };
+
try {
details.loadingObj.signforData = true;
+
const res = await postSignforData({});
const { code, data } = res.data;
- if (code !== 200) return;
+ if (code !== 200 || getObjType(data) !== 'object') return;
+
+ const { monthData, dayData } = data;
+
+ // 初始化值
+ for (let i = 0; i < _keyArr.length; i++) {
+ const value = _keyArr[i];
+
+ for (let key in _obj) {
+ const item = _obj[key];
+
+ item[value] = 0;
+ }
+ }
+
+ // 当月签收数据
+ if (getObjType(monthData) === 'array') {
+ for (let i = 0; i < monthData.length; i++) {
+ const value = monthData[i];
+
+ for (let j = 0; j < _keyArr.length; j++) {
+ const key = _keyArr[j];
+
+ const _val = isNumber(value[key]) ? Number(value[key]) : 0;
+
+ // 签收数据
+ if (Number(value.type) === 1) {
+ _obj.monthSignData[key] = computeNumber(_obj.monthSignData[key], '+', _val).result;
+ }
+ // 自提签收数据
+ else {
+ _obj.monthBillLadingSignData[key] = computeNumber(
+ _obj.monthBillLadingSignData[key],
+ '+',
+ _val
+ ).result;
+ }
+ }
+
+ // 签收数据
+ Number(value.type) === 1
+ ? _obj.monthSignData.data.push(value)
+ : // 自提签收数据
+ _obj.monthBillLadingSignData.data.push(value);
+ }
+ }
+
+ // 当日数据
+ if (getObjType(dayData) === 'array') {
+ for (let i = 0; i < dayData.length; i++) {
+ const value = dayData[i];
+
+ for (let j = 0; j < _keyArr.length; j++) {
+ const key = _keyArr[j];
+
+ const _val = isNumber(value[key]) ? Number(value[key]) : 0;
+
+ // 签收数据
+ if (Number(value.type) === 1) {
+ _obj.daySignData[key] = computeNumber(_obj.daySignData[key], '+', _val).result;
+ }
+ // 自提签收数据
+ else {
+ _obj.dayBillLadingSignData[key] = computeNumber(
+ _obj.dayBillLadingSignData[key],
+ '+',
+ _val
+ ).result;
+ }
+ }
+
+ // 签收数据
+ Number(value.type) === 1
+ ? _obj.daySignData.data.push(value)
+ : // 自提签收数据
+ _obj.dayBillLadingSignData.data.push(value);
+ }
+ }
+
details.signforDataInfo = data || [];
} catch (error) {
console.log('error :>> ', error);
} finally {
+ details.signforDataInfo = _obj;
details.loadingObj.signforData = false;
}
};
@@ -1843,13 +2073,8 @@ const delivery_bill_info = computed(() => {
});
/** 签收数据 */
-const signforData = computed(() => {
- let _obj: any = {};
-
- for (let i = 0; i < details.signforDataInfo.length; i++) {
- const value = details.signforDataInfo[i];
- if (value.type + '' === signforData_status.value) _obj = value;
- }
+const signforData = computed
(() => {
+ const _obj: any = details.signforDataInfo[signforData_status.value] || {};
_obj.signScaleNum ? _obj.signScaleNum : (_obj.signScaleNum = _obj.signScale || 0);
_obj.clerkSignforScaleNum
@@ -1872,12 +2097,7 @@ const signforData = computed(() => {
/** 签收数据 -- 自提 */
const billSignforData = computed(() => {
- let _obj = {};
-
- for (let i = 0; i < details.signforDataInfo.length; i++) {
- const value = details.signforDataInfo[i];
- if (value.type + '' === billSignforData_status.value) _obj = value;
- }
+ const _obj: any = details.signforDataInfo[billSignforData_status.value] || {};
_obj.signScaleNum ? _obj.signScaleNum : (_obj.signScaleNum = _obj.signScale || 0);
_obj.clerkSignforScaleNum
@@ -1898,173 +2118,53 @@ const billSignforData = computed(() => {
return _obj;
});
-/** 请求详情 */
-const handleDetails = async (type, title, optionObj: any = {}) => {
- details.popUpShow.isShow = true;
- details.loadingObj.loading = true;
- details.title = title;
-
- try {
- let res: any = { data: {} };
- switch (type) {
- // 开单数据
- case 'openOrderColumn':
- res = await postOpenOrderDataByWarehouseId({});
- break;
-
- // 库位数据
- case 'allocationDataColumn':
- res = await postAllocationDataByWarehouseId({});
- break;
-
- // 在库数据
- case 'handOrderDataColumn':
- res = await postHandOrderDataByWarehouseId({});
- break;
-
- // 干线车次数据
- case 'trunklineCarsDataColumn':
- res = await postTrunklineCarsDataByWarehouseId({});
- break;
-
- default:
- break;
- }
- const { code, data } = res.data;
- if (code !== 200 || getObjType(data) !== 'array') return;
-
- const _arr = [];
-
- for (let i = 0; i < data.length; i++) {
- const value = data[i];
+type OptionObjType = { prop: string; tip: string };
- let isContinue = false;
+/** 获取百分比 */
+const getProportion = (value: number, total: number) => {
+ if (total === 0) return '0%';
+ if (!isNumber(value)) return '0%';
+ return computeNumber(Number(value), '/', total).next('*', 100).result.toFixed(2) + '%';
+};
- for (let j = 0; j < _arr.length; j++) {
- const item = _arr[j];
- if (item.value > value[optionObj.prop]) continue;
- _arr.splice(j, 0, {
- name: value.warehouseName + ' - ' + value[optionObj.prop],
- value: value[optionObj.prop],
- });
- isContinue = true;
- break;
- }
- if (isContinue) continue;
+/** 显示图表 */
+const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType) => {
+ if (getObjType(data) !== 'array') return;
- _arr.push({
- name: value.warehouseName + ' - ' + value[optionObj.prop],
- value: value[optionObj.prop],
- });
- }
+ const _arr = [];
- nextTick(() => {
- // 初始化Echarts
- const chartDom = document.getElementById('echartBox');
- const myChart = echarts.init(chartDom);
+ let _total = 0;
- const option = {
- title: {
- text: title,
- // subtext: 'Fake Data',
- left: 'center',
- },
- tooltip: {
- trigger: 'item',
- },
- legend: {
- orient: 'vertical',
- left: 'left',
- },
- series: [
- {
- name: optionObj.tip,
- // 数据显示类型 -- 扇形
- type: 'pie',
- // radius: '50%',
- // 数据
- data: _arr,
- // 激活样式
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: 'rgba(0, 0, 0, 0.5)',
- },
- label: {
- show: true,
- fontSize: 20,
- fontWeight: 'bold',
- },
- },
- // 扇区显示
- radius: ['30%', '70%'],
- avoidLabelOverlap: false,
- // 扇区间隔
- padAngle: 2,
- // 最小显示角度
- minShowLabelAngle: 5,
- // 距离左侧的距离
- left: '20%',
- },
- ],
- };
+ for (let i = 0; i < data.length; i++) {
+ const value = data[i];
- option && myChart.setOption(option);
- });
+ value[optionObj.prop] = isNumber(value[optionObj.prop]) ? Number(value[optionObj.prop]) : 0;
- // details.tableData = data;
- // details.renderData = data;
- } catch (error) {
- console.log('error :>> ', error);
- } finally {
- details.loadingObj.loading = false;
+ _total = computeNumber(_total, '+', value[optionObj.prop]).result;
}
-};
-
-/** 显示配送详情 */
-const handleShowDeliveryDetail = (
- title,
- type:
- | 'tradeMatching'
- | 'outsourceTradeMatching'
- | 'municipalAllocation'
- | 'outsourceMunicipalAllocation'
- | 'billLading',
- optionObj: any = {}
-) => {
- details.popUpShow.isShow = true;
- details.title = title;
-
- if (getObjType(details.deliveryDataInfo[type]) !== 'object') return;
-
- const { data } = details.deliveryDataInfo[type];
- const _arr = [];
+ for (let i = 0; i < data.length; i++) {
+ const value = data[i];
- if (getObjType(_arr) === 'array') {
- for (let i = 0; i < data.length; i++) {
- const value = data[i];
+ let isContinue = false;
- let isContinue = false;
+ for (let j = 0; j < _arr.length; j++) {
+ const item = _arr[j];
+ if (item.value > value[optionObj.prop]) continue;
- for (let j = 0; j < _arr.length; j++) {
- const item = _arr[j];
- if (item.value > value[optionObj.prop]) continue;
- _arr.splice(j, 0, {
- name: value.warehouseName + ' - ' + value[optionObj.prop],
- value: value[optionObj.prop],
- });
- isContinue = true;
- break;
- }
- if (isContinue) continue;
-
- _arr.push({
- name: value.warehouseName + ' - ' + value[optionObj.prop],
+ _arr.splice(j, 0, {
+ name: value.warehouseName + ' - ' + getProportion(value[optionObj.prop], _total),
value: value[optionObj.prop],
});
+ isContinue = true;
+ break;
}
+ if (isContinue) continue;
+
+ _arr.push({
+ name: value.warehouseName + ' - ' + getProportion(value[optionObj.prop], _total),
+ value: value[optionObj.prop],
+ });
}
nextTick(() => {
@@ -2076,7 +2176,7 @@ const handleShowDeliveryDetail = (
title: {
text: title,
// subtext: 'Fake Data',
- left: 'center',
+ left: 'right',
},
tooltip: {
trigger: 'item',
@@ -2108,11 +2208,11 @@ const handleShowDeliveryDetail = (
},
// 扇区显示
radius: ['30%', '70%'],
- avoidLabelOverlap: false,
+ // avoidLabelOverlap: false,
// 扇区间隔
- padAngle: 2,
+ // padAngle: 2,
// 最小显示角度
- minShowLabelAngle: 5,
+ // minShowLabelAngle: 5,
// 距离左侧的距离
left: '20%',
},
@@ -2123,6 +2223,88 @@ const handleShowDeliveryDetail = (
});
};
+/** 请求详情 */
+const handleDetails = async (type, title, optionObj: OptionObjType) => {
+ details.popUpShow.isShow = true;
+ details.loadingObj.loading = true;
+ details.title = title;
+
+ try {
+ let res: any = { data: {} };
+ switch (type) {
+ // 开单数据
+ case 'openOrderColumn':
+ res = await postOpenOrderDataByWarehouseId({});
+ break;
+
+ // 库位数据
+ case 'allocationDataColumn':
+ res = await postAllocationDataByWarehouseId({});
+ break;
+
+ // 在库数据
+ case 'handOrderDataColumn':
+ res = await postHandOrderDataByWarehouseId({});
+ break;
+
+ // 干线车次数据
+ case 'trunklineCarsDataColumn':
+ res = await postTrunklineCarsDataByWarehouseId({});
+ break;
+
+ default:
+ break;
+ }
+ const { code, data } = res.data;
+ if (code !== 200 || getObjType(data) !== 'array') return;
+
+ handleShowEcharts(data, title, optionObj);
+ } catch (error) {
+ console.log('error :>> ', error);
+ } finally {
+ details.loadingObj.loading = false;
+ }
+};
+
+/** 显示配送详情 */
+const handleShowDeliveryDetail = (
+ title,
+ type:
+ | 'tradeMatching'
+ | 'outsourceTradeMatching'
+ | 'municipalAllocation'
+ | 'outsourceMunicipalAllocation'
+ | 'billLading',
+ optionObj: any = {}
+) => {
+ details.popUpShow.isShow = true;
+ details.title = title;
+
+ if (getObjType(details.deliveryDataInfo[type]) !== 'object') return;
+
+ const { data } = details.deliveryDataInfo[type];
+
+ handleShowEcharts(data, title, optionObj);
+};
+
+/** 显示签收详情 */
+const handleShowSignDetail = (
+ title,
+ type: 'daySignData' | 'monthSignData' | 'dayBillLadingSignData' | 'monthBillLadingSignData',
+ optionObj: any = {}
+) => {
+ details.popUpShow.isShow = true;
+ details.title = title;
+
+ if (getObjType(details.signforDataInfo[type]) !== 'object') return;
+
+ const { data } = details.signforDataInfo[type];
+
+ console.log('data :>> ', data);
+
+ handleShowEcharts(data, title, optionObj);
+};
+
/** 导出 */
const handleExport = () => {
exportExcelByDom(exportColumnListNode.value.$el, `${details.title} - ${dateNow()}.xlsx`);