|
@@ -1019,6 +1019,20 @@ const equipmentTablePageChange = ({current, size}) => {
|
|
|
equipmentPage.value.size = size
|
|
|
getDeviceTableData()
|
|
|
}
|
|
|
+//数组去重
|
|
|
+ var temp = [];
|
|
|
+const getnewArr=(tempArr)=> {
|
|
|
+
|
|
|
+ tempArr.forEach(function(a) {
|
|
|
+ var check = temp.every(function(b) {
|
|
|
+ return a.id !== b.id;
|
|
|
+ })
|
|
|
+ check ? temp.push(a) : ''
|
|
|
+ })
|
|
|
+ return temp;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
//获取表格数据
|
|
|
const deviceTableLoading = ref(false)
|
|
|
const getDeviceTableData =async () => {
|
|
@@ -1036,6 +1050,27 @@ const getDeviceTableData =async () => {
|
|
|
if (!error && code === 200) {
|
|
|
deviceTableData.value = getArrValue(data['records'])
|
|
|
equipmentPage.value.total = data.total || 0
|
|
|
+ //去重
|
|
|
+ let uniqueArray =getnewArr(checkList.value)
|
|
|
+ deviceTableKeys.value=uniqueArray
|
|
|
+
|
|
|
+ if(uniqueArray.length>0){
|
|
|
+ uniqueArray.forEach((item)=>{
|
|
|
+ if(item.deviceClassId=== equipmentmenuKey.value){
|
|
|
+ deviceTableData.value.forEach((ele)=>{
|
|
|
+ if(ele.id===item.id){
|
|
|
+ item=ele
|
|
|
+ }
|
|
|
+ })
|
|
|
+ nextTick(() => {
|
|
|
+ deviceTableRef.value?.toggleRowSelection(item, true)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
} else {
|
|
|
deviceTableData.value = []
|
|
|
equipmentPage.value.total = 0
|
|
@@ -1045,8 +1080,17 @@ const getDeviceTableData =async () => {
|
|
|
|
|
|
//多选
|
|
|
const deviceTableKeys = ref([]);
|
|
|
+//选中的设备仪器
|
|
|
+const checkList=ref([])
|
|
|
const deviceTableSelection = (rows) => {
|
|
|
- deviceTableKeys.value = rows
|
|
|
+ // deviceTableKeys.value = rows
|
|
|
+ if(rows.length>0){
|
|
|
+ rows.forEach((item)=>{
|
|
|
+ checkList.value.push(item)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//确认引用
|