fix: 修复员工业绩图表 null 数据展示与甘特图日期格式解析错误
本次提交包含以下两个模块的修复:
1. fix(crm): 修复员工业绩环比/同比增长率基数为 0 时前端展示 null 的问题
- 问题原因:当上期(上月或去年同期)数据为 0 时,原代码返回字符串 'NULL',导致 ECharts 图表断点且表格显示乱码。
- 修复逻辑:重构计算规则。若上期为 0 且当期大于 0(从无到有),则增长率展示为 100%;若双方均为 0,则展示为 0%。
2. fix(mes): 修复甘特图批量保存时日期格式解析错误的问题
- 问题原因:前端在批量保存时传递给后端的 startTime 和 endTime 为 ISO 8601 格式(带 'T' 字符及毫秒数),导致后端在反序列化时抛出解析异常。
- 修复逻辑:引入 dayjs,在调用 updateTask 接口前统一将参数格式化为标准的 'YYYY-MM-DD HH:mm:ss' 格式,解决前后端日期格式不匹配问题。
| | |
| | | yAxisIndex: 1, |
| | | data: res.map((s: any) => |
| | | s.lastMonthCount === 0 |
| | | ? 'NULL' |
| | | ? (s.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((s.currentMonthCount - s.lastMonthCount) / |
| | | s.lastMonthCount) * |
| | |
| | | yAxisIndex: 1, |
| | | data: res.map((s: any) => |
| | | s.lastYearCount === 0 |
| | | ? 'NULL' |
| | | ? (s.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((s.currentMonthCount - s.lastYearCount) / |
| | | s.lastYearCount) * |
| | |
| | | yAxisIndex: 1, |
| | | data: res.map((s: any) => |
| | | s.lastMonthCount === 0 |
| | | ? 'NULL' |
| | | ? (s.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((s.currentMonthCount - s.lastMonthCount) / |
| | | s.lastMonthCount) * |
| | |
| | | yAxisIndex: 1, |
| | | data: res.map((s: any) => |
| | | s.lastYearCount === 0 |
| | | ? 'NULL' |
| | | ? (s.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((s.currentMonthCount - s.lastYearCount) / |
| | | s.lastYearCount) * |
| | |
| | | yAxisIndex: 1, |
| | | data: res.map((s: any) => |
| | | s.lastMonthCount === 0 |
| | | ? 'NULL' |
| | | ? (s.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((s.currentMonthCount - s.lastMonthCount) / |
| | | s.lastMonthCount) * |
| | |
| | | yAxisIndex: 1, |
| | | data: res.map((s: any) => |
| | | s.lastYearCount === 0 |
| | | ? 'NULL' |
| | | ? (s.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((s.currentMonthCount - s.lastYearCount) / |
| | | s.lastYearCount) * |
| | |
| | | tableData[2][`field${index}`] = item.lastYearCount; |
| | | tableData[3][`field${index}`] = |
| | | item.lastMonthCount === 0 |
| | | ? 'NULL' |
| | | ? (item.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((item.currentMonthCount - item.lastMonthCount) / |
| | | item.lastMonthCount) * |
| | |
| | | ).toFixed(2); |
| | | tableData[4][`field${index}`] = |
| | | item.lastYearCount === 0 |
| | | ? 'NULL' |
| | | ? (item.currentMonthCount > 0 ? 100 : 0).toFixed(2) |
| | | : ( |
| | | ((item.currentMonthCount - item.lastYearCount) / |
| | | item.lastYearCount) * |
| | |
| | | import { Page } from '@vben/common-ui'; |
| | | |
| | | import { Badge, Button, message } from 'ant-design-vue'; |
| | | import dayjs from 'dayjs'; |
| | | |
| | | import { getGanttTaskList, updateTask } from '#/api/mes/pro/task'; |
| | | |
| | |
| | | changes.map((change) => |
| | | updateTask({ |
| | | duration: change.duration, |
| | | endTime: change.endTime, |
| | | endTime: change.endTime ? dayjs(change.endTime).format('YYYY-MM-DD HH:mm:ss') : undefined, |
| | | id: change.id, |
| | | startTime: change.startTime, |
| | | startTime: change.startTime ? dayjs(change.startTime).format('YYYY-MM-DD HH:mm:ss') : undefined, |
| | | }), |
| | | ), |
| | | ); |
| | |
| | | |
| | | import { z } from '#/adapter/form'; |
| | | import { generateAutoCode } from '#/api/mes/md/autocode/record'; |
| | | import { getItemPage } from '#/api/mdm/item'; |
| | | import { getItemSimpleList } from '#/api/mdm/item'; |
| | | import { MdUnitMeasureSelect } from '#/views/mes/md/unitmeasure/components'; |
| | | import { QcIndicatorSelect } from '#/views/mes/qc/indicator/components'; |
| | | |
| | |
| | | placeholder: '请选择产品物料', |
| | | allowClear: true, |
| | | showSearch: true, |
| | | api: getItemPage, |
| | | resultField: 'list', |
| | | api: getItemSimpleList, |
| | | labelField: 'name', |
| | | valueField: 'id', |
| | | optionRender: (option: any) => { |