|
@ -95,24 +95,13 @@ export default { |
|
|
//更新数据 |
|
|
//更新数据 |
|
|
async updateSeach() { |
|
|
async updateSeach() { |
|
|
this.loading = true |
|
|
this.loading = true |
|
|
let allChufangList = _.cloneDeep(await myDatabase.chufang.toArray()) |
|
|
let that = this |
|
|
let dataTemp = [] |
|
|
let collection = myDatabase.chufang |
|
|
if (_.trim(this.searchParams.xingming)) { |
|
|
if (that.searchParams.xingming) { |
|
|
for (let i = 0; i < allChufangList.length; i++) { |
|
|
let reg = new RegExp(that.searchParams.xingming, "i") |
|
|
let element = allChufangList[i]; |
|
|
collection = collection.filter((equip) => reg.test(equip.xingming)) |
|
|
if (element.xingming.includes(_.trim(this.searchParams.xingming))) { |
|
|
|
|
|
dataTemp.push({ ...element }) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
dataTemp = _.cloneDeep(allChufangList) |
|
|
|
|
|
} |
|
|
|
|
|
let dataTempSort = dataTemp |
|
|
|
|
|
if (_.get(this.sortObj, ["sort"], "")) { |
|
|
|
|
|
// 带条件排序 |
|
|
|
|
|
dataTempSort = _.orderBy(dataTemp, [this.sortObj.prop], [_.get(this.sortObj, ["sort"], "") === 1 ? 'desc' : 'asc']) |
|
|
|
|
|
} |
|
|
} |
|
|
this.tableData = _.uniqBy(dataTempSort, "id") |
|
|
this.tableData = await collection.toArray(); |
|
|
this.loading = false |
|
|
this.loading = false |
|
|
}, |
|
|
}, |
|
|
// 排序 |
|
|
// 排序 |
|
|