|
|
@ -41,7 +41,7 @@ |
|
|
|
import download from '@/utils/download' |
|
|
|
import { Item, ItemRules } from './item.data' |
|
|
|
import * as ItemApi from '@/api/eam/basic/item' |
|
|
|
import { createDeviceItemBatch, getDeviceItemPage } from '@/api/eam/basic/rel' |
|
|
|
import { createDeviceItemBatch, getDeviceItemPage, getDeviceItemNoPage } from '@/api/eam/basic/rel' |
|
|
|
import { DeviceAccounts, DeviceAccountsRules } from '@/views/eam/device/deviceAccounts/deviceAccounts.data' |
|
|
|
import * as DeviceAccountsApi from '@/api/eam/device/deviceAccounts' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
@ -128,24 +128,44 @@ |
|
|
|
// itemNumber.value = number; |
|
|
|
// searchTableRef.value.open('设备列表', DeviceAccounts.allSchemas, DeviceAccountsApi.getDeviceAccountsPage(), null, Item.allSchemas.searchSchema, true, null, null, null, null); |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
const searchTableRef = ref() |
|
|
|
/** 绑定备件操作 */ |
|
|
|
const openItem = async (number: String) => { |
|
|
|
const openItem = async (number : String) => { |
|
|
|
itemNumber.value = number |
|
|
|
await CallBack1() |
|
|
|
searchTableRef.value.open( |
|
|
|
'选择设备', |
|
|
|
DeviceAccounts.allSchemas, |
|
|
|
getDeviceItemList, |
|
|
|
DeviceAccountsApi.getDeviceAccountsPage, |
|
|
|
null, |
|
|
|
Item.allSchemas.searchSchema, |
|
|
|
DeviceAccounts.allSchemas.searchSchema, |
|
|
|
true, |
|
|
|
null, |
|
|
|
null, |
|
|
|
null, |
|
|
|
null |
|
|
|
null, |
|
|
|
searchTableSelections.value |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
const searchTableSelections = ref([]) |
|
|
|
const CallBack1 = async () => { |
|
|
|
await getDeviceItemNoPage({ itemNumber: itemNumber.value }).then(async (res) => { |
|
|
|
await DeviceAccountsApi.getDeviceAccountsAllNoPage({}).then(response => { |
|
|
|
searchTableSelections.value = response.filter(element => { |
|
|
|
let flag = false; |
|
|
|
res.forEach(item => { |
|
|
|
if (element.number == item.deviceNumber) { |
|
|
|
flag = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
return flag; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const submitItem = async (formFieldRef, searchFieldRef, selections, typeRef, rowRef) => { |
|
|
|
const deviceItemRelList = selections.map(element => ({ |
|
|
|
itemNumber: itemNumber.value, |
|
|
@ -155,47 +175,6 @@ |
|
|
|
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() |
|
|
|