下拉框搜索
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<view class="filter_item">
|
||||
<view class="filter_label">物料</view>
|
||||
<view class="filter_input_wraper">
|
||||
<uni-data-select v-model="index3" :localdata="options3" @change="selectChange3"></uni-data-select>
|
||||
<uni-data-select v-model="index3" :searchInput="true" :localdata="newoptions3" @change="selectChange3" @handleChange="handleChange" @showSelector="showSelector"></uni-data-select>
|
||||
</view>
|
||||
</view>
|
||||
<view class="filter_item">
|
||||
@@ -30,7 +30,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="submit-bar">
|
||||
<button class="submit-button" :class="{'btn-disabled': !qty || !index1 || !index3}" :disabled="disabled" @tap="_emptyConfirm">入库设置</button>
|
||||
<button class="submit-button" :class="{'btn-disabled': !index1 || !index3}" :disabled="disabled" @tap="_emptyConfirm">入库设置</button>
|
||||
<button class="submit-button" :class="{'btn-disabled': !index2}" @tap="_taskQuerydevice">查询</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -54,7 +54,9 @@
|
||||
options3: [],
|
||||
index3: '',
|
||||
qty: '',
|
||||
disabled: false
|
||||
disabled: false,
|
||||
val1: '',
|
||||
newoptions3: []
|
||||
};
|
||||
},
|
||||
created () {
|
||||
@@ -75,6 +77,27 @@
|
||||
selectChange3(e) {
|
||||
this.index3 = 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.index3 = ''
|
||||
this.newoptions3 = this.selectMatchItem(this.options3, e)
|
||||
} else {
|
||||
this.newoptions3 = this.options3
|
||||
}
|
||||
},
|
||||
showSelector () {
|
||||
this.newoptions3 = this.options3
|
||||
},
|
||||
/** 生产区域下拉框查询 */
|
||||
async _queryProductArea () {
|
||||
let res = await queryProductArea()
|
||||
@@ -89,6 +112,7 @@
|
||||
async _queryPaperMaterial (code) {
|
||||
let res = await queryPaperMaterial(code)
|
||||
this.options3 = [...res.rows]
|
||||
this.newoptions3 = [...res.rows]
|
||||
res.rows.map(el => {
|
||||
if (el.value === code) {
|
||||
this.index3 = res.material_code
|
||||
@@ -127,14 +151,6 @@
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
if (!this.qty) {
|
||||
uni.showToast({
|
||||
title: '数量不能为空',
|
||||
icon: 'none'
|
||||
})
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await emptyConfirm(this.qty, this.index3, this.index2, '1')
|
||||
this.disabled = false
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
|
||||
<view class="uni-select__selector" v-if="showSelector">
|
||||
<view class="uni-popper__arrow"></view>
|
||||
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
|
||||
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
|
||||
<input v-if="searchInput === true" type="text" class="filter_input filter_input_s" :value="svalue" @input="handleInput($event)">
|
||||
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
|
||||
<text>{{emptyTips}}</text>
|
||||
</view>
|
||||
@@ -60,6 +61,14 @@
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
searchInput: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
svalue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
@@ -138,7 +147,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
methods: {
|
||||
handleInput($event) {
|
||||
this.$emit('input', $event.target.value)
|
||||
this.$emit('handleChange', $event.target.value)
|
||||
},
|
||||
initDefVal() {
|
||||
let defValue = ''
|
||||
if ((this.value || this.value === 0) && !this.isDisabled(this.value)) {
|
||||
@@ -181,7 +194,7 @@
|
||||
return isDisabled;
|
||||
},
|
||||
|
||||
clearVal() {
|
||||
clearVal() {
|
||||
this.emit('')
|
||||
if (this.collection) {
|
||||
uni.removeStorageSync(this.last)
|
||||
@@ -423,5 +436,9 @@
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
.filter_input_s {
|
||||
width: calc(100% - 30rpx);
|
||||
margin: 0 20rpx 0 10rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user