import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' import * as ItemApi from '@/api/eam/item' import { Item } from '../item/item.data' import * as LocationApi from '@/api/eam/location' import { Location } from '../location/location.data' // 表单校验 export const ItemAccountsRules = reactive({ itemNumber: [required], locationNumber: [required], singlePrice: [required], qty: [required] }) export const ItemAccounts = useCrudSchemas( reactive([ { label: '备件编号', field: 'itemNumber', sort: 'custom', isSearch: true, table: { width: 200 }, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择备件编号', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '备件信息', // 查询弹窗标题 searchAllSchemas: Item.allSchemas, // 查询弹窗所需类 searchPage: ItemApi.getItemPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '备件名称', field: 'name', sort: 'custom', table: { width: 110 }, isSearch: false }, { label: '库位编号', field: 'locationNumber', sort: 'custom', isSearch: true, form: { // labelMessage: '信息提示说明!!!', componentProps: { isSearchList: true, // 开启查询弹窗 searchListPlaceholder: '请选择库区编号', // 输入框占位文本 searchField: 'number', // 查询弹窗赋值字段 searchTitle: '库区信息', // 查询弹窗标题 searchAllSchemas: Location.allSchemas, // 查询弹窗所需类 searchPage: LocationApi.getLocationPage, // 查询弹窗所需分页方法 searchCondition: [ { key: 'available', value: 'TRUE', isMainValue: false } ] } } }, { label: '库区编号', field: 'areaNumber', sort: 'custom', required: true, table: { width: 110 } }, { label: '单价', field: 'singlePrice', sort: 'custom' }, { label: '库存数量', field: 'qty', sort: 'custom', table: { width: 110 } }, { label: '规格', field: 'specifications', sort: 'custom' }, { label: '是否账内库', field: 'isInAccount', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 130 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '是否常储', field: 'isConstant', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 110 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '科目', field: 'subject', sort: 'custom', dictType: DICT_TYPE.SUBJECT, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '科目代码', field: 'subjectCode', sort: 'custom', isTable: true }, { label: '单位', field: 'uom', sort: 'custom', dictType: DICT_TYPE.UOM, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '类别', field: 'category', sort: 'custom', dictType: DICT_TYPE.ITEM_CATEGORY, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '备件分类', field: 'classification', sort: 'custom', dictType: DICT_TYPE.PART_CLASS, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '区域', field: 'region', sort: 'custom', dictType: DICT_TYPE.REGION, dictClass: 'string', isSearch: false, isTable: true, tableForm: { type: 'Select' } }, { label: '重采购点', field: 'reprocurement', sort: 'custom', table: { width: 110 }, form: { component: 'InputNumber', value: 0 } }, { label: '安全库存', field: 'safetyStock', sort: 'custom', table: { width: 110 }, form: { component: 'InputNumber', value: 0 } }, { label: '成本中心', field: 'cost', sort: 'custom', table: { width: 110 } }, { label: '采购员', field: 'purchaser', sort: 'custom', table: { width: 100 } }, { label: '财务', field: 'financer', sort: 'custom' }, { label: '是否以旧换新', field: 'isRadeIn', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 140 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '是否框架协议', field: 'isFramework', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 140 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '是否可用', field: 'available', dictType: DICT_TYPE.TRUE_FALSE, dictClass: 'string', isSearch: false, isTable: true, sort: 'custom', table: { width: 150 }, tableForm: { type: 'Select', inactiveValue: 'FALSE', disabled: true }, form: { component: 'Switch', value: 'TRUE', componentProps: { inactiveValue: 'FALSE', activeValue: 'TRUE' } } }, { label: '操作', field: 'action', isForm: false, table: { width: 180, fixed: 'right' } } ]) )