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 {