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

79 lines
1.6 KiB
Vue
Raw Normal View History

2024-04-22 05:35:19 +00:00
<template>
<el-select
style="width:100%"
filterable
clearable
v-model="svalue"
:placeholder="placeholder"
@change="onChange">
<el-option v-for="item in optionItems" :key="item.lineCode" :label="item.lineCode+'-'+item.lineName" :value="item.lineCode" />
</el-select>
</template>
<script>
import { listSimpleEmisTransLine } from "@/api/emis/emisTransLine";
export default {
name: "TransLinePicker",
props: {
value: {
type: String,
required: false
},
placeholder:{
type: String,
required: false
},
countryCode: {
type: String,
required: false
},
isInitiated:{
type: [Boolean,String],
required: false,
default:false
}
},
data() {
return {
optionItems: [],
svalue: this.value,
};
},
watch: {
value(newVal) {
this.svalue = newVal;
},
svalue(newVal, oldVal) {
this.$emit("input", this.svalue);
},
countryCode(newVal) {
this.queryData();
}
},
created() {
if(this.isInitiated || this.svalue!=null){
this.queryData();
}
},
methods: {
onChange() {
this.$emit("input", this.svalue);
this.$emit("onChange");
},
queryData() {
let queryParams = {
pageNum: 1,
pageSize: 3000,
country:this.countryCode
};
listSimpleEmisTransLine(queryParams).then(response => {
this.optionItems = response.rows;
});
},
}
};
</script>