作者 小范

国籍和证件下拉框组件文件

<template>
<div>
<el-select v-model="document"
filterable
@click.native="getCreden"
@change="selectChange"
default-first-option
:loading="loading" placeholder="请选择"
style="text-transform:uppercase">
<el-option
v-for="item in certOptions"
:key="item.serialno"
:label="item.serialno+'-'+item.credenname"
:value="item.serialno">
<span style="float: left">{{ item.serialno }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.credenname }}</span>
</el-option>
</el-select>
</div>
</template>
<script>
import { selectCreden} from '../../api/transport'
export default {
name: 'Document',
props: {
},
data() {
return {
document: '',
loading:false,
certOptions:[],
serialno:'',
}
},
// computed: {
// },
// created() {
// },
methods: {
/*获取证件*/
getCreden:function(query){
this.certOptions=[];
let params={serialno:query};
this.loading = true;
selectCreden(params).then(res =>{
if (res!=null) {
console.log(res.data.data)
setTimeout(() => {
this.loading = false;
this.certOptions=res.data.data;
}, 200);
} else {
this.certOptions = [];
}
});
},
selectChange:function(val){
console.log(val)
this.$emit('tellFa',val);
}
}
}
</script>
<style scoped>
</style>
... ...
<template>
<div>
<el-select v-model="nationality"
filterable
@click.native="getCountry"
@change="selectChange"
default-first-option
:loading="loading" placeholder="请选择"
style="text-transform:uppercase">
<el-option
v-for="item in countryOptions"
:key="item.countryid"
:label="item.countryid+'-'+item.countrydescchn"
:value="item.countryid">
<span style="float: left">{{ item.countryid }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.countrydescchn }}</span>
</el-option>
</el-select>
</div>
</template>
<script>
import {selectCountry} from '../../api/transport'
export default {
name: 'Nationality',
props: {
},
data() {
return {
nationality: '',
loading:false,
countryOptions:[],
countryid:'',
}
},
// computed: {
// },
// created() {
// },
methods: {
/*获取国籍*/
getCountry:function(query){
this.countryOptions=[];
let params={countryid:query};
this.loading = true;
selectCountry(params).then(res =>{
if (res!=null) {
console.log(res.data.data)
setTimeout(() => {
this.loading = false;
this.countryOptions=res.data.data;
}, 200);
} else {
this.countryOptions = [];
}
});
},
selectChange:function(val){
console.log(val)
this.$emit('tellFarther',val);
}
}
}
</script>
<style scoped>
</style>
... ...