From 64b38f57628375dff92d147ddeefd771e6e85439 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 08 七月 2026 15:55:36 +0800
Subject: [PATCH] Merge branch 'dev_NEW_pro' into dev_黎城_康森商砼

---
 src/views/officeProcessAutomation/ApproveManage/approve-template/useSelectOptionSources.js |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 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..5d246e1
--- /dev/null
+++ b/src/views/officeProcessAutomation/ApproveManage/approve-template/useSelectOptionSources.js
@@ -0,0 +1,46 @@
+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, context = {}) {
+    const sources = collectOptionSourcesFromFields(fields, context);
+    if (!sources.length) return;
+    loading.value = true;
+    try {
+      const next = await fetchSelectOptionCaches(sources);
+      caches.users = next.users;
+      caches.deptOptions = next.deptOptions;
+      caches.employees = next.employees || [];
+    } finally {
+      loading.value = false;
+    }
+  }
+
+  function getOptions(field, context = {}) {
+    return resolveFieldSelectOptions(field, caches, context);
+  }
+
+  function getDisplayLabel(field, val, context = {}) {
+    return resolveSelectDisplayLabel(field, val, caches, context);
+  }
+
+  return {
+    loading,
+    caches,
+    ensureForFields,
+    getOptions,
+    getDisplayLabel,
+  };
+}

--
Gitblit v1.9.3