diff --git a/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts b/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts index 05b0458..a637649 100644 --- a/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts +++ b/src/views/eam/item/itemApplyMain/itemApplyMain.data.ts @@ -3,479 +3,515 @@ import { dateFormatter } from '@/utils/formatTime' import { ItemAccounts } from '@/views/eam/item/itemAccounts/itemAccounts.data' import * as ItemAccountsApi from '@/api/eam/item/itemAccounts' import * as DeviceMoldItemsApi from '@/api/eam/basic/deviceMaintenance' -import { validateHanset, validateEmail } from '@/utils/validator' -import Detail from '@/views/bpm/oa/leave/detail.vue' +import { getUserListAll } from '@/api/system/user' + const { t } = useI18n() // 国际化 /** * @returns {Array} 备件申领主表 */ -export const ItemApplyMain = useCrudSchemas(reactive([ - { - label: '领用编号', - field: 'number', - sort: 'custom', - isForm: false, - isSearch: true, - table: { - width: 180, - fixed: 'left' +export const ItemApplyMain = useCrudSchemas( + reactive([ + { + label: '领用编号', + field: 'number', + sort: 'custom', + isForm: false, + isSearch: true, + table: { + width: 180, + fixed: 'left' + } }, - }, - { - label: '申领人', - field: 'applyId', - sort: 'custom', - isForm: false, - isSearch: false, - }, - - { - label: '审批人', - field: 'approveId', - sort: 'custom', - isForm: false, - isSearch: false, - }, - { - label: '出库人', - field: 'outId', - sort: 'custom', - isForm: false, - isSearch: false, - }, - { - label: '是否已审批', - field: 'isApprove', - sort: 'custom', - dictType: DICT_TYPE.TRUE_FALSE, - dictClass: 'string', - isSearch: true, - isTable: true, - isForm: false, - table: { - width: 150 + { + label: '申领人', + field: 'applyId', + sort: 'custom', + isForm: false, + hiddenSearchHigh: true, + isSearch: true, + search: { + show: true, + component: 'Select', + api: () => getUserListAll(), + componentProps: { + optionsAlias: { + labelField: 'nickname', + valueField: 'id' + }, + filterable: true + } + } }, - tableForm: { - type: 'Select', - disabled: false - } - }, - { - label: '状态', - field: 'status', - sort: 'custom', - dictType: DICT_TYPE.ITEM_APPLY_STATUS, - dictClass: 'string', - isSearch: true, - isTable: true, - isForm: false, - table: { - width: 150 - }, - tableForm: { - type: 'Select', - disabled: false - } - }, - { - label: '申请主题', - field: 'name', - sort: 'custom', - }, - { - label: '成本中心', - field: 'costCenter', - sort: 'custom', - dictType: DICT_TYPE.CENTER_SUBJECT_MAP_DEPT, - }, - { - label: '创建者', - field: 'creator', - hiddenSearchHigh: true, - sort: 'custom', - isForm: false, - isSearch: false + + { + label: '审批人', + field: 'approveId', + hiddenSearchHigh: true, + sort: 'custom', + isForm: false, + isSearch: true, + search: { + show: true, + component: 'Select', + api: () => getUserListAll(), + componentProps: { + optionsAlias: { + labelField: 'nickname', + valueField: 'id' + }, + filterable: true + } + } + }, + { + label: '出库人', + field: 'outId', + hiddenSearchHigh: true, + sort: 'custom', + isForm: false, + isSearch: true, + search: { + show: true, + component: 'Select', + api: () => getUserListAll(), + componentProps: { + optionsAlias: { + labelField: 'nickname', + valueField: 'id' + }, + filterable: true + } + } + }, + { + label: '是否已审批', + field: 'isApprove', + sort: 'custom', + dictType: DICT_TYPE.TRUE_FALSE, + dictClass: 'string', + isSearch: true, + isTable: true, + isForm: false, + table: { + width: 150 }, - { - label: '创建时间', - field: 'createTime', - hiddenSearchHigh: true, - formatter: dateFormatter, - detail: { - dateFormat: 'YYYY-MM-DD HH:mm:ss' - }, - sort: 'custom', - isTable: true, - form: { - component: 'DatePicker', - componentProps: { - style: { width: '100%' }, - type: 'datetime', - dateFormat: 'YYYY-MM-DD HH:mm:ss', - valueFormat: 'x' - } - }, - isForm: false, - isSearch: true, - 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')] - } + tableForm: { + type: 'Select', + disabled: false + } + }, + { + label: '状态', + field: 'status', + sort: 'custom', + dictType: DICT_TYPE.ITEM_APPLY_STATUS, + dictClass: 'string', + isSearch: true, + isTable: true, + isForm: false, + table: { + width: 150 + }, + tableForm: { + type: 'Select', + disabled: false + } + }, + { + label: '申请主题', + field: 'name', + sort: 'custom' + }, + { + label: '成本中心', + field: 'costCenter', + sort: 'custom', + dictType: DICT_TYPE.CENTER_SUBJECT_MAP_DEPT + }, + { + label: '创建者', + field: 'creator', + hiddenSearchHigh: true, + sort: 'custom', + isForm: false, + isSearch: false + }, + { + label: '创建时间', + field: 'createTime', + hiddenSearchHigh: true, + formatter: dateFormatter, + detail: { + dateFormat: 'YYYY-MM-DD HH:mm:ss' + }, + sort: 'custom', + isTable: true, + form: { + component: 'DatePicker', + componentProps: { + style: { width: '100%' }, + type: 'datetime', + dateFormat: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x' } }, + isForm: false, + isSearch: true, + 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')] + } + } + }, - { - label: '操作', - field: 'action', - isDetail: false, - isForm: false, - table: { - width: 200, - fixed: 'right' + { + label: '操作', + field: 'action', + isDetail: false, + isForm: false, + table: { + width: 200, + fixed: 'right' + } } - } -])) + ]) +) //表单校验 export const ItemApplyMainRules = reactive({ - name: [ - { required: true, message: '请填写描述', trigger: 'change' } - ], - remark: [ - { max: 50, message: '不得超过50个字符', trigger: 'blur' } - ], - available: [ - { required: true, message: '请选择是否可用', trigger: 'change' } - ], - costCenter:[ - { required: true, message: '请填写描述', trigger: 'change' } - ], + name: [{ required: true, message: '请填写描述', trigger: 'change' }], + remark: [{ max: 50, message: '不得超过50个字符', trigger: 'blur' }], + available: [{ required: true, message: '请选择是否可用', trigger: 'change' }], + costCenter: [{ required: true, message: '请填写描述', trigger: 'change' }] }) - -export const DeviceMOLD = useCrudSchemas(reactive([ - { - label: '编号', - field: 'number', - sort: 'custom', - isForm: false, - table: { - width: 180, - fixed: 'left' +export const DeviceMOLD = useCrudSchemas( + reactive([ + { + label: '编号', + field: 'number', + sort: 'custom', + isForm: false, + table: { + width: 180, + fixed: 'left' + } }, - }, - { - label: '名称', - field: 'name', - sort: 'custom', - }, - { - label: '规格型号', - field: 'specification', - sort: 'custom', - }, - -])) + { + label: '名称', + field: 'name', + sort: 'custom' + }, + { + label: '规格型号', + field: 'specification', + sort: 'custom' + } + ]) +) /** * @returns {Array} 备件申请子表 */ -export const ItemApplyDetail = useCrudSchemas(reactive([ - { - label: '备件编号', - field: 'itemNumber', - sort: 'custom', - isSearch: true, - tableForm: { - isInpuFocusShow: true, - searchListPlaceholder: '请选择备件编号', - searchField: 'number', - searchTitle: '备件信息', - searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类 - searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法 - searchCondition: [{ - key: 'available', - value: 'TRUE', - isMainValue: false - }, - ] - }, - form: { - // labelMessage: '信息提示说明!!!', - componentProps: { - isSearchList: true, +export const ItemApplyDetail = useCrudSchemas( + reactive([ + { + label: '备件编号', + field: 'itemNumber', + sort: 'custom', + isSearch: true, + tableForm: { + isInpuFocusShow: true, searchListPlaceholder: '请选择备件编号', searchField: 'number', searchTitle: '备件信息', searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类 searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法 - searchCondition: [{ - key: 'available', - value: 'TRUE', - isMainValue: false - },] + searchCondition: [ + { + key: 'available', + value: 'TRUE', + isMainValue: false + } + ] + }, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, + searchListPlaceholder: '请选择备件编号', + searchField: 'number', + searchTitle: '备件信息', + searchAllSchemas: ItemAccounts.allSchemas, // 查询弹窗所需类 + searchPage: ItemAccountsApi.getItemAccountsPage, // 查询弹窗所需分页方法 + searchCondition: [ + { + key: 'available', + value: 'TRUE', + isMainValue: false + } + ] + } } - } - }, - { - label: '备件名称', - field: 'name', - sort: 'custom', - isTable: true, - table: { - width: 150 }, - isTableForm: true, - tableForm: { - disabled: true - } - }, - { - label: '类型', - field: 'type', - sort: 'custom', - dictType: DICT_TYPE.DEVICE_MOLD_TYPE, - dictClass: 'string', - isSearch: true, - isTable: true, - table: { - width: 150 - }, - tableForm: { - type: 'Select', - disabled: false - }, - isTableForm: true, - }, - { - label: '规格型号', - field: 'specifications', - sort: 'custom', - isTable: true, - table: { - width: 150 - }, - isTableForm: true, - form: { - componentProps: { + { + label: '备件名称', + field: 'name', + sort: 'custom', + isTable: true, + table: { + width: 150 + }, + isTableForm: true, + tableForm: { disabled: true } }, - tableForm: { - disabled: true - } - }, - { - label: '设备/模具编号', - field: 'deviceNumber', - sort: 'custom', - isSearch: true, - tableForm: { - isInpuFocusShow: true, - searchListPlaceholder: '请选择单号', - searchField: 'number', - searchTitle: '单号信息', - searchAllSchemas: DeviceMOLD.allSchemas, // 查询弹窗所需类 - searchPage: DeviceMoldItemsApi.getNumber, // 查询弹窗所需分页方法 - searchCondition: [{ - key: 'available', - value: "TRUE", - isMainValue: false - }, { - key: 'type', - value: "type", - isMainValue: true + { + label: '类型', + field: 'type', + sort: 'custom', + dictType: DICT_TYPE.DEVICE_MOLD_TYPE, + dictClass: 'string', + isSearch: true, + isTable: true, + table: { + width: 150 + }, + tableForm: { + type: 'Select', + disabled: false + }, + isTableForm: true + }, + { + label: '规格型号', + field: 'specifications', + sort: 'custom', + isTable: true, + table: { + width: 150 + }, + isTableForm: true, + form: { + componentProps: { + disabled: true + } + }, + tableForm: { + disabled: true } - ] }, - form: { - // labelMessage: '信息提示说明!!!', - componentProps: { - isSearchList: true, + { + label: '设备/模具编号', + field: 'deviceNumber', + sort: 'custom', + isSearch: true, + tableForm: { + isInpuFocusShow: true, searchListPlaceholder: '请选择单号', searchField: 'number', searchTitle: '单号信息', searchAllSchemas: DeviceMOLD.allSchemas, // 查询弹窗所需类 searchPage: DeviceMoldItemsApi.getNumber, // 查询弹窗所需分页方法 - searchCondition: [{ - key: 'available', - value: "TRUE", - isMainValue: false - }, { - key: 'type', - value: "type", - isMainValue: true - }] + searchCondition: [ + { + key: 'available', + value: 'TRUE', + isMainValue: false + }, + { + key: 'type', + value: 'type', + isMainValue: true + } + ] + }, + form: { + // labelMessage: '信息提示说明!!!', + componentProps: { + isSearchList: true, + searchListPlaceholder: '请选择单号', + searchField: 'number', + searchTitle: '单号信息', + searchAllSchemas: DeviceMOLD.allSchemas, // 查询弹窗所需类 + searchPage: DeviceMoldItemsApi.getNumber, // 查询弹窗所需分页方法 + searchCondition: [ + { + key: 'available', + value: 'TRUE', + isMainValue: false + }, + { + key: 'type', + value: 'type', + isMainValue: true + } + ] + } } - } - }, - { - label: '申领数量', - field: 'qty', - sort: 'custom', - table: { - width: 150 }, - form: { - component: 'InputNumber', - componentProps: { + { + label: '申领数量', + field: 'qty', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + min: 0, + precision: 2 + } + }, + tableForm: { + type: 'InputNumber', min: 0, precision: 2 } }, - tableForm: { - type: 'InputNumber', - min: 0, - precision: 2 - } - }, - { - label: '(库内或库外)库存数量', - field: 'currentQty', - sort: 'custom', - table: { - width: 150 - }, - form: { - component: 'InputNumber', - componentProps: { + { + label: '(库内或库外)库存数量', + field: 'currentQty', + sort: 'custom', + table: { + width: 150 + }, + form: { + component: 'InputNumber', + componentProps: { + disabled: true, + min: 0, + precision: 2 + } + }, + tableForm: { disabled: true, + type: 'InputNumber', min: 0, precision: 2 } }, - tableForm: { - disabled: true, - type: 'InputNumber', - min: 0, - precision: 2 - }, - }, - { - label: '库存总数', - field: 'totalStockQty', - sort: 'custom', - table: { - width: 150 - }, - isForm: false, - tableForm: { - disabled: true, - type: 'InputNumber', - min: 0, - precision: 2 - }, - isTable:false, - }, - { - label: '可申请库存数量', - field: 'availableQty', - sort: 'custom', - table: { - width: 150 - }, - isForm: false, - tableForm: { - disabled: true, - type: 'InputNumber', - min: 0, - precision: 2 - }, - isTable:false, - }, - { - label: '已出库数量', - field: 'requestQty', - sort: 'custom', - table: { - width: 150 + { + label: '库存总数', + field: 'totalStockQty', + sort: 'custom', + table: { + width: 150 + }, + isForm: false, + tableForm: { + disabled: true, + type: 'InputNumber', + min: 0, + precision: 2 + }, + isTable: false }, - isForm: false, - tableForm: { - disabled: true, - type: 'InputNumber', - min: 0, - precision: 2 + { + label: '可申请库存数量', + field: 'availableQty', + sort: 'custom', + table: { + width: 150 + }, + isForm: false, + tableForm: { + disabled: true, + type: 'InputNumber', + min: 0, + precision: 2 + }, + isTable: false }, - }, + { + label: '已出库数量', + field: 'requestQty', + sort: 'custom', + table: { + width: 150 + }, + isForm: false, + tableForm: { + disabled: true, + type: 'InputNumber', + min: 0, + precision: 2 + } + } - // { - // label: '是否账内库', - // field: 'isInAccount', - // sort: 'custom', - // dictType: DICT_TYPE.TRUE_FALSE, - // dictClass: 'string', - // isSearch: true, - // isTable: true, - // table: { - // width: 150 - // }, - // tableForm: { - // type: 'Select', - // disabled: true - // }, - // form: { - // componentProps: { - // disabled: true, - // } - // }, - // }, - // { - // label: '是否可用', - // field: 'available', - // sort: 'custom', - // dictType: DICT_TYPE.TRUE_FALSE, - // dictClass: 'string', - // isSearch: true, - // isTable: true, - // table: { - // width: 150 - // }, - // tableForm: { - // type: 'Select', - // disabled: true - // } - // }, - // { - // label: '备注', - // field: 'remark', - // table: { - // width: 150 - // }, - // }, - // { - // label: '操作', - // field: 'action', - // isDetail: false, - // isForm: false, - // table: { - // width: 150, - // fixed: 'right' - // }, - // isTableForm: false, - // } -])) + // { + // label: '是否账内库', + // field: 'isInAccount', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // isSearch: true, + // isTable: true, + // table: { + // width: 150 + // }, + // tableForm: { + // type: 'Select', + // disabled: true + // }, + // form: { + // componentProps: { + // disabled: true, + // } + // }, + // }, + // { + // label: '是否可用', + // field: 'available', + // sort: 'custom', + // dictType: DICT_TYPE.TRUE_FALSE, + // dictClass: 'string', + // isSearch: true, + // isTable: true, + // table: { + // width: 150 + // }, + // tableForm: { + // type: 'Select', + // disabled: true + // } + // }, + // { + // label: '备注', + // field: 'remark', + // table: { + // width: 150 + // }, + // }, + // { + // label: '操作', + // field: 'action', + // isDetail: false, + // isForm: false, + // table: { + // width: 150, + // fixed: 'right' + // }, + // isTableForm: false, + // } + ]) +) //表单校验 export const ItemApplyDetailRules = reactive({ - itemNumber: [ - { required: true, message: '请选择备件编号', trigger: 'change' } - ], + itemNumber: [{ required: true, message: '请选择备件编号', trigger: 'change' }], // type: [ // { required: true, message: '请选择类型', trigger: 'change' } // ], // deviceNumber: [ // { required: true, message: '请选择设备模具编号', trigger: 'change' } // ], - qty: [ - { required: true, message: '请输入申领数量', trigger: 'change' } - ], - available: [ - { required: true, message: '请选择是否可用', trigger: 'change' } - ], - + qty: [{ required: true, message: '请输入申领数量', trigger: 'change' }], + available: [{ required: true, message: '请选择是否可用', trigger: 'change' }] })