Skip to content

Commit

Permalink
fix(sidepanel): data upload chart display
Browse files Browse the repository at this point in the history
  • Loading branch information
lastsunday committed Nov 19, 2024
1 parent 2888f65 commit 85f445b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/sidepanel/views/dataSharePlan/StatisticView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ const chartUploadData = ref();
const chartDownloadData = ref();
const chartMergeData = ref();
let UPLOAD_NAME_OBJECT = {
"JOB_DATA_UPLOAD": "职位数据",
"COMPANY_DATA_UPLOAD": "公司数据",
"COMPANY_TAG_DATA_UPLOAD": "公司标签数据",
}
const onClickSearch = async () => {
refresh();
};
Expand Down Expand Up @@ -70,32 +76,34 @@ onUnmounted(() => {
const refresh = async () => {
let startDate = dayjs(form.datetimeRange[0]);
let endDate = dayjs(form.datetimeRange[1]);
chartUploadData.value = convertToChartData({ startDate, endDate, queryResult: await TaskApi.taskStatisticUpload({ startDate, endDate }), convertNameFunction: convertUploadName });
chartUploadData.value = convertToChartData({ startDate, endDate, queryResult: await TaskApi.taskStatisticUpload({ startDate, endDate }), convertNameFunction: convertUploadName, defaultNameArray: Object.keys(UPLOAD_NAME_OBJECT) });
chartDownloadData.value = convertToChartData({ startDate, endDate, queryResult: await TaskApi.taskStatisticDownload({ startDate, endDate }), convertNameFunction: null });
chartMergeData.value = convertToChartData({ startDate, endDate, queryResult: await TaskApi.taskStatisticMerge({ startDate, endDate }), convertNameFunction: null });
}
let UPLOAD_NAME_OBJECT = {
"JOB_DATA_UPLOAD": "职位数据",
"COMPANY_DATA_UPLOAD": "公司数据",
"COMPANY_TAG_DATA_UPLOAD": "公司标签数据",
}
const convertUploadName = (name) => {
return UPLOAD_NAME_OBJECT[name] ?? name;
}
const convertToChartData = ({ startDate, endDate, queryResult, convertNameFunction }) => {
const convertToChartData = ({ startDate, endDate, queryResult, convertNameFunction, defaultNameArray }) => {
let rangeDate = genRangeDate(startDate, endDate);
rangeDate.sort();
let nameArray = null;
let nameMap = new Map();
if (defaultNameArray) {
defaultNameArray.forEach(name => {
if (!nameMap.has(name)) {
nameMap.set(name, null);
}
});
}
queryResult.forEach(item => {
if (!nameMap.has(item.name)) {
nameMap.set(item.name, null);
}
});
nameArray = Array.from(nameMap.keys());
let seriesData = [];
let nameArray = Array.from(nameMap.keys());
let nameAndDateTotalMapMap = new Map();
nameArray.forEach(name => {
let map = new Map();
Expand Down

0 comments on commit 85f445b

Please sign in to comment.