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.
265 lines
5.3 KiB
265 lines
5.3 KiB
1 year ago
|
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||
|
import { dateFormatter } from '@/utils/formatTime'
|
||
|
import * as ConfigApi from '@/api/infra/config'
|
||
|
const autoCodeSwitch = await ConfigApi.getConfigKey('sparePartCodeAutoSwitch')
|
||
|
const autoSwitch = ref(false)
|
||
|
if (autoCodeSwitch == 'TRUE') {
|
||
|
autoSwitch.value = true
|
||
|
}
|
||
|
|
||
|
// 表单校验
|
||
|
export const SparePartRules = reactive({
|
||
|
code: [required],
|
||
|
name: [required],
|
||
|
isOverall: [required],
|
||
|
uom: [required],
|
||
|
concurrencyStamp: [required]
|
||
|
})
|
||
|
|
||
|
export const SparePart = useCrudSchemas(reactive<CrudSchema[]>([
|
||
|
{
|
||
|
label: '备件编号',
|
||
|
field: 'code',
|
||
|
sort: 'custom',
|
||
|
isForm: !autoSwitch.value,
|
||
|
isSearch: true,
|
||
|
fixed: 'left'
|
||
|
},
|
||
|
{
|
||
|
label: '名称',
|
||
|
field: 'name',
|
||
|
sort: 'custom',
|
||
|
isSearch: true
|
||
|
},
|
||
|
{
|
||
|
label: '品牌',
|
||
|
field: 'brand',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '规格型号',
|
||
|
field: 'specifications',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '是否全局',
|
||
|
field: 'isOverall',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.TRUE_FALSE,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Switch',
|
||
|
value: 'TRUE',
|
||
|
componentProps: {
|
||
|
inactiveValue: 'FALSE',
|
||
|
activeValue: 'TRUE'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '是否存储',
|
||
|
field: 'isConstant',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.TRUE_FALSE,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Switch',
|
||
|
value: 'TRUE',
|
||
|
componentProps: {
|
||
|
inactiveValue: 'FALSE',
|
||
|
activeValue: 'TRUE'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '科目',
|
||
|
field: 'subject',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.SUBJECT,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Select'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '科目代码',
|
||
|
field: 'subjectCode',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '类别',
|
||
|
field: 'category',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '区域',
|
||
|
field: 'region',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.REGION,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isSearch: false,
|
||
|
form: {
|
||
|
component: 'Select'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '备件分类',
|
||
|
field: 'classification',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.PART_CLASS,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Select'
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '单位',
|
||
|
field: 'uom',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '单价',
|
||
|
field: 'singlePrice',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '库龄',
|
||
|
field: 'stockAge',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
form: {
|
||
|
component: 'InputNumber',
|
||
|
value: 0
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '重采购点',
|
||
|
field: 'reprocurement',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
form: {
|
||
|
component: 'InputNumber',
|
||
|
value: 0
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '安全库存',
|
||
|
field: 'safetyStock',
|
||
|
sort: 'custom',
|
||
|
isSearch: false,
|
||
|
form: {
|
||
|
component: 'InputNumber',
|
||
|
value: 0
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '成本中心',
|
||
|
field: 'cost',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '采购员',
|
||
|
field: 'purchaser',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '财务',
|
||
|
field: 'financer',
|
||
|
sort: 'custom',
|
||
|
isSearch: false
|
||
|
},
|
||
|
{
|
||
|
label: '采购时间',
|
||
|
field: 'purchaseTime',
|
||
|
sort: 'custom',
|
||
|
formatter: dateFormatter,
|
||
|
isSearch: false,
|
||
|
search: {
|
||
|
component: 'DatePicker',
|
||
|
componentProps: {
|
||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||
|
type: 'daterange',
|
||
|
defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')]
|
||
|
}
|
||
|
},
|
||
|
form: {
|
||
|
component: 'DatePicker',
|
||
|
componentProps: {
|
||
|
type: 'datetime',
|
||
|
valueFormat: 'x'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '是否框架协议',
|
||
|
field: 'isFramework',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.TRUE_FALSE,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Switch',
|
||
|
value: 'TRUE',
|
||
|
componentProps: {
|
||
|
inactiveValue: 'FALSE',
|
||
|
activeValue: 'TRUE'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '是否以旧换新',
|
||
|
field: 'isRadeIn',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.TRUE_FALSE,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isSearch: true,
|
||
|
form: {
|
||
|
component: 'Switch',
|
||
|
value: 'TRUE',
|
||
|
componentProps: {
|
||
|
inactiveValue: 'FALSE',
|
||
|
activeValue: 'TRUE'
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
label: '备注',
|
||
|
field: 'remark',
|
||
|
sort: 'custom',
|
||
|
isSearch: true
|
||
|
},
|
||
|
{
|
||
|
label: '是否可用',
|
||
|
field: 'available',
|
||
|
sort: 'custom',
|
||
|
dictType: DICT_TYPE.TRUE_FALSE,
|
||
|
dictClass: 'string', // 默认都是字符串类型其他暂不考虑
|
||
|
isTable: true,
|
||
|
isDetail: false,
|
||
|
isForm: false,
|
||
|
isSearch: false,
|
||
|
isTableForm: false,
|
||
|
},
|
||
|
{
|
||
|
label: '操作',
|
||
|
field: 'action',
|
||
|
isForm: false,
|
||
|
table: {
|
||
|
width: 150,
|
||
|
fixed: 'right'
|
||
|
}
|
||
|
}
|
||
|
]))
|