From 5a7e5e92a87f4da24243d7ada9447cbd006fbbe3 Mon Sep 17 00:00:00 2001 From: zhangyahui Date: Wed, 17 Dec 2025 10:55:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20=E6=95=99=E8=82=B2=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8F=AA=E8=8E=B7=E5=8F=96active=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E8=AE=A1=E5=88=92&=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8F=AF=E4=BF=AE=E6=94=B9=E8=AE=A2=E9=98=85=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Administrator/SE/allUser/index.vue | 2 +- .../Administrator/subscriptionPlan.vue | 51 ++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/src/component/Administrator/SE/allUser/index.vue b/src/component/Administrator/SE/allUser/index.vue index 4a5f397b..ea543c38 100644 --- a/src/component/Administrator/SE/allUser/index.vue +++ b/src/component/Administrator/SE/allUser/index.vue @@ -430,7 +430,7 @@ export default defineComponent({ if (!orgId) return Https.axiosPost(Https.httpUrls.searchSubscribeByOrg, { organizationId: orgId, - status: ['PENDING', 'ACTIVE'] + status: ['ACTIVE'] }).then(res => { // 将与当前用户 subscriptionPlanId 相同的订阅计划放到第一个 const userSubscriptionPlanId = store.state.UserHabit.userDetail.subscriptionPlanId diff --git a/src/component/Administrator/subscriptionPlan.vue b/src/component/Administrator/subscriptionPlan.vue index 8d024e81..53e1fb8e 100644 --- a/src/component/Administrator/subscriptionPlan.vue +++ b/src/component/Administrator/subscriptionPlan.vue @@ -293,6 +293,16 @@ placeholder="Input the credit limit" /> +
+ Status: + +
@@ -411,7 +421,8 @@ const formState = reactive({ organizationId: undefined as string | undefined, adminAccId: undefined as string | undefined, creditLimit: null as number | null, - accountNum: null as number | null + accountNum: null as number | null, + status: undefined as PlanStatus | undefined }) const organizationModalVisible = ref(false) @@ -499,6 +510,7 @@ const resetFormState = () => { formState.adminAccId = undefined formState.creditLimit = null formState.accountNum = null + formState.status = undefined } const handleSearch = () => { @@ -537,7 +549,29 @@ const openEdit = (record: SubscriptionPlan) => { formState.adminAccId = record.adminAccId formState.creditLimit = record.creditLimit formState.accountNum = (record as any).accountNum || null + formState.status = record.status formState.id = record.id + + // 检查组织ID是否在已加载的组织列表中,如果不在,则添加临时项 + if (record.organizationId) { + const orgExists = organizationOptions.value.some( + (org: any) => org.id === record.organizationId || String(org.id) === String(record.organizationId) + ) + if (!orgExists) { + // 从表格数据中获取组织名称,如果存在则添加临时项 + const orgName = (record as any).organizationName + if (orgName) { + organizationOptions.value = [ + { + id: record.organizationId, + name: orgName + }, + ...organizationOptions.value + ] + } + } + } + modalVisible.value = true } @@ -666,7 +700,20 @@ const getOrganizationList = async (isLoadMore = false) => { organizationParams ) if (rv) { - organizationOptions.value = [...organizationOptions.value, ...(rv.records || [])] + const newRecords = rv.records || [] + // 去重:如果新数据中包含已存在的组织ID,则移除旧项(包括临时项),保留新项 + const existingIds = new Set( + organizationOptions.value.map((org: any) => String(org.id)) + ) + const newIds = new Set(newRecords.map((org: any) => String(org.id))) + + // 移除会被新数据覆盖的旧项(包括临时项) + organizationOptions.value = organizationOptions.value.filter( + (org: any) => !newIds.has(String(org.id)) + ) + + // 追加新数据 + organizationOptions.value = [...organizationOptions.value, ...newRecords] organizationParams.total = rv.total || 0 } } finally {