diff --git a/src/api/eam/item/itemAccounts/index.ts b/src/api/eam/item/itemAccounts/index.ts index 62f4ad8..c8a161d 100644 --- a/src/api/eam/item/itemAccounts/index.ts +++ b/src/api/eam/item/itemAccounts/index.ts @@ -33,6 +33,11 @@ export const getByLocationNumber = async (locationNumber: string) => { return await request.get({ url: `/eam/item-accounts/getByLocationNumber?locationNumber=` + locationNumber }) } +// 根据备件查询备件台账详情 +export const getByItemNumber = async (itemNumber: string) => { + return await request.get({ url: `/eam/item-accounts/getByItemNumber?itemNumber=` + itemNumber }) +} + // 新增备件台账 export const createItemAccounts = async (data: ItemAccountsVO) => { return await request.post({ url: `/eam/item-accounts/create`, data }) diff --git a/src/views/eam/basic/item/item.data.ts b/src/views/eam/basic/item/item.data.ts index a05ed1b..bf5e788 100644 --- a/src/views/eam/basic/item/item.data.ts +++ b/src/views/eam/basic/item/item.data.ts @@ -19,6 +19,31 @@ export const ItemRules = reactive({ ], }) +export const ItemSearchTable = useCrudSchemas(reactive([ + { + label: '备件编号', + field: 'number', + sort: 'custom', + isSearch: true, + isForm: false, + table: { + fixed: 'left' + }, + }, + { + label: '备件名称', + field: 'name', + sort: 'custom', + isSearch: true, + table: { + }, + }, + { + label: '数量', + field: 'qty', + sort: 'custom', + } +])) export const Item = useCrudSchemas(reactive([ { label: '零件编码', diff --git a/src/views/eam/item/itemAccounts/index.vue b/src/views/eam/item/itemAccounts/index.vue index 0d50ccb..495d646 100644 --- a/src/views/eam/item/itemAccounts/index.vue +++ b/src/views/eam/item/itemAccounts/index.vue @@ -68,13 +68,36 @@ const tableColumns = ref(ItemAccounts.allSchemas.tableColumns) // 查询页面返回 - const searchTableSuccess = (formField, searchField, val, formRef) => {//表单选中表格后走的方法 - nextTick(() => { - const setV = {} - setV[formField] = val[0][searchField] - setV['itemName'] = val[0]['name'] + const searchTableSuccess = async(formField, searchField, val, formRef) => {//表单选中表格后走的方法 + if(formField=='itemNumber'){ + const aa = await ItemAccountsApi.getByItemNumber(val[0][searchField]); + if(aa.locationNumber==null||aa.locationNumber==''){//该备件无台账 + nextTick(() => { + const setV = {} + setV[formField] = val[0][searchField] + setV['itemName'] = val[0]['name'] + setV['locationNumber'] = '' + setV['areaNumber'] = '' formRef.setValues(setV) - }) + }) + }else{//有台账直接回显 + nextTick(() => { + const setV = {} + setV[formField] = val[0][searchField] + setV['itemName'] = val[0]['name'] + setV['locationNumber'] = aa.locationNumber + setV['areaNumber'] =aa.areaNumber + formRef.setValues(setV) + }) + } + }else{ + nextTick(() => { + const setV = {} + setV[formField] = val[0][searchField] + formRef.setValues(setV) + }) + } + } // 字段设置 更新主列表字段 diff --git a/src/views/eam/item/itemInLocation/index.vue b/src/views/eam/item/itemInLocation/index.vue index 3adfe67..754c758 100644 --- a/src/views/eam/item/itemInLocation/index.vue +++ b/src/views/eam/item/itemInLocation/index.vue @@ -68,7 +68,7 @@ setV[formField] = ''; setV[formField] = val[0][searchField] formRef.setValues(setV) - message.error('该库位下无绑定的备件') + message.info('该库位下无绑定的备件') return; }) }else{ @@ -201,7 +201,7 @@ // 发起导出 exportLoading.value = true const data = await ItemInLocationApi.exportItemInLocation(tableObject.params) - download.excel(data, '备件入库记录.xlsx') + download.excel(data, '备件归还记录.xlsx') } catch { } finally { exportLoading.value = false diff --git a/src/views/eam/item/itemInLocation/itemInLocation.data.ts b/src/views/eam/item/itemInLocation/itemInLocation.data.ts index c60b92d..ceee92b 100644 --- a/src/views/eam/item/itemInLocation/itemInLocation.data.ts +++ b/src/views/eam/item/itemInLocation/itemInLocation.data.ts @@ -12,6 +12,9 @@ export const ItemInLocationRules = reactive({ required, { validator: validateNumber, message: '数量不能等于0', trigger: 'blur' }, ], + returner: [ + { max: 50, message: '不得超过20个字符', trigger: 'blur' }, + ], }) export const ItemInLocation = useCrudSchemas(reactive([