@@ -1628,13 +1672,53 @@ const details = reactive({
/** 签收数据 */
signforDataInfo: {
/** 当日签收数据 */
- daySignData: {},
+ daySignData: {
+ signNum: 0,
+ clerkOverTimeSignfoNum: 0,
+ clerkOverTimeScale: 0,
+ signScale: 0,
+ clerkSignNum: 0,
+ planNum: 0,
+ unSignNum: 0,
+ clerkSignforScale: 0,
+ data: [],
+ },
/** 当月签收数据 */
- monthSignData: {},
+ monthSignData: {
+ signNum: 0,
+ clerkOverTimeSignfoNum: 0,
+ clerkOverTimeScale: 0,
+ signScale: 0,
+ clerkSignNum: 0,
+ planNum: 0,
+ unSignNum: 0,
+ clerkSignforScale: 0,
+ data: [],
+ },
/** 当日自提签收数据 */
- dayBillLadingSignData: {},
+ dayBillLadingSignData: {
+ signNum: 0,
+ clerkOverTimeSignfoNum: 0,
+ clerkOverTimeScale: 0,
+ signScale: 0,
+ clerkSignNum: 0,
+ planNum: 0,
+ unSignNum: 0,
+ clerkSignforScale: 0,
+ data: [],
+ },
/** 当月自提签收数据 */
- monthBillLadingSignData: {},
+ monthBillLadingSignData: {
+ signNum: 0,
+ clerkOverTimeSignfoNum: 0,
+ clerkOverTimeScale: 0,
+ signScale: 0,
+ clerkSignNum: 0,
+ planNum: 0,
+ unSignNum: 0,
+ clerkSignforScale: 0,
+ data: [],
+ },
},
loadingObj: {
/** 开单数据 */
@@ -1996,15 +2080,7 @@ const initDeliveryData = async () => {
/** 签收数据 */
const initSignforData = async () => {
- const _keyArr = [
- 'signNum',
- 'unSignNum',
- 'signScale',
- 'clerkSignNum',
- 'clerkSignforScale',
- 'clerkOverTimeSignfoNum',
- 'clerkOverTimeScale',
- ];
+ const _keyArr = ['signNum', 'unSignNum', 'clerkSignNum', 'planNum', 'clerkOverTimeSignfoNum'];
const _obj = {
daySignData: { data: [] },
@@ -2030,6 +2106,8 @@ const initSignforData = async () => {
const item = _obj[key];
item[value] = 0;
+
+ console.log('item :>> ', item);
}
}
@@ -2042,6 +2120,7 @@ const initSignforData = async () => {
const key = _keyArr[j];
const _val = isNumber(value[key]) ? Number(value[key]) : 0;
+ value[key] = _val;
// 签收数据
if (Number(value.type) === 1) {
@@ -2063,6 +2142,106 @@ const initSignforData = async () => {
: // 自提签收数据
_obj.monthBillLadingSignData.data.push(value);
}
+
+ _obj.monthBillLadingSignData.totalSinNum = computeNumber(
+ _obj.monthBillLadingSignData.signNum,
+ '+',
+ _obj.monthBillLadingSignData.unSignNum
+ ).result;
+ _obj.monthSignData.totalSinNum = computeNumber(
+ _obj.monthSignData.signNum,
+ '+',
+ _obj.monthSignData.unSignNum
+ ).result;
+
+ console.log('_obj :>> ', _obj);
+
+ // 签收率
+ if (
+ !isNumber(_obj.monthBillLadingSignData.signNum) ||
+ !isNumber(_obj.monthBillLadingSignData.totalSinNum) ||
+ Number(_obj.monthBillLadingSignData.totalSinNum) === 0
+ ) {
+ _obj.monthBillLadingSignData.signScale = 0;
+ } else {
+ _obj.monthBillLadingSignData.signScale = computeNumber(
+ _obj.monthBillLadingSignData.signNum,
+ '/',
+ _obj.monthBillLadingSignData.totalSinNum
+ ).result;
+ }
+
+ if (
+ !isNumber(_obj.monthSignData.signNum) ||
+ !isNumber(_obj.monthSignData.totalSinNum) ||
+ Number(_obj.monthSignData.totalSinNum) === 0
+ ) {
+ _obj.monthSignData.signScale = 0;
+ } else {
+ _obj.monthSignData.signScale = computeNumber(
+ _obj.monthSignData.signNum,
+ '/',
+ _obj.monthSignData.totalSinNum
+ ).result;
+ }
+
+ // 文员签收率
+ if (
+ !isNumber(_obj.monthBillLadingSignData.clerkSignNum) ||
+ !isNumber(_obj.monthBillLadingSignData.planNum) ||
+ Number(_obj.monthBillLadingSignData.planNum) === 0
+ ) {
+ _obj.monthBillLadingSignData.clerkSignforScale = 0;
+ } else {
+ _obj.monthBillLadingSignData.clerkSignforScale = computeNumber(
+ Number(_obj.monthBillLadingSignData.clerkSignNum),
+ '/',
+ Number(_obj.monthBillLadingSignData.planNum)
+ ).result;
+ }
+
+ if (
+ !isNumber(_obj.monthSignData.clerkSignNum) ||
+ !isNumber(_obj.monthSignData.planNum) ||
+ Number(_obj.monthSignData.planNum) === 0
+ ) {
+ _obj.monthSignData.clerkSignforScale = 0;
+ } else {
+ _obj.monthSignData.clerkSignforScale = computeNumber(
+ Number(_obj.monthSignData.clerkSignNum),
+ '/',
+ Number(_obj.monthSignData.planNum)
+ ).result;
+ }
+
+ // 异常签收率
+ if (
+ !isNumber(_obj.monthBillLadingSignData.clerkOverTimeSignfoNum) ||
+ !isNumber(_obj.monthBillLadingSignData.planNum) ||
+ Number(_obj.monthBillLadingSignData.planNum) === 0
+ ) {
+ _obj.monthBillLadingSignData.clerkOverTimeScale = 0;
+ } else {
+ _obj.monthBillLadingSignData.clerkOverTimeScale = computeNumber(
+ _obj.monthBillLadingSignData.clerkOverTimeSignfoNum,
+ '/',
+ _obj.monthBillLadingSignData.planNum
+ ).result;
+ }
+
+ if (
+ !isNumber(_obj.monthSignData.clerkOverTimeSignfoNum) ||
+ !isNumber(_obj.monthSignData.planNum) ||
+ Number(_obj.monthSignData.planNum) === 0
+ ) {
+ _obj.monthSignData.clerkOverTimeScale = 0;
+ } else {
+ _obj.monthSignData.clerkOverTimeScale = computeNumber(
+ _obj.monthSignData.clerkOverTimeSignfoNum,
+ '/',
+ _obj.monthSignData.planNum
+ ).result;
+ }
}
// 当日数据
@@ -2097,11 +2276,12 @@ const initSignforData = async () => {
}
}
- details.signforDataInfo = data || [];
+ // details.signforDataInfo = data || [];
} catch (error) {
console.log('error :>> ', error);
} finally {
details.signforDataInfo = _obj;
+ console.log('details.signforDataInfo :>> ', details.signforDataInfo);
details.loadingObj.signforData = false;
}
};
@@ -2156,7 +2336,7 @@ const delivery_bill_info = computed(() => {
/** 签收数据 */
const signforData = computed
(() => {
const _obj: any = details.signforDataInfo[signforData_status.value] || {};
- console.log('_obj :>> ', _obj);
+ // console.log('_obj :>> ', _obj);
_obj.signScaleNum ? _obj.signScaleNum : (_obj.signScaleNum = _obj.signScale || 0);
_obj.clerkSignforScaleNum
@@ -2202,7 +2382,6 @@ const billSignforData = computed(() => {
type OptionObjType = { prop: string; tip: string };
-
// 定义两种颜色
const colors = ['#008CBA', '#808080']; // 蓝色和灰色
// /** 获取百分比 */
@@ -2317,10 +2496,15 @@ const getProportion = (value: number) => {
// });
// };
// 定义显示图表的函数,接受数据、标题、选项对象和图表类型(默认为饼图)
-const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType, chartType: string = 'pie') => {
- console.log('data :>> ', data);
- console.log('title :>> ', title);
- console.log('optionObj :>> ', optionObj);
+const handleShowEcharts = (
+ data: any[],
+ title: string,
+ optionObj: OptionObjType,
+ chartType: string = 'pie'
+) => {
+ console.log('data :>> ', data);
+ console.log('title :>> ', title);
+ console.log('optionObj :>> ', optionObj);
if (getObjType(data) !== 'array') return; // 检查传入的数据是否为数组,如果不是则返回
@@ -2344,7 +2528,8 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
const item = _arr[j]; // 获取当前 _arr 中的数据项
if (item.value > value[optionObj.prop]) continue; // 如果当前 _arr 中的数据项值大于当前数据项的值,继续下一个循环
- _arr.splice(j, 0, { // 在当前位置插入当前数据项
+ _arr.splice(j, 0, {
+ // 在当前位置插入当前数据项
name: value.warehouseName, // 数据项的名称
value: value[optionObj.prop], // 数据项的值
});
@@ -2353,13 +2538,15 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
}
if (isContinue) continue; // 如果已插入当前数据项,跳过插入到数组末尾的操作
- _arr.push({ // 如果未插入,将当前数据项添加到数组末尾
+ _arr.push({
+ // 如果未插入,将当前数据项添加到数组末尾
name: value.warehouseName, // 数据项的名称
value: value[optionObj.prop], // 数据项的值
});
}
- nextTick(() => { // 确保 DOM 更新完成后再进行图表初始化
+ nextTick(() => {
+ // 确保 DOM 更新完成后再进行图表初始化
// 获取图表容器元素
const chartDom = document.getElementById('echartBox');
if (!chartDom) return; // 如果未找到图表容器元素,则返回
@@ -2373,7 +2560,7 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
},
tooltip: {
trigger: 'item', // 设置提示框触发方式为数据项
- formatter: (params) => {
+ formatter: params => {
if (chartType === 'pie') {
return `${params.name}: ${params.value} (${params.percent}%)`; // 如果是饼图,格式化提示信息为名称、值和百分比
} else {
@@ -2385,7 +2572,8 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
orient: 'vertical', // 图例布局方向
left: 'left', // 图例位置
},
- ...(chartType === 'bar' && { // 如果是柱状图,添加柱状图的配置
+ ...(chartType === 'bar' && {
+ // 如果是柱状图,添加柱状图的配置
xAxis: {
type: 'category', // x 轴类型为类别
data: _arr.map(item => item.name), // x 轴数据为类别名称
@@ -2397,24 +2585,25 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
yAxis: {
type: 'value', // y 轴类型为数值
axisLabel: {
- formatter: (value) => {
+ formatter: value => {
return getProportion(value); // 将 y 轴标签格式化为百分比形式
- }
+ },
},
},
series: [
{
name: optionObj.tip, // 系列名称
type: 'bar', // 系列类型为柱状图
- data: _arr.map(item => ({ // 系列数据
+ data: _arr.map(item => ({
+ // 系列数据
name: item.name, // 数据项名称
value: item.value, // 数据项值
})),
itemStyle: {
- color: (params) => {
+ color: params => {
// 根据数据项的索引选择颜色
return colors[params.dataIndex % 2];
- }
+ },
},
emphasis: {
itemStyle: {
@@ -2426,9 +2615,9 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
show: true, // 显示高亮标签
fontSize: 20, // 高亮标签字体大小
fontWeight: 'bold', // 高亮标签字体粗细
- formatter: (params) => {
+ formatter: params => {
return getProportion(params.value); // 高亮标签格式化为百分比形式
- }
+ },
},
},
barGap: '30%', // 柱子之间的间隔
@@ -2437,12 +2626,14 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
},
],
}),
- ...(chartType === 'pie' && { // 如果是饼图,添加饼图的配置
+ ...(chartType === 'pie' && {
+ // 如果是饼图,添加饼图的配置
series: [
{
name: optionObj.tip, // 系列名称
type: 'pie', // 系列类型为饼图
- data: _arr.map((item) => ({ // 系列数据
+ data: _arr.map(item => ({
+ // 系列数据
name: item.name + ' - ' + getProportion(item.value / _total), // 数据项名称,附加百分比
value: item.value, // 数据项值
})),
@@ -2469,8 +2660,6 @@ const handleShowEcharts = (data: any[], title: string, optionObj: OptionObjType,
});
};
-
-
/** 请求详情 */
const handleDetails = async (type, title, optionObj: OptionObjType) => {
details.popUpShow.isShow = true;
@@ -2534,7 +2723,12 @@ const handleShowDeliveryDetail = (
handleShowEcharts(data, title, optionObj);
};
/** 显示售后异常数据 */
-const handleShowAbnormalData = (title, type: 'dayData' | 'monthData', optionObj: any = {},chartType) => {
+const handleShowAbnormalData = (
+ title,
+ type: 'dayData' | 'monthData',
+ optionObj: any = {},
+ chartType
+) => {
details.popUpShow.isShow = true;
details.title = title;
console.log(optionObj, 'optionObj');
@@ -2544,7 +2738,7 @@ const handleShowAbnormalData = (title, type: 'dayData' | 'monthData', optionObj:
if (getObjType(details.unloadAbnormalDataInfo[type]) !== 'object') return;
const { data } = details.unloadAbnormalDataInfo[type];
- handleShowEcharts(data, title, optionObj,chartType);
+ handleShowEcharts(data, title, optionObj, chartType);
};
/** 显示签收详情 */
@@ -2567,7 +2761,7 @@ const handleShowSignDetail = (
console.log('data :>> ', data);
- handleShowEcharts(data, title, optionObj,chartType);
+ handleShowEcharts(data, title, optionObj, chartType);
};
/** 导出 */