Files
hht-xzhy-uni/pages/General/line-transfer.vue

115 lines
2.8 KiB
Vue
Raw Normal View History

2025-09-03 09:57:06 +08:00
<template>
2025-09-03 17:08:48 +08:00
<view class="zd_container">
<!-- 产线转运 -->
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
2025-09-08 15:41:33 +08:00
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">载具编码</span>
</view>
<view class="zd-col-18">
<search-box v-model="vehicleCode"/>
</view>
</view>
2025-09-03 17:08:48 +08:00
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">起点</span>
</view>
<view class="zd-col-18">
<search-box v-model="code1"/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">终点</span>
</view>
<view class="zd-col-18">
<search-box v-model="code2"/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">载具类型</span>
</view>
<view class="zd-col-18 filter_select">
<uni-data-select v-model="index" :localdata="options"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
2025-09-08 15:41:33 +08:00
<button class="zd-col-18 button-primary" :class="{'button-info': !code1 || !code2 || !index}" :disabled="disabled" @tap="_createTask">生成任务</button>
2025-09-03 17:08:48 +08:00
</view>
2025-09-03 09:57:06 +08:00
</view>
</template>
<script>
2025-09-03 17:08:48 +08:00
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2025-09-08 16:45:57 +08:00
// import {queryVehicleType} from '@/utils/mork2.js'
import {queryVehicleType, createTask} from '@/utils/getData2.js'
2025-09-03 09:57:06 +08:00
export default {
2025-09-03 17:08:48 +08:00
components: {
NavBar,
SearchBox
},
2025-09-03 09:57:06 +08:00
data() {
return {
2025-09-03 17:08:48 +08:00
title: '',
2025-09-08 15:41:33 +08:00
vehicleCode: null,
2025-09-03 17:08:48 +08:00
code1: '',
code2: '',
2025-09-08 15:41:33 +08:00
options: [],
2025-09-03 17:08:48 +08:00
index: '',
disabled: false
2025-09-03 09:57:06 +08:00
};
2025-09-03 17:08:48 +08:00
},
onLoad (options) {
this.title = options.title
2025-09-08 15:41:33 +08:00
this._queryVehicleType()
2025-09-03 17:08:48 +08:00
},
methods: {
/** 下拉框*/
2025-09-08 15:41:33 +08:00
async _queryVehicleType () {
try {
let res = await queryVehicleType()
if (res && res.data.length > 0) {
this.options = [...res.data]
} else {
this.options = []
}
} catch (e) {
this.options = []
2025-09-03 17:08:48 +08:00
}
},
toEmpty () {
2025-09-08 15:41:33 +08:00
this.vehicleCode = null,
2025-09-03 17:08:48 +08:00
this.code1 = ''
2025-09-08 15:41:33 +08:00
this.code2 = ''
this.index = ''
this.disabled = false
2025-09-03 17:08:48 +08:00
},
2025-09-08 15:41:33 +08:00
async _createTask () {
2025-09-03 17:08:48 +08:00
this.disabled = true
2025-09-08 15:41:33 +08:00
if (!this.code1 || !this.code2 || !this.index) {
2025-09-03 17:08:48 +08:00
this.disabled = false
return
}
try {
2025-09-08 15:41:33 +08:00
let res = await createTask(this.vehicleCode, this.code1, this.code2, this.index)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
2025-09-03 17:08:48 +08:00
}
this.disabled = false
} catch (e) {
this.disabled = false
}
}
2025-09-03 09:57:06 +08:00
}
}
2025-09-03 17:08:48 +08:00
</script>