Files
hht-xzhy-uni/pages/Material/kzj-inout-store.vue

140 lines
3.1 KiB
Vue
Raw Normal View History

2025-09-02 11:10:13 +08:00
<template>
<view class="zd_container">
2025-09-02 17:24:46 +08:00
<!-- 大料箱 - 空载具出入库 -->
2025-09-02 11:10:13 +08:00
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-7">
2025-09-02 17:24:46 +08:00
<span class="filter_label">货位</span>
2025-09-02 11:10:13 +08:00
</view>
2025-09-02 17:24:46 +08:00
<view class="zd-col-17">
<search-box
v-model="val1"
/>
2025-09-02 11:10:13 +08:00
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
2025-09-02 17:24:46 +08:00
<span class="filter_label">载具</span>
2025-09-02 11:10:13 +08:00
</view>
2025-09-02 17:24:46 +08:00
<view class="zd-col-17">
2025-09-02 11:10:13 +08:00
<search-box
2025-09-02 17:24:46 +08:00
v-model="val2"
2025-09-02 11:10:13 +08:00
/>
</view>
</view>
2025-09-02 17:24:46 +08:00
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">载具类型</span>
</view>
<view class="zd-col-24 filter_select">
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
</view>
2025-09-02 11:10:13 +08:00
</view>
</view>
</view>
<view class="zd-row submit-bar">
2025-09-02 17:24:46 +08:00
<!-- <button class="zd-col-6 button-default" @tap="clearUp">清空</button> -->
2025-09-10 10:38:03 +08:00
<button class="zd-col-11 button-primary" :class="{'button-info': !val1 || !val2}" :disabled="disabled" @tap="_bindEmptyVehicle">绑定</button>
<button class="zd-col-11 button-primary" :class="{'button-info': !val1 || !val2}" :disabled="disabled" @tap="_unBindEmptyVehicle">解绑</button>
2025-09-02 11:10:13 +08:00
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2025-09-17 16:09:45 +08:00
import {bindEmptyVehicle, unBindEmptyVehicle} from '@/utils/getData1.js'
import {queryVehicleType} from '@/utils/getData2.js'
2025-09-02 11:10:13 +08:00
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
2025-09-02 17:24:46 +08:00
val1: '',
val2: '',
2025-09-02 11:10:13 +08:00
options: [],
2025-09-17 16:09:45 +08:00
index: '2',
2025-09-02 11:10:13 +08:00
disabled: false
};
},
onLoad (options) {
this.title = options.title
2025-09-02 17:24:46 +08:00
},
created () {
2025-09-10 10:38:03 +08:00
this._queryVehicleType()
2025-09-02 11:10:13 +08:00
},
methods: {
2025-09-10 10:38:03 +08:00
async _queryVehicleType () {
2025-09-02 17:24:46 +08:00
try {
2025-09-10 10:38:03 +08:00
let res = await queryVehicleType()
2025-09-02 17:24:46 +08:00
if (res) {
this.options = res.data
} else {
this.options = []
}
} catch (e) {
this.options = []
}
2025-09-02 11:10:13 +08:00
},
selectChange (e) {
this.index = e
},
2025-09-02 17:24:46 +08:00
clearUp () {
this.val1 = ''
2025-09-10 10:38:03 +08:00
this.val2 = ''
2025-09-02 17:24:46 +08:00
this.index = ''
this.disabled = false
2025-09-02 11:10:13 +08:00
},
2025-09-10 10:38:03 +08:00
async _bindEmptyVehicle () {
this.disabled = true
if (!this.val1 || !this.val2) {
this.disabled = false
return
}
2025-09-02 17:24:46 +08:00
try {
2025-09-10 10:38:03 +08:00
let res = await bindEmptyVehicle(this.val1, this.val2)
if (res) {
uni.showToast({
title: res.message,
icon: 'none'
})
this.clearUp()
2025-09-02 11:10:13 +08:00
}
2025-09-10 10:38:03 +08:00
this.disabled = false
2025-09-02 17:24:46 +08:00
} catch (e) {
2025-09-10 10:38:03 +08:00
this.disabled = false
2025-09-02 11:10:13 +08:00
}
},
2025-09-10 10:38:03 +08:00
async _unBindEmptyVehicle () {
2025-09-02 11:10:13 +08:00
this.disabled = true
2025-09-10 10:38:03 +08:00
if (!this.val1 || !this.val2) {
2025-09-02 11:10:13 +08:00
this.disabled = false
return
}
try {
2025-09-10 10:38:03 +08:00
let res = await unBindEmptyVehicle(this.val1, this.val2)
if (res) {
2025-09-02 11:10:13 +08:00
uni.showToast({
2025-09-02 17:24:46 +08:00
title: res.message,
2025-09-02 11:10:13 +08:00
icon: 'none'
})
2025-09-02 17:24:46 +08:00
this.clearUp()
2025-09-02 11:10:13 +08:00
}
2025-09-10 10:38:03 +08:00
this.disabled = false
2025-09-02 11:10:13 +08:00
} catch (e) {
this.disabled = false
}
}
}
}
2025-09-02 17:24:46 +08:00
</script>
<style lang="stylus">
</style>