md
This commit is contained in:
parent
6e3c482c89
commit
17926b357a
111
src/views/emis/EmisBaseTools/TransProductAllPicker.vue
Normal file
111
src/views/emis/EmisBaseTools/TransProductAllPicker.vue
Normal file
@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<el-select
|
||||
filterable
|
||||
clearable
|
||||
v-model="svalue"
|
||||
:placeholder="placeholder"
|
||||
@blur="onBlur"
|
||||
@focus="onFocus"
|
||||
@change="onChange"
|
||||
@visible-change="visibleChange"
|
||||
@clear="onClear"
|
||||
style="width:100%"
|
||||
>
|
||||
<el-option v-for="item in optionItems" :key="item.prodCode" :label="item.prodName+((item.status==0)?'-已停用':'')" :value="item.prodCode" />
|
||||
</el-select>
|
||||
|
||||
<!-- style="width:100%" multiple-->
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import emitter from 'element-ui/src/mixins/emitter';
|
||||
import { listEmisTransProduct } from "@/api/emis/emisTransProduct";
|
||||
|
||||
export default {
|
||||
name: "TransProductPicker",
|
||||
mixins: [emitter],
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Number],
|
||||
required: false
|
||||
},
|
||||
transLineCode: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
placeholder:{
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
isInitiated:{
|
||||
type: [Boolean,String],
|
||||
required: false,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
optionItems: [],
|
||||
svalue: this.value,
|
||||
isFistInit:true,
|
||||
searchProdCode:this.value,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(newVal) {
|
||||
this.svalue = newVal;
|
||||
},
|
||||
transLineCode(newVal) {
|
||||
this.queryData();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.queryData();
|
||||
},
|
||||
methods: {
|
||||
visibleChange(boolean){
|
||||
if(boolean){
|
||||
this.searchProdCode=null;
|
||||
this.queryData();
|
||||
}
|
||||
},
|
||||
onFocus(){
|
||||
this.isFistInit=false;
|
||||
this.searchProdCode=null;
|
||||
},
|
||||
onBlur(val){
|
||||
this.$emit("input", this.svalue);
|
||||
this.dispatch('ElFormItem', 'el.form.blur');
|
||||
},
|
||||
onClear(){
|
||||
this.searchProdCode=null;
|
||||
},
|
||||
onChange() {
|
||||
this.$emit("input", this.svalue);
|
||||
let itemData = this.optionItems.find(item=>item.prodCode == this.svalue);
|
||||
this.$emit("onChange",itemData);
|
||||
this.dispatch('ElFormItem', 'el.form.change');
|
||||
},
|
||||
queryData() {
|
||||
|
||||
this.optionItems=[];
|
||||
|
||||
// if(!this.transLineCode && !this.isFistInit){
|
||||
// this.optionItems=[];
|
||||
// return;
|
||||
// }
|
||||
|
||||
let queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 3000,
|
||||
prodCode:this.searchProdCode,
|
||||
transLineCode:this.transLineCode
|
||||
};
|
||||
listEmisTransProduct(queryParams).then(response => {
|
||||
this.optionItems = response.rows;
|
||||
});
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user