From a9d97b150701e634bdb751eab277696abd136cca Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 16 六月 2026 14:39:47 +0800
Subject: [PATCH] 君歌app 1.依照web端功能修改

---
 src/pages/oa/ReimburseManage/_utils/costReimburseUtils.js |  120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 120 insertions(+), 0 deletions(-)

diff --git a/src/pages/oa/ReimburseManage/_utils/costReimburseUtils.js b/src/pages/oa/ReimburseManage/_utils/costReimburseUtils.js
new file mode 100644
index 0000000..118b353
--- /dev/null
+++ b/src/pages/oa/ReimburseManage/_utils/costReimburseUtils.js
@@ -0,0 +1,120 @@
+import dayjs from "dayjs";
+
+export const EXPENSE_CATEGORY_OPTIONS = [
+  { label: "宸梾", value: "travel" },
+  { label: "鍔炲叕閲囪喘", value: "office_procurement" },
+  { label: "涓氬姟鎷涘緟", value: "business_entertainment" },
+  { label: "浜ら�氳垂", value: "transport" },
+  { label: "閫氳璐�", value: "communication" },
+  { label: "鍏朵粬", value: "other" },
+];
+
+export const EXPENSE_SUBJECT_OPTIONS = [
+  { label: "浜ら�氳垂", value: "transport" },
+  { label: "浣忓璐�", value: "hotel" },
+  { label: "椁愰ギ璐�", value: "meal" },
+  { label: "鍔炲叕鐢ㄥ搧", value: "office_supply" },
+  { label: "鎷涘緟璐�", value: "entertainment" },
+  { label: "閫氳璐�", value: "phone" },
+  { label: "鍏朵粬", value: "other" },
+];
+
+export const CATEGORY_TEMPLATES = {
+  travel: {
+    label: "宸梾璐圭敤",
+    reason: "鍥犲叕鍑哄樊浜х敓鐨勪氦閫氥�佷綇瀹裤�侀楗瓑璐圭敤鎶ラ攢銆�",
+    details: [
+      { expenseSubject: "transport", description: "寰�杩斾氦閫氳垂" },
+      { expenseSubject: "hotel", description: "浣忓璐�" },
+      { expenseSubject: "meal", description: "鍑哄樊椁愰ギ" },
+    ],
+  },
+  office_procurement: {
+    label: "鍔炲叕閲囪喘",
+    reason: "閮ㄩ棬鏃ュ父鍔炲叕鐢ㄥ搧銆佽�楁潗閲囪喘鎶ラ攢銆�",
+    details: [
+      { expenseSubject: "office_supply", description: "鍔炲叕鐢ㄥ搧閲囪喘" },
+      { expenseSubject: "office_supply", description: "鎵撳嵃鑰楁潗" },
+    ],
+  },
+  business_entertainment: {
+    label: "涓氬姟鎷涘緟",
+    reason: "瀹㈡埛鎺ュ緟銆佸晢鍔″璇风瓑璐圭敤鎶ラ攢銆�",
+    details: [
+      { expenseSubject: "entertainment", description: "瀹㈡埛鎺ュ緟椁愯垂" },
+      { expenseSubject: "entertainment", description: "鍟嗗姟绀煎搧" },
+    ],
+  },
+  transport: {
+    label: "浜ら�氳垂",
+    reason: "甯傚唴閫氬嫟銆佹墦杞︺�佸仠杞︾瓑浜ら�氳垂鐢ㄦ姤閿�銆�",
+    details: [{ expenseSubject: "transport", description: "甯傚唴浜ら��" }],
+  },
+  communication: {
+    label: "閫氳璐�",
+    reason: "鍥犲叕閫氳銆佹祦閲忋�佽瘽璐硅ˉ璐存姤閿�銆�",
+    details: [{ expenseSubject: "phone", description: "璇濊垂/娴侀噺" }],
+  },
+  other: {
+    label: "鍏朵粬璐圭敤",
+    reason: "鍏朵粬鍥犲叕鏀嚭璐圭敤鎶ラ攢銆�",
+    details: [{ expenseSubject: "other", description: "鍏朵粬璐圭敤" }],
+  },
+};
+
+export function expenseSubjectLabel(v) {
+  return EXPENSE_SUBJECT_OPTIONS.find(x => x.value === v)?.label || "鈥�";
+}
+
+export function expenseCategoryLabel(v) {
+  return EXPENSE_CATEGORY_OPTIONS.find(x => x.value === v)?.label || v || "鈥�";
+}
+
+export function expenseTypeToCategory(expenseType) {
+  const t = (expenseType || "").trim();
+  const hit = EXPENSE_CATEGORY_OPTIONS.find(x => x.label === t || x.value === t);
+  return hit?.value || "other";
+}
+
+export function createEmptyExpenseDetail() {
+  return {
+    id: `ed_${Date.now()}_${Math.random().toString(36).slice(2, 7)}`,
+    invoiceDate: "",
+    expenseSubject: "",
+    amount: "",
+    description: "",
+  };
+}
+
+export function createEmptyCostForm() {
+  return {
+    reimbursementId: undefined,
+    applicantId: "",
+    employeeNo: "",
+    employeeName: "",
+    expenseCategory: "other",
+    reimburseReason: "",
+    applyAmount: "",
+    payee: "",
+    payeeAccount: "",
+    bankBranch: "",
+    expenseDetails: [],
+    attachmentList: [],
+    approvalFlowNodes: [{ approverId: "", approverName: "", nodeOrder: 1, signMode: "countersign" }],
+    deptId: "",
+    deptName: "",
+  };
+}
+
+export function applyCategoryTemplate(form, category) {
+  const tpl = CATEGORY_TEMPLATES[category];
+  if (!tpl) return;
+  form.expenseCategory = category;
+  if (!form.reimburseReason?.trim()) form.reimburseReason = tpl.reason;
+  form.expenseDetails = (tpl.details || []).map(d => ({
+    ...createEmptyExpenseDetail(),
+    expenseSubject: d.expenseSubject,
+    description: d.description,
+    invoiceDate: dayjs().format("YYYY-MM-DD"),
+  }));
+}

--
Gitblit v1.9.3