任务下发

This commit is contained in:
2025-12-15 08:46:13 +08:00
parent 394eef69e0
commit a683be5cdc
7 changed files with 189 additions and 369 deletions

View File

@@ -203,14 +203,7 @@
}
,{
"path" : "pages/wb/taskcarry",
"style" :
{
"navigationStyle": "custom"
}
}
,{
"path" : "pages/wb/taskmanage",
"path" : "pages/nlfive/taskcarry",
"style" :
{
"navigationStyle": "custom"

View File

@@ -43,8 +43,7 @@
userName: '',
menuList: [
{title: '通用功能', path: 'RF06', sonTree: [
{title: '任务下发', path: '/pages/wb/taskcarry'},
{title: '任务管理', path: '/pages/wb/taskmanage'}
{title: '任务下发', path: '/pages/nlfive/taskcarry'}
// {title: '入库组箱', path: '/pages/General/warehouse-box'},
// {title: '配送组箱', path: '/pages/General/distribution-box'},
// {title: '点对点转运', path: '/pages/General/line-transfer'},

View File

@@ -32,8 +32,7 @@
return {
userName: '',
menuList: [
{title: '任务下发', icon: 'RF03', path: '/pages/wb/taskcarry'},
{title: '任务管理', icon: 'RF02', path: '/pages/wb/taskmanage'}
{title: '任务下发', icon: 'RF03', path: '/pages/nlfive/taskcarry'}
],
show: false,
secM: []

169
pages/nlfive/taskcarry.vue Normal file
View File

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

View File

@@ -1,204 +0,0 @@
<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="index2" :localdata="options2" @change="selectChange2"></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="index3" :localdata="options3" @change="selectChange3"></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="index4" :localdata="options4" @change="selectChange4"></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="index5" :localdata="options5" @change="selectChange5"></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 || !index5}" :disabled="disabled" @tap="_callTask">确认</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {queryArea, queryPointByArea, queryVehicleType, callTask } from '@/utils/getData3.js'
export default {
components: {
NavBar
},
data() {
return {
title: '',
val1: '',
val2: '',
options: [],
index: '',
options2: [],
index2: '',
options3: [],
index3: '',
options4: [],
index4: '',
options5: [],
index5: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._queryArea ()
this._queryArea2()
this._queryVehicleType()
},
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 (this.index)
if (res) {
this.options3 = res.data
} else {
this.options3 = []
}
} catch (e) {
this.options3 = []
}
},
async _queryPointByArea4 () {
try {
let res = await queryPointByArea (this.index2)
if (res) {
this.options4 = res.data
} else {
this.options4 = []
}
} catch (e) {
this.options4 = []
}
},
async _queryVehicleType () {
try {
let res = await queryVehicleType ()
if (res) {
this.options5 = res.data
} else {
this.options5 = []
}
} catch (e) {
this.options5 = []
}
},
selectChange (e) {
this.index = e
if (e) {
this._queryPointByArea3()
}
},
selectChange2 (e) {
this.index2 = e
if (e) {
this._queryPointByArea4()
}
},
selectChange3 (e) {
this.index3 = e
},
selectChange4 (e) {
this.index4 = e
},
selectChange5 (e) {
this.index5 = e
},
clearUp () {
this.index = ''
this.index2 = ''
this.index3 = ''
this.index4 = ''
this.index5 = ''
this.disabled = false
},
async _callTask () {
this.disabled = true
if (!this.index3 || !this.index4 || !this.index5) {
this.disabled = false
return
}
try {
let res = await callTask (this.index3, this.index4, '3', this.index5)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
this.clearUp()
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>

View File

@@ -1,116 +0,0 @@
<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: {
clearUp () {
this.pkId = ''
this.dataList = []
this.disabled = false
},
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) {
uni.showToast({
title: res.message,
icon: 'none'
})
this.clearUp()
setTimeout(()=> {
this._querytasks()
}, 2000)
}
} catch (err) {
this.disabled = false
}
}
}
}
</script>
<style scoped>
.filter_picker {
text-align: center
}
</style>

View File

@@ -24,48 +24,28 @@ export const handLogin = (user, password) => request({
/**
* 任务下发
*/
// 一、生成任务
export const callTask = (scode, ncode, type, vtype) => request({
url:'api/hand/callTask',
// 1.1根据起点查询任务信息
export const getTaskInfoByStartPoint = (pcode1, ttype) => request({
url:'api/hand/getTaskInfoByStartPoint',
data: {
start_device_code: scode,
next_device_code: ncode,
task_type: type,
vehicle_type: vtype
point_code1: pcode1,
task_type: ttype
}
})
// 二、查询区域
export const queryArea = () => request({
url:'api/hand/queryArea',
data: {}
})
// 三、查询区域站点
export const queryPointByArea = (rcode) => request({
url:'api/hand/queryPointByArea',
// 1.3下发
export const sendPointTask = (ttype, pcode1, pcode2, pcode3, pcode4, isoverrun) => request({
url:'api/hand/sendPointTask',
data: {
region_code: rcode
task_type: ttype,
point_code1: pcode1,
point_code2: pcode2,
point_code3: pcode3,
point_code4: pcode4,
is_overrun: isoverrun
}
})
/**
* 任务管理
*/
// 四、查询未完成任务
export const querytasks = () => request({
url:'api/hand/tasks',
data: {}
})
// 五、任务操作
export const taskoperation = (id, type) => request({
url:'api/hand/taskoperation',
data: {
task_uuid: id,
type: type
}
})
// 六、获取载具类型
export const queryVehicleType = () => request({
url:'api/hand/queryVehicleType',
// 1.2查询所有任务类型
export const getAllTaskType = () => request({
url:'api/hand/getAllTaskType',
data: {}
})