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.regionCode" :label="item.regionName" :value="item.regionCode" />
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { listSimpleEmisRegion } from "@/api/emis/emisRegion";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "ProvincePicker",
|
|
|
|
|
props: {
|
|
|
|
|
value: {
|
|
|
|
|
type: [String, Number],
|
|
|
|
|
required: false
|
|
|
|
|
},
|
|
|
|
|
countryCode: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false
|
|
|
|
|
},
|
|
|
|
|
placeholder: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: false
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
optionItems: [],
|
|
|
|
|
svalue: this.value,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
countryCode(newVal, oldVal) {
|
|
|
|
|
this.queryData();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
2024-05-22 06:21:10 +00:00
|
|
|
this.queryData();
|
2024-04-22 05:35:19 +00:00
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onChange() {
|
2024-05-22 06:21:10 +00:00
|
|
|
console.log("xxxxx00000:"+this.svalue)
|
2024-04-22 05:35:19 +00:00
|
|
|
this.$emit("input", this.svalue);
|
2024-05-22 06:21:10 +00:00
|
|
|
this.$emit("onChange",this.svalue);
|
2024-04-22 05:35:19 +00:00
|
|
|
},
|
|
|
|
|
|
2024-05-22 06:21:10 +00:00
|
|
|
queryData() {
|
2024-04-22 05:35:19 +00:00
|
|
|
this.optionItems =[];
|
2024-05-22 06:21:10 +00:00
|
|
|
if(!this.countryCode && !this.svalue){
|
2024-04-22 05:35:19 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-22 06:21:10 +00:00
|
|
|
let queryParams = {
|
|
|
|
|
pageNum:1,
|
|
|
|
|
pageSize:100,
|
|
|
|
|
countryCode:this.countryCode,
|
|
|
|
|
regionType:1
|
|
|
|
|
};
|
2024-04-22 05:35:19 +00:00
|
|
|
listSimpleEmisRegion(queryParams).then(response => {
|
|
|
|
|
this.optionItems = response.rows;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|