Files
hht-tongbo/pages/task/taskmanage.vue
2022-10-10 10:19:18 +08:00

110 lines
2.4 KiB
Vue

<template>
<view class="content">
<view class="container">
<view class="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.material_type_name}}</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" @click="toSure('1')">重新生成</button>
<button class="submit-button" :class="{'btn-disabled': pkId === ''}" :disabled="disabled" @click="toSure('2')">强制完成</button>
</view>
</view>
</template>
<script>
import {queryTask, taskOperation} from 'utils/api.js'
export default {
data() {
return {
dataList: [],
pkId: '',
disabled: false
};
},
mounted () {
this.queryTask()
},
methods: {
onNavigationBarButtonTap(e) {
uni.redirectTo({
url: '/pages/home/home'
});
},
async queryTask () {
let res = await queryTask()
if (res.code === '1') {
this.dataList = [...res.result]
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
async taskOperation (type) {
try {
let res = await taskOperation(this.pkId, type)
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
this.pkId = ''
this.dataList = []
this.queryTask()
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
this.disabled = false
} catch (err) {
this.disabled = false
}
},
toSure (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
this.taskOperation(type)
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
}
}
}
</script>
<style lang="stylus">
</style>