2025-07-10 17:33:46 +08:00
|
|
|
import type {FormSchemaGetter} from '#/adapter/form';
|
|
|
|
import type {VxeGridProps} from '#/adapter/vxe-table';
|
|
|
|
import {getDictOptions} from "#/utils/dict";
|
|
|
|
import {renderDict} from "#/utils/render";
|
2025-07-11 17:29:59 +08:00
|
|
|
import {z} from "#/adapter/form";
|
2025-07-10 17:33:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
fieldName: 'planName',
|
|
|
|
label: '计划名称',
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('wy_xjzq'),
|
|
|
|
},
|
|
|
|
fieldName: 'inspectionPlanPeriod',
|
|
|
|
label: '巡检周期',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('wy_xjqdfs'),
|
|
|
|
},
|
|
|
|
fieldName: 'signType',
|
|
|
|
label: '签到方式',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const columns: VxeGridProps['columns'] = [
|
|
|
|
{type: 'checkbox', width: 60},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
title: '计划名称',
|
2025-07-10 17:33:46 +08:00
|
|
|
field: 'planName',
|
2025-07-11 17:29:59 +08:00
|
|
|
minWidth: 180,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '巡检路线',
|
|
|
|
field: 'inspectionRouteId',
|
2025-07-11 17:29:59 +08:00
|
|
|
width: 180,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '巡检周期',
|
|
|
|
field: 'inspectionPlanPeriod',
|
|
|
|
slots: {
|
2025-07-11 17:29:59 +08:00
|
|
|
default: ({row}) => {
|
2025-07-10 17:33:46 +08:00
|
|
|
return renderDict(row.inspectionPlanPeriod, 'wy_xjzq');
|
|
|
|
},
|
|
|
|
},
|
2025-07-11 17:29:59 +08:00
|
|
|
width: 100,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
title: '任务提前分钟',
|
2025-07-10 17:33:46 +08:00
|
|
|
field: 'beforeTime',
|
2025-07-11 17:29:59 +08:00
|
|
|
width: 120,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '开始日期',
|
|
|
|
field: 'startDate',
|
2025-07-11 17:29:59 +08:00
|
|
|
width: 120,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '结束日期',
|
|
|
|
field: 'endDate',
|
2025-07-11 17:29:59 +08:00
|
|
|
width: 120,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '签到方式',
|
|
|
|
field: 'signType',
|
|
|
|
slots: {
|
2025-07-11 17:29:59 +08:00
|
|
|
default: ({row}) => {
|
2025-07-10 17:33:46 +08:00
|
|
|
return renderDict(row.signType, 'wy_xjqdfs');
|
|
|
|
},
|
|
|
|
},
|
2025-07-11 17:29:59 +08:00
|
|
|
width: 120,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '是否允许补检',
|
|
|
|
field: 'canReexamine',
|
|
|
|
slots: {
|
2025-07-11 17:29:59 +08:00
|
|
|
default: ({row}) => {
|
2025-07-10 17:33:46 +08:00
|
|
|
return renderDict(row.canReexamine, 'wy_sf');
|
|
|
|
},
|
|
|
|
},
|
2025-07-11 17:29:59 +08:00
|
|
|
width: 120,
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
title: '状态',
|
|
|
|
field: 'state',
|
|
|
|
width: 120,
|
|
|
|
slots:{default: 'state'}
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'action',
|
|
|
|
fixed: 'right',
|
|
|
|
slots: {default: 'action'},
|
|
|
|
title: '操作',
|
|
|
|
width: 180,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const modalSchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
label: '主键id',
|
|
|
|
fieldName: 'id',
|
|
|
|
component: 'Input',
|
|
|
|
dependencies: {
|
|
|
|
show: () => false,
|
|
|
|
triggerFields: [''],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
label: '计划名称',
|
2025-07-10 17:33:46 +08:00
|
|
|
fieldName: 'planName',
|
|
|
|
component: 'Input',
|
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '巡检路线',
|
|
|
|
fieldName: 'inspectionRouteId',
|
2025-07-11 17:29:59 +08:00
|
|
|
component: 'ApiSelect',
|
2025-07-10 17:33:46 +08:00
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '巡检周期',
|
|
|
|
fieldName: 'inspectionPlanPeriod',
|
2025-07-11 17:29:59 +08:00
|
|
|
component: 'Select',
|
2025-07-10 17:33:46 +08:00
|
|
|
rules: 'required',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('wy_xjzq'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
label: '任务提前',
|
2025-07-10 17:33:46 +08:00
|
|
|
fieldName: 'beforeTime',
|
|
|
|
component: 'Input',
|
2025-07-11 17:29:59 +08:00
|
|
|
rules: z.number({
|
|
|
|
required_error: "请输入任务提前完成分钟数",
|
|
|
|
invalid_type_error: "请输入任务提前完成分钟数"
|
|
|
|
}),
|
|
|
|
slots: {default: 'beforeTime'},
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
label: '周',
|
|
|
|
fieldName: 'inspectionWorkday',
|
|
|
|
component: 'CheckboxGroup',
|
|
|
|
rules: 'selectRequired',
|
|
|
|
formItemClass: 'col-span-2',
|
|
|
|
dependencies: {
|
|
|
|
show: (formValue) => formValue.inspectionPlanPeriod == '2',
|
|
|
|
triggerFields: ['inspectionPlanPeriod'],
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
2025-07-11 17:29:59 +08:00
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('wy_xq')
|
|
|
|
}
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
label: '月',
|
|
|
|
fieldName: 'inspectionMonth',
|
|
|
|
component: 'CheckboxGroup',
|
|
|
|
rules: 'selectRequired',
|
|
|
|
formItemClass: 'col-span-2',
|
|
|
|
dependencies: {
|
|
|
|
show: (formValue) => formValue.inspectionPlanPeriod == '1',
|
|
|
|
triggerFields: ['inspectionPlanPeriod'],
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
2025-07-11 17:29:59 +08:00
|
|
|
componentProps: {
|
|
|
|
options: Array.from({ length: 12 }, (_, i) => ({
|
|
|
|
label: `${i + 1}月`,
|
|
|
|
value: (i + 1).toString(),
|
|
|
|
})),
|
|
|
|
}
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
label: '日',
|
|
|
|
fieldName: 'inspectionDay',
|
|
|
|
component: 'CheckboxGroup',
|
|
|
|
rules: 'selectRequired',
|
|
|
|
formItemClass: 'col-span-2',
|
|
|
|
dependencies: {
|
|
|
|
show: (formValue) => formValue.inspectionPlanPeriod == '1',
|
|
|
|
triggerFields: ['inspectionPlanPeriod'],
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
2025-07-11 17:29:59 +08:00
|
|
|
componentProps: {
|
|
|
|
options: Array.from({ length: 31 }, (_, i) => ({
|
|
|
|
label: `${i + 1}日`,
|
|
|
|
value: (i + 1).toString(),
|
|
|
|
})),
|
|
|
|
}
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
label: '计划日期',
|
|
|
|
fieldName: 'planDate',
|
|
|
|
component: 'RangePicker',
|
2025-07-10 17:33:46 +08:00
|
|
|
componentProps: {
|
|
|
|
showTime: true,
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
},
|
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '签到方式',
|
|
|
|
fieldName: 'signType',
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('wy_xjqdfs'),
|
|
|
|
},
|
|
|
|
rules: 'selectRequired',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '允许补检',
|
|
|
|
fieldName: 'canReexamine',
|
2025-07-11 17:29:59 +08:00
|
|
|
component: 'RadioGroup',
|
2025-07-10 17:33:46 +08:00
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions('wy_sf'),
|
2025-07-11 17:29:59 +08:00
|
|
|
buttonStyle: 'solid',
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
rules: 'selectRequired',
|
|
|
|
},
|
|
|
|
{
|
2025-07-11 17:29:59 +08:00
|
|
|
label: '巡检人员',
|
2025-07-10 17:33:46 +08:00
|
|
|
fieldName: 'userId',
|
2025-07-11 17:29:59 +08:00
|
|
|
component: 'ApiSelect',
|
|
|
|
componentProps:{
|
|
|
|
mode: 'multiple',
|
|
|
|
},
|
|
|
|
rules: z.array(z.string()).min(1, { message: '请选择巡检人员' }),
|
|
|
|
formItemClass: 'col-span-2'
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: '备注',
|
|
|
|
fieldName: 'remark',
|
2025-07-11 17:29:59 +08:00
|
|
|
component: 'Textarea',
|
|
|
|
formItemClass: 'col-span-2'
|
2025-07-10 17:33:46 +08:00
|
|
|
},
|
|
|
|
];
|
2025-07-11 17:29:59 +08:00
|
|
|
|
|
|
|
const weekOptions = (): any[] => {
|
|
|
|
let arr: any[] = []
|
|
|
|
for (let i = 1; i <= 7; i++) {
|
|
|
|
arr.push({label: '星期' + '', value: i})
|
|
|
|
}
|
|
|
|
return arr;
|
|
|
|
}
|