You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
241 lines
4.7 KiB
241 lines
4.7 KiB
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
const { t } = useI18n() // 国际化
|
|
|
|
/**
|
|
* @returns {Array} 班次
|
|
*/
|
|
export const Shift = useCrudSchemas(reactive<CrudSchema[]>([
|
|
{
|
|
label: '代码',
|
|
field: 'code',
|
|
sort: 'custom',
|
|
table: {
|
|
width: 150,
|
|
fixed: 'left'
|
|
},
|
|
isSearch: true,
|
|
},
|
|
{
|
|
label: '名称',
|
|
field: 'name',
|
|
sort: 'custom',
|
|
table: {
|
|
width: 150
|
|
},
|
|
},
|
|
{
|
|
label: '开始时间',
|
|
field: 'beginTime',
|
|
isTable: true,
|
|
formatter: dateFormatter,
|
|
detail: {
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
},
|
|
sort: 'custom',
|
|
table: {
|
|
width: 180
|
|
},
|
|
form: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
style: {width:'100%'},
|
|
type: 'datetime',
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'x',
|
|
}
|
|
},
|
|
},
|
|
{
|
|
label: '结束时间',
|
|
field: 'entTime',
|
|
isTable: true,
|
|
formatter: dateFormatter,
|
|
detail: {
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
},
|
|
sort: 'custom',
|
|
table: {
|
|
width: 180
|
|
},
|
|
form: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
style: {width:'100%'},
|
|
type: 'datetime',
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'x',
|
|
}
|
|
},
|
|
isSearch: true,
|
|
search: {
|
|
show: true,
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
type: 'daterange',
|
|
}
|
|
}
|
|
},
|
|
{
|
|
label: '是否跨天',
|
|
field: 'endAtNextDay',
|
|
dictType: DICT_TYPE.TRUE_FALSE,
|
|
dictClass: 'string',
|
|
isTable: true,
|
|
isSearch: true,
|
|
sort: 'custom',
|
|
table: {
|
|
width: 150
|
|
},
|
|
form: {
|
|
component: 'Switch',
|
|
value: 'TRUE',
|
|
componentProps: {
|
|
inactiveValue: 'FALSE',
|
|
activeValue: 'TRUE'
|
|
}
|
|
},
|
|
},
|
|
{
|
|
label: '是否可用',
|
|
field: 'available',
|
|
dictType: DICT_TYPE.TRUE_FALSE,
|
|
dictClass: 'string',
|
|
isTable: true,
|
|
isSearch: true,
|
|
sort: 'custom',
|
|
table: {
|
|
width: 150
|
|
},
|
|
form: {
|
|
component: 'Switch',
|
|
value: 'TRUE',
|
|
componentProps: {
|
|
inactiveValue: 'FALSE',
|
|
activeValue: 'TRUE'
|
|
}
|
|
},
|
|
},
|
|
{
|
|
label: '生效时间',
|
|
field: 'activeTime',
|
|
isTable: true,
|
|
formatter: dateFormatter,
|
|
detail: {
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
},
|
|
sort: 'custom',
|
|
table: {
|
|
width: 180
|
|
},
|
|
form: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
style: {width:'100%'},
|
|
type: 'datetime',
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'x',
|
|
}
|
|
},
|
|
},
|
|
{
|
|
label: '失效时间',
|
|
field: 'expireTime',
|
|
isTable: true,
|
|
formatter: dateFormatter,
|
|
detail: {
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
},
|
|
sort: 'custom',
|
|
table: {
|
|
width: 180
|
|
},
|
|
form: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
style: {width:'100%'},
|
|
type: 'datetime',
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'x',
|
|
}
|
|
},
|
|
},
|
|
{
|
|
label: '备注',
|
|
field: 'remark',
|
|
sort: 'custom',
|
|
table: {
|
|
width: 150
|
|
},
|
|
},
|
|
{
|
|
label: '创建时间',
|
|
field: 'createTime',
|
|
formatter: dateFormatter,
|
|
detail: {
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss'
|
|
},
|
|
sort: 'custom',
|
|
table: {
|
|
width: 180
|
|
},
|
|
form: {
|
|
component: 'DatePicker',
|
|
componentProps: {
|
|
style: {width:'100%'},
|
|
type: 'datetime',
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
valueFormat: 'x',
|
|
}
|
|
},
|
|
isForm: false,
|
|
isTable: false,
|
|
},
|
|
{
|
|
label: '创建者',
|
|
field: 'creator',
|
|
sort: 'custom',
|
|
table: {
|
|
width: 150
|
|
},
|
|
isForm: false,
|
|
isTable: false,
|
|
},
|
|
{
|
|
label: '操作',
|
|
field: 'action',
|
|
isDetail: false,
|
|
isForm: false ,
|
|
table: {
|
|
width: 150,
|
|
fixed: 'right'
|
|
}
|
|
}
|
|
]))
|
|
|
|
//表单校验
|
|
export const ShiftRules = reactive({
|
|
code: [
|
|
{ required: true, message: '请输入代码', trigger: 'blur' },
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
|
|
],
|
|
name: [
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
|
|
],
|
|
remark: [
|
|
{ max: 50, message: '不得超过50个字符', trigger: 'blur' }
|
|
],
|
|
beginTime: [
|
|
{ required: true, message: '请输入开始时间', trigger: 'blur' }
|
|
],
|
|
entTime: [
|
|
{ required: true, message: '请输入结束时间', trigger: 'blur' }
|
|
],
|
|
endAtNextDay: [
|
|
{ required: true, message: '请选择是否跨天', trigger: 'change' }
|
|
],
|
|
available: [
|
|
{ required: true, message: '请选择是否可用', trigger: 'change' }
|
|
],
|
|
})
|