托盘绑定

This commit is contained in:
2023-10-07 14:50:55 +08:00
parent 5eee469c1b
commit eaa5d3f8c8

View File

@@ -6,7 +6,7 @@
<view class="filter_item"> <view class="filter_item">
<view class="filter_label">木托盘编码</view> <view class="filter_label">木托盘编码</view>
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<uni-data-select v-model="index1" :localdata="options1" @change="selectChange1"></uni-data-select> <search-box v-model="val1" />
</view> </view>
</view> </view>
<view class="filter_item"> <view class="filter_item">
@@ -14,14 +14,14 @@
<span class="filter_label">钢托盘编码</span> <span class="filter_label">钢托盘编码</span>
</view> </view>
<view class="filter_input_wraper"> <view class="filter_input_wraper">
<uni-data-select v-model="index2" :localdata="options2" @change="selectChange2"></uni-data-select> <search-box v-model="val2" />
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="submit-bar"> <view class="submit-bar">
<button class="submit-button" :class="{'btn-disabled': !index1 || !index2}" :disabled="disabled1" @tap="toSure">确认</button> <button class="submit-button" :class="{'btn-disabled': !val1 || !val2}" :disabled="disabled" @tap="toSure">确认</button>
<button class="submit-button" @tap="toCancle">取消</button> <button class="submit-button" @tap="toCancle">清空</button>
</view> </view>
</view> </view>
</template> </template>
@@ -29,7 +29,7 @@
<script> <script>
import NavBar from '@/components/NavBar.vue' import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue' import SearchBox from '@/components/SearchBox.vue'
import {deviceInfo, deviceStatus, deviceCheckVerify} from '@/utils/getData2.js' import {manualSortingBindingVehicle} from '@/utils/getData2.js'
export default { export default {
components: { components: {
NavBar, NavBar,
@@ -37,79 +37,40 @@
}, },
data() { data() {
return { return {
options1: [], val1: '',
index1: '', val2: '',
options2: [], disabled: false
index2: '',
disabled1: false
}; };
}, },
created () {
this._deviceInfo()
this._deviceStatus()
},
methods: { methods: {
/** 选择器 */
selectChange1(e) {
this.index1 = e
},
selectChange2(e) {
this.index2 = e
},
/** 获取设备下拉框 */
async _deviceInfo () {
let res = await deviceInfo()
this.options1 = [...res]
},
/** 获取设备状态下拉框 */
async _deviceStatus () {
let res = await deviceStatus()
this.options2 = [...res]
},
/** 确定 */ /** 确定 */
async toSure () { async toSure () {
this.disabled1 = true this.disabled = true
if (!this.index1) { if (!this.val1 || !this.val2) {
uni.showToast({ this.disabled = false
title: '设备号不能为空',
icon: 'none'
})
this.disabled1 = false
return
}
if (!this.index2) {
uni.showToast({
title: '状态不能为空',
icon: 'none'
})
this.disabled1 = false
return return
} }
try { try {
let userName = this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '' let res = await manualSortingBindingVehicle(this.val2, this.val1)
let res = await deviceCheckVerify(this.index1, userName, this.index2) this.disabled = false
this.disabled1 = false this.val1 = ''
this.index1 = '' this.val2 = ''
this.index2 = ''
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: 'none' icon: 'none'
}) })
} catch (e) { } catch (e) {
this.disabled1 = false this.disabled = false
} }
}, },
toCancle () { toCancle () {
this.disabled1 = false this.disabled = false
this.index1 = '' this.val1 = ''
this.index2 = '' this.val2 = ''
} }
} }
} }
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped>
.filter_item_1, .filter_input_wraper_1
align-items: flex-start
height 210rpx
</style> </style>