From 01c21cc7b0ac2fbf7bbcb9637a70efc805dc2640 Mon Sep 17 00:00:00 2001 From: wwp <782568523@qq.com> Date: Wed, 4 Sep 2024 17:58:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E6=96=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/tki-tree/tki-tree.vue | 78 ++++++++++++++++--- monitorMobile/pages.json | 2 + monitorMobile/pages/earlyWarning/index.vue | 62 +++++++-------- monitorMobile/pages/monitor/index.vue | 14 +++- 4 files changed, 106 insertions(+), 50 deletions(-) diff --git a/monitorMobile/components/tki-tree/tki-tree.vue b/monitorMobile/components/tki-tree/tki-tree.vue index 54e716d..57ffe98 100644 --- a/monitorMobile/components/tki-tree/tki-tree.vue +++ b/monitorMobile/components/tki-tree/tki-tree.vue @@ -3,18 +3,24 @@ - 取消 + 取消 + {{title}} - 确定 + 确定 + + - + + {{item.name}} - - - + + + + + - + @@ -108,10 +121,12 @@ showTree: false, treeList: [], selectIndex: -1, + searchText: '' } }, computed: {}, methods: { + _show() { this.showTree = true }, @@ -268,13 +283,39 @@ this.treeList[i].checked = v.orChecked }) }, - _initTree(range = this.range){ + _initTree(range = this.range) { this.treeList = []; this._renderTreeList(range); this.$nextTick(() => { this._defaultSelect(range) }) - } + }, + // searChange(value, data) { + // // this.treeList = this.filterTree(value, data) + // }, + filterTree(val, tree, newArr = []) { + if (!(tree.length && val)) { // 如果搜索关键字为空直接返回源数据 + return tree + } + for (let item of tree) { + if (item.name.indexOf(val) > -1) { // 匹配到关键字的逻辑 + newArr.push(item) // 如果匹配到就在数值中添加记录 + continue // 匹配到了就退出循环了此时如果有子集也会一并带着 + } + + if (item.children && item.children.length) { // 如果父级节点没有匹配到就看看是否有子集,然后做递归 + let subArr = this.filterTree(val, item.children) // 缓存递归后的子集数组 + if (subArr && subArr.length) { // 如果子集数据有匹配到的节点 + let node = { + ...item, + children: subArr + } // 关键逻辑,缓存父节点同时将递归后的子节点作为新值 + newArr.push(node) // 添加进数组 + } + } + } + return newArr + }, }, watch: { range(list) { @@ -290,6 +331,19 @@ this._reTreeList(); } }, + // searchText: { + // handler(newValue, oldValue) { + // console.log(111) + // console.log(this.treeList,11) + // console.log(this.range,11) + // // let arr = JSON.parse(JSON.stringify(this.treeList)) + // this.filterTrees = this.filterTree(newValue, this.range) + // console.log(this.range,22) + // console.log(this.treeList,22) + // }, + // deep: true + + // } }, mounted() { this._initTree(); @@ -299,4 +353,4 @@ + \ No newline at end of file diff --git a/monitorMobile/pages.json b/monitorMobile/pages.json index fea8cc2..2576c46 100644 --- a/monitorMobile/pages.json +++ b/monitorMobile/pages.json @@ -41,6 +41,7 @@ { "path": "pages/earlyWarning/index", "style": { + "enablePullDownRefresh": true, "navigationStyle": "custom" } }, @@ -102,6 +103,7 @@ { "path": "pages/monitor/index", "style": { + "enablePullDownRefresh": true, "navigationBarTitleText": "监控管理" } }, diff --git a/monitorMobile/pages/earlyWarning/index.vue b/monitorMobile/pages/earlyWarning/index.vue index 3c25e2b..12a7e10 100644 --- a/monitorMobile/pages/earlyWarning/index.vue +++ b/monitorMobile/pages/earlyWarning/index.vue @@ -10,7 +10,7 @@ - + @@ -172,9 +172,9 @@ - + @@ -196,7 +196,7 @@ }, data() { return { - searchValue: '', + searchValue: '全部', isShowSearch: false, isTriggered: true, searchForm: { @@ -210,7 +210,12 @@ pageNum: 1, pageSize: 10 }, - warnOption: [], + warnOption: [ + { + label: '全部', + value: '' + } + ], handOption: [{ label: '已处理', value: 1 @@ -239,36 +244,22 @@ }, }, onLoad() { + console.log(this.searchForm.$alarmType) // 获取预警类型 this.getWarnTypeList() // 隐藏导航栏 this.loadmore() }, + onPullDownRefresh() { + uni.stopPullDownRefresh() + this.status = 'loadmore' + this.searchForm.pageNum = 1; + this.warnList = [] + this.loadmore() + }, methods: { - - onRefresh() { - // this.refreshing = true; - console.log('下拉刷新') - }, - // 执行刷新操作 - doRefresh() { - console.log('正在刷新...'); - // 这里执行刷新数据的逻辑 - this.searchForm.pageNum = 1; - this.warnList = []; - this.loadmore() - setTimeout(() => { - // 刷新数据完成后,调用restore或abort方法结束刷新状态 - this.restore(); - }, 2000); - }, - // 刷新结束,恢复scroll-view - restore() { - console.log('刷新结束'); - }, - // 刷新结束,取消scroll-view的刷新状态 - abort() { - console.log('取消刷新'); + selectChange(e) { + console.log(e, 2323) }, // 预览图片 previewImage(url, index) { @@ -317,16 +308,17 @@ } = res; if (code == 200) { - this.warnOption = data.map(item => { + let arr = data.map(item => { return { label: item.name, value: item.code }; }) - this.warnOption.unshift({ - label: '全部', - value: '' - }) + this.warnOption = [...this.warnOption,...arr] + // this.warnOption.unshift({ + // label: '全部', + // value: '' + // }) } }); diff --git a/monitorMobile/pages/monitor/index.vue b/monitorMobile/pages/monitor/index.vue index d01532c..f68c873 100644 --- a/monitorMobile/pages/monitor/index.vue +++ b/monitorMobile/pages/monitor/index.vue @@ -1,5 +1,5 @@ @@ -154,6 +154,7 @@ videoTitle: '', isShowSearch: false, searchForm: { + groupName: '全部', groupId: '', pageNum: 1, pageSize: 10 @@ -183,6 +184,13 @@ // 获取列表数据 this.loadmore() }, + onPullDownRefresh(){ + uni.stopPullDownRefresh() + this.status = 'loadmore' + this.searchForm.pageNum = 1; + this.monitorList = [] + this.loadmore() + }, methods: { setVideo() { @@ -296,7 +304,7 @@ getGroupList() { groupList({}).then((res) => { if (res.code == 200) { - this.treelist = [...[{id: "",name: "全部"}], ...res.data]; + this.treelist = [...[{id: "",name: "全部",checked: true}], ...res.data]; } }); },