170 lines
3.4 KiB
TypeScript
170 lines
3.4 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";
|
||
|
|
||
|
|
||
|
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: 'schedulingCycle',
|
||
|
component: 'Input',
|
||
|
dependencies: {
|
||
|
show: (formValue) => formValue.attendanceType=='1',
|
||
|
triggerFields: ['attendanceType'],
|
||
|
},
|
||
|
slots:{
|
||
|
default:'schedulingCycle'
|
||
|
},
|
||
|
defaultValue:'1',
|
||
|
rules:'required'
|
||
|
},
|
||
|
];
|
||
|
|
||
|
export const weekdayColumns: VxeGridProps['columns'] = [
|
||
|
{
|
||
|
title: '工作日',
|
||
|
name: 'label',
|
||
|
width:180,
|
||
|
align:'center',
|
||
|
dataIndex:'label'
|
||
|
},
|
||
|
{
|
||
|
title: '班次',
|
||
|
name: 'shift',
|
||
|
minWidth:180,
|
||
|
align:'center',
|
||
|
dataIndex:'shift'
|
||
|
},
|
||
|
{
|
||
|
title: '操作',
|
||
|
name: 'action',
|
||
|
dataIndex:'action',
|
||
|
width:180,
|
||
|
align:'center',
|
||
|
slots:{
|
||
|
default:'action'
|
||
|
},
|
||
|
|
||
|
},
|
||
|
]
|