159 lines
3.2 KiB
TypeScript
159 lines
3.2 KiB
TypeScript
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||
|
import { getDictOptions } from '#/utils/dict';
|
||
|
import { renderDict } from '#/utils/render';
|
||
|
import {h} from "vue";
|
||
|
import {Rate} from "ant-design-vue";
|
||
|
|
||
|
export const querySchema: FormSchemaGetter = () => [
|
||
|
{
|
||
|
component: 'Select',
|
||
|
componentProps: {
|
||
|
options: getDictOptions('type_contingency_plan'),
|
||
|
},
|
||
|
fieldName: 'contingenPlanType',
|
||
|
label: '预案类型',
|
||
|
},
|
||
|
{
|
||
|
component: 'ApiSelect',
|
||
|
fieldName: 'dutyPersion',
|
||
|
label: '责任人',
|
||
|
},
|
||
|
{
|
||
|
component: 'Select',
|
||
|
componentProps: {
|
||
|
options: getDictOptions('pro_exercise_status'),
|
||
|
},
|
||
|
fieldName: 'status',
|
||
|
label: '演练状态',
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const columns: VxeGridProps['columns'] = [
|
||
|
{ type: 'checkbox', width: 60 },
|
||
|
{
|
||
|
title: '序号',
|
||
|
field: 'id',
|
||
|
slots: {
|
||
|
default: ({rowIndex}) => {
|
||
|
return (rowIndex + 1).toString();
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
title: '预案名称',
|
||
|
field: 'contingenPlanName',
|
||
|
},
|
||
|
{
|
||
|
title: '预案类型',
|
||
|
field: 'contingenPlanType',
|
||
|
slots: {
|
||
|
default: ({ row }) => {
|
||
|
return renderDict(row.contingenPlanType, 'type_contingency_plan');
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
title: '风险等级',
|
||
|
field: 'grade',
|
||
|
slots: {
|
||
|
default: ({ row }) => {
|
||
|
return h(Rate, {
|
||
|
value: row.grade || 0,
|
||
|
disabled: true,
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
minWidth: '150'
|
||
|
},
|
||
|
{
|
||
|
title: '发起人',
|
||
|
field: 'initiatName',
|
||
|
},
|
||
|
{
|
||
|
title: '演练状态',
|
||
|
field: 'status',
|
||
|
slots: {
|
||
|
default: ({ row }) => {
|
||
|
return renderDict(row.status, 'pro_exercise_status');
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
title: '责任人',
|
||
|
field: 'dutyPersionName',
|
||
|
},
|
||
|
{
|
||
|
title: '完成时间',
|
||
|
field: 'compleTimes',
|
||
|
},
|
||
|
{
|
||
|
field: 'action',
|
||
|
fixed: 'right',
|
||
|
slots: { default: 'action' },
|
||
|
title: '操作',
|
||
|
width: 240,
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const modalSchema: FormSchemaGetter = () => [
|
||
|
{
|
||
|
label: '主键',
|
||
|
fieldName: 'id',
|
||
|
component: 'Input',
|
||
|
dependencies: {
|
||
|
show: () => false,
|
||
|
triggerFields: [''],
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
label: '预案名称',
|
||
|
fieldName: 'contingenPlanName',
|
||
|
component: 'Input',
|
||
|
rules: 'required',
|
||
|
},
|
||
|
{
|
||
|
label: '预案类型',
|
||
|
fieldName: 'contingenPlanType',
|
||
|
component: 'Select',
|
||
|
componentProps: {
|
||
|
options: getDictOptions('type_contingency_plan'),
|
||
|
},
|
||
|
rules: 'selectRequired',
|
||
|
},
|
||
|
{
|
||
|
label: '发起人',
|
||
|
fieldName: 'initiat',
|
||
|
component: 'ApiSelect',
|
||
|
rules: 'selectRequired',
|
||
|
},
|
||
|
{
|
||
|
label: '责任人',
|
||
|
fieldName: 'dutyPersion',
|
||
|
component: 'ApiSelect',
|
||
|
rules: 'selectRequired',
|
||
|
},
|
||
|
{
|
||
|
label: '预案内容',
|
||
|
fieldName: 'contingenPlanContent',
|
||
|
component: 'RichTextarea',
|
||
|
componentProps: {
|
||
|
// disabled: false, // 是否只读
|
||
|
// height: 400 // 高度 默认400
|
||
|
},
|
||
|
formItemClass: 'col-span-2'
|
||
|
},
|
||
|
{
|
||
|
label: '风险等级',
|
||
|
fieldName: 'grade',
|
||
|
component: 'Rate',
|
||
|
componentProps: {
|
||
|
allowHalf: false,
|
||
|
count: 5,
|
||
|
tooltips: ['1星', '2星', '3星', '4星', '5星'],
|
||
|
defaultValue: 0
|
||
|
},
|
||
|
rules: 'required',
|
||
|
},
|
||
|
];
|