From 769fb543015f1a90d42882a0a9f0592efa45a10e Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期一, 01 六月 2026 19:33:30 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' of http://114.132.189.42:9002/r/product-inventory-management into dev_NEW_pro

---
 src/views/officeProcessAutomation/ApproveManage/approve-template/useSelectOptionSources.js |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/src/views/officeProcessAutomation/ApproveManage/approve-template/useSelectOptionSources.js b/src/views/officeProcessAutomation/ApproveManage/approve-template/useSelectOptionSources.js
new file mode 100644
index 0000000..8397288
--- /dev/null
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/useSelectOptionSources.js
@@ -0,0 +1,45 @@
+import { reactive, ref } from "vue";
+import {
+  collectOptionSourcesFromFields,
+  fetchSelectOptionCaches,
+  resolveFieldSelectOptions,
+  resolveSelectDisplayLabel,
+} from "./selectOptionSource.js";
+
+/** 涓嬫媺鍔ㄦ�侀�夐」锛氫汉鍛� / 閮ㄩ棬缂撳瓨涓庤В鏋� */
+export function useSelectOptionSources() {
+  const loading = ref(false);
+  const caches = reactive({
+    users: [],
+    deptOptions: [],
+  });
+
+  async function ensureForFields(fields) {
+    const sources = collectOptionSourcesFromFields(fields);
+    if (!sources.length) return;
+    loading.value = true;
+    try {
+      const next = await fetchSelectOptionCaches(sources);
+      caches.users = next.users;
+      caches.deptOptions = next.deptOptions;
+    } finally {
+      loading.value = false;
+    }
+  }
+
+  function getOptions(field) {
+    return resolveFieldSelectOptions(field, caches);
+  }
+
+  function getDisplayLabel(field, val) {
+    return resolveSelectDisplayLabel(field, val, caches);
+  }
+
+  return {
+    loading,
+    caches,
+    ensureForFields,
+    getOptions,
+    getDisplayLabel,
+  };
+}

--
Gitblit v1.9.3