Files
hht-huaxiang-uni/pages/manage/task-manage.vue
2025-05-13 15:23:07 +08:00

137 lines
3.8 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"></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.task_uuid}">
<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>
</view>
<view class="zd-row">
<view class="zd-col-16">
<view class="zd-row">
<view class="zd-col-7 item-font-3">任务状态</view>
<view class="zd-col-17 item-font-4">{{e.task_status_name}}</view>
</view>
<view class="zd-row">
<view class="zd-col-7 item-font-3">载具号</view>
<view class="zd-col-17 item-font-4">{{e.carrier}}</view>
</view>
</view>
<view class="zd-col-8">
<view class="item-font-5">{{e.priority}}</view>
<view class="item-font-7">优先级</view>
</view>
</view>
<view class="zd-row">
<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>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<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>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {handTasks, handTaskoperation} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
state: [{id:'-1', text: '全部'}, {id:'0', text: '就绪'}, {id:'1', text: '执行中'}],
tab: '-1',
title: '',
data: [],
dataList: [],
pkId: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
this._handTasks()
},
methods: {
async _handTasks () {
try {
let res = await handTasks()
if (res.code === '1') {
this.data = [...res.result]
this.dataList = [...this.data]
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
} catch (e) {
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.task_status === e.id})
this.dataList = [...arr]
} else {
this.dataList = [...this.data]
}
},
async _handTaskoperation (type) {
this.disabled = true
if (!this.pkId) {
this.disabled = false
return
}
try {
let res = await handTaskoperation(type, this.pkId)
if (res.code === '1') {
this.disabled = false
this.tab = '-1'
this._handTasks()
uni.showToast({
title: res.desc,
icon: 'none'
})
} else {
this.disabled = false
}
} catch (e) {
this.disabled = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
}
}
}
</script>
<style lang="stylus">
</style>