From 915e468d262bcd27a515cff4d7fd2c31a33b692f Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Mon, 22 Apr 2024 14:09:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=BC=E5=8F=AB=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/style/layout.styl | 27 ++++- pages/manage/agv-call-manage.vue | 185 +++++++++++++++++++------------ pages/manage/call-manage.vue | 114 ++++++++++++++----- 3 files changed, 224 insertions(+), 102 deletions(-) diff --git a/common/style/layout.styl b/common/style/layout.styl index 17722b8..79a9885 100644 --- a/common/style/layout.styl +++ b/common/style/layout.styl @@ -250,7 +250,7 @@ uni-button:after { height 52rpx _font(26rpx,52rpx,#666,,center) background-color #e5e5e5 - border-radius 26rpx + border-radius 10rpx .item-font-7 _font(24rpx,52rpx,#666,,center) .isChecked @@ -532,7 +532,7 @@ uni-button[disabled]:not([type]), uni-button[disabled][type=default] { // transform scale(0) .pop_point_content position relative - margin-top 40rpx + margin 40rpx auto padding 20rpx background-color #fff border-radius 10rpx @@ -544,4 +544,25 @@ uni-button[disabled]:not([type]), uni-button[disabled][type=default] { width: 0; height: 0; border: 20rpx solid; - border-color: transparent transparent #fff transparent \ No newline at end of file + border-color: transparent transparent #fff transparent +.pop_point_content_up + top -270rpx + &::after + border-color: #fff transparent transparent transparent + top auto + bottom -36rpx +.filter_select_wraper + position absolute + top 100% + z-index 3 + width 100% + background-color: #FFFFFF; + border: 1px solid #EBEEF5; + border-radius: 6px; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + padding 10rpx 22rpx +.filter_select_item + line-height: 80rpx + height: 80rpx + font-size: 28rpx + color: #606266 \ No newline at end of file diff --git a/pages/manage/agv-call-manage.vue b/pages/manage/agv-call-manage.vue index 02bdc64..a9bb7c3 100644 --- a/pages/manage/agv-call-manage.vue +++ b/pages/manage/agv-call-manage.vue @@ -4,33 +4,44 @@ - - 查找点位 - - - - - - - - 任务起点1 - {{sCode1}} + 任务起点1 + + + + {{e.device_code}} + + - + - 任务终点1 - {{nCode1}} + 任务终点1 + + + + {{e.device_code}} + + - + - 任务起点2 - {{sCode2}} + 任务起点2 + + + + {{e.device_code}} + + - 任务终点2 - {{nCode2}} + 任务终点2 + + + + {{e.device_code}} + + @@ -60,14 +71,14 @@ - + - 任务起点1 - 任务终点1 + 任务起点1 + 任务终点1 - 任务起点2 - 任务终点2 + 任务起点2 + 任务终点2 @@ -99,7 +110,10 @@ distanceToTop: -300, distanceToLeft: -300, windowHeight: '', - val1: '' + popHeight: '', + filteredData: [], + filterNo: '', + popup: false }; }, onLoad (options) { @@ -109,22 +123,44 @@ this.windowHeight = info.windowHeight } }) + }, + onReady () { const query = uni.createSelectorQuery().in(this) query - .select('.pop_point_wrap') + .select('.pop_point_content') .boundingClientRect(data => { - console.log(data) + this.popHeight = data.height }).exec() }, created () { this.initArea() }, methods: { - selectPoint () { - this.pointArr.map(el => { - if (this.val1 === el.device_code || this.val1 === el.device_name) { - console.log(this.val1) - } + matchData (no) { + this.filterNo = no + let query = '' + switch (no) { + case 1: + query = this.sCode1.toLowerCase() + break + case 2: + query = this.nCode1.toLowerCase() + break + case 3: + query = this.sCode2.toLowerCase() + break + case 4: + query = this.nCode2.toLowerCase() + break + default: + break + } + if (!query) { + this.filteredData = [] + return + } + this.filteredData = this.pointArr.filter(item => { + return item.device_code.toLowerCase().includes(query) }) }, async initArea () { @@ -150,10 +186,14 @@ query .select(`#site_item_box_${index}`) .boundingClientRect(data => { - console.log(data.top) if (data) { this.distanceToTop = data.top + (data.height / 2) - 9 this.distanceToLeft = data.left + if ((this.windowHeight - this.distanceToTop) < (this.popHeight + 20)) { + this.popup = true + } else { + this.popup = false + } } }).exec() this.show = true @@ -161,46 +201,27 @@ }, colsePop () { this.show = !this.show - if (!this.show) { - this.distanceToTop = -300 - this.distanceToLeft = -300 + this.distanceToTop = -300 + this.distanceToLeft = -300 + }, + popCode (code) { + switch (code) { + case 1: + this.sCode1 = this.code + break + case 2: + this.nCode1 = this.code + break + case 3: + this.sCode2 = this.code + break + case 4: + this.nCode2 = this.code + break + default: + break } - }, - getstartcode1 () { - if (this.nCode1 !== '' && this.nCode1 === this.code) { - this.nCode1 = '' - } - this.sCode1 = this.code - this.show = false - this.distanceToTop = -300 - this.distanceToLeft = -300 - }, - getnextcode1 () { - if (this.sCode1 !== '' && this.sCode1 === this.code) { - this.sCode1 = '' - } - this.nCode1 = this.code - this.show = false - this.distanceToTop = -300 - this.distanceToLeft = -300 - }, - getstartcode2 () { - if (this.nCode2 !== '' && this.nCode2 === this.code) { - this.nCode2 = '' - } - this.sCode2 = this.code - this.show = false - this.distanceToTop = -300 - this.distanceToLeft = -300 - }, - getnextcode2 () { - if (this.sCode2 !== '' && this.sCode2 === this.code) { - this.sCode2 = '' - } - this.nCode2 = this.code - this.show = false - this.distanceToTop = -300 - this.distanceToLeft = -300 + this.colsePop() }, /** 清空点位选择 */ cancle () { @@ -216,6 +237,22 @@ this.disabled = false return } + if (this.sCode1 !=='' && this.sCode1 === this.nCode1) { + uni.showToast({ + title: '任务起点终点不能相同', + icon: 'none' + }) + this.disabled = false + return + } + if (this.sCode2 !=='' && this.sCode2 === this.nCode2) { + uni.showToast({ + title: '任务起点终点不能相同', + icon: 'none' + }) + this.disabled = false + return + } try { let res = await agvcallTask(this.sCode1, this.nCode1, this.sCode2, this.nCode2, type) this.cancle() @@ -237,8 +274,10 @@ } - diff --git a/pages/manage/call-manage.vue b/pages/manage/call-manage.vue index 7ac39c0..9fdd4a9 100644 --- a/pages/manage/call-manage.vue +++ b/pages/manage/call-manage.vue @@ -11,13 +11,23 @@ - 任务起点 - {{sCode}} + 任务起点 + + + + {{e.device_code}} + + - 任务终点 - {{nCode}} + 任务终点 + + + + {{e.device_code}} + + @@ -47,9 +57,9 @@ - - 任务起点 - 任务终点 + + 任务起点 + 任务终点 @@ -75,16 +85,55 @@ nCode: '', show: false, distanceToTop: -300, - distanceToLeft: -300 + distanceToLeft: -300, + windowHeight: '', + popHeight: '', + filteredData: [], + filterNo: '', + popup: false }; }, onLoad (options) { this.title = options.title + uni.getSystemInfo({ + success: (info) => { + this.windowHeight = info.windowHeight + } + }) + }, + onReady () { + const query = uni.createSelectorQuery().in(this) + query + .select('.pop_point_content') + .boundingClientRect(data => { + this.popHeight = data.height + }).exec() }, created () { this.initArea() }, methods: { + matchData (no) { + this.filterNo = no + let query = '' + switch (no) { + case 1: + query = this.sCode.toLowerCase() + break + case 2: + query = this.nCode.toLowerCase() + break + default: + break + } + if (!query) { + this.filteredData = [] + return + } + this.filteredData = this.pointArr.filter(item => { + return item.device_code.toLowerCase().includes(query) + }) + }, async initArea () { let res = await queryArea() this.areaArr = [...res.data] @@ -111,6 +160,12 @@ if (data) { this.distanceToTop = data.top + (data.height / 2) - 9 this.distanceToLeft = data.left + console.log(this.popHeight) + if ((this.windowHeight - this.distanceToTop) < (this.popHeight + 20)) { + this.popup = true + } else { + this.popup = false + } } }).exec() this.show = true @@ -123,23 +178,18 @@ this.distanceToLeft = -300 } }, - getstartcode () { - if (this.nCode !== '' && this.nCode === this.code) { - this.nCode = '' - } - this.sCode = this.code - this.show = false - this.distanceToTop = -300 - this.distanceToLeft = -300 - }, - getnextcode () { - if (this.sCode !== '' && this.sCode === this.code) { - this.sCode = '' + popCode (code) { + switch (code) { + case 1: + this.sCode = this.code + break + case 2: + this.nCode = this.code + break + default: + break } - this.nCode = this.code - this.show = false - this.distanceToTop = -300 - this.distanceToLeft = -300 + this.colsePop() }, /** 清空点位选择 */ cancle () { @@ -149,7 +199,15 @@ }, async _callTask (type) { this.disabled = true - if (this.sCode === '' || nCode === '') { + if (this.sCode === '' || this.nCode === '') { + this.disabled = false + return + } + if (this.sCode === this.nCode) { + uni.showToast({ + title: '任务起点终点不能相同', + icon: 'none' + }) this.disabled = false return } @@ -174,8 +232,12 @@ } -