增加租户名的自动完成框

This commit is contained in:
lai
2024-07-15 15:51:46 +08:00
parent af5ac7d29a
commit 51226fbfb4
3 changed files with 89 additions and 58 deletions

View File

@@ -9,6 +9,8 @@ import { listUEInfoByIMS } from '@/api/neUser/ims';
import useNeInfoStore from '@/store/modules/neinfo';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { listTenant } from '@/api/system/tenant';
const { t } = useI18n();
/**网元参数 */
@@ -16,6 +18,7 @@ let neOtions = ref<Record<string, any>[]>([]);
/**查询参数 */
let queryParams = reactive({
tenantNameArr: <Record<string, any>[]>[],
/**网元ID */
neId: undefined,
/**IMSI */
@@ -33,6 +36,7 @@ let queryParams = reactive({
/**查询参数重置 */
function fnQueryReset() {
queryParams = Object.assign(queryParams, {
tenantNameArr: [],
imsi: '',
msisdn: '',
tenantName: '',
@@ -179,6 +183,11 @@ function fnGetList(pageNum?: number) {
});
}
//自动完成框不区分大小写
function filterOption(input: string, option: any) {
return option.value.toUpperCase().indexOf(input.toUpperCase()) >= 0;
}
onMounted(() => {
// 获取网元网元列表
useNeInfoStore()
@@ -208,6 +217,21 @@ onMounted(() => {
// 获取列表数据
fnGetList();
});
//查询租户
listTenant({ parentId: 0 }).then(res => {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
queryParams.tenantNameArr = []; //上面置为空数组时会报错 故在此
res.data.forEach((item: any) => {
if (item.parentId === '0') {
queryParams.tenantNameArr.push({
value: item.tenantName,
label: item.tenantName,
});
}
});
}
});
});
</script>
@@ -232,7 +256,11 @@ onMounted(() => {
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="IMSI" name="imsi">
<a-input v-model:value="queryParams.imsi" allow-clear :maxlength="15"></a-input>
<a-input
v-model:value="queryParams.imsi"
allow-clear
:maxlength="15"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">
@@ -246,10 +274,11 @@ onMounted(() => {
:label="t('views.neUser.sub.tenantName')"
name="tenantName "
>
<a-input
<a-auto-complete
v-model:value="queryParams.tenantName"
allow-clear
></a-input>
:options="queryParams.tenantNameArr"
:filter-option="filterOption"
></a-auto-complete>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">