import { ElMessage } from 'element-plus' /** * 检查数组中不能存在属性数组中同时一样的两条数据 * @param list 要检查的数组 * @param property 属性数组 */ export function useArrayDataUnique(list: any, property: string[]) { for (let i = 0; i < list.length - 1; i++) { const j = i + 1 for (let z = 0; z < property.length; z++) { if (list[i].property[z] === list[j].property[z]) { continue } else { ElMessage.warning(`表格第${i}与第${j}行的两个属性不能完全一样`) } } } } // export function useArrayDataUnique(list: any, property: string[]) { // const list1 = new list() // const set = new Set() // var arr = [] // for (let i = 0; i < any.length; i++) { // var obj = new Object() // for (const j in property) { // obj.j = any[i].j // } // list1.add(obj) // set.add(obj) // if (set.size != list1.size) { // arr.add(i) // arr.add(Array.from(mySet).indexOf(obj)) // break // } // } // }