Files
hht-xzhy-uni/pages/manage/vehicle-unbind.vue
2025-09-01 17:18:37 +08:00

109 lines
2.6 KiB
Vue

<template>
<view class="zd_container">
<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">
<span class="filter_label">区域</span>
</view>
<view class="zd-col-17 filter_select">
<uni-data-select v-model="index1" :localdata="options1" @change="change"></uni-data-select>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-7">
<span class="filter_label">点位</span>
</view>
<view class="zd-col-17 filter_select">
<uni-data-select v-model="index2" :localdata="options2"></uni-data-select>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-6 button-default" @tap="clearUp">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': !index2}" :disabled="disabled" @tap="_vehicleUnbind">解绑</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {vehicleUnbind} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
options1: [{value: 0, text: '困料区域', point: []}, {value: 1, text: '缓存货架区域', point: []}],
index1: '',
options2: [],
index2: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
created () {
let point1 = []
for (let i = 0; i < 56; i++) {
if (i >= 9) {
point1.push({value: `KLHW${i+1}`, text: `困料货位${i+1}`})
} else {
point1.push({value: `KLHW0${i+1}`, text: `困料货位0${i+1}`})
}
}
let point2 = []
for (let i = 0; i < 44; i++) {
if (i >= 9) {
point2.push({value: `HCHJ${i+1}`, text: `缓存货架${i+1}`})
} else {
point2.push({value: `HCHJ0${i+1}`, text: `缓存货架0${i+1}`})
}
}
this.options1[0].point = point1
this.options1[1].point = point2
},
methods: {
change (e) {
this.options1.map((el, i) => {
if (e === i) {
this.options2 = el.point
}
})
},
clearUp () {
this.index1 = ''
this.index2 = ''
},
async _vehicleUnbind () {
this.disabled = true
if (!this.index2) {
this.disabled = false
return
}
try {
let res = await vehicleUnbind(this.index2)
this.disabled = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus">
</style>