5 changed files with 500 additions and 17 deletions
@ -0,0 +1,475 @@ |
|||||
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
const { t } = useI18n() // 国际化
|
||||
|
|
||||
|
/** |
||||
|
* @returns {Array} 基础物料信息 |
||||
|
*/ |
||||
|
const crudSchemas = reactive<CrudSchema[]>([ |
||||
|
{ |
||||
|
label: '代码', |
||||
|
field: 'code', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'left' |
||||
|
}, |
||||
|
// tableForm:{
|
||||
|
// minWidth:200,
|
||||
|
// sortable:false
|
||||
|
// }
|
||||
|
}, |
||||
|
{ |
||||
|
label: '名称', |
||||
|
field: 'name', |
||||
|
sort: 'custom', |
||||
|
isSearch: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '描述1', |
||||
|
field: 'desc1', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} , |
||||
|
// isTableForm:false
|
||||
|
}, |
||||
|
{ |
||||
|
label: '描述2', |
||||
|
field: 'desc2', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '状态', |
||||
|
field: 'status', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_STATUS, |
||||
|
dictClass: 'string', |
||||
|
isForm: true, |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '计量单位', |
||||
|
field: 'uom', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isSearch: true, |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '替代计量单位', |
||||
|
field: 'altUom', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.UOM, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 150 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否标包', |
||||
|
field: 'isStdPack', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
// colorType: 'danger',
|
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
// tableForm:{
|
||||
|
// width: 180,
|
||||
|
// type:'Radio',
|
||||
|
// }
|
||||
|
}, |
||||
|
{ |
||||
|
label: '可采购', |
||||
|
field: 'enableBuy', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '可制造', |
||||
|
field: 'enableMake', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '可委外加工', |
||||
|
field: 'enableOutsourcing', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} , |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '回收件', |
||||
|
field: 'isRecycled', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '虚零件', |
||||
|
field: 'isPhantom', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: 'ABC类', |
||||
|
field: 'abcClass', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ABC_CLASS, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '类型', |
||||
|
field: 'type', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_TYPE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '种类', |
||||
|
field: 'category', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_CATEGORY, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '分组', |
||||
|
field: 'itemGroup', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_GROUP, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '颜色', |
||||
|
field: 'color', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_COLOR, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '配置', |
||||
|
field: 'configuration', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.ITEM_CONFIGURATION, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '项目', |
||||
|
field: 'project', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 100 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '质量等级', |
||||
|
field: 'eqLevel', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.EQ_LEVEL, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '有效天数', |
||||
|
field: 'validityDays', |
||||
|
sort: 'custom', |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'InputNumber', |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '是否可用', |
||||
|
field: 'available', |
||||
|
sort: 'custom', |
||||
|
dictType: DICT_TYPE.TRUE_FALSE, |
||||
|
dictClass: 'string', |
||||
|
isTable: true, |
||||
|
table: { |
||||
|
width: 120 |
||||
|
}, |
||||
|
form: { |
||||
|
component: 'Switch', |
||||
|
value: 'TRUE', |
||||
|
componentProps: { |
||||
|
inactiveValue: 'FALSE', |
||||
|
activeValue: 'TRUE' |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '生效时间', |
||||
|
field: 'activeTime', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
} , |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
} |
||||
|
}, |
||||
|
// tableForm:{
|
||||
|
// width: 200,
|
||||
|
// type:'FormDateTime',
|
||||
|
// }
|
||||
|
}, |
||||
|
{ |
||||
|
label: '失效时间', |
||||
|
field: 'expireTime', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
} , |
||||
|
form: { |
||||
|
component: 'DatePicker', |
||||
|
componentProps: { |
||||
|
type: 'datetime', |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建时间', |
||||
|
field: 'createTime', |
||||
|
sort: 'custom', |
||||
|
isTable: true, |
||||
|
formatter: dateFormatter, |
||||
|
isForm: false, |
||||
|
detail: { |
||||
|
dateFormat: 'YYYY-MM-DD HH:mm:ss' |
||||
|
}, |
||||
|
table: { |
||||
|
width: 180 |
||||
|
} , |
||||
|
}, |
||||
|
{ |
||||
|
label: '创建者', |
||||
|
field: 'creator', |
||||
|
isForm: false, |
||||
|
isTable: false |
||||
|
}, |
||||
|
{ label: '备注', field: 'remark', sort: 'custom', isTable: false}, |
||||
|
{ |
||||
|
label: '操作', |
||||
|
field: 'action', |
||||
|
isDetail: false, |
||||
|
isForm: false , |
||||
|
table: { |
||||
|
width: 150, |
||||
|
fixed: 'right' |
||||
|
}, |
||||
|
} |
||||
|
]) |
||||
|
|
||||
|
// 表单校验
|
||||
|
export const rules = reactive({ |
||||
|
code: [ |
||||
|
{ required: true, message: '请输入代码', trigger: 'blur' } |
||||
|
], |
||||
|
name: [ |
||||
|
{ required: true, message: '请输入名称', trigger: 'blur' } |
||||
|
], |
||||
|
status: [ |
||||
|
{ required: true, message: '请选择状态', trigger: 'change' } |
||||
|
], |
||||
|
uom: [ |
||||
|
{ required: true, message: '请选择计量单位', trigger: 'change' } |
||||
|
], |
||||
|
altUom: [ |
||||
|
{ required: true, message: '请选择替代计量单位', trigger: 'change' } |
||||
|
], |
||||
|
isStdPack: [ |
||||
|
{ required: true, message: '请选择是否标包', trigger: 'change' } |
||||
|
], |
||||
|
enableBuy: [ |
||||
|
{ required: true, message: '请选择是否可采购', trigger: 'change' } |
||||
|
], |
||||
|
enableMake: [ |
||||
|
{ required: true, message: '请选择是否可制造', trigger: 'change' } |
||||
|
], |
||||
|
enableOutsourcing: [ |
||||
|
{ required: true, message: '请选择是否可委外加工', trigger: 'change' } |
||||
|
], |
||||
|
isRecycled: [ |
||||
|
{ required: true, message: '请选择回收件', trigger: 'change' } |
||||
|
], |
||||
|
isPhantom: [ |
||||
|
{ required: true, message: '请选择虚零件', trigger: 'change' } |
||||
|
], |
||||
|
abcClass: [ |
||||
|
{ required: true, message: '请选择ABC类', trigger: 'change' } |
||||
|
], |
||||
|
type: [ |
||||
|
{ required: true, message: '请选择类型', trigger: 'change' } |
||||
|
], |
||||
|
category: [ |
||||
|
{ required: true, message: '请选择种类', trigger: 'change' } |
||||
|
], |
||||
|
itemGroup: [ |
||||
|
{ required: true, message: '请选择分组', trigger: 'change' } |
||||
|
], |
||||
|
color: [ |
||||
|
{ required: true, message: '请选择颜色', trigger: 'change' } |
||||
|
], |
||||
|
configuration: [ |
||||
|
{ required: true, message: '请选择配置', trigger: 'change' } |
||||
|
], |
||||
|
project: [ |
||||
|
{ required: true, message: '请输入项目', trigger: 'blur' } |
||||
|
], |
||||
|
eqLevel: [ |
||||
|
{ required: true, message: '请选择质量等级', trigger: 'change' } |
||||
|
], |
||||
|
validityDays: [ |
||||
|
{ required: true, message: '请输入有效天数', trigger: 'change' } |
||||
|
], |
||||
|
available: [ |
||||
|
{ required: true, message: '请选择是否可用', trigger: 'change' } |
||||
|
], |
||||
|
activeTime: [ |
||||
|
{ required: true, message: '请输入生效时间', trigger: 'change' } |
||||
|
], |
||||
|
expireTime: [ |
||||
|
{ required: true, message: '请输入失效时间', trigger: 'change' } |
||||
|
], |
||||
|
}) |
||||
|
|
||||
|
export const { allSchemas } = useCrudSchemas(crudSchemas) |
Loading…
Reference in new issue