|
@@ -221,48 +221,39 @@ const Countryloading = ref(false)
|
|
|
const city = ref<CountryItem[]>([])
|
|
const city = ref<CountryItem[]>([])
|
|
|
const Cityoptions = ref<CountryItem[]>([])
|
|
const Cityoptions = ref<CountryItem[]>([])
|
|
|
const cityloading = ref(false)
|
|
const cityloading = ref(false)
|
|
|
-const getAddressCountryCityData = (type: any) => {
|
|
|
|
|
- $api
|
|
|
|
|
|
|
+const querySearchCountry = (query: string) => {
|
|
|
|
|
+ Countryloading.value = true
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ $api
|
|
|
.getAddressCountryCityData({
|
|
.getAddressCountryCityData({
|
|
|
- term: '',
|
|
|
|
|
- term_type: type,
|
|
|
|
|
- limit: type == 'country' ? CityCode.value : CountryCode.value
|
|
|
|
|
|
|
+ term: query,
|
|
|
|
|
+ term_type: 'country',
|
|
|
|
|
+ limit: CityCode.value != '' ? CityCode.value : ''
|
|
|
})
|
|
})
|
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
- if (type == 'country') {
|
|
|
|
|
- countrys.value = res.data
|
|
|
|
|
- } else {
|
|
|
|
|
- city.value = res.data
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Countryoptions.value = res.data
|
|
|
|
|
+ Countryloading.value = false
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-}
|
|
|
|
|
-const querySearchCountry = (query: string) => {
|
|
|
|
|
- if (query) {
|
|
|
|
|
- Countryloading.value = true
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- Countryloading.value = false
|
|
|
|
|
- Countryoptions.value = countrys.value.filter((item) => {
|
|
|
|
|
- return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
|
|
- })
|
|
|
|
|
- }, 1000)
|
|
|
|
|
- } else {
|
|
|
|
|
- Countryoptions.value = []
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }, 1000)
|
|
|
}
|
|
}
|
|
|
const querySearchCity = (query: string) => {
|
|
const querySearchCity = (query: string) => {
|
|
|
- if (query) {
|
|
|
|
|
- cityloading.value = true
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- cityloading.value = false
|
|
|
|
|
- Cityoptions.value = city.value.filter((item) => {
|
|
|
|
|
- return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
|
|
- })
|
|
|
|
|
- }, 1000)
|
|
|
|
|
- } else {
|
|
|
|
|
- Cityoptions.value = []
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ cityloading.value = true
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ $api
|
|
|
|
|
+ .getAddressCountryCityData({
|
|
|
|
|
+ term: query,
|
|
|
|
|
+ term_type: 'city',
|
|
|
|
|
+ limit: CountryCode.value != '' ? CountryCode.value : ''
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((res: any) => {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ Cityoptions.value = res.data
|
|
|
|
|
+ cityloading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }, 1000)
|
|
|
}
|
|
}
|
|
|
// 特殊日期样式
|
|
// 特殊日期样式
|
|
|
const getCurrentStyle = (current: any) => {
|
|
const getCurrentStyle = (current: any) => {
|
|
@@ -1148,7 +1139,6 @@ onMounted(() => {
|
|
|
v-model="CountryCode"
|
|
v-model="CountryCode"
|
|
|
filterable
|
|
filterable
|
|
|
remote
|
|
remote
|
|
|
- @focus="getAddressCountryCityData('country')"
|
|
|
|
|
placeholder="Select Country"
|
|
placeholder="Select Country"
|
|
|
:remote-method="querySearchCountry"
|
|
:remote-method="querySearchCountry"
|
|
|
:loading="Countryloading"
|
|
:loading="Countryloading"
|
|
@@ -1168,7 +1158,6 @@ onMounted(() => {
|
|
|
v-model="CityCode"
|
|
v-model="CityCode"
|
|
|
filterable
|
|
filterable
|
|
|
remote
|
|
remote
|
|
|
- @focus="getAddressCountryCityData('city')"
|
|
|
|
|
placeholder="Select City"
|
|
placeholder="Select City"
|
|
|
:remote-method="querySearchCity"
|
|
:remote-method="querySearchCity"
|
|
|
:loading="cityloading"
|
|
:loading="cityloading"
|