Files
hht-weibang-uni/pages/wb/taskcarry.vue
2025-11-07 11:26:05 +08:00

174 lines
3.9 KiB
Vue

<template>
<view class="zd_container">
<!-- 任务下发 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">起始区域</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">目标区域</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">起点点位</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">目标点位</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
<button class="zd-col-18 button-primary" :class="{'button-info': !index || !index2 || !index3 || !index4}" :disabled="disabled" @tap="_callTask">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {queryArea, queryPointByArea , callTask } from '@/utils/getData3.js'
export default {
components: {
NavBar
},
data() {
return {
title: '',
val1: '',
val2: '',
options: [],
index: '',
options2: [],
index2: '',
options3: [],
index3: '',
options4: [],
index4: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._queryArea ()
this._queryArea2()
this._queryPointByArea3()
this._queryPointByArea4()
},
methods: {
async _queryArea () {
try {
let res = await queryArea ()
if (res) {
this.options = res.data
} else {
this.options = []
}
} catch (e) {
this.options = []
}
},
async _queryArea2 () {
try {
let res = await queryArea ()
if (res) {
this.options2 = res.data
} else {
this.options2 = []
}
} catch (e) {
this.options2 = []
}
},
async _queryPointByArea3 () {
try {
let res = await queryPointByArea ()
if (res) {
this.options3 = res.data
} else {
this.options3 = []
}
} catch (e) {
this.options3 = []
}
},
async _queryPointByArea4 () {
try {
let res = await queryPointByArea ()
if (res) {
this.options4 = res.data
} else {
this.options4 = []
}
} catch (e) {
this.options4 = []
}
},
selectChange (e) {
this.index = e
},
selectChange2 (e) {
this.index2 = e
},
selectChange3 (e) {
this.index3 = e
},
selectChange4 (e) {
this.index4 = e
},
clearUp () {
this.index = ''
this.index2 = ''
this.index3 = ''
this.index4 = ''
this.disabled = false
},
async _callTask () {
this.disabled = true
if (!this.index3 || !this.index4) {
this.disabled = false
return
}
try {
let res = await callTask (this.index3, this.index4, '3')
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.clearUp()
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>