81 lines
1.6 KiB
TypeScript
81 lines
1.6 KiB
TypeScript
|
import type { VbenFormSchema } from '#/adapter/form';
|
||
|
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||
|
|
||
|
export function useGridFormSchema(): VbenFormSchema[] {
|
||
|
return [
|
||
|
// {
|
||
|
// component: 'Input',
|
||
|
// fieldName: 'type',
|
||
|
// label: '类型',
|
||
|
// },
|
||
|
{
|
||
|
component: 'Select',
|
||
|
componentProps: {
|
||
|
allowClear: true,
|
||
|
options: [
|
||
|
{ label: 'WORD', value: 1 },
|
||
|
{ label: 'PPT', value: 2 },
|
||
|
{ label: 'SPIDER', value: 3 },
|
||
|
],
|
||
|
},
|
||
|
fieldName: 'type',
|
||
|
label: '类型',
|
||
|
},
|
||
|
];
|
||
|
}
|
||
|
|
||
|
export function useFormSchema(): VbenFormSchema[] {
|
||
|
return [
|
||
|
{
|
||
|
component: 'Input',
|
||
|
fieldName: 'deptIds',
|
||
|
formItemClass: 'items-start',
|
||
|
label: '部门',
|
||
|
modelPropName: 'modelValue',
|
||
|
labelWidth: 40,
|
||
|
},
|
||
|
];
|
||
|
}
|
||
|
|
||
|
export function useColumns(
|
||
|
onActionClick?: OnActionClickFn<any>,
|
||
|
): VxeTableGridOptions['columns'] {
|
||
|
return [
|
||
|
{
|
||
|
field: 'id',
|
||
|
title: 'ID',
|
||
|
// type: 'checkbox',
|
||
|
minWidth: 100,
|
||
|
},
|
||
|
{
|
||
|
field: 'mode',
|
||
|
width: 200,
|
||
|
title: '类型',
|
||
|
},
|
||
|
{
|
||
|
field: 'name',
|
||
|
title: '名称',
|
||
|
minWidth: 100,
|
||
|
},
|
||
|
{
|
||
|
align: 'center',
|
||
|
cellRender: {
|
||
|
name: 'CellOperation',
|
||
|
attrs: {
|
||
|
nameField: 'name',
|
||
|
nameTitle: '工作流',
|
||
|
onClick: onActionClick,
|
||
|
},
|
||
|
options: [
|
||
|
'edit', // 默认的编辑按钮
|
||
|
],
|
||
|
},
|
||
|
field: 'operation',
|
||
|
headerAlign: 'center',
|
||
|
showOverflow: false,
|
||
|
title: '操作',
|
||
|
width: 200,
|
||
|
},
|
||
|
];
|
||
|
}
|