271 lines
6.2 KiB
Vue
271 lines
6.2 KiB
Vue
<template>
|
||
<view class="zd_container">
|
||
<nav-bar title="呼叫管理"></nav-bar>
|
||
<view class="zd_content">
|
||
<view class="state-wrap">
|
||
<view class="state-item-wrap" v-for="e in state">
|
||
<view class="state-color" :class="e.color"></view>
|
||
<view class="state-name">{{e.name}}</view>
|
||
</view>
|
||
</view>
|
||
<view v-show="areaArr.length > 0" class="zd_wrapper grid-wraper">
|
||
<view class="locate_block" v-for="e in areaArr" :key="e.value">
|
||
<view class="locate_name" @click="getPonit (e)">
|
||
<view class="title_1">{{e.label}}</view>
|
||
<view class="iconfont open_icon" :class="{'is_reverse': e.checked === true}"></view>
|
||
</view>
|
||
<view v-show="e.checked === true" class="site_block" ref="liCon">
|
||
<view class="site_item" v-for="(el, i) in e.pointArr" :key="i" :class="['bggray', 'bggreen', 'bgyellow'][Number(el.status)]">
|
||
<view class="site_item_box">
|
||
<text class="title_2">站点</text>
|
||
<view class="site_item_box_inner_r" @click="setcode(el)">
|
||
<text>{{el.device_name}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="submit-bar">
|
||
<view class="dot_item">
|
||
<view class="p1">起始点</view>
|
||
<view class="p2">设备号:{{sObj.device_name}}</view>
|
||
</view>
|
||
<view class="dot_item">
|
||
<view class="p1">目标点</view>
|
||
<view class="p2">设备号:{{nObj.device_name}}</view>
|
||
</view>
|
||
<view class="btn_block">
|
||
<button class="submit-button" :class="{'btn-disabled': JSON.stringify(sObj) === '{}' && JSON.stringify(nObj) === '{}'}" @click="cancle">清空</button>
|
||
<button class="submit-button" :class="{'btn-disabled': JSON.stringify(sObj) === '{}' || JSON.stringify(nObj) === '{}'}" :disabled="disabled1" @click="toSure">确认</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import NavBar from '@/components/NavBar.vue'
|
||
import {designatedRegion, queryPointByArea, handCallTask} from '@/utils/getData2.js'
|
||
export default {
|
||
components: {
|
||
NavBar
|
||
},
|
||
data() {
|
||
return {
|
||
// interTime: this.$store.getters.setTime,
|
||
// timer: null,
|
||
state: [{color: 'bggray', name: '空位'}, {color: 'bggreen', name: '有货'}, {color: 'bgyellow', name: '有任务'}],
|
||
areaArr: [],
|
||
pointArr: [],
|
||
regobj: {},
|
||
disabled1: false,
|
||
sObj: {},
|
||
nObj: {},
|
||
isS: false
|
||
};
|
||
},
|
||
created () {
|
||
this.initArea()
|
||
},
|
||
// beforeDestroy () {
|
||
// clearInterval(this.timer)
|
||
// },
|
||
methods: {
|
||
// refresh (e) {
|
||
// this.timer = setInterval(() => {
|
||
// this.initPonit(e)
|
||
// }, this.interTime)
|
||
// },
|
||
async initArea () {
|
||
let res = await designatedRegion()
|
||
if (res.code === '1') {
|
||
this.areaArr = [...res.result]
|
||
this.areaArr.map(el => {
|
||
this.$set(el, 'checked', false)
|
||
this.$set(el, 'pointArr', [])
|
||
})
|
||
if (this.areaArr.length > 0) {
|
||
this.getPonit(this.areaArr[0])
|
||
}
|
||
} else {
|
||
uni.showToast({
|
||
title: res.desc,
|
||
icon: 'none'
|
||
})
|
||
}
|
||
},
|
||
async initPonit (e) {
|
||
let res = await queryPointByArea(e.value)
|
||
if (res.code === '1') {
|
||
this.regobj = e
|
||
this.areaArr.map(el => {
|
||
if (el.value === e.value) {
|
||
this.$set(el, 'pointArr', [...res.result])
|
||
}
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.desc,
|
||
icon: 'none'
|
||
})
|
||
}
|
||
},
|
||
getPonit (e) {
|
||
// clearInterval(this.timer)
|
||
this.areaArr.map(el => {
|
||
if (el.value !== e.value) {
|
||
el.checked = false
|
||
}
|
||
if (el.value === e.value) {
|
||
e.checked = !e.checked
|
||
}
|
||
})
|
||
if (e.checked) {
|
||
this.initPonit(e)
|
||
// this.refresh(e)
|
||
}
|
||
},
|
||
setcode (el) {
|
||
if (this.isS === false) {
|
||
this.sObj = el
|
||
this.isS = true
|
||
} else if (this.isS) {
|
||
this.nObj = el
|
||
this.isS = false
|
||
}
|
||
},
|
||
/** 清空点位选择 */
|
||
cancle () {
|
||
this.sObj = {}
|
||
this.nObj = {}
|
||
this.disabled1 = false
|
||
},
|
||
toSure () {
|
||
this.disabled1 = true
|
||
if (JSON.stringify(this.sObj) === '{}' || JSON.stringify(this.nObj) === '{}') {
|
||
this.disabled1 = false
|
||
return
|
||
}
|
||
this._callTask()
|
||
},
|
||
async _callTask () {
|
||
try {
|
||
let res = await handCallTask(this.sObj.device_code, this.nObj.device_code)
|
||
this.cancle()
|
||
uni.showToast({
|
||
title: res.desc,
|
||
icon: 'none'
|
||
})
|
||
// clearInterval(this.timer)
|
||
// this.timer = null
|
||
// setTimeout(() => {
|
||
// this.refresh()
|
||
// this.cancle()
|
||
// }, 2000)
|
||
} catch (err) {
|
||
this.disabled1 = false
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="stylus">
|
||
@import '../../common/style/mixin.styl';
|
||
.zd_content
|
||
padding-bottom 152rpx
|
||
.locate_block
|
||
width 100%
|
||
.locate_name
|
||
position relative
|
||
_wh(100%,48rpx)
|
||
.title_1
|
||
_font(32rpx,48rpx,#000,500)
|
||
.open_icon
|
||
position absolute
|
||
right 0
|
||
top 0
|
||
_wh(48rpx,48rpx)
|
||
_font(40rpx,48rpx,$red,,right)
|
||
transition all .3s
|
||
transform rotateZ(-90deg)
|
||
&:before
|
||
content: "\e6db";
|
||
.is_reverse
|
||
transform rotateZ(90deg)
|
||
.site_block
|
||
_wh(100%,auto)
|
||
overflow hidden
|
||
transition height .3s
|
||
_fj(flex-start,,,wrap)
|
||
padding-bottom 10rpx
|
||
.site_item
|
||
_wh(32%,100rpx)
|
||
padding 0 10rpx
|
||
margin-top 12rpx
|
||
background-color #e5e5e5
|
||
border-radius 5px
|
||
overflow hidden
|
||
_fj(center)
|
||
&:nth-child(3n+2)
|
||
margin-left 2%
|
||
margin-right 2%
|
||
.site_item_box
|
||
_wh(100%, 80rpx)
|
||
_fj()
|
||
.title_2
|
||
width 36rpx
|
||
_font(28rpx,40rpx,#000,500)
|
||
.site_item_box_inner_r
|
||
_fj(center)
|
||
_wh(calc(100% - 36rpx), 100%)
|
||
background-color #fff
|
||
border-radius 3px
|
||
padding 0 5rpx
|
||
overflow hidden
|
||
text
|
||
_font(28rpx,40rpx,#999,,center)
|
||
.state-wrap
|
||
_wh(100%, 60rpx)
|
||
margin-bottom 10rpx
|
||
_fj(flex-start)
|
||
.state-item-wrap
|
||
height 60rpx
|
||
margin-right 20rpx
|
||
_fj()
|
||
.state-color
|
||
_wh(30rpx, 30rpx)
|
||
border-radius 50%
|
||
margin-right 10rpx
|
||
.state-name
|
||
_font(28rpx, 60rpx, #333)
|
||
.submit-bar
|
||
justify-content space-between
|
||
padding 10rpx
|
||
.dot_item
|
||
width 35%
|
||
background-color #e5e5e5
|
||
_fj(center,,column)
|
||
.p1
|
||
_wh(100%, 52rpx)
|
||
_font(30rpx,52rpx,,,center)
|
||
border-bottom 1rpx solid #fff
|
||
overflow hidden
|
||
.p2
|
||
_wh(100%, 80rpx)
|
||
_fj(center)
|
||
padding 0 5rpx
|
||
_font(30rpx,40rpx,,,center)
|
||
overflow hidden
|
||
word-break break-all
|
||
.btn_block
|
||
_fj(,,column)
|
||
align-content: flex-end
|
||
.submit-button
|
||
line-height 56rpx
|
||
margin 0
|
||
&:nth-child(1)
|
||
margin-bottom 10rpx
|
||
</style>
|