From 08720c578d1f833b6264141a1b77cbb05385ce29 Mon Sep 17 00:00:00 2001 From: songguoqiang <765017469@qq.com> Date: Fri, 10 May 2024 16:33:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=B6=E5=BD=92=E8=BF=98=E3=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=87=E4=BB=B6=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/eam/item/itemAccounts/index.ts | 5 +++ src/views/eam/basic/item/item.data.ts | 25 +++++++++++++ src/views/eam/item/itemAccounts/index.vue | 35 +++++++++++++++---- src/views/eam/item/itemInLocation/index.vue | 4 +-- .../itemInLocation/itemInLocation.data.ts | 3 ++ 5 files changed, 64 insertions(+), 8 deletions(-) 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([