Files
hht-gaoce-uni/pages/modules/taskmanage.vue
2024-04-23 13:59:56 +08:00

121 lines
2.6 KiB
Vue

<template>
<view class="zd_container">
<nav-bar 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>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.task_uuid === pkId}">
<td>{{e.task_no}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.task_status_name}}</td>
<td>{{e.carrier}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure1('1')">重新生成</button>
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled" @tap="toSure2('2')">强制完成</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {handTasks, handTaskoperation} from '@/utils/getData02.js'
export default {
components: {
NavBar
},
data() {
return {
keyword: '',
startPoint: '',
endPoint: '',
data: [],
dataList: [],
disabled: false,
pkId: ''
};
},
created () {
this._handTasks()
},
methods: {
async _handTasks () {
this.show = false
try {
let res = await handTasks(this.val1, this.val2, this.val3)
this.data = [...res.data]
this.dataList = [...this.data]
} catch (e) {
uni.showToast({
title: res.message,
icon: 'none'
})
}
},
async _handTaskoperation (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await handTaskoperation(type, this.pkId)
this.disabled = false
this.pkId = ''
this._handTasks()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
},
toSure1 (type) {
this.disabled1 = true
if (!this.pkId) {
this.disabled1 = false
return
}
this._handTaskoperation(type)
},
toSure2 (type) {
this.disabled2 = true
if (!this.pkId) {
this.disabled2 = false
return
}
this._handTaskoperation(type)
}
}
}
</script>
<style lang="stylus">
</style>