|
|
@@ -42,7 +42,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="tag_group" v-if="cityNode.length > 0">
|
|
|
+ <div class="tag_group" v-if="cityNode.length > 0 && !isMunicipality">
|
|
|
<div class="tag_group_title">城市:</div>
|
|
|
<div class="tag_group_content">
|
|
|
<div class="tag_item" v-for="item in cityNode" :key="item.cityCode" @click="selectItem(item.cityCode, 'cityCode', item)" :class="item.cityCode === searchData.cityCode ? 'active' : ''">
|
|
|
@@ -88,12 +88,12 @@
|
|
|
<div class="page_item">
|
|
|
<div class="page_search">
|
|
|
<div class="search_content" ref="searchContentRef">
|
|
|
- <div class="content_left">
|
|
|
+ <div class="content_left" style="flex: 1;">
|
|
|
<div class="simple_filter" v-if="isShowSimpleFilter">
|
|
|
<el-select v-model="searchData.provinceCode" @change="ChangeRegion('provinceCode')" v-if="searchList.provinceNode && searchList.provinceNode.length > 1">
|
|
|
<el-option v-for="item in searchList.provinceNode" :key="item.provinceCode" :value="item.provinceCode" :label="item.provinceName == '全部' ? '全部省份' : item.provinceName"></el-option>
|
|
|
</el-select>
|
|
|
- <el-select v-model="searchData.cityCode" @change="ChangeRegion('cityCode')" v-if="cityNode && cityNode.length > 1">
|
|
|
+ <el-select v-model="searchData.cityCode" @change="ChangeRegion('cityCode')" v-if="cityNode && cityNode.length > 1 && !isMunicipality">
|
|
|
<el-option v-for="item in cityNode" :key="item.cityCode" :value="item.cityCode" :label="item.cityName == '全部' ? '全部城市' : item.cityName"></el-option>
|
|
|
</el-select>
|
|
|
<el-select v-model="searchData.districtCode" @change="ChangeRegion('districtCode')" v-if="districtNode && districtNode.length > 1">
|
|
|
@@ -260,6 +260,8 @@ interface District {
|
|
|
}
|
|
|
const cityNode = ref<City[]>([])
|
|
|
const districtNode = ref<District[]>([])
|
|
|
+const isMunicipality = ref(false) // 是否为直辖市
|
|
|
+const municipalityList = ['北京', '上海', '天津', '重庆']
|
|
|
|
|
|
interface TypeNode {
|
|
|
type: string;
|
|
|
@@ -299,16 +301,31 @@ const searchList = ref<SearchList>({
|
|
|
type SearchDataKey = 'provinceCode' | 'cityCode' | 'districtCode' | 'type' | 'userId' | 'status'
|
|
|
const selectItem = (value: string, str: SearchDataKey, item: any) => {
|
|
|
searchData.value[str] = value
|
|
|
- let arr = []
|
|
|
+ let arr: any[] = []
|
|
|
if(str == 'provinceCode') {
|
|
|
if(value && value != 'all') {
|
|
|
+ // 判断是否为直辖市
|
|
|
+ isMunicipality.value = municipalityList.some(m => item.provinceName.includes(m))
|
|
|
arr = [...item.children]
|
|
|
arr.splice(0, 0, { cityCode: "all", cityName: "全部" })
|
|
|
cityNode.value = arr
|
|
|
- searchData.value.cityCode = 'all'
|
|
|
districtNode.value = []
|
|
|
searchData.value.districtCode = 'all'
|
|
|
+
|
|
|
+ if(isMunicipality.value) {
|
|
|
+ // 直辖市:自动选中第一个非"全部"的城市,加载区县
|
|
|
+ const firstCity = item.children[0]
|
|
|
+ if(firstCity) {
|
|
|
+ searchData.value.cityCode = firstCity.cityCode
|
|
|
+ const districtArr = [...(firstCity.children || [])]
|
|
|
+ districtArr.splice(0, 0, { districtCode: "all", districtName: "全部" })
|
|
|
+ districtNode.value = districtArr
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ searchData.value.cityCode = 'all'
|
|
|
+ }
|
|
|
}else {
|
|
|
+ isMunicipality.value = false
|
|
|
cityNode.value = []
|
|
|
searchData.value.cityCode = 'all'
|
|
|
districtNode.value = []
|
|
|
@@ -331,17 +348,31 @@ const selectItem = (value: string, str: SearchDataKey, item: any) => {
|
|
|
// emit('FnSearch', searchData);
|
|
|
}
|
|
|
const ChangeRegion = (str: SearchDataKey) => {
|
|
|
- let arr = []
|
|
|
+ let arr: any[] = []
|
|
|
if(str == 'provinceCode') {
|
|
|
if(searchData.value.provinceCode && searchData.value.provinceCode != 'all') {
|
|
|
- arr = [...searchList.value.provinceNode.find(item => item.provinceCode == searchData.value.provinceCode).children]
|
|
|
+ const provinceItem = searchList.value.provinceNode.find(item => item.provinceCode == searchData.value.provinceCode)
|
|
|
+ isMunicipality.value = provinceItem ? municipalityList.some(m => provinceItem.provinceName.includes(m)) : false
|
|
|
+ arr = [...(provinceItem?.children || [])]
|
|
|
arr.splice(0, 0, { cityCode: "all", cityName: "全部" })
|
|
|
cityNode.value = arr
|
|
|
- console.log(cityNode.value)
|
|
|
- searchData.value.cityCode = 'all'
|
|
|
districtNode.value = []
|
|
|
searchData.value.districtCode = 'all'
|
|
|
+
|
|
|
+ if(isMunicipality.value && provinceItem) {
|
|
|
+ // 直辖市:自动选中第一个城市,加载区县
|
|
|
+ const firstCity = provinceItem.children?.[0]
|
|
|
+ if(firstCity) {
|
|
|
+ searchData.value.cityCode = firstCity.cityCode
|
|
|
+ const districtArr = [...(firstCity.children || [])]
|
|
|
+ districtArr.splice(0, 0, { districtCode: "all", districtName: "全部" })
|
|
|
+ districtNode.value = districtArr
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ searchData.value.cityCode = 'all'
|
|
|
+ }
|
|
|
} else {
|
|
|
+ isMunicipality.value = false
|
|
|
cityNode.value = []
|
|
|
searchData.value.cityCode = 'all'
|
|
|
districtNode.value = []
|
|
|
@@ -350,7 +381,7 @@ const ChangeRegion = (str: SearchDataKey) => {
|
|
|
}
|
|
|
if(str == 'cityCode') {
|
|
|
if(searchData.value.cityCode && searchData.value.cityCode != 'all') {
|
|
|
- arr = [...cityNode.value.find(item => item.cityCode == searchData.value.cityCode).children]
|
|
|
+ arr = [...(cityNode.value.find(item => item.cityCode == searchData.value.cityCode)?.children || [])]
|
|
|
arr.splice(0, 0, { districtCode: "all", districtName: "全部" })
|
|
|
districtNode.value = arr
|
|
|
searchData.value.districtCode = 'all'
|
|
|
@@ -436,14 +467,14 @@ const passwordDialog = reactive({
|
|
|
label: '', // 名称label
|
|
|
remark: '' // 提示语
|
|
|
}) // 重置密码弹窗数据
|
|
|
-const permissions = ref([]) // 权限列表
|
|
|
+const permissions = ref<string[]>([]) // 权限列表
|
|
|
provide('showDialog', showDialog) // 新增用户弹窗是否展示
|
|
|
provide('dialogData', dialogData) // 新增用户弹窗数据
|
|
|
provide('authData', authData) // 设置权限弹窗数据
|
|
|
provide('subjectShowDialog', subjectShowDialog) // 开通科目弹窗数据
|
|
|
provide('passwordDialog', passwordDialog) // 重置密码弹窗数据
|
|
|
onMounted(() => {
|
|
|
- permissions.value = JSON.parse(localStorage.getItem('permissions'))
|
|
|
+ permissions.value = JSON.parse(localStorage.getItem('permissions') || '[]')
|
|
|
|
|
|
GetSearchList()
|
|
|
GetSchoolNumber()
|
|
|
@@ -531,11 +562,11 @@ const GetSchoolList = () => {
|
|
|
})
|
|
|
}
|
|
|
// 切换分页页码
|
|
|
-const HandleCurrentChange = (val) => {
|
|
|
+const HandleCurrentChange = (val: number) => {
|
|
|
pageNum.value = val
|
|
|
GetSchoolList()
|
|
|
}
|
|
|
-const HandleSizeChange = (val) => {
|
|
|
+const HandleSizeChange = (val: number) => {
|
|
|
pageSize.value = val
|
|
|
pageNum.value = 1
|
|
|
GetSchoolList()
|
|
|
@@ -636,7 +667,7 @@ const isShowSimpleFilter = ref(false);
|
|
|
// 监听页面滚动
|
|
|
const OnScroll = () => {
|
|
|
nextTick(() => {
|
|
|
- const filterElement = filterRef.value.$el || filterRef.value // 获取 DOM 元素
|
|
|
+ const filterElement = (filterRef.value as any)?.$el || filterRef.value // 获取 DOM 元素
|
|
|
if (!filterElement) return
|
|
|
|
|
|
const filterElementHeight = filterElement.getBoundingClientRect().height
|
|
|
@@ -670,11 +701,18 @@ const HandleResize = throttle(() => {
|
|
|
<style lang="scss" scoped>
|
|
|
.simple_filter {
|
|
|
display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
+ flex-wrap: nowrap;
|
|
|
gap: 10px;
|
|
|
+ flex-shrink: 0;
|
|
|
}
|
|
|
.search_content {
|
|
|
- align-items: flex-start !important;
|
|
|
+ align-items: center !important;
|
|
|
+}
|
|
|
+.content_left {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ gap: 10px;
|
|
|
+ flex-wrap: wrap;
|
|
|
}
|
|
|
.user_num_content {
|
|
|
width: 100%;
|