|
|
@@ -682,14 +682,29 @@ Page({
|
|
|
})
|
|
|
|
|
|
let tempSchoolId = ''
|
|
|
+ let areaIndex = 0
|
|
|
if (tempList.length > 0) {
|
|
|
- const first = tempList[0]
|
|
|
- tempSchoolId = first.value || ''
|
|
|
+ const childIndex = tempList.findIndex((item: any) => this.data.schoolAreaId === item.value)
|
|
|
+ console.log(childIndex, 'childIndex')
|
|
|
+
|
|
|
+ if (childIndex !== -1) {
|
|
|
+ const first = tempList[childIndex]
|
|
|
+ tempSchoolId = first.value || ''
|
|
|
+ areaIndex = childIndex
|
|
|
+ } else {
|
|
|
+ const first = tempList[0]
|
|
|
+ tempSchoolId = first.value || ''
|
|
|
+ areaIndex = 0
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.setData({
|
|
|
+ schoolAreaIndex: areaIndex,
|
|
|
schoolAreaList: tempList,
|
|
|
tempChangeSchoolAreaId: tempSchoolId
|
|
|
+ }, () => {
|
|
|
+ const schoolArea = this.selectComponent('#schoolArea')
|
|
|
+ schoolArea?.setIndexes([areaIndex])
|
|
|
})
|
|
|
} catch {
|
|
|
//
|
|
|
@@ -963,11 +978,7 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
onSearch() {
|
|
|
- this.setData({
|
|
|
- schoolAreaIndex: 0
|
|
|
- }, () => {
|
|
|
- this.getSchools(this.data.searchName);
|
|
|
- })
|
|
|
+ this.getSchools(this.data.searchName);
|
|
|
},
|
|
|
onSearchChange(e: any) {
|
|
|
this.setData({
|