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
| import dayjs from "dayjs";
|
| export const EXPENSE_SUBJECT_OPTIONS = [
| { label: "交通费", value: "transport" },
| { label: "住宿费", value: "hotel" },
| { label: "餐饮费", value: "meal" },
| { label: "其他", value: "other" },
| ];
|
| const TIER1_CITIES = ["北京", "上海", "广州", "深圳"];
|
| export function expenseSubjectLabel(v) {
| return EXPENSE_SUBJECT_OPTIONS.find(x => x.value === v)?.label || "—";
| }
|
| export function detectTravelTier(destination) {
| const city = (destination || "").trim();
| if (!city) return "tier3";
| if (TIER1_CITIES.some(c => city.includes(c))) return "tier1";
| const tier2Keywords = ["杭州", "南京", "武汉", "成都", "重庆", "西安", "天津", "苏州", "长沙", "郑州"];
| if (tier2Keywords.some(c => city.includes(c))) return "tier2";
| return "tier3";
| }
|
| export function getTravelStandardByTier(tier) {
| const map = {
| tier1: { hotelPerNight: 600, transportPerDay: 80, mealPerDay: 100, label: "一线城市" },
| tier2: { hotelPerNight: 450, transportPerDay: 60, mealPerDay: 80, label: "二线城市" },
| tier3: { hotelPerNight: 350, transportPerDay: 40, mealPerDay: 60, label: "其他城市" },
| };
| return map[tier] || map.tier3;
| }
|
| export function computeTravelDays(startStr, endStr) {
| if (!startStr || !endStr) return null;
| const t0 = dayjs(startStr);
| const t1 = dayjs(endStr);
| if (!t0.isValid() || !t1.isValid() || !t1.isAfter(t0)) return null;
| return Math.max(1, Math.ceil(t1.diff(t0, "day", true)));
| }
|
| export function createEmptyExpenseDetail() {
| return {
| id: `ed_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`,
| invoiceDate: "",
| expenseSubject: "",
| amount: "",
| description: "",
| };
| }
|
| export function createEmptyTravelForm() {
| return {
| reimbursementId: undefined,
| applicantId: "",
| employeeNo: "",
| employeeName: "",
| reimburseReason: "",
| travelStartTime: "",
| travelEndTime: "",
| travelDays: undefined,
| departurePlace: "",
| destination: "",
| hotelStandard: undefined,
| hotelDays: undefined,
| livingSubsidy: undefined,
| transportSubsidy: undefined,
| lodgingLimit: undefined,
| applyAmount: "",
| payee: "",
| payeeAccount: "",
| payeeBank: "",
| expenseDetails: [],
| attachmentList: [],
| approvalFlowNodes: [{ approverId: "", approverName: "", nodeOrder: 1, signMode: "countersign" }],
| needSpecialApproval: false,
| deptId: "",
| deptName: "",
| travelTier: "tier3",
| standardTag: "",
| };
| }
|
|