From ef8c083ea6869010c2fd271b057fbad48771d146 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Fri, 18 Jul 2025 19:14:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=B5=8B=E5=80=BC=E5=8F=98=E9=87=8F=E6=9E=84=E5=BB=BA=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/license/license/data.ts | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/apps/web-antd/src/views/license/license/data.ts b/apps/web-antd/src/views/license/license/data.ts index ae0f3e3..db50566 100644 --- a/apps/web-antd/src/views/license/license/data.ts +++ b/apps/web-antd/src/views/license/license/data.ts @@ -1,6 +1,8 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { CustomerApi } from '#/api/license/customer'; import type { LicenseApi } from '#/api/license/license'; +import type { ProjectApi } from '#/api/license/project'; import type { DescriptionItemSchema } from '#/components/description'; import { h, ref } from 'vue'; @@ -19,11 +21,9 @@ import { DictTag, DictTagGroup } from '#/components/dict-tag'; import { $t } from '#/locales'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils'; -// import Button from '../../../../../../packages/@core/ui-kit/shadcn-ui/src/components/button/button.vue'; - const { hasAccessByCodes } = useAccess(); -let projectList = await getProjectList({}); -const customerList = await getCustomerList(); +const customerList = ref([]); +const projectList = ref([]); export const formData = ref(); /** 新增/修改的表单 */ @@ -41,9 +41,12 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'customerId', label: $t('license.customer'), rules: 'required', - component: 'Select', + component: 'ApiSelect', componentProps: { - options: customerList, + api: async () => { + customerList.value = await getCustomerList(); + return customerList.value; + }, fieldNames: { label: 'name', value: 'id' }, showSearch: true, filterOption: (input: string, option: any) => @@ -64,10 +67,10 @@ export function useFormSchema(): VbenFormSchema[] { }, dependencies: { componentProps: async (values) => { - projectList = await getProjectList({ + projectList.value = await getProjectList({ customerId: values.customerId, }); - const hasProject = projectList.find((project) => { + const hasProject = projectList.value.find((project) => { return project.id === values.projectId; }); if (!hasProject) { @@ -89,10 +92,10 @@ export function useFormSchema(): VbenFormSchema[] { }, dependencies: { trigger(values, form) { - const projectCode = projectList.find((project) => { + const projectCode = projectList.value.find((project) => { return project.id === values.projectId; })?.code; - const customerCode = customerList.find((customer) => { + const customerCode = customerList.value.find((customer) => { return customer.id === values.customerId; })?.code; form.setFieldValue( @@ -414,12 +417,12 @@ export function useGridColumns( visible: false, minWidth: 120, }, - { - field: 'licenseContent', - visible: false, - title: $t('license.licenseContent'), - minWidth: 120, - }, + // { + // field: 'licenseContent', + // visible: false, + // title: $t('license.licenseContent'), + // minWidth: 120, + // }, { field: 'applicantName', title: $t('license.applicant'),