Files
hht-hengsen-acs-uni/pages/modules/taskmanage.vue
2025-06-19 09:34:28 +08:00

127 lines
2.9 KiB
Vue

<template>
<view class="zd_container">
<nav-bar title="任务管理"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>任务号</th>
<th>起点</th>
<th>终点</th>
<th>状态</th>
<th>托盘号</th>
<th>物料类型</th>
<th>优先级</th>
<th>时间</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i" @click="toCheck(e)" :class="{'checked': e.task_uuid === pkId}">
<td>{{e.task_no}}</td>
<td>{{e.start_devicecode}}</td>
<td>{{e.next_devicecode}}</td>
<td>{{e.task_status_name}}</td>
<td>{{e.vehicle_code}}</td>
<td>{{e.material_type_name}}</td>
<td>{{e.priority}}</td>
<td>{{e.create_time}}</td>
</tr>
</tbody>
</table>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled1" @tap="toSure1('1')">重新生成</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !pkId}" :disabled="disabled2" @tap="toSure2('2')">强制完成</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {queryTask, taskOperation} from '@/utils/getData2.js'
export default {
components: {
NavBar
},
data() {
return {
keyword: '',
startPoint: '',
endPoint: '',
dataList: [],
disabled1: false,
disabled2: false,
disabled3: false,
pkId: ''
};
},
created () {
this._queryTask(this.keyword, this.startPoint, this.endPoint)
},
methods: {
async _queryTask () {
let res = await queryTask(this.keyword, this.startPoint, this.endPoint)
if (res.code === '1') {
this.dataList = [...res.result]
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
}
},
async _taskOperation (type) {
try {
let res = await taskOperation(this.pkId, type)
if (res.code === '1') {
this.disabled1 = false
this.disabled2 = false
this.pkId = ''
this._queryTask()
uni.showToast({
title: res.desc,
icon: 'none'
})
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
this.disabled1 = false
this.disabled2 = false
}
} catch (err) {
this.disabled1 = false
this.disabled2 = false
}
},
toCheck (e) {
this.pkId = this.pkId === e.task_uuid ? '' : e.task_uuid
},
toSure1 (type) {
this.disabled1 = true
if (!this.pkId) {
this.disabled1 = false
return
}
this._taskOperation(type)
},
toSure2 (type) {
this.disabled2 = true
if (!this.pkId) {
this.disabled2 = false
return
}
this._taskOperation(type)
}
}
}
</script>
<style lang="stylus">
</style>