Files
hht-shangdianke-uni/pages/manage/task-manage.vue

186 lines
5.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="zd_container">
<nav-bar :title="title" :searchActive="true" @toSearch="toSearch"></nav-bar>
<view class="zd_content pdt0">
<view class="filter_wrapper">
<view class="zd-row">
<view class="zd-col-8 font-style-1" v-for="e in state" :key="e.id" @tap="changeTab(e)">
<view class="font-style-1" :class="{'font-style-2': e.id === tab}">{{e.text}}</view>
<view class="tab-line" :class="{'tab-line_active': e.id === tab}"></view>
</view>
</view>
</view>
<view class="item-wrapper">
<view class="item-wrap" v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)" :class="{isChecked: pkId === e.inst_uuid}">
<view class="zd-row mgb10">
<view class="item-font-1">{{e.task_no}}&nbsp;&#124;&nbsp;{{['就绪', '执行中', '完成'][Number(e.inst_status)]}}</view>
</view>
<view class="zd-row">
<view class="zd-col-16">
<view class="item-font-2 mgb10">{{e.create_time}}&nbsp;&#124;&nbsp;{{['请求取货', '取货完成', '请求放货', '放货完成'][Number(e.inst_step) - 1]}}</view>
<view class="zd-row mgb10">
<view class="item-font-3">载具号</view>
<view class="item-font-4">{{e.carrier}}</view>
</view>
<view class="zd-row mgb10">
<view class="item-font-3">指令号</view>
<view class="item-font-4">{{e.instruction_code}}</view>
</view>
<view class="zd-row mgb10">
<view class="item-font-3">车号</view>
<view class="item-font-4">{{e.carno}}</view>
</view>
</view>
<view class="zd-col-8">
<view class="item-font-5">{{e.priority}}</view>
<view class="item-font-8">优先级</view>
</view>
</view>
<view class="zd-row">
<view class="item-font-3">设备</view>
<view class="item-font-6">{{e.start_devicecode}}</view>
<view class="item-font-7">&ndash;</view>
<view class="item-font-6">{{e.next_devicecode}}</view>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('1')">指令撤销</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('2')">重新下发</button>
<button class="zd-col-7 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_pdaInst('3')">强制完成</button>
</view>
<view class="zd_content msg_wrapper" :class="show ? 'popshow' : 'pophide'">
<view class="msg_content">
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">关键字</span>
</view>
<view class="zd-col-19">
<input type="text" class="filter_input" v-model="val1">
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-5">
<span class="filter_label">起始设备</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val2"
/>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">目标设备</span>
</view>
<view class="zd-col-19 filter_select">
<search-box
v-model="val3"
/>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-7 button-default" @tap.stop="show = false">取消</button>
<button class="zd-col-7 button-default" @tap.stop="clearUp">清空</button>
<button class="zd-col-7 button-primary" @tap="_pdaInsts">查询</button>
</view>
</view>
<view v-if="show" class="msg_mask"></view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {pdaInsts, pdaInst} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
show: false,
state: [{id:'-1', text: '全部'}, {id:'0', text: '就绪'}, {id:'1', text: '执行中'}, {id:'2', text: '完成'}],
tab: '-1',
title: '',
val1: '',
val2: '',
val3: '',
data: [],
dataList: [],
pkId: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._pdaInsts()
},
methods: {
toSearch () {
this.show = true
this.tab = '-1'
},
async _pdaInsts () {
this.show = false
let res = await pdaInsts(this.val1, this.val2, this.val3)
if (res.code === '1') {
this.data = [...res.result]
this.dataList = [...this.data]
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
changeTab (e) {
this.tab = e.id
if (e.id !== '-1') {
let arr = this.data.filter(el => {return el.inst_status === e.id})
this.dataList = [...arr]
} else {
this.dataList = [...this.data]
}
},
async _pdaInst (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await pdaInst(type, this.pkId)
this.disabled = false
this.tab = '-1'
this._pdaInsts()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.val1 = ''
this.val2 = ''
this.val3 = ''
this.pkId = ''
this.disabled = false
},
toCheck (e) {
this.pkId = this.pkId === e.inst_uuid ? '' : e.inst_uuid
}
}
}
</script>
<style lang="stylus">
</style>