Files
admin-vben5/apps/web-antd/src/views/property/attendanceManagement/attendanceGroupSettings/data.ts

320 lines
6.2 KiB
TypeScript
Raw Normal View History

2025-07-21 20:57:31 +08:00
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
2025-07-19 17:25:17 +08:00
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
2025-07-21 20:57:31 +08:00
import type {TableColumnsType} from 'ant-design-vue';
2025-07-19 17:25:17 +08:00
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'groupName',
label: '考勤组名称',
},
{
component: 'Select',
componentProps: {
2025-07-21 20:57:31 +08:00
options: getDictOptions('wy_kqlx')
2025-07-19 17:25:17 +08:00
},
fieldName: 'attendanceType',
label: '考勤类型',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
2025-07-21 20:57:31 +08:00
{type: 'checkbox', width: 60},
2025-07-19 17:25:17 +08:00
{
title: '考勤组名称',
field: 'groupName',
2025-07-21 20:57:31 +08:00
minWidth: 180,
2025-07-19 17:25:17 +08:00
},
{
title: '考勤类型',
field: 'attendanceType',
2025-07-21 20:57:31 +08:00
slots: {
default: ({row}) => {
return renderDict(row.attendanceType, 'wy_kqlx')
2025-07-19 17:25:17 +08:00
}
},
2025-07-21 20:57:31 +08:00
width: 150
2025-07-19 17:25:17 +08:00
},
{
title: '状态',
field: 'status',
2025-07-21 20:57:31 +08:00
slots: {
2025-07-19 17:25:17 +08:00
default: 'status'
},
2025-07-21 20:57:31 +08:00
width: 180
2025-07-19 17:25:17 +08:00
},
{
field: 'action',
fixed: 'right',
2025-07-21 20:57:31 +08:00
slots: {default: 'action'},
2025-07-19 17:25:17 +08:00
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',
2025-07-21 20:57:31 +08:00
defaultValue: '0'
2025-07-19 17:25:17 +08:00
},
{
label: '工作日设置',
fieldName: 'weekdaySetting',
component: 'Input',
dependencies: {
2025-07-21 20:57:31 +08:00
show: (formValue) => formValue.attendanceType == '0',
2025-07-19 17:25:17 +08:00
triggerFields: ['attendanceType'],
},
2025-07-21 20:57:31 +08:00
slots: {
default: 'weekdaySetting'
2025-07-19 17:25:17 +08:00
},
2025-07-21 20:57:31 +08:00
rules: 'required',
defaultValue: '1',
2025-07-19 17:25:17 +08:00
},
{
label: '',
fieldName: 'settingItem',
component: 'Input',
dependencies: {
2025-07-21 20:57:31 +08:00
show: (formValue) => formValue.attendanceType == '0',
2025-07-19 17:25:17 +08:00
triggerFields: ['attendanceType'],
},
2025-07-21 20:57:31 +08:00
slots: {
default: 'settingItem'
2025-07-19 17:25:17 +08:00
},
},
{
label: '考勤班次',
fieldName: 'attendanceShift',
component: 'Input',
dependencies: {
2025-07-21 20:57:31 +08:00
show: (formValue) => formValue.attendanceType == '1',
2025-07-19 17:25:17 +08:00
triggerFields: ['attendanceType'],
},
2025-07-21 20:57:31 +08:00
slots: {
default: 'attendanceShift'
2025-07-19 17:25:17 +08:00
},
2025-07-21 20:57:31 +08:00
rules: 'required',
defaultValue: '1',
2025-07-19 17:25:17 +08:00
},
2025-07-20 17:58:39 +08:00
{
label: '',
fieldName: 'shiftData',
component: 'Input',
dependencies: {
2025-07-21 20:57:31 +08:00
show: (formValue) => formValue.attendanceType == '1',
2025-07-20 17:58:39 +08:00
triggerFields: ['attendanceType'],
},
2025-07-21 20:57:31 +08:00
slots: {
default: 'shiftData'
2025-07-20 17:58:39 +08:00
},
},
2025-07-19 17:25:17 +08:00
{
label: '排班周期',
fieldName: 'schedulingCycle',
component: 'Input',
dependencies: {
2025-07-21 20:57:31 +08:00
show: (formValue) => formValue.attendanceType == '1',
2025-07-19 17:25:17 +08:00
triggerFields: ['attendanceType'],
},
2025-07-21 20:57:31 +08:00
slots: {
default: 'schedulingCycle'
2025-07-19 17:25:17 +08:00
},
2025-07-21 20:57:31 +08:00
defaultValue: '1',
rules: 'required'
2025-07-19 17:25:17 +08:00
},
2025-07-20 17:58:39 +08:00
{
label: '',
fieldName: 'cycleData',
component: 'Input',
dependencies: {
2025-07-21 20:57:31 +08:00
show: (formValue) => formValue.attendanceType == '1',
2025-07-20 17:58:39 +08:00
triggerFields: ['attendanceType'],
},
2025-07-21 20:57:31 +08:00
slots: {
default: 'cycleData'
2025-07-20 17:58:39 +08:00
},
},
2025-07-19 17:25:17 +08:00
];
2025-07-20 17:58:39 +08:00
export const weekdayColumns: TableColumnsType = [
2025-07-19 17:25:17 +08:00
{
title: '工作日',
2025-07-20 17:58:39 +08:00
key: 'label',
2025-07-21 20:57:31 +08:00
width: 120,
align: 'center',
dataIndex: 'label'
2025-07-19 17:25:17 +08:00
},
{
title: '班次',
2025-07-20 17:58:39 +08:00
key: 'shift',
2025-07-21 20:57:31 +08:00
minWidth: 180,
align: 'center',
dataIndex: 'shift'
2025-07-19 17:25:17 +08:00
},
{
title: '操作',
2025-07-20 17:58:39 +08:00
key: 'action',
2025-07-21 20:57:31 +08:00
dataIndex: 'action',
width: 180,
align: 'center',
2025-07-20 17:58:39 +08:00
},
]
export const noClockingColumns: TableColumnsType = [
{
title: '无需打卡日期',
key: 'label',
2025-07-21 20:57:31 +08:00
minWidth: 180,
align: 'center',
dataIndex: 'label'
2025-07-20 17:58:39 +08:00
},
{
title: '操作',
key: 'action',
2025-07-21 20:57:31 +08:00
dataIndex: 'action',
width: 150,
align: 'center',
2025-07-20 17:58:39 +08:00
},
]
export const clockingColumns: TableColumnsType = [
{
title: '必须打卡日期',
key: 'label',
2025-07-21 20:57:31 +08:00
minWidth: 180,
align: 'center',
dataIndex: 'label'
2025-07-20 17:58:39 +08:00
},
{
title: '操作',
key: 'action',
2025-07-21 20:57:31 +08:00
dataIndex: 'action',
width: 150,
align: 'center',
2025-07-20 17:58:39 +08:00
},
]
2025-07-19 17:25:17 +08:00
2025-07-20 17:58:39 +08:00
export const cycleColumns: TableColumnsType = [
{
title: '天数',
key: 'label',
2025-07-21 20:57:31 +08:00
width: 150,
align: 'center',
dataIndex: 'label'
2025-07-20 17:58:39 +08:00
},
{
title: '班次',
key: 'label',
2025-07-21 20:57:31 +08:00
minWidth: 180,
align: 'center',
dataIndex: 'label'
2025-07-20 17:58:39 +08:00
},
{
title: '操作',
key: 'action',
2025-07-21 20:57:31 +08:00
dataIndex: 'action',
width: 150,
align: 'center',
2025-07-19 17:25:17 +08:00
},
]
2025-07-20 17:58:39 +08:00
2025-07-21 20:57:31 +08:00
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'],
},
},
]