This commit is contained in:
2025-11-07 11:26:05 +08:00
parent fe08240870
commit dd9a7a24e0
7 changed files with 624 additions and 109 deletions

173
pages/wb/taskcarry.vue Normal file
View File

@@ -0,0 +1,173 @@
<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>

111
pages/wb/taskmanage.vue Normal file
View File

@@ -0,0 +1,111 @@
<template>
<view class="zd_container">
<!-- 任务管理 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>任务号</th>
<th>起点</th>
<th>终点</th>
<th>状态</th>
<th>优先级</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" :class="{'checked': e.task_uuid === pkId}" @tap="toCheck(e)">
<td>{{e.task_no}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.task_status_name}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_taskoperation(1)">重新下发</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_taskoperation(2)">完成任务</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {querytasks, taskoperation} from '@/utils/getData3.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
pkId: '',
disabled: false,
dataList: []
};
},
onLoad (options) {
this.title = options.title
this._querytasks()
},
methods: {
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
},
async _querytasks () {
try {
let res = await querytasks()
if (res && res.data) {
this.dataList = [...res.data]
} else {
this.dataList = []
uni.showToast({
title: res.message,
icon: 'none'
})
}
} catch (e) {
this.dataList = []
}
},
async _taskOperation (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await taskOperation(this.pkId, type)
if (res) {
this._queryTask()
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.disabled = false
this.pkId = ''
} catch (err) {
this.disabled = false
this.pkId = ''
}
}
}
}
</script>
<style scoped>
.filter_picker {
text-align: center
}
</style>