Files
hht-nlpower-uni/pages/modules/agv-task.vue

199 lines
4.9 KiB
Vue
Raw Normal View History

2025-02-06 16:32:24 +08:00
<template>
<view class="zd_container">
<nav-bar title="搬运任务"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
2025-02-08 13:24:33 +08:00
<view class="filter_item">
<view class="filter_label">任务模式</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index5" :localdata="options5" @change="selectChange5"></uni-data-select>
</view>
</view>
2025-02-06 16:32:24 +08:00
<view class="filter_item">
<view class="filter_label">起始区域</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index3" :localdata="options3" @change="selectChange3"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label">目标区域</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index4" :localdata="options4" @change="selectChange4"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label">起始点位</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select>
</view>
</view>
<view class="filter_item">
<view class="filter_label">目标点位</view>
<view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar_new">
<button class="zd-col-7 submit-button_c" @tap="toClear">清空</button>
2025-02-11 13:05:11 +08:00
<button class="zd-col-15 submit-button_new" :class="{'btn-disabled': !index1 || !index2 || !index3 || !index4 || !index5}" :disabled="disabled" @tap="toSure">确认</button>
2025-02-06 16:32:24 +08:00
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
2025-02-08 16:42:01 +08:00
import {queryBusinessProcesses, queryPointByArea, callTask} from '@/utils/getData0.js'
2025-02-06 16:32:24 +08:00
export default {
components: {
NavBar
},
data() {
return {
disabled: false,
options1: [],
index1: '',
options2: [],
index2: '',
options3: [],
index3: '',
options4: [],
index4: '',
2025-02-08 13:24:33 +08:00
options5: [],
2025-02-08 16:42:01 +08:00
index5: '',
retData: '',
descObj: {},
dtel: ''
2025-02-06 16:32:24 +08:00
};
},
created () {
2025-02-08 16:42:01 +08:00
this._queryBusinessProcesses()
2025-02-06 16:32:24 +08:00
},
methods: {
selectChange1 (e) {
2025-02-08 16:42:01 +08:00
if(!e){
return
}
2025-02-06 16:32:24 +08:00
this.index1 = e
},
selectChange2 (e) {
2025-02-08 16:42:01 +08:00
if(!e){
return
}
2025-02-06 16:32:24 +08:00
this.index2 = e
},
selectChange3 (e) {
2025-02-08 16:42:01 +08:00
if(!e){
return
}
2025-02-06 16:32:24 +08:00
this.index3 = e
2025-02-08 13:24:33 +08:00
this._queryPointByArea1(e)
2025-02-06 16:32:24 +08:00
},
selectChange4 (e) {
2025-02-08 16:42:01 +08:00
if(!e){
return
}
2025-02-06 16:32:24 +08:00
this.index4 = e
2025-02-08 13:24:33 +08:00
this._queryPointByArea2(e)
2025-02-06 16:32:24 +08:00
},
2025-02-08 16:42:01 +08:00
selectChange5 (e) {
this.index1 = ''
this.index2 = ''
this.index3 = ''
this.index4 = ''
this.options1 = []
this.options2 = []
this.options3 = []
this.options4 = []
if(!e){
return
}
this.index5 = e
let descObj = this.retData.find(item => item.name == e);
let dictArr = descObj.dictDetails
dictArr.map(el => {
if (el.dictSort == 1) {
this.options3.push({'value': el.value, 'text' :el.label})
}
if (el.dictSort == 2) {
this.options4.push({'value': el.value, 'text' :el.label})
}
2025-02-06 16:32:24 +08:00
})
},
2025-02-08 16:42:01 +08:00
async _queryBusinessProcesses () {
let res = await queryBusinessProcesses()
console.log(res)
this.retData = res.data
res.data.map(el => {
this.options5.push({'value': el.name, 'text' :el.description})
2025-02-06 16:32:24 +08:00
})
},
/** 点位查询1 */
2025-02-08 13:24:33 +08:00
async _queryPointByArea1 (a) {
let res = await queryPointByArea(a)
2025-02-08 16:42:01 +08:00
this.options1 = [...res.data]
2025-02-06 16:32:24 +08:00
this.options1.map(el => {
2025-02-08 13:24:33 +08:00
this.$set(el, 'value', el.device_code)
this.$set(el, 'text', el.device_name)
2025-02-06 16:32:24 +08:00
})
},
/** 点位查询2 */
2025-02-08 13:24:33 +08:00
async _queryPointByArea2 (a) {
let res = await queryPointByArea(a)
2025-02-08 16:42:01 +08:00
this.options2 = [...res.data]
2025-02-06 16:32:24 +08:00
this.options2.map(el => {
2025-02-08 13:24:33 +08:00
this.$set(el, 'value', el.device_code)
this.$set(el, 'text', el.device_name)
2025-02-06 16:32:24 +08:00
})
},
toClear () {
this.index1 = ''
this.index2 = ''
2025-02-08 16:42:01 +08:00
this.index3 = ''
this.index4 = ''
this.index5 = ''
this.options1 = []
this.options2 = []
this.options3 = []
this.options4 = []
this.options5 = []
2025-02-06 16:32:24 +08:00
},
2025-02-08 13:24:33 +08:00
async _callTask () {
2025-02-06 16:32:24 +08:00
try {
2025-02-08 13:24:33 +08:00
let res = await callTask(this.index1, this.index2, '3', '')
2025-02-06 16:32:24 +08:00
uni.showToast({
title: res.message,
icon: 'none'
})
2025-02-11 13:05:11 +08:00
this.disabled = false
2025-02-06 16:32:24 +08:00
} catch (e) {
this.disabled = false
}
2025-02-11 13:05:11 +08:00
},
toSure () {
this.disabled = true
if (!this.index1 || !this.index2 || !this.index3 || !this.index4 || !this.index5) {
this.disabled = false
return
}
uni.showModal({
title: '提示',
content: '确认下发任务?',
confirmColor: '#ff6a00',
success: (res) => {
if (res.confirm) {
this._callTask()
} else if (res.cancel) {
this.disabled = false
}
}
})
2025-02-06 16:32:24 +08:00
}
}
}
</script>
<style lang="stylus">
</style>