Files
hht-lnsh-new/src/pages/manual/ExceptionHand.vue
2024-05-22 16:12:45 +08:00

171 lines
5.1 KiB
Vue

<template>
<section>
<nav-bar title="人工异常处理"></nav-bar>
<section class="content mgt86 mgb110">
<div class="filter-wraper">
<div class="bottom-filter-tip">
<div class="filter-label">区域</div>
<div class="fxcol mgl20 visible" >
<el-select v-model="value1" filterable placeholder="请选择">
<el-option
v-for="item in options1"
:key="item.region_code"
:label="item.region_name"
:value="item.region_code">
</el-option>
</el-select>
</div>
</div>
</div>
<div class="zd-row grid_wraper">
<div class="left_fixed">
<table class="layout-t left_layout_t">
<tr>
<th>任务号</th>
</tr>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.task_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>载具号</th>
</tr>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.task_id === pkId}">
<td>{{ e.task_name }}</td>
<td>{{ ['生成', '确定起点', '确定终点', '确认起点和终点', '下发', '执行中', '完成', '取消'][Number(e.task_status) - 1] }}</td>
<td>{{e.start_point}}</td>
<td>{{e.end_point}}</td>
<td>{{e.vehicle_type}}</td>
<td>{{e.vehicle_code}}</td>
</tr>
</table>
</div>
</div>
</section>
<section class="submit-bar">
<button class="btn submit-button" @click="_ExceptionHandlingTaskShow">查询</button>
<button class="btn submit-button" :class="{'btn-disabled' : !pkId}" @click="show = true">修改终点</button>
<button class="btn submit-button" :class="{'btn-disabled' : !pkId}" :disabled="disabled" @click="_ExceptionHandlingTask(1)">确认</button>
</section>
<modal :mdShow="show" @closeModalCallback="closeModalCallback" @comfirmCallback="comfirmCallback">
<div class="msg_item">
<div class="label_item">目的位置</div>
<div class="from_item" >
<el-select v-model="value2" filterable placeholder="请选择">
<el-option
v-for="item in options2"
:key="item.point_code"
:label="item.point_name"
:value="item.point_code">
</el-option>
</el-select>
</div>
</div>
</modal>
</section>
</template>
<script>
import NavBar from '@components/NavBar.vue'
import Modal from '@components/Modal.vue'
import {ExceptionHandlingRegionList, ExceptionHandlingTaskList, ExceptionHandlingTaskShow, ExceptionHandlingTask} from '@config/getData2'
export default {
name: 'BindPalletPoint',
components: {
NavBar,
Modal
},
data () {
return {
value1: '',
options1: [],
value2: '',
options2: [],
dataList: [],
pkId: '',
disabled: false,
show: false
}
},
created () {
this._ExceptionHandlingRegionList()
this._ExceptionHandlingTaskList()
},
methods: {
/** 查询区域下拉框 */
async _ExceptionHandlingRegionList () {
let res = await ExceptionHandlingRegionList()
if (res.code === '1') {
this.options1 = [...res.result]
} else {
this.Dialog(res.desc)
}
},
/** 点位下拉框 */
async _ExceptionHandlingTaskList () {
let res = await ExceptionHandlingTaskList()
if (res.code === '1') {
this.options2 = [...res.result]
} else {
this.Dialog(res.desc)
}
},
/** grid */
async _ExceptionHandlingTaskShow () {
let res = await ExceptionHandlingTaskShow(this.value1)
if (res.code === '1') {
this.dataList = [...res.result]
} else {
this.Dialog(res.desc)
}
},
toCheck (e) {
this.pkId = this.pkId === e.task_id ? '' : e.task_id
},
closeModalCallback () {
this.show = false
},
comfirmCallback () {
if (this.valu2 === '') {
this.toast('请选择目的位置')
return
}
this.show = false
this._ExceptionHandlingTask(2)
},
/** 确认 */
async _ExceptionHandlingTask (type) {
this.disabled = true
if (type === 1 && this.pkId === '') {
this.disabled = false
return
}
if (type === 2) {
this.disabled = false
}
try {
let code = type === 1 ? '' : this.value2
let res = await ExceptionHandlingTask(this.pkId, code)
if (res.code === '1') {
this.toast(res.desc)
this._ExceptionHandlingTaskShow()
} else {
this.Dialog(res.desc)
}
this.disabled = false
} catch (e) {
this.disabled = false
}
}
}
}
</script>