129 lines
3.0 KiB
Vue
129 lines
3.0 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.inst_status_name}}</td>
|
|
<td>{{e.priority}}</td>
|
|
<td>{{e.create_time}}</td>
|
|
<td>{{e.carrier}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="submit-bar">
|
|
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled1" @tap="toSure1('1')">重新生成</button>
|
|
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled2" @tap="toSure2('2')">强制完成</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import {tasks, taskoperation} from '@/utils/getData1.js'
|
|
export default {
|
|
components: {
|
|
NavBar
|
|
},
|
|
data() {
|
|
return {
|
|
keyword: '',
|
|
startPoint: '',
|
|
endPoint: '',
|
|
dataList: [],
|
|
disabled1: false,
|
|
disabled2: false,
|
|
disabled3: false,
|
|
pkId: ''
|
|
};
|
|
},
|
|
created () {
|
|
this._tasks(this.keyword, this.startPoint, this.endPoint)
|
|
},
|
|
methods: {
|
|
async _tasks () {
|
|
let res = await tasks(this.keyword, this.startPoint, this.endPoint)
|
|
res.result.map(el => {
|
|
if(el.inst_status === '0') {
|
|
this.$set(el, 'inst_status_name', '就绪')
|
|
}
|
|
if(el.inst_status === '1') {
|
|
this.$set(el, 'inst_status_name', '执行中')
|
|
}
|
|
if(el.inst_status === '2') {
|
|
this.$set(el, 'inst_status_name', '完成')
|
|
}
|
|
})
|
|
this.dataList = [...res.result]
|
|
},
|
|
async _taskoperation (type) {
|
|
try {
|
|
let res = await taskoperation(type, this.pkId)
|
|
if (res.code === '1') {
|
|
this.disabled1 = false
|
|
this.disabled2 = false
|
|
this.pkId = ''
|
|
this._tasks()
|
|
uni.showToast({
|
|
title: res.desc,
|
|
icon: 'none'
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: res.desc,
|
|
icon: 'none'
|
|
})
|
|
this.disabled1 = false
|
|
this.disabled2 = false
|
|
}
|
|
} catch (err) {
|
|
this.disabled1 = false
|
|
this.disabled2 = 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._taskoperation(type)
|
|
},
|
|
toSure2 (type) {
|
|
this.disabled2 = true
|
|
if (!this.pkId) {
|
|
this.disabled2 = false
|
|
return
|
|
}
|
|
this._taskoperation(type)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus">
|
|
</style>
|