feat(用户列表-->搜索栏): 调整国家项功能

This commit is contained in:
hzj 2026-03-13 18:54:14 +08:00
parent 59140f760e
commit 2cb47b411f

View File

@ -91,7 +91,7 @@
</el-select> </el-select>
<!-- 国家 --> <!-- 国家 -->
<el-autocomplete <!-- <el-autocomplete
v-if="showAllCondition" v-if="showAllCondition"
v-model="countryCodeStr" v-model="countryCodeStr"
popper-class="my-autocomplete" popper-class="my-autocomplete"
@ -113,7 +113,33 @@
{{ item.phonePrefix + " " + item.countryName }} {{ item.phonePrefix + " " + item.countryName }}
</div> </div>
</template> </template>
</el-autocomplete> </el-autocomplete> -->
<!-- 国家 -->
<el-select
v-model="listQuery.countryCode"
v-loading="loadingCountry"
placeholder="国家"
style="width: 200px"
class="filter-item"
clearable
collapse-tags
@change="changeCountry"
>
<el-option
v-for="item in countryList"
:key="item.id"
:label="item.country.aliasName || item.country.enName"
:value="item.country.alphaTwo"
>
<span style="float: left;">
<img :src="item.country.nationalFlag" width="30"
/></span>
<span style="float: left;margin-left:10px">{{
item.country.aliasName || item.country.enName
}}</span>
</el-option>
</el-select>
<!-- 账号类型 --> <!-- 账号类型 -->
<el-select <el-select
@ -752,6 +778,7 @@ import { registerOrigins, originPlatforms } from "@/constant/origin";
import { getUserTable, resetPassword } from "@/api/app-user"; import { getUserTable, resetPassword } from "@/api/app-user";
import { getCountryAlls } from "@/api/sys"; import { getCountryAlls } from "@/api/sys";
import { listPayOpenCountry } from "@/api/sys-pay";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
import PlatformSvgIcon from "@/components/PlatformSvgIcon"; import PlatformSvgIcon from "@/components/PlatformSvgIcon";
@ -872,7 +899,11 @@ export default {
rangeDate: "", rangeDate: "",
listLoading: true, listLoading: true,
searchLoading: false, searchLoading: false,
clickUserId: "" clickUserId: "",
selectedCountry: {}, //
countryList: [],
loadingCountry: false
}; };
}, },
computed: { computed: {
@ -897,6 +928,7 @@ export default {
} }
} }
}, },
created() { created() {
const that = this; const that = this;
const querySystem = this.permissionsSysOriginPlatforms[0]; const querySystem = this.permissionsSysOriginPlatforms[0];
@ -906,10 +938,12 @@ export default {
that.listQuery.sysOrigins = [querySystem.value]; that.listQuery.sysOrigins = [querySystem.value];
that.renderData(true); that.renderData(true);
// that.loadCountryAlls() // that.loadCountryAlls()
this.loadOpenCountry();
setTimeout(() => { setTimeout(() => {
that.permissionValidationLoading = false; that.permissionValidationLoading = false;
}, 3 * 1000); }, 3 * 1000);
}, },
methods: { methods: {
renderData(isReset) { renderData(isReset) {
const that = this; const that = this;
@ -934,18 +968,21 @@ export default {
that.searchLoading = that.listLoading = false; that.searchLoading = that.listLoading = false;
}); });
}, },
handleSearch() { handleSearch() {
this.searchLoading = true; this.searchLoading = true;
this.renderData(true); this.renderData(true);
}, },
querySearch(queryString, cb) {
var restaurants = this.allCountryList; // querySearch(queryString, cb) {
var results = queryString // var restaurants = this.allCountryList;
? restaurants.filter(this.createFilter(queryString)) // var results = queryString
: restaurants; // ? restaurants.filter(this.createFilter(queryString))
// callback // : restaurants;
cb(results); // // callback
}, // cb(results);
// },
createFilter(queryString) { createFilter(queryString) {
return restaurant => { return restaurant => {
if ( if (
@ -982,24 +1019,70 @@ export default {
); );
}; };
}, },
handleDelCountryCodeClick() {
this.listQuery.countryCode = ""; // handleDelCountryCodeClick() {
this.countryCodeStr = ""; // this.listQuery.countryCode = "";
this.handleSearch(); // this.countryCodeStr = "";
}, // this.handleSearch();
handleCountryCodeClick(item) { // },
this.listQuery.countryCode = item.alphaTwo;
this.countryCodeStr = item.phonePrefix + " " + item.countryName; // handleCountryCodeClick(item) {
this.handleSearch(); // this.listQuery.countryCode = item.alphaTwo;
}, // this.countryCodeStr = item.phonePrefix + " " + item.countryName;
loadCountryAlls() { // this.handleSearch();
// },
// loadCountryAlls() {
// const that = this;
// getCountryAlls()
// .then(res => {
// that.allCountryList = res.result || {};
// })
// .catch(er => {});
// },
//
loadOpenCountry() {
const that = this; const that = this;
getCountryAlls()
that.loadingCountry = true;
listPayOpenCountry()
.then(res => { .then(res => {
that.allCountryList = res.result || {}; that.loadingCountry = false;
that.countryList = res.body || [];
that.listQuery.countryCode = "";
that.selectedCountry = {};
// that.renderData();
}) })
.catch(er => {}); .catch(er => {
that.loadingCountry = false;
console.error(er);
});
}, },
//
changeCountry(val) {
const that = this;
console.log("val", val);
if (!val) {
//
that.listQuery.countryCode = "";
that.selectedCountry = {};
} else {
//
that.selectedCountry =
this.countryList.find(item => item.country.alphaTwo === val) || {};
// 使访
that.listQuery.countryCode = that.selectedCountry.country
? that.selectedCountry.country.alphaTwo
: "";
}
this.renderData();
},
getAccountText(userInfo) { getAccountText(userInfo) {
if (!userInfo) { if (!userInfo) {
return ""; return "";