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 { 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<CustomerApi.Customer[]>([]);
const projectList = ref<ProjectApi.Project[]>([]);
export const formData = ref<LicenseApi.License>();
/** 新增/修改的表单 */
@@ -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'),