Просмотр исходного кода

fix(expense): 编辑回显员工数据 - 从支付宝 owner_id_list 映射 employee_ids

- 后端 detailinfo.query 从 Alipay 获取 owner_id_list
- 将此列表映射为 employee_ids/scope_owner_id_list 供前端回显
- 前端 InstitutionDetail 补充 employee_ids 字段类型
alphah 2 недель назад
Родитель
Сommit
b21e998ace

+ 10 - 0
backend/app/plugin/module_payment/expense/institution/service.py

@@ -604,6 +604,16 @@ class InstitutionService:
         except Exception as e:
             log.warning(f"合并本地DB字段失败: {e}")
 
+        # 从支付宝 owner_id_list 映射为前端需要的 employee_ids
+        if not result_dict.get("employee_ids"):
+            owner_ids = result_dict.get("owner_id_list")
+            if owner_ids and result_dict.get("adapter_type") in ("EMPLOYEE_SELECT", None):
+                result_dict["employee_ids"] = list(owner_ids)
+        if not result_dict.get("scope_owner_id_list"):
+            owner_ids = result_dict.get("owner_id_list")
+            if owner_ids:
+                result_dict["scope_owner_id_list"] = list(owner_ids)
+
         # 补充本地规则和额度
         from app.plugin.module_payment.expense.rule.model import ExpenseRuleModel
         from app.plugin.module_payment.expense.quota.model import QuotaModel

+ 2 - 0
frontend/src/api/module_payment/institution.ts

@@ -148,6 +148,8 @@ export interface InstitutionDetail {
   applicable_scope?: string;
   period_type?: string;
   amount?: number;
+  employee_ids?: string[];
+  scope_owner_id_list?: string[];
   created_time: string;
   updated_time: string;
 }