纸管绑定
This commit is contained in:
@@ -32,18 +32,12 @@
|
||||
<uni-data-select v-model="index2" :placeholder="$t('uni.dataSelect.placeholder')" :localdata="options2" @change="selectChange2"></uni-data-select>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter_item">
|
||||
<view class="filter_label">{{$t('filter.material')}}</view>
|
||||
<view class="filter_input_wraper">
|
||||
<uni-data-select v-model="index" :placeholder="$t('uni.dataSelect.placeholder')" :searchInput="true" :localdata="newoptions" @change="selectChange" @handleChange="handleChange" @showSelector="showSelector"></uni-data-select>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="zd-row submitbar">
|
||||
<button class="zd-col-5 btn-submit btn-default" @tap="clearUp">{{$t('button.clear')}}</button>
|
||||
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !val1 || !index || !index1 || !index2 || !val3}" :disabled="disabled" @tap="_operateIvt('1')">{{$t('button.bind')}}</button>
|
||||
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !val1 || !index || !index1 || !index2 || !val3}" :disabled="disabled" @tap="_operateIvt('2')">{{$t('button.cleanup')}}</button>
|
||||
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !val1 || !index1 || !index2 || !val3}" :disabled="disabled" @tap="_operateIvt('1')">{{$t('button.bind')}}</button>
|
||||
<button class="zd-col-8 btn-submit btn-success" :class="{'btn-info': !val1 || !index1 || !index2 || !val3}" :disabled="disabled" @tap="_operateIvt('2')">{{$t('button.cleanup')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -68,7 +62,6 @@
|
||||
options2: [{value: '1', text: '1'}, {value: '2', text: '2'}, {value: '3', text: '3'}, {value: '4', text: '4'}, {value: '5', text: '5'}],
|
||||
index2: '',
|
||||
options: [],
|
||||
index: '',
|
||||
newoptions: [],
|
||||
disabled: false
|
||||
};
|
||||
@@ -93,38 +86,17 @@
|
||||
selectChange2 (e) {
|
||||
this.index2 = e
|
||||
},
|
||||
selectChange (e) {
|
||||
this.index = e
|
||||
},
|
||||
/** 模糊匹配 */
|
||||
selectMatchItem (lists, keyWord) {
|
||||
let resArr = []
|
||||
lists.filter((item) => {
|
||||
if (item.text.indexOf(keyWord) > -1) {
|
||||
resArr.push(item)
|
||||
}
|
||||
})
|
||||
return resArr
|
||||
},
|
||||
handleChange (e) {
|
||||
if (e){
|
||||
this.index = ''
|
||||
this.newoptions = this.selectMatchItem(this.options, e)
|
||||
} else {
|
||||
this.newoptions = this.options
|
||||
}
|
||||
},
|
||||
showSelector () {
|
||||
this.newoptions = this.options
|
||||
},
|
||||
async _operateIvt (type) {
|
||||
this.disabled = true
|
||||
if (!this.val1 || !this.index || !this.index1 || !this.index2 || !this.val3) {
|
||||
if (!this.val1 || !this.index1 || !this.index2 || !this.val3) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await operateIvt(type, this.val1, this.index1, this.index2, this.index, this.val3)
|
||||
let res = await operateIvt(type, this.val1, this.index1, this.index2, this.val3)
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none'
|
||||
@@ -137,7 +109,6 @@
|
||||
clearUp () {
|
||||
this.val1 = ''
|
||||
this.val3 = ''
|
||||
this.index = ''
|
||||
this.index1 = ''
|
||||
this.index2 = ''
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user