Files
hht-nlfive-uni/pages/nlfive/taskcarry.vue
2025-12-24 13:10:02 +08:00

170 lines
4.0 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-6">
<span class="filter_label">起点1</span>
</view>
<view class="zd-col-18">
<search-box
v-model="val1"
@handleChange="handleChange"
/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">终点1</span>
</view>
<view class="zd-col-18">
<search-box v-model="val2"/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">起点2</span>
</view>
<view class="zd-col-18">
<search-box v-model="val3"/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">终点2</span>
</view>
<view class="zd-col-18">
<search-box v-model="val4"/>
</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="index2" :localdata="options2" @change="selectChange2"></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 || !val1 || !val2 || !index2}" :disabled="disabled" @tap="_sendPointTask">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getAllTaskType, getTaskInfoByStartPoint, sendPointTask } from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
val1: '',
val2: '',
val3: '',
val4: '',
options: [],
index: '',
options2: [{text: '正常', value: '0'}, {text: '超限', value: '1'}],
index2: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._getAllTaskType ()
},
methods: {
async _getAllTaskType () {
try {
let res = await getAllTaskType ()
if (res) {
this.options = res.data
} else {
this.options = []
}
} catch (e) {
this.options = []
}
},
selectChange (e) {
this.index = e
if (this.index && this.val1) {
this._getTaskInfoByStartPoint()
}
},
handleChange (e) {
if (this.index && this.val1) {
this._getTaskInfoByStartPoint()
}
},
selectChange2 (e) {
this.index2 = e
},
clearUp () {
this.index = ''
this.index2 = ''
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.val4 = ''
this.disabled = false
},
async _getTaskInfoByStartPoint () {
try {
let res = await getTaskInfoByStartPoint(this.val1, this.index)
if (res) {
this.val2 = res.data.point_code2
this.val3 = res.data.point_code3
this.val4 = res.data.point_code4
} else {
}
} catch (e) {
}
},
async _sendPointTask () {
this.disabled = true
if (!this.index || !this.index2 || !this.val1 || !this.val2) {
this.disabled = false
return
}
try {
let res = await sendPointTask (this.index, this.val1, this.val2, this.val3, this.val4, this.index2)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.clearUp()
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>