From fe466a550615e620a04d5b30fbdb7f9dfbb827f3 Mon Sep 17 00:00:00 2001 From: yejiaxing <591141169@qq.com> Date: Wed, 7 Feb 2024 10:16:34 +0800 Subject: [PATCH] =?UTF-8?q?BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/eam/basic/item/index.vue | 67 ++++++++++++++++++- .../eam/item/applicationRecord/index.vue | 2 +- .../countadjustPlan/countadjustPlan.data.ts | 1 + src/views/eam/item/countadjustPlan/index.vue | 6 +- 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/src/views/eam/basic/item/index.vue b/src/views/eam/basic/item/index.vue index 39c6638..096136f 100644 --- a/src/views/eam/basic/item/index.vue +++ b/src/views/eam/basic/item/index.vue @@ -123,11 +123,31 @@ } /** 添加设备操作 */ + // const searchTableRef = ref() + // const openItem = (number : String) => { + // itemNumber.value = number; + // searchTableRef.value.open('设备列表', DeviceAccounts.allSchemas, DeviceAccountsApi.getDeviceAccountsPage(), null, Item.allSchemas.searchSchema, true, null, null, null, null); + // } + const searchTableRef = ref() - const openItem = (number : String) => { - itemNumber.value = number; - searchTableRef.value.open('设备列表', DeviceAccounts.allSchemas, DeviceAccountsApi.getDeviceAccountsPage(), null, Item.allSchemas.searchSchema, true, null, null, null, null); + /** 绑定备件操作 */ + const openItem = async (number: String) => { + itemNumber.value = number + searchTableRef.value.open( + '选择设备', + DeviceAccounts.allSchemas, + getDeviceItemList, + null, + Item.allSchemas.searchSchema, + true, + null, + null, + null, + null + ) } + + const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { const deviceItemRelList = selections.map(element => ({ @@ -138,6 +158,47 @@ message.success(t('common.createSuccess')) }) }; + + const getItemWithOutBind = async () => { + try { + const res = await DeviceAccountsApi.getDeviceAccountsPage({ + ...Item.allSchemas.searchSchema + }) + if (res.list?.length > 0) { + // const response = await getDeviceItemPage(DeviceAccounts.allSchemas.searchSchema); + // const filteredList = res.list.filter(item => { + // return !response.list?.some(element => { + // return item.number === element.itemNumber + // }); + // }); + // console.log('filteredList',filteredList); + const filteredList = res.list + return filteredList // 返回过滤后的列表 + } + return [] // 如果没有数据,返回空数组 + } catch (error) { + console.error(error) + throw error // 抛出错误 + } + } + + // 将 getListApi 替换为 getItemWithOutBind + const getDeviceItemList = async () => { + tableObject.loading = true + try { + const res = await getItemWithOutBind() + let result = { + list: res, + total: res.length + } + return result + } catch (error) { + console.error(error) + } finally { + tableObject.loading = false + } + } + /** 添加/修改操作 */ const basicFormRef = ref() diff --git a/src/views/eam/item/applicationRecord/index.vue b/src/views/eam/item/applicationRecord/index.vue index a58386a..9452918 100644 --- a/src/views/eam/item/applicationRecord/index.vue +++ b/src/views/eam/item/applicationRecord/index.vue @@ -171,7 +171,7 @@ const butttondata = (row) => { return [ defaultButtons.approveBtn({ hide: isShowMainButton(row, ['0']) }), // 审批 - defaultButtons.mainListEditBtn(null), // 编辑 + // defaultButtons.mainListEditBtn(null), // 编辑 // defaultButtons.mainListDeleteBtn(null), // 删除 ] } diff --git a/src/views/eam/item/countadjustPlan/countadjustPlan.data.ts b/src/views/eam/item/countadjustPlan/countadjustPlan.data.ts index 4f5b6bc..0075d07 100644 --- a/src/views/eam/item/countadjustPlan/countadjustPlan.data.ts +++ b/src/views/eam/item/countadjustPlan/countadjustPlan.data.ts @@ -12,6 +12,7 @@ export const CountadjustPlan = useCrudSchemas(reactive([ field: 'number', sort: 'custom', isSearch: true, + isForm: false, }, { label: '名称', diff --git a/src/views/eam/item/countadjustPlan/index.vue b/src/views/eam/item/countadjustPlan/index.vue index 90a8c47..c9674b7 100644 --- a/src/views/eam/item/countadjustPlan/index.vue +++ b/src/views/eam/item/countadjustPlan/index.vue @@ -99,9 +99,9 @@ const { getList, setSearchParams } = tableMethods // 列表头部按钮 const HeadButttondata = [ - defaultButtons.defaultAddBtn({hasPermi:'eam:countadjustPlan:create'}), // 新增 - defaultButtons.defaultImportBtn({hasPermi:'eam:countadjustPlan:import'}), // 导入 - defaultButtons.defaultExportBtn({hasPermi:'eam:countadjustPlan:export'}), // 导出 + defaultButtons.defaultAddBtn(null), // 新增 + defaultButtons.defaultImportBtn(null), // 导入 + defaultButtons.defaultExportBtn(null), // 导出 defaultButtons.defaultFreshBtn(null), // 刷新 defaultButtons.defaultFilterBtn(null), // 筛选 defaultButtons.defaultSetBtn(null), // 设置