Files
hht-nl-four-uni/pages/modules/zlmanage.vue
2023-10-13 13:53:24 +08:00

165 lines
4.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>
<th>优先级</th>
<th>创建时间</th>
<th>agv车号</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.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.inst_step_name}}</td>
<td>{{e.carrier}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
<td>{{e.carno}}</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>
<button class="submit-button" :class="{'btn-disabled': !pkId}" :disabled="disabled3" @tap="toSure3('3')">强制完成</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {insts, inst} from '@/utils/getData1.js'
export default {
components: {
NavBar
},
data() {
return {
keyword: '',
startPoint: '',
endPoint: '',
dataList: [],
disabled1: false,
disabled2: false,
disabled3: false,
pkId: ''
};
},
created () {
this._insts(this.keyword, this.startPoint, this.endPoint)
},
methods: {
async _insts () {
let res = await insts(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', '完成')
}
if(el.inst_status === '3') {
this.$set(el, 'inst_status_name', '取消')
}
if(el.inst_status === '4') {
this.$set(el, 'inst_status_name', '异常')
}
if(el.inst_step === '1') {
this.$set(el, 'inst_step_name', '请求取货')
}
if(el.inst_step === '2') {
this.$set(el, 'inst_step_name', '取货完成')
}
if(el.inst_step === '3') {
this.$set(el, 'inst_step_name', '请求放货')
}
if(el.inst_step === '4') {
this.$set(el, 'inst_step_name', '放货完成')
}
})
this.dataList = [...res.result]
},
async _inst (type) {
try {
let res = await inst(type, this.pkId)
if (res.code === '1') {
this.disabled1 = false
this.disabled2 = false
this.disabled3 = false
this.pkId = ''
this._insts()
uni.showToast({
title: res.desc,
icon: 'none'
})
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
this.disabled1 = false
this.disabled2 = false
this.disabled3 = false
}
} catch (err) {
this.disabled1 = false
this.disabled2 = false
this.disabled3 = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.inst_uuid ? '' : e.inst_uuid
},
toSure1 (type) {
this.disabled1 = true
if (!this.pkId) {
this.disabled1 = false
return
}
this._inst(type)
},
toSure2 (type) {
this.disabled2 = true
if (!this.pkId) {
this.disabled2 = false
return
}
this._inst(type)
},
toSure3 (type) {
this.disabled3 = true
if (!this.pkId) {
this.disabled3 = false
return
}
this._inst(type)
}
}
}
</script>
<style lang="stylus">
</style>