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

115 lines
2.7 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>agv车号</th>
<th>物料类型</th>
<th>优先级</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': inst_uuid === pkId}">
<td>{{e.task_no}}</td>
<td>{{e.inst_no}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.inst_status_name}}</td>
<td>{{e.carno}}</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>
<button class="submit-button" :class="{'btn-disabled': pkId === ''}" :disabled="disabled" @click="toSure('3')">强制完成</button>
</view>
</view>
</template>
<script>
import {queryInstraction, instOperation} from 'utils/api.js'
export default {
data() {
return {
dataList: [],
pkId: '',
disabled: false
};
},
mounted () {
this._queryInstraction()
},
methods: {
onNavigationBarButtonTap(e) {
uni.redirectTo({
url: '/pages/home/home'
});
},
async _queryInstraction () {
let res = await queryInstraction()
if (res.code === '1') {
this.dataList = [...res.result]
} else {
uni.showModal({
content: res.desc,
showCancel: false
})
}
},
async _instOperation (type) {
try {
let res = await instOperation(this.pkId, type)
if (res.code === '1') {
uni.showToast({
title: '操作成功',
icon: 'none'
})
this.pkId = ''
this.dataList = []
this._queryInstraction()
} 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._instOperation(type)
},
toCheck (e) {
this.pkId = this.pkId === inst_uuid ? '' : e.inst_uuid
}
}
}
</script>
<style lang="stylus">
</style>