فهرست منبع

fix: 编辑弹窗加 formKey 强制重绘 + 详情合并本地字段

alphah 2 هفته پیش
والد
کامیت
8c39dbcae7

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

@@ -372,6 +372,20 @@ class InstitutionService:
         if not result_dict:
             return None
 
+        # 合并本地DB的自定义字段(支付宝不包含的字段)
+        try:
+            crud = InstitutionCRUD(auth)
+            local_obj = await crud.get(institution_id=institution_id, enterprise_id=enterprise_id)
+            if local_obj:
+                local_dict = InstitutionListOutSchema.model_validate(local_obj).model_dump()
+                for field in ("applicable_scope", "grant_mode", "period_type", "amount",
+                              "single_limit", "effective_time_type", "employee_ids",
+                              "period_type", "scope_owner_id_list"):
+                    if field in local_dict and local_dict[field] is not None:
+                        result_dict[field] = local_dict[field]
+        except Exception as e:
+            log.warning(f"合并本地DB字段失败: {e}")
+
         # 补充本地规则和额度
         from app.plugin.module_payment.expense.rule.model import ExpenseRuleModel
         from app.plugin.module_payment.expense.quota.model import QuotaModel

+ 5 - 0
frontend/src/views/module_payment/institution/index.vue

@@ -189,6 +189,7 @@
       <template v-else>
         <InstitutionForm
           ref="formRef"
+          :key="formKey"
           :type="dialogVisible.type"
           :institution-id="currentInstitutionId"
           :enterprise-id="enterpriseIdFromUrl"
@@ -331,6 +332,9 @@ const dialogVisible = reactive({
 });
 
 const currentInstitutionId = ref<string>();
+const formKey = ref(0);
+
+
 
 const scopeDialogVisible = ref(false);
 
@@ -344,6 +348,7 @@ function handleOpenDialog(type: "create" | "update" | "detail", institutionId?:
   } else {
     dialogVisible.title = "费控制度详情";
   }
+  if (type === "update") formKey.value++;
   dialogVisible.visible = true;
 }