呼叫管理

This commit is contained in:
2024-04-22 14:09:42 +08:00
parent f09e688c1f
commit 915e468d26
3 changed files with 224 additions and 102 deletions

View File

@@ -4,33 +4,44 @@
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label" @tap="selectPoint">查找点位</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="val1">
</view>
<uni-icons type="search" size="22" color="#ff6a00"></uni-icons>
</view>
<view class="zd-row mgb20">
<uni-icons type="arrow-up" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 item-font-2">任务起点1</view>
<view class="zd-col-16 item-font-1">{{sCode1}}</view>
<view class="zd-col-6 filter_label">任务起点1</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="sCode1" @input="matchData(1)">
<view v-if="filterNo ===1 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="sCode1 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row mgb20">
<view class="zd-row border-bottom">
<uni-icons type="arrow-down" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 item-font-2">任务终点1</view>
<view class="zd-col-16 item-font-1">{{nCode1}}</view>
<view class="zd-col-6 filter_label">任务终点1</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="nCode1" @input="matchData(2)">
<view v-if="filterNo ===2 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="nCode1 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row mgb20">
<view class="zd-row border-bottom">
<uni-icons type="arrow-up" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 item-font-2">任务起点2</view>
<view class="zd-col-16 item-font-1">{{sCode2}}</view>
<view class="zd-col-6 filter_label">任务起点2</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="sCode2" @input="matchData(3)">
<view v-if="filterNo ===3 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="sCode2 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row">
<uni-icons type="arrow-down" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 item-font-2">任务终点2</view>
<view class="zd-col-16 item-font-1">{{nCode2}}</view>
<view class="zd-col-6 filter_label">任务终点2</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="nCode2" @input="matchData(4)">
<view v-if="filterNo ===4 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="nCode2 = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
</view>
<view class="zd_wrapper">
@@ -60,14 +71,14 @@
<view class="zd-row jccenter">
<uni-icons type="map-pin-ellipse" size="18" color="#fff"></uni-icons>
</view>
<view class="pop_point_content">
<view class="pop_point_content" :class="{'pop_point_content_up': this.popup}">
<view class="zd-row mgb20">
<view class="zd-col-11 item-font-6 bggreen" @tap="getstartcode1">任务起点1</view>
<view class="zd-col-11 item-font-6 bgblue" @tap="getnextcode1">任务终点1</view>
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(1)">任务起点1</view>
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(2)">任务终点1</view>
</view>
<view class="zd-row">
<view class="zd-col-11 item-font-6 bggreen" @tap="getstartcode2">任务起点2</view>
<view class="zd-col-11 item-font-6 bgblue" @tap="getnextcode2">任务终点2</view>
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(3)">任务起点2</view>
<view class="zd-col-11 item-font-6 bgred" @tap="popCode(4)">任务终点2</view>
</view>
</view>
</view>
@@ -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 @@
}
</script>
<style lang="stylus">
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.item-font-6
color #fff
.filter_label
padding-left 0
</style>

View File

@@ -11,13 +11,23 @@
<view class="zd_wrapper">
<view class="zd-row mgb20 border-bottom">
<uni-icons type="arrow-up" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 item-font-2">任务起点</view>
<view class="zd-col-16 item-font-1">{{sCode}}</view>
<view class="zd-col-6 filter_label">任务起点</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="sCode" @input="matchData(1)">
<view v-if="filterNo ===1 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="sCode = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
<view class="zd-row">
<uni-icons type="arrow-down" size="18" color="#ff6a00"></uni-icons>
<view class="zd-col-6 item-font-2">任务终点</view>
<view class="zd-col-16 item-font-1">{{nCode}}</view>
<view class="zd-col-6 filter_label">任务终点</view>
<view class="zd-col-18 relative">
<input type="text" class="filter_input" v-model="nCode" @input="matchData(2)">
<view v-if="filterNo ===2 && filteredData.length" class="filter_select_wraper">
<view class="filter_select_item" v-for="(e, i) in filteredData" :key="'ul'+ i" @tap.stop="nCode = e.device_code,filteredData = []">{{e.device_code}}</view>
</view>
</view>
</view>
</view>
<view class="zd_wrapper">
@@ -47,9 +57,9 @@
<view class="zd-row jccenter">
<uni-icons type="map-pin-ellipse" size="18" color="#fff"></uni-icons>
</view>
<view class="zd-row pop_point_content">
<view class="zd-col-11 item-font-6 bggreen" @tap="getstartcode">任务起点</view>
<view class="zd-col-11 item-font-6 bgblue" @tap="getnextcode">任务终点</view>
<view class="zd-row pop_point_content" :class="{'pop_point_content_up': this.popup}">
<view class="zd-col-11 item-font-6 bggreen" @tap="popCode(1)">任务起点</view>
<view class="zd-col-11 item-font-6 bgblue" @tap="popCode(2)">任务终点</view>
</view>
</view>
<view v-if="show" class="msg_mask" @tap="colsePop"></view>
@@ -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 @@
}
</script>
<style lang="stylus">
<style lang="stylus" scoped>
@import '../../common/style/mixin.styl';
.item-font-6
color #fff
.filter_label
padding-left 0
.pop_point_content_up
top -200rpx
</style>