Files
hht-longdianningxin-uni/pages/manage/sub-vol-bind.vue
2024-09-13 15:31:19 +08:00

115 lines
2.8 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">
<zxz-uni-data-select v-model="index1" filterable :localdata="options1" @change="selectChange"></zxz-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">
<zxz-uni-data-select v-model="index2" filterable :localdata="options2"></zxz-uni-data-select>
</view>
</view>
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">子卷号</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val1"
/>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-8 button-default" @tap="clearUp">清空</button>
<button class="zd-col-15 button-primary" :class="{'button-info': !index1 || !index2 || !val1}" :disabled="disabled" @tap="_bindSlitterSubVolumeInfo">子卷绑定</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getSlitterDeviceBox, devicePointQuery, bindSlitterSubVolumeInfo} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
options1: [],
index1: '',
options2: [],
index2: '',
val1: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
this._getSlitterDeviceBox()
},
methods: {
async _getSlitterDeviceBox () {
let res = await getSlitterDeviceBox()
this.options1 = [...res]
},
selectChange (e) {
this.index2 = ''
this._devicePointQuery(e)
},
async _devicePointQuery (e) {
let res = await devicePointQuery(e)
this.options2 = [...res]
},
clearUp () {
this.index1 = ''
this.index2 = ''
this.val1 = ''
this.disabled = false
},
async _bindSlitterSubVolumeInfo () {
this.disabled = true
if (!this.index1 || !this.index2 || !this.val1) {
this.disabled = false
return
}
try {
let res = await bindSlitterSubVolumeInfo(this.index1, this.index2, this.val1)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
}
}
}
</script>
<style lang="stylus" scoped>
.zd_content
height: calc(100% - var(--status-bar-height) - 212rpx);
padding: 20rpx 14rpx 0 14rpx;
.grid-wraper
height: 100%;
overflow: auto;
.slide_new table td, .slide_new table th
overflow: visible;
</style>