constants.js
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import {
formatJournalDate,
formatJournalDateTime,
JOURNAL_EMPTY_TEXT,
} from "./utils/journalDateTime";
export const JOURNAL_TABS = [
{ key: "storeDaily", label: "门店日报", journalType: 2 },
];
export const BIZ_TYPE_TOOLTIP = "轻改:1.1精品升级、1.2次新车升配、1.3售后众筹;延保:2.3.1售前延保、2.3.2售后延保;权益:2.1.1售前会员权益升级、2.1.2售后会员权益升级";
export const BIZ_TYPE_STYLE = {
1: { label: "轻改", bg: "#E8F3FF", color: "#1677FF" },
2: { label: "权益", bg: "#F3E8FF", color: "#722ED1" },
轻改: { label: "轻改", bg: "#E8F3FF", color: "#1677FF" },
延保: { label: "延保", bg: "#FFF7E6", color: "#D46B08" },
权益: { label: "权益", bg: "#F3E8FF", color: "#722ED1" },
};
export const TAB_TRACK_CODE_MAP = {
storeDaily: "journal_web_tab_click_store_daily",
};
export const LIST_API_MAP = {
storeDaily: "getDailyReportOverviewPage",
};
export function getTemplateTypeByTabKey(tabKey) {
const tab = JOURNAL_TABS.find(item => item.key === tabKey);
return tab?.journalType ?? 2;
}
export function getTabKeyByTemplateType(templateType) {
const tab = JOURNAL_TABS.find(item => item.journalType === templateType);
return tab?.key ?? "storeDaily";
}
export { formatJournalDate, formatJournalDateTime } from "./utils/journalDateTime";
const bizTypeColumn = {
label: "业务大类",
prop: "bizTypeName",
minWidth: "100px",
width: "100px",
addHtml: "bizType",
isPopConfig: {
width: 320,
text: BIZ_TYPE_TOOLTIP,
},
};
function createDateTimeColumn(label, prop) {
return {
label,
prop,
minWidth: "170px",
formatter: row => formatJournalDateTime(row[prop]),
};
}
function createEmptyTextColumn(label, prop, options = {}) {
return {
label,
prop,
formatter: (row) => {
const value = row[prop];
return value != null && value !== "" ? value : "—";
},
...options,
};
}
export const TABLE_COLUMNS_MAP = {
storeDaily: [
{
label: "所属门店",
prop: "merchantName",
minWidth: "160px",
showOverFlow: true,
align: "center",
},
bizTypeColumn,
{
label: "今日驻店人数",
prop: "staffCount",
width: "120px",
formatter: row => (row.staffCount != null ? `${row.staffCount}人` : "—"),
},
createDateTimeColumn("最近保存时间", "lastSaveTime"),
createDateTimeColumn("上报时间", "submissionDate"),
createEmptyTextColumn("提交人", "staffName", {
minWidth: "100px",
width: "120px",
showOverFlow: true,
}),
],
};
export function getDetailTitle(detail, journalType) {
const { merchantName, reportDate } = detail;
const formattedDate = formatJournalDate(reportDate);
const dateText = formattedDate !== JOURNAL_EMPTY_TEXT ? `(${formattedDate})` : "";
const titleMap = {
storeDaily: `${merchantName}的门店日报${dateText}`,
};
return titleMap[journalType] || "";
}