Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
320 lines
6.2 KiB
TypeScript
320 lines
6.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 type {TableColumnsType} from 'ant-design-vue';
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
{
|
|
component: 'Input',
|
|
fieldName: 'groupName',
|
|
label: '考勤组名称',
|
|
},
|
|
{
|
|
component: 'Select',
|
|
componentProps: {
|
|
options: getDictOptions('wy_kqlx')
|
|
},
|
|
fieldName: 'attendanceType',
|
|
label: '考勤类型',
|
|
},
|
|
];
|
|
|
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
|
export const columns: VxeGridProps['columns'] = [
|
|
{type: 'checkbox', width: 60},
|
|
{
|
|
title: '考勤组名称',
|
|
field: 'groupName',
|
|
minWidth: 180,
|
|
},
|
|
|
|
{
|
|
title: '考勤类型',
|
|
field: 'attendanceType',
|
|
slots: {
|
|
default: ({row}) => {
|
|
return renderDict(row.attendanceType, 'wy_kqlx')
|
|
}
|
|
},
|
|
width: 150
|
|
},
|
|
{
|
|
title: '状态',
|
|
field: 'status',
|
|
slots: {
|
|
default: 'status'
|
|
},
|
|
width: 180
|
|
},
|
|
{
|
|
field: 'action',
|
|
fixed: 'right',
|
|
slots: {default: 'action'},
|
|
title: '操作',
|
|
width: 180,
|
|
},
|
|
];
|
|
|
|
export const modalSchema: FormSchemaGetter = () => [
|
|
{
|
|
label: '主键id',
|
|
fieldName: 'id',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: () => false,
|
|
triggerFields: [''],
|
|
},
|
|
},
|
|
{
|
|
label: '考勤组名称',
|
|
fieldName: 'groupName',
|
|
component: 'Input',
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '考勤类型',//(0:固定班制,1:排班制)
|
|
fieldName: 'attendanceType',
|
|
component: 'RadioGroup',
|
|
componentProps: {
|
|
buttonStyle: 'solid',
|
|
options: getDictOptions('wy_kqlx'),
|
|
},
|
|
rules: 'selectRequired',
|
|
defaultValue: '0'
|
|
},
|
|
{
|
|
label: '工作日设置',
|
|
fieldName: 'weekdaySetting',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: (formValue) => formValue.attendanceType == '0',
|
|
triggerFields: ['attendanceType'],
|
|
},
|
|
slots: {
|
|
default: 'weekdaySetting'
|
|
},
|
|
rules: 'required',
|
|
defaultValue: '1',
|
|
},
|
|
{
|
|
label: '',
|
|
fieldName: 'settingItem',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: (formValue) => formValue.attendanceType == '0',
|
|
triggerFields: ['attendanceType'],
|
|
},
|
|
slots: {
|
|
default: 'settingItem'
|
|
},
|
|
},
|
|
{
|
|
label: '考勤班次',
|
|
fieldName: 'attendanceShift',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: (formValue) => formValue.attendanceType == '1',
|
|
triggerFields: ['attendanceType'],
|
|
},
|
|
slots: {
|
|
default: 'attendanceShift'
|
|
},
|
|
rules: 'required',
|
|
defaultValue: '1',
|
|
},
|
|
{
|
|
label: '',
|
|
fieldName: 'shiftData',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: (formValue) => formValue.attendanceType == '1',
|
|
triggerFields: ['attendanceType'],
|
|
},
|
|
slots: {
|
|
default: 'shiftData'
|
|
},
|
|
},
|
|
{
|
|
label: '排班周期',
|
|
fieldName: 'schedulingCycle',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: (formValue) => formValue.attendanceType == '1',
|
|
triggerFields: ['attendanceType'],
|
|
},
|
|
slots: {
|
|
default: 'schedulingCycle'
|
|
},
|
|
defaultValue: '1',
|
|
rules: 'required'
|
|
},
|
|
{
|
|
label: '',
|
|
fieldName: 'cycleData',
|
|
component: 'Input',
|
|
dependencies: {
|
|
show: (formValue) => formValue.attendanceType == '1',
|
|
triggerFields: ['attendanceType'],
|
|
},
|
|
slots: {
|
|
default: 'cycleData'
|
|
},
|
|
},
|
|
];
|
|
|
|
export const weekdayColumns: TableColumnsType = [
|
|
{
|
|
title: '工作日',
|
|
key: 'label',
|
|
width: 120,
|
|
align: 'center',
|
|
dataIndex: 'label'
|
|
},
|
|
{
|
|
title: '班次',
|
|
key: 'shift',
|
|
minWidth: 180,
|
|
align: 'center',
|
|
dataIndex: 'shift'
|
|
},
|
|
{
|
|
title: '操作',
|
|
key: 'action',
|
|
dataIndex: 'action',
|
|
width: 180,
|
|
align: 'center',
|
|
},
|
|
]
|
|
|
|
export const noClockingColumns: TableColumnsType = [
|
|
{
|
|
title: '无需打卡日期',
|
|
key: 'label',
|
|
minWidth: 180,
|
|
align: 'center',
|
|
dataIndex: 'label'
|
|
},
|
|
{
|
|
title: '操作',
|
|
key: 'action',
|
|
dataIndex: 'action',
|
|
width: 150,
|
|
align: 'center',
|
|
},
|
|
]
|
|
|
|
export const clockingColumns: TableColumnsType = [
|
|
{
|
|
title: '必须打卡日期',
|
|
key: 'label',
|
|
minWidth: 180,
|
|
align: 'center',
|
|
dataIndex: 'label'
|
|
},
|
|
{
|
|
title: '操作',
|
|
key: 'action',
|
|
dataIndex: 'action',
|
|
width: 150,
|
|
align: 'center',
|
|
},
|
|
]
|
|
|
|
export const cycleColumns: TableColumnsType = [
|
|
{
|
|
title: '天数',
|
|
key: 'label',
|
|
width: 150,
|
|
align: 'center',
|
|
dataIndex: 'label'
|
|
},
|
|
{
|
|
title: '班次',
|
|
key: 'label',
|
|
minWidth: 180,
|
|
align: 'center',
|
|
dataIndex: 'label'
|
|
},
|
|
{
|
|
title: '操作',
|
|
key: 'action',
|
|
dataIndex: 'action',
|
|
width: 150,
|
|
align: 'center',
|
|
},
|
|
]
|
|
|
|
export const shiftColumns = [
|
|
{
|
|
title: '序号',
|
|
dataIndex: 'id',
|
|
key: 'id',
|
|
width: 100,
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: '班次名称',
|
|
dataIndex: 'name',
|
|
key: 'name',
|
|
width: 180,
|
|
align: 'center',
|
|
},
|
|
{
|
|
title: '考勤时间',
|
|
dataIndex: 'attendanceTime',
|
|
key: 'attendanceTime',
|
|
minWidth: 180,
|
|
align: 'center',
|
|
},
|
|
];
|
|
|
|
const typeOptions = [
|
|
{label: '单个日期', value: 1},
|
|
{label: '时间段', value: 2},
|
|
];
|
|
export const clockInModalSchema: FormSchemaGetter = () => [
|
|
{
|
|
label: '添加方式',
|
|
fieldName: 'type',
|
|
component: 'RadioGroup',
|
|
componentProps: {
|
|
options: typeOptions,
|
|
buttonStyle: 'solid',
|
|
},
|
|
defaultValue:1,
|
|
rules: 'required',
|
|
},
|
|
{
|
|
label: '日期',
|
|
fieldName: 'singleTime',
|
|
component: 'DatePicker',
|
|
rules: 'required',
|
|
componentProps: {
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
},
|
|
dependencies: {
|
|
show: (formValue) => formValue.type==1,
|
|
triggerFields: ['type'],
|
|
},
|
|
},
|
|
{
|
|
label: '日期',
|
|
fieldName: 'timeSlot',
|
|
component: 'RangePicker',
|
|
componentProps: {
|
|
format: 'YYYY-MM-DD',
|
|
valueFormat: 'YYYY-MM-DD',
|
|
},
|
|
rules: 'required',
|
|
dependencies: {
|
|
show: (formValue) => formValue.type==2,
|
|
triggerFields: ['type'],
|
|
},
|
|
},
|
|
]
|
|
|
|
|