fix: 修复直接赋值变量构建报错

This commit is contained in:
caiyuchao
2025-07-18 19:14:12 +08:00
parent c385dd18b6
commit ef8c083ea6

View File

@@ -1,6 +1,8 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { CustomerApi } from '#/api/license/customer';
import type { LicenseApi } from '#/api/license/license'; import type { LicenseApi } from '#/api/license/license';
import type { ProjectApi } from '#/api/license/project';
import type { DescriptionItemSchema } from '#/components/description'; import type { DescriptionItemSchema } from '#/components/description';
import { h, ref } from 'vue'; import { h, ref } from 'vue';
@@ -19,11 +21,9 @@ import { DictTag, DictTagGroup } from '#/components/dict-tag';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
// import Button from '../../../../../../packages/@core/ui-kit/shadcn-ui/src/components/button/button.vue';
const { hasAccessByCodes } = useAccess(); const { hasAccessByCodes } = useAccess();
let projectList = await getProjectList({}); const customerList = ref<CustomerApi.Customer[]>([]);
const customerList = await getCustomerList(); const projectList = ref<ProjectApi.Project[]>([]);
export const formData = ref<LicenseApi.License>(); export const formData = ref<LicenseApi.License>();
/** 新增/修改的表单 */ /** 新增/修改的表单 */
@@ -41,9 +41,12 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'customerId', fieldName: 'customerId',
label: $t('license.customer'), label: $t('license.customer'),
rules: 'required', rules: 'required',
component: 'Select', component: 'ApiSelect',
componentProps: { componentProps: {
options: customerList, api: async () => {
customerList.value = await getCustomerList();
return customerList.value;
},
fieldNames: { label: 'name', value: 'id' }, fieldNames: { label: 'name', value: 'id' },
showSearch: true, showSearch: true,
filterOption: (input: string, option: any) => filterOption: (input: string, option: any) =>
@@ -64,10 +67,10 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
dependencies: { dependencies: {
componentProps: async (values) => { componentProps: async (values) => {
projectList = await getProjectList({ projectList.value = await getProjectList({
customerId: values.customerId, customerId: values.customerId,
}); });
const hasProject = projectList.find((project) => { const hasProject = projectList.value.find((project) => {
return project.id === values.projectId; return project.id === values.projectId;
}); });
if (!hasProject) { if (!hasProject) {
@@ -89,10 +92,10 @@ export function useFormSchema(): VbenFormSchema[] {
}, },
dependencies: { dependencies: {
trigger(values, form) { trigger(values, form) {
const projectCode = projectList.find((project) => { const projectCode = projectList.value.find((project) => {
return project.id === values.projectId; return project.id === values.projectId;
})?.code; })?.code;
const customerCode = customerList.find((customer) => { const customerCode = customerList.value.find((customer) => {
return customer.id === values.customerId; return customer.id === values.customerId;
})?.code; })?.code;
form.setFieldValue( form.setFieldValue(
@@ -414,12 +417,12 @@ export function useGridColumns(
visible: false, visible: false,
minWidth: 120, minWidth: 120,
}, },
{ // {
field: 'licenseContent', // field: 'licenseContent',
visible: false, // visible: false,
title: $t('license.licenseContent'), // title: $t('license.licenseContent'),
minWidth: 120, // minWidth: 120,
}, // },
{ {
field: 'applicantName', field: 'applicantName',
title: $t('license.applicant'), title: $t('license.applicant'),