From 4762afb6cb043a3e539ed7ec8da5bde997bfaf65 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 29 五月 2026 11:51:41 +0800
Subject: [PATCH] 英泽防锈 1.车辆管理页面开发联调
---
src/views/officeProcessAutomation/ApproveManage/approve-template/selectOptionSource.js | 36 ++++++++++++++++++++++++++++++++----
1 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/selectOptionSource.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/selectOptionSource.js
index 99706b4..1e19bb6 100644
--- a/src/views/officeProcessAutomation/ApproveManage/approve-template/selectOptionSource.js
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/selectOptionSource.js
@@ -1,16 +1,19 @@
import { deptTreeSelect, userListNoPageByTenantId } from "@/api/system/user.js";
+import { listVehiclePage } from "@/api/officeProcessAutomation/vehicle.js";
/** 涓嬫媺閫夐」鏉ユ簮锛堝啓鍏� formConfig锛屾彁浜ら〉鎸夋潵婧愭媺鍙栨暟鎹級 */
export const SELECT_OPTION_SOURCE = {
STATIC: "static",
USER: "user",
DEPT: "dept",
+ VEHICLE: "vehicle",
};
export const SELECT_OPTION_SOURCE_OPTIONS = [
{ value: SELECT_OPTION_SOURCE.STATIC, label: "鎵嬪姩閰嶇疆", desc: "鍦ㄦā鏉夸腑鑷畾涔夐�夐」鏂囨湰涓庡��" },
{ value: SELECT_OPTION_SOURCE.USER, label: "浜哄憳鍒楄〃", desc: "浠庣郴缁熺敤鎴蜂腑閫夋嫨锛屽�间负鐢ㄦ埛 ID" },
{ value: SELECT_OPTION_SOURCE.DEPT, label: "閮ㄩ棬鍒楄〃", desc: "浠庣粍缁囨灦鏋勪腑閫夋嫨锛屽�间负閮ㄩ棬 ID" },
+ { value: SELECT_OPTION_SOURCE.VEHICLE, label: "杞﹁締鍒楄〃", desc: "浠庤溅杈嗙鐞嗕腑閫夋嫨锛屽�间负杞︾墝鍙�" },
];
export function selectOptionSourceLabel(source) {
@@ -18,7 +21,7 @@
}
export function isDynamicOptionSource(source) {
- return source === SELECT_OPTION_SOURCE.USER || source === SELECT_OPTION_SOURCE.DEPT;
+ return source === SELECT_OPTION_SOURCE.USER || source === SELECT_OPTION_SOURCE.DEPT || source === SELECT_OPTION_SOURCE.VEHICLE;
}
function unwrapArray(payload) {
@@ -69,6 +72,14 @@
});
}
+/** 杞﹁締 鈫� 涓嬫媺 option */
+export function mapVehicleToSelectOption(v) {
+ return {
+ label: v.plateNumber || `杞﹁締${v.id}`,
+ value: v.plateNumber || String(v.id),
+ };
+}
+
/** 鎸夊瓧娈甸厤缃В鏋愪笅鎷� options锛堥渶浼犲叆宸插姞杞界殑缂撳瓨锛� */
export function resolveFieldSelectOptions(field, caches = {}) {
const source = field?.optionSource || SELECT_OPTION_SOURCE.STATIC;
@@ -77,6 +88,9 @@
}
if (source === SELECT_OPTION_SOURCE.DEPT) {
return caches.deptOptions || [];
+ }
+ if (source === SELECT_OPTION_SOURCE.VEHICLE) {
+ return (caches.vehicles || []).map(mapVehicleToSelectOption);
}
return (field?.options || []).filter((o) => o.value !== "" && o.value != null);
}
@@ -89,13 +103,14 @@
return hit?.label || String(val);
}
-/** 鍔犺浇浜哄憳 / 閮ㄩ棬缂撳瓨锛堝澶勫鐢級 */
+/** 鍔犺浇浜哄憳 / 閮ㄩ棬 / 杞﹁締缂撳瓨锛堝澶勫鐢級 */
export async function fetchSelectOptionCaches(sources = []) {
const needUser = sources.includes(SELECT_OPTION_SOURCE.USER);
const needDept = sources.includes(SELECT_OPTION_SOURCE.DEPT);
- const caches = { users: [], deptOptions: [] };
+ const needVehicle = sources.includes(SELECT_OPTION_SOURCE.VEHICLE);
+ const caches = { users: [], deptOptions: [], vehicles: [] };
- if (!needUser && !needDept) return caches;
+ if (!needUser && !needDept && !needVehicle) return caches;
const tasks = [];
if (needUser) {
@@ -123,6 +138,19 @@
})
);
}
+ if (needVehicle) {
+ tasks.push(
+ listVehiclePage({ current: 1, size: 1000 })
+ .then((res) => {
+ // 杞﹁締鎺ュ彛杩斿洖鏍煎紡: { data: { records: [...], total: ... } }
+ const records = res?.data?.records;
+ caches.vehicles = Array.isArray(records) ? records : [];
+ })
+ .catch(() => {
+ caches.vehicles = [];
+ })
+ );
+ }
await Promise.all(tasks);
return caches;
--
Gitblit v1.9.3