Files
hht-tongbo-acs-two-uni/pages/manage/task-manage.vue

181 lines
5.1 KiB
Vue
Raw Normal View History

2024-04-02 13:22:24 +08:00
<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">
2024-04-02 15:49:38 +08:00
<view class="item-wrap" v-for="(e, i) in dataList" :key="i" @tap="toCheck(e)" :class="{isChecked: pkId === e.task_uuid}">
2024-04-19 14:40:47 +08:00
<view class="zd-row">
<view class="zd-col-10 item-font-1">{{e.task_no}}</view>
<view class="zd-col-10 item-font-2" style="text-align:right">{{e.create_time}}</view>
2024-04-02 13:22:24 +08:00
</view>
<view class="zd-row">
<view class="zd-col-16">
2024-04-19 14:40:47 +08:00
<view class="zd-row">
<view class="zd-col-7 item-font-3">任务状态</view>
<view class="zd-col-17 item-font-4">{{['就绪', '执行中', '完成'][Number(e.task_status)]}}</view>
</view>
<view class="zd-row">
2024-04-04 18:03:33 +08:00
<view class="zd-col-7 item-font-3">载具号</view>
<view class="zd-col-17 item-font-4">{{e.carrier}}</view>
2024-04-02 13:22:24 +08:00
</view>
</view>
<view class="zd-col-8">
<view class="item-font-5">{{e.priority}}</view>
2024-04-19 14:40:47 +08:00
<view class="item-font-7">优先级</view>
2024-04-02 13:22:24 +08:00
</view>
</view>
<view class="zd-row">
2024-04-04 18:03:33 +08:00
<view class="zd-col-10 item-font-6">起始设备{{e.start_devicecode}}</view>
<view class="zd-col-2 item-font-7">&ndash;&ndash;</view>
<view class="zd-col-10 item-font-6">目标设备{{e.next_devicecode}}</view>
2024-04-02 13:22:24 +08:00
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
2024-04-04 18:03:33 +08:00
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_handTaskoperation('1')">重新生成</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled" @tap="_handTaskoperation('2')">强制完成</button>
2024-04-02 13:22:24 +08:00
</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>
2024-04-04 18:03:33 +08:00
<button class="zd-col-7 button-primary" @tap="_handTasks">查询</button>
2024-04-02 13:22:24 +08:00
</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'
2024-04-04 18:03:33 +08:00
import {handTasks, handTaskoperation} from '@/utils/getData2.js'
2024-04-02 13:22:24 +08:00
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 () {
2024-04-04 18:03:33 +08:00
this._handTasks()
2024-04-02 13:22:24 +08:00
},
methods: {
toSearch () {
this.show = true
this.tab = '-1'
},
2024-04-04 18:03:33 +08:00
async _handTasks () {
2024-04-02 13:22:24 +08:00
this.show = false
2024-04-02 15:49:38 +08:00
try {
2024-04-04 18:03:33 +08:00
let res = await handTasks(this.val1, this.val2, this.val3)
2024-04-02 15:49:38 +08:00
this.data = [...res.data]
2024-04-02 13:22:24 +08:00
this.dataList = [...this.data]
2024-04-02 15:49:38 +08:00
} catch (e) {
2024-04-02 13:22:24 +08:00
uni.showToast({
2024-04-02 15:49:38 +08:00
title: res.message,
2024-04-02 13:22:24 +08:00
icon: 'none'
})
}
},
changeTab (e) {
this.tab = e.id
if (e.id !== '-1') {
2024-04-04 18:03:33 +08:00
let arr = this.data.filter(el => {return el.task_status === e.id})
2024-04-02 13:22:24 +08:00
this.dataList = [...arr]
} else {
this.dataList = [...this.data]
}
},
2024-04-04 18:03:33 +08:00
async _handTaskoperation (type) {
2024-04-02 13:22:24 +08:00
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
2024-04-04 18:03:33 +08:00
let res = await handTaskoperation(type, this.pkId)
2024-04-02 13:22:24 +08:00
this.disabled = false
this.tab = '-1'
2024-04-04 18:03:33 +08:00
this._handTasks()
2024-04-02 13:22:24 +08:00
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) {
2024-04-02 15:49:38 +08:00
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
2024-04-02 13:22:24 +08:00
}
}
}
</script>
<style lang="stylus">
</style>