feat: 添加项目管理模块
This commit is contained in:
451
apps/web-antd/src/views/license/project/data.ts
Normal file
451
apps/web-antd/src/views/license/project/data.ts
Normal file
@@ -0,0 +1,451 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { ProjectApi } from '#/api/license/project';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'customerId',
|
||||
label: '客户ID',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入客户ID',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '项目名称',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入项目名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'code',
|
||||
label: '项目编号',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入项目编号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'contractCode',
|
||||
label: '合同编号',
|
||||
rules: 'required',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入合同编号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'businessStatus',
|
||||
label: '商务状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_BUSINESS_STATUS, 'number'),
|
||||
placeholder: '请选择商务状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'businessOwner',
|
||||
label: '业务负责人',
|
||||
rules: 'required',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'customerOwner',
|
||||
label: '客户对接人',
|
||||
rules: 'required',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'technicalOwnerA',
|
||||
label: '技术负责人1',
|
||||
rules: 'required',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'technicalOwnerB',
|
||||
label: '技术负责人2',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'technicalOwnerC',
|
||||
label: '技术负责人3',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
showSearch: true,
|
||||
filterOption: (input: string, option: any) =>
|
||||
option.label.toLowerCase().includes(input.toLowerCase()),
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'startTime',
|
||||
label: '项目开始时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'endTime',
|
||||
label: '项目结束时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '项目状态',
|
||||
rules: 'required',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.LIC_PROJECT_STATUS, 'number'),
|
||||
placeholder: '请选择项目状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'envInfo',
|
||||
label: '环境信息',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入环境信息',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'envFileId',
|
||||
label: '环境信息附件id',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入环境信息附件id',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'remark',
|
||||
label: '备注',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '项目名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入项目名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'code',
|
||||
label: '项目编号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入项目编号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'contractCode',
|
||||
label: '合同编号',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入合同编号',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'businessStatus',
|
||||
label: '商务状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.LIC_BUSINESS_STATUS, 'number'),
|
||||
placeholder: '请选择商务状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'businessOwner',
|
||||
label: '业务负责人',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择业务负责人',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'customerOwner',
|
||||
label: '客户对接人',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择客户对接人',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'technicalOwnerA',
|
||||
label: '技术负责人1',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择技术负责人1',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'technicalOwnerB',
|
||||
label: '技术负责人2',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择技术负责人2',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'technicalOwnerC',
|
||||
label: '技术负责人3',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [],
|
||||
placeholder: '请选择技术负责人3',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'startTime',
|
||||
label: '项目开始时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'endTime',
|
||||
label: '项目结束时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '项目状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: getDictOptions(DICT_TYPE.LIC_PROJECT_STATUS, 'number'),
|
||||
placeholder: '请选择项目状态',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'envInfo',
|
||||
label: '环境信息',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
placeholder: '请输入环境信息',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'createTime',
|
||||
label: '创建时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
...getRangePickerDefaultProps(),
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(
|
||||
onActionClick?: OnActionClickFn<ProjectApi.Project>,
|
||||
): VxeTableGridOptions<ProjectApi.Project>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
title: '项目名称',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
title: '项目编号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'contractCode',
|
||||
title: '合同编号',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'businessStatus',
|
||||
title: '商务状态',
|
||||
minWidth: 120,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.LIC_BUSINESS_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'businessOwner',
|
||||
title: '业务负责人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'customerOwner',
|
||||
title: '客户对接人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'technicalOwnerA',
|
||||
title: '技术负责人1',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'technicalOwnerB',
|
||||
title: '技术负责人2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'technicalOwnerC',
|
||||
title: '技术负责人3',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'startTime',
|
||||
title: '项目开始时间',
|
||||
minWidth: 120,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'endTime',
|
||||
title: '项目结束时间',
|
||||
minWidth: 120,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '项目状态',
|
||||
minWidth: 120,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.LIC_PROJECT_STATUS },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'envInfo',
|
||||
title: '环境信息',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
minWidth: 120,
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'operation',
|
||||
title: '操作',
|
||||
minWidth: 200,
|
||||
align: 'center',
|
||||
fixed: 'right',
|
||||
headerAlign: 'center',
|
||||
showOverflow: false,
|
||||
cellRender: {
|
||||
attrs: {
|
||||
nameField: 'id',
|
||||
nameTitle: '项目',
|
||||
onClick: onActionClick,
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
{
|
||||
code: 'edit',
|
||||
show: hasAccessByCodes(['license:project:update']),
|
||||
},
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['license:project:delete']),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user