84 lines
2.0 KiB
Vue
84 lines
2.0 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-5">
|
|
<span class="filter_label">区域</span>
|
|
</view>
|
|
<view class="zd-col-19 filter_select">
|
|
<uni-data-select v-model="index" :localdata="options" @change="selectChange"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="zd-row submit-bar">
|
|
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
|
|
<button class="zd-col-8 button-primary" :class="{'button-info': index === ''}" :disabled="disabled" @tap="_handheldLock('1')">锁定</button>
|
|
<button class="zd-col-8 button-primary" :class="{'button-info': index === ''}" :disabled="disabled" @tap="_handheldLock('0')">释放</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import SearchBox from '@/components/SearchBox.vue'
|
|
import {regionList, handheldLock} from '@/utils/getData2.js'
|
|
export default {
|
|
components: {
|
|
NavBar,
|
|
SearchBox
|
|
},
|
|
data() {
|
|
return {
|
|
title: '',
|
|
options: [],
|
|
index: '',
|
|
disabled: false
|
|
};
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
this._regionList()
|
|
},
|
|
methods: {
|
|
async _regionList () {
|
|
let res = await regionList()
|
|
this.options = [...res.content]
|
|
this.options.map(el => {
|
|
this.$set(el, 'text', el.label)
|
|
})
|
|
},
|
|
selectChange (e) {
|
|
this.index = e
|
|
},
|
|
async _handheldLock (type) {
|
|
this.disabled = true
|
|
if (this.index === '') {
|
|
this.disabled = false
|
|
return
|
|
}
|
|
try {
|
|
let res = await handheldLock(this.index, type)
|
|
this.clearUp()
|
|
uni.showToast({
|
|
title: res.message,
|
|
icon: 'none'
|
|
})
|
|
} catch (e) {
|
|
this.disabled = false
|
|
}
|
|
},
|
|
clearUp () {
|
|
this.index = ''
|
|
this.disabled = false
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="stylus">
|
|
@import '../../common/style/mixin.styl';
|
|
</style>
|