Files
hht-xinrui-mes/src/pages/xinrui/dispatch/InstructManage.vue
2022-06-27 10:21:54 +08:00

166 lines
4.5 KiB
Vue

<template>
<section>
<nav-bar title="任务管理"></nav-bar>
<section class="content mgt186" v-infinite-scroll="loadMore" infinite-scroll-disabled="busy" infinite-scroll-distance="0" infinite-scroll-immediate-check="false">
<div class="filter-wraper">
<search-box
class="pad"
label="关键字"
keyCode="载具号、点位号、任务号、车号"
v-model="val1"
:seaShow="false"
></search-box>
</div>
<div class="grid-wraper">
<div class="left_fixed">
<table class="layout-t left_layout_t">
<tr>
<th>任务号</th>
</tr>
<tr v-for="e in dataList" :key="e.taskdtl_id" @click="toCheck(e)" :class="{'checked': e.taskdtl_id === pkId}">
<td>{{e.task_code}}</td>
</tr>
</table>
</div>
<div class="slide">
<table class="layout-t">
<tr>
<th>载具号</th>
<th>起点</th>
<th>终点</th>
<th>状态</th>
<th>业务类型</th>
<th>AGV</th>
<th>生成时间</th>
</tr>
<tr v-for="e in dataList" :key="e.taskdtl_id" @click="toCheck(e)" :class="{'checked': e.taskdtl_id === pkId}">
<td>{{e.vehicle_code}}</td>
<td>{{e.start_point_code}}</td>
<td>{{e.next_point_code}}</td>
<td>{{e.task_status_name}}</td>
<td>{{e.task_type_name}}</td>
<td>{{e.car_no}}</td>
<td>{{e.create_time}}</td>
</tr>
</table>
</div>
</div>
<div class="loading-tips">{{desc}}</div>
</section>
<section class="submit-bar">
<button class="btn submit-button" @click="_queryTask">查询</button>
<button class="btn submit-button" :disabled="disabled1" :class="{'btn-disabled': pkId === ''}" @click="toSure1('renotifyAcs')">重新下发</button>
<button class="btn submit-button" :disabled="disabled2" :class="{'btn-disabled': pkId === ''}" @click="toSure2('forceFinish')">强制完成</button>
</section>
</section>
</template>
<script>
import NavBar from '@components/NavBar.vue'
import SearchBox from '@components/SearchBox.vue'
import {queryTask, operation} from '@config/getData2.js'
export default {
name: 'InstructManage',
components: {
NavBar,
SearchBox
},
data () {
return {
val1: '',
dataList: [],
page: 1,
size: '10',
busy: false,
desc: '',
pkId: '',
disabled1: false,
disabled2: false
}
},
methods: {
handleFocus1 () {
this.$refs.scaninput1.focus()
},
async _queryTask () {
this.page = 1
this.busy = false
this.desc = ''
let res = await queryTask(this.val1, this.page + '', this.size)
if (res.code === '1') {
this.dataList = []
this.pkId = ''
this.dataList = [...res.rows]
if (res.rows.length < 10) {
this.busy = true
this.desc = '已加载全部数据'
}
} else {
this.Dialog(res.desc)
this.desc = res.desc
}
},
async loadMore () {
this.busy = true
this.page++
let res = await queryTask(this.val1, this.page + '', this.size)
if (res.code === '1') {
this.dataList = [...this.dataList, ...res.rows]
if (res.rows.length < 10) {
this.busy = true
this.desc = '已加载全部数据'
} else {
this.busy = false
}
} else {
this.Dialog(res.desc)
this.desc = res.desc
}
},
async _operation (type) {
try {
let res = await operation(this.pkId, type)
if (res.code === '1') {
this.toast(res.desc)
this._queryTask()
} else {
this.Dialog(res.desc)
}
this.pkId = ''
this.disabled1 = false
this.disabled2 = false
} catch (e) {
this.disabled1 = false
this.disabled2 = false
}
},
toSure1 (type) {
this.disabled1 = true
if (this.pkId !== '') {
this._operation(type)
}
},
toSure2 (type) {
this.disabled2 = true
if (this.pkId !== '') {
this._operation(type)
}
},
toCheck (e) {
this.pkId = this.pkId !== e.taskdtl_id ? e.taskdtl_id : ''
}
}
}
</script>
<style lang="stylus" scoped>
>>>.content
height calc(100% - 1.96rem)
overflow-y auto
.pad
>>>.filter-label
width 1rem
>>>.search_input
padding-right 1.4rem
</style>