From 84127872daf5d94211fca86e39a5a94fff7c210a Mon Sep 17 00:00:00 2001 From: lichong <18518571399@163.com> Date: Thu, 14 Nov 2024 12:05:19 +0800 Subject: [PATCH] 11.14 --- src/renderer/src/views/chufang.vue | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/renderer/src/views/chufang.vue b/src/renderer/src/views/chufang.vue index 6f1a06f..6b97188 100644 --- a/src/renderer/src/views/chufang.vue +++ b/src/renderer/src/views/chufang.vue @@ -95,24 +95,13 @@ export default { //更新数据 async updateSeach() { this.loading = true - let allChufangList = _.cloneDeep(await myDatabase.chufang.toArray()) - let dataTemp = [] - if (_.trim(this.searchParams.xingming)) { - for (let i = 0; i < allChufangList.length; i++) { - let element = allChufangList[i]; - 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']) + let that = this + let collection = myDatabase.chufang + if (that.searchParams.xingming) { + let reg = new RegExp(that.searchParams.xingming, "i") + collection = collection.filter((equip) => reg.test(equip.xingming)) } - this.tableData = _.uniqBy(dataTempSort, "id") + this.tableData = await collection.toArray(); this.loading = false }, // 排序