下拉框搜索
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
<view class="filter_item">
|
<view class="filter_item">
|
||||||
<view class="filter_label">物料</view>
|
<view class="filter_label">物料</view>
|
||||||
<view class="filter_input_wraper">
|
<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>
|
</view>
|
||||||
<view class="filter_item">
|
<view class="filter_item">
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="submit-bar">
|
<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>
|
<button class="submit-button" :class="{'btn-disabled': !index2}" @tap="_taskQuerydevice">查询</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -54,7 +54,9 @@
|
|||||||
options3: [],
|
options3: [],
|
||||||
index3: '',
|
index3: '',
|
||||||
qty: '',
|
qty: '',
|
||||||
disabled: false
|
disabled: false,
|
||||||
|
val1: '',
|
||||||
|
newoptions3: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
@@ -75,6 +77,27 @@
|
|||||||
selectChange3(e) {
|
selectChange3(e) {
|
||||||
this.index3 = 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 () {
|
async _queryProductArea () {
|
||||||
let res = await queryProductArea()
|
let res = await queryProductArea()
|
||||||
@@ -89,6 +112,7 @@
|
|||||||
async _queryPaperMaterial (code) {
|
async _queryPaperMaterial (code) {
|
||||||
let res = await queryPaperMaterial(code)
|
let res = await queryPaperMaterial(code)
|
||||||
this.options3 = [...res.rows]
|
this.options3 = [...res.rows]
|
||||||
|
this.newoptions3 = [...res.rows]
|
||||||
res.rows.map(el => {
|
res.rows.map(el => {
|
||||||
if (el.value === code) {
|
if (el.value === code) {
|
||||||
this.index3 = res.material_code
|
this.index3 = res.material_code
|
||||||
@@ -127,14 +151,6 @@
|
|||||||
this.disabled = false
|
this.disabled = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!this.qty) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '数量不能为空',
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
this.disabled = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
let res = await emptyConfirm(this.qty, this.index3, this.index2, '1')
|
let res = await emptyConfirm(this.qty, this.index3, this.index2, '1')
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
<view class="uni-select__selector" v-if="showSelector">
|
<view class="uni-select__selector" v-if="showSelector">
|
||||||
<view class="uni-popper__arrow"></view>
|
<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">
|
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
|
||||||
<text>{{emptyTips}}</text>
|
<text>{{emptyTips}}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -61,6 +62,14 @@
|
|||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
searchInput: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
svalue: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: ''
|
default: ''
|
||||||
@@ -139,6 +148,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleInput($event) {
|
||||||
|
this.$emit('input', $event.target.value)
|
||||||
|
this.$emit('handleChange', $event.target.value)
|
||||||
|
},
|
||||||
initDefVal() {
|
initDefVal() {
|
||||||
let defValue = ''
|
let defValue = ''
|
||||||
if ((this.value || this.value === 0) && !this.isDisabled(this.value)) {
|
if ((this.value || this.value === 0) && !this.isDisabled(this.value)) {
|
||||||
@@ -424,4 +437,8 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
.filter_input_s {
|
||||||
|
width: calc(100% - 30rpx);
|
||||||
|
margin: 0 20rpx 0 10rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user