Files
hht-ximenzi-uni/pages/manage/area-lock.vue

88 lines
2.0 KiB
Vue
Raw Normal View History

<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
2024-09-06 09:35:26 +08:00
<view class="zd-row">
<view class="zd-col-5">
2024-09-13 16:11:36 +08:00
<span class="filter_label">区域</span>
2024-09-06 09:35:26 +08:00
</view>
<view class="zd-col-19 filter_select">
2024-09-06 10:51:49 +08:00
<zxz-uni-data-select
v-model="index"
:localdata="options"
:multiple="true"
:collapseTags="true"
/>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
2024-09-06 10:51:49 +08:00
<button class="zd-col-8 button-primary" :class="{'button-info': index.length === 0}" :disabled="disabled" @tap="_handheldLock('1')">锁定</button>
<button class="zd-col-8 button-primary" :class="{'button-info': index.length === 0}" :disabled="disabled" @tap="_handheldLock('0')">释放</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2024-09-06 09:35:26 +08:00
// import {regionList} from '@/utils/mork2.js'
2024-08-26 16:05:16 +08:00
import {regionList, handheldLock} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
2024-09-06 10:51:49 +08:00
options: [],
index: [],
multiple: true,
disabled: false
};
},
onLoad (options) {
this.title = options.title
2024-08-26 16:05:16 +08:00
this._regionList()
},
methods: {
2024-08-26 16:05:16 +08:00
async _regionList () {
let res = await regionList()
2024-09-06 10:51:49 +08:00
this.options = [...res.content]
this.options.map(el => {
2024-08-26 16:05:16 +08:00
this.$set(el, 'text', el.label)
})
},
2024-08-26 16:05:16 +08:00
async _handheldLock (type) {
this.disabled = true
2024-09-06 10:51:49 +08:00
if (this.index.length === 0) {
this.disabled = false
return
}
try {
2024-09-06 10:51:49 +08:00
let res = await handheldLock(this.index, type)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
2024-09-06 10:51:49 +08:00
this.index = []
this.disabled = false
}
}
}
</script>
<style lang="stylus">
@import '../../common/style/mixin.styl';
</style>