emis-frontend/src/views/emis/EmisBaseTools/EmisMonthpayAccountPicker.vue

127 lines
2.8 KiB
Vue
Raw Normal View History

2024-05-07 04:53:57 +00:00
<template>
<el-select
:loading="loading"
filterable
clearable
v-model="svalue"
:placeholder="placeholder"
:filter-method="dataFilter"
style="width: 100%;"
:disabled="disabled"
@change="onChange">
2024-06-20 04:45:10 +00:00
<el-option v-for="item in optionItems" :key="item.custNo" :label="item.custName" :value="item.custNo" ></el-option>
2024-05-07 04:53:57 +00:00
</el-select>
2024-06-20 04:45:10 +00:00
<!-- item.custNo+'-'+ -->
2024-05-07 04:53:57 +00:00
</template>
<script>
import { listSimpleEmisMonthpayAccount } from "@/api/emis/emisMonthpayAccount";
export default {
name: "EmisMonthpayAccountPicker",
props: {
value: {
type: [String, Number],
required: false
},
sideCode: {
type: String,
required: false
},
2024-06-13 02:31:09 +00:00
payee: {
type: String,
required: false
},
salesmen: {
type: String,
required: false
},
2024-05-07 04:53:57 +00:00
postCode:{
type: String,
required: false
},
isInitiated:{
type: [Boolean,String],
required: false,
default:false
},
placeholder:{
type: String,
required: false
},
disabled:{
type: [Boolean,String],
required: false
},
},
data() {
return {
loading:false,
bakOptionItems:[],
optionItems: [],
svalue: this.value,
optionDefault:null,
dataMap:new Map(),
};
},
watch: {
value(newVal) {
this.svalue = newVal;
},
svalue(newVal, oldVal) {
// this.$emit("input", this.svalue);
},
postCode(newVal){
}
},
created() {
this.initData();
},
methods: {
onChange() {
this.$emit("input", this.svalue);
2024-06-20 04:37:30 +00:00
let itemData =null;
2024-05-07 04:53:57 +00:00
this.optionItems.forEach(item=>{
if(item.custNo === this.svalue){
itemData = item;
}
});
this.$emit("onChange",itemData);
this.optionItems = this.bakOptionItems;
},
initData() {
this.loading = true;
2024-06-13 02:31:09 +00:00
let queryParams = {
pageNumber:1,
pageSize:1300,
payee:this.payee,
salesmen:this.salesmen
};
2024-05-07 04:53:57 +00:00
this.bakOptionItems=[];
this.optionItems=[];
listSimpleEmisMonthpayAccount(queryParams).then(response => {
this.loading = false;
this.bakOptionItems = response.rows;
this.optionItems =this.bakOptionItems;
});
},
dataFilter(val) {
this.optionDefault = val
if (val) {
let searchVal = val.toLowerCase();
this.optionItems = this.bakOptionItems.filter(item => {
if (item.custNo.indexOf(searchVal) != -1 || item.custName.toLowerCase().indexOf(searchVal) != -1 ) {
return true
}
})
} else {
this.optionItems = this.bakOptionItems;
}
},
}
};
</script>