diff --git a/apps/web-antd/src/api/license/customer/index.ts b/apps/web-antd/src/api/license/customer/index.ts index be403c7..21a34f5 100644 --- a/apps/web-antd/src/api/license/customer/index.ts +++ b/apps/web-antd/src/api/license/customer/index.ts @@ -26,6 +26,11 @@ export function getCustomerPage(params: PageParam) { ); } +/** 查询客户分页 */ +export function getCustomerList() { + return requestClient.get('/license/customer/list'); +} + /** 查询客户详情 */ export function getCustomer(id: number) { return requestClient.get( @@ -54,7 +59,7 @@ export function exportCustomer(params: any) { } /** 客户名称是否唯一 */ -async function isCustomerNameUnique( +export async function isCustomerNameUnique( name: string, id?: CustomerApi.Customer['id'], ) { @@ -64,7 +69,7 @@ async function isCustomerNameUnique( } /** 客户编号是否唯一 */ -async function isCustomerCodeUnique( +export async function isCustomerCodeUnique( code: number, id?: CustomerApi.Customer['id'], ) { @@ -74,8 +79,6 @@ async function isCustomerCodeUnique( } /** 查询当前最大sn */ -async function getMaxSn() { +export async function getMaxSn() { return requestClient.get('/license/customer/max-sn'); } - -export { getMaxSn, isCustomerCodeUnique, isCustomerNameUnique }; diff --git a/apps/web-antd/src/views/license/project/data.ts b/apps/web-antd/src/views/license/project/data.ts index 6b11cf2..7b53e2b 100644 --- a/apps/web-antd/src/views/license/project/data.ts +++ b/apps/web-antd/src/views/license/project/data.ts @@ -4,6 +4,7 @@ import type { ProjectApi } from '#/api/license/project'; import { useAccess } from '@vben/access'; +import { getCustomerList } from '#/api/license/customer'; import { getSimpleUserList } from '#/api/system/user'; import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils'; @@ -20,15 +21,6 @@ export function useFormSchema(): VbenFormSchema[] { show: () => false, }, }, - { - fieldName: 'customerId', - label: '客户ID', - rules: 'required', - component: 'Input', - componentProps: { - placeholder: '请输入客户ID', - }, - }, { fieldName: 'name', label: '项目名称', @@ -47,6 +39,25 @@ export function useFormSchema(): VbenFormSchema[] { placeholder: '请输入项目编号', }, }, + { + fieldName: 'customerId', + label: '所属客户', + rules: 'required', + component: 'ApiSelect', + componentProps: { + api: async () => { + const data = await getCustomerList(); + return data.map((item) => ({ + // label: `${item.name}(${item.code})`, + label: item.name, + value: item.id, + })); + }, + showSearch: true, + filterOption: (input: string, option: any) => + option.label.toLowerCase().includes(input.toLowerCase()), + }, + }, { fieldName: 'contractCode', label: '合同编号', @@ -59,12 +70,23 @@ export function useFormSchema(): VbenFormSchema[] { { fieldName: 'businessStatus', label: '商务状态', + rules: 'required', component: 'Select', componentProps: { options: getDictOptions(DICT_TYPE.LIC_BUSINESS_STATUS, 'number'), placeholder: '请选择商务状态', }, }, + { + fieldName: 'status', + label: '项目状态', + rules: 'required', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.LIC_PROJECT_STATUS, 'number'), + placeholder: '请选择项目状态', + }, + }, { fieldName: 'businessOwner', label: '业务负责人', @@ -153,16 +175,6 @@ export function useFormSchema(): VbenFormSchema[] { valueFormat: 'x', }, }, - { - fieldName: 'status', - label: '项目状态', - rules: 'required', - component: 'Select', - componentProps: { - options: getDictOptions(DICT_TYPE.LIC_PROJECT_STATUS, 'number'), - placeholder: '请选择项目状态', - }, - }, { fieldName: 'envInfo', label: '环境信息', @@ -344,6 +356,11 @@ export function useGridColumns( title: '项目编号', minWidth: 120, }, + { + field: 'customerName', + title: '所属客户', + minWidth: 120, + }, { field: 'contractCode', title: '合同编号', @@ -359,27 +376,27 @@ export function useGridColumns( }, }, { - field: 'businessOwner', + field: 'businessOwnerName', title: '业务负责人', minWidth: 120, }, { - field: 'customerOwner', + field: 'customerOwnerName', title: '客户对接人', minWidth: 120, }, { - field: 'technicalOwnerA', + field: 'technicalOwnerAName', title: '技术负责人1', minWidth: 120, }, { - field: 'technicalOwnerB', + field: 'technicalOwnerBName', title: '技术负责人2', minWidth: 120, }, { - field: 'technicalOwnerC', + field: 'technicalOwnerCName', title: '技术负责人3', minWidth: 120, },