1、巡检计划
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-07-11 17:29:59 +08:00
parent 109242db60
commit 620bf8dd17
5 changed files with 391 additions and 98 deletions

View File

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