|
@@ -209,9 +209,20 @@ interface District {
|
|
|
// 省份列表
|
|
// 省份列表
|
|
|
const provinceTreeList = ref<Province[]>([])
|
|
const provinceTreeList = ref<Province[]>([])
|
|
|
// 市列表
|
|
// 市列表
|
|
|
-const cityTreeList = ref<City[]>([])
|
|
|
|
|
|
|
+const cityTreeList = ref<City[]>([
|
|
|
|
|
+ {
|
|
|
|
|
+ cityCode: '',
|
|
|
|
|
+ cityName: '',
|
|
|
|
|
+ children: []
|
|
|
|
|
+ }
|
|
|
|
|
+])
|
|
|
// 区/县列表
|
|
// 区/县列表
|
|
|
-const areaList = ref<District[]>([])
|
|
|
|
|
|
|
+const areaList = ref<District[]>([
|
|
|
|
|
+ {
|
|
|
|
|
+ districtCode: '',
|
|
|
|
|
+ districtName: ''
|
|
|
|
|
+ }
|
|
|
|
|
+])
|
|
|
interface User {
|
|
interface User {
|
|
|
id: string
|
|
id: string
|
|
|
nickname: string
|
|
nickname: string
|
|
@@ -233,10 +244,12 @@ const GetUserDetail = () => {
|
|
|
if(res.code == 200 && res.data) {
|
|
if(res.code == 200 && res.data) {
|
|
|
const { data } = res
|
|
const { data } = res
|
|
|
if(data.provinceCode) {
|
|
if(data.provinceCode) {
|
|
|
- cityTreeList.value = provinceTreeList.value.find(item => item.provinceCode == data.provinceCode).children
|
|
|
|
|
|
|
+ let list = provinceTreeList.value.find(item => item.provinceCode == data.provinceCode)
|
|
|
|
|
+ cityTreeList.value = list?.children ?? []
|
|
|
}
|
|
}
|
|
|
if(data.cityCode) {
|
|
if(data.cityCode) {
|
|
|
- areaList.value = cityTreeList.value.find(item => item.cityCode == data.cityCode).children
|
|
|
|
|
|
|
+ let list = cityTreeList.value.find(item => item.cityCode == data.cityCode)
|
|
|
|
|
+ areaList.value = list?.children ?? []
|
|
|
}
|
|
}
|
|
|
userForm.id = data.id
|
|
userForm.id = data.id
|
|
|
userForm.tenantName = data.tenantName
|
|
userForm.tenantName = data.tenantName
|
|
@@ -281,8 +294,10 @@ const GetProvinceTree = (): Promise<void> => {
|
|
|
// 选择省份
|
|
// 选择省份
|
|
|
const handleProvinceChange = (val: any) => {
|
|
const handleProvinceChange = (val: any) => {
|
|
|
userForm.provinceCode = val
|
|
userForm.provinceCode = val
|
|
|
- userForm.provinceName = provinceTreeList.value.find(item => item.provinceCode == val)?.provinceName
|
|
|
|
|
- cityTreeList.value = provinceTreeList.value.find(item => item.provinceCode == val)?.children
|
|
|
|
|
|
|
+ let name = provinceTreeList.value.find(item => item.provinceCode == val)
|
|
|
|
|
+ userForm.provinceName = name?.provinceName ?? ''
|
|
|
|
|
+ let list = provinceTreeList.value.find(item => item.provinceCode == val)
|
|
|
|
|
+ cityTreeList.value = list?.children ?? []
|
|
|
areaList.value = []
|
|
areaList.value = []
|
|
|
userForm.cityCode = ''
|
|
userForm.cityCode = ''
|
|
|
userForm.areaCode = ''
|
|
userForm.areaCode = ''
|
|
@@ -290,14 +305,17 @@ const handleProvinceChange = (val: any) => {
|
|
|
// 选择市
|
|
// 选择市
|
|
|
const handleCityChange = (val: any) => {
|
|
const handleCityChange = (val: any) => {
|
|
|
userForm.cityCode = val
|
|
userForm.cityCode = val
|
|
|
- userForm.cityName = cityTreeList.value.find(item => item.cityCode == val)?.cityName
|
|
|
|
|
- areaList.value = cityTreeList.value.find(item => item.cityCode == val)?.children
|
|
|
|
|
|
|
+ let city = cityTreeList.value.find(item => item.cityCode == val)
|
|
|
|
|
+ userForm.cityName = city?.cityName ?? ''
|
|
|
|
|
+ let list = cityTreeList.value.find(item => item.cityCode == val)
|
|
|
|
|
+ areaList.value = list?.children ?? []
|
|
|
userForm.areaCode = ''
|
|
userForm.areaCode = ''
|
|
|
}
|
|
}
|
|
|
// 选择区/县
|
|
// 选择区/县
|
|
|
const handleAreaChange = (val: any) => {
|
|
const handleAreaChange = (val: any) => {
|
|
|
userForm.areaCode = val
|
|
userForm.areaCode = val
|
|
|
- userForm.areaName = areaList.value.find(item => item.districtCode == val)?.districtName
|
|
|
|
|
|
|
+ let name = areaList.value.find(item => item.districtCode == val)
|
|
|
|
|
+ userForm.areaName = name?.districtName ?? ''
|
|
|
}
|
|
}
|
|
|
// 上传学校logo
|
|
// 上传学校logo
|
|
|
const UploadLogo = (file: any) => {
|
|
const UploadLogo = (file: any) => {
|