|
@@ -69,7 +69,6 @@ Page({
|
|
|
showSchool: false,
|
|
|
schoolLoading: false,
|
|
|
schoolAreaList: [] as any,
|
|
|
- tempChangeSchoolAreaId: '', // 临时改变的学校id
|
|
|
schoolAreaId: '', //学校
|
|
|
schoolAreaName: '',
|
|
|
schoolAreaIndex: 0,
|
|
@@ -138,10 +137,6 @@ Page({
|
|
|
const schoolAreaIndex = this.data.schoolAreaList.findIndex(((item: any) => {
|
|
|
return item.value === this.data.schoolAreaId
|
|
|
}))
|
|
|
- // 获取学校列表之后 需要给tempChangeSchoolAreaId赋值 因为tempChangeSchoolAreaId默认选中第一个
|
|
|
- this.setData({
|
|
|
- tempChangeSchoolAreaId: params.schoolAreaId
|
|
|
- })
|
|
|
// 筛选出年级 赋值班级
|
|
|
const gradeIndex = (this.data.gradeList[0]?.values || []).findIndex((item: any) => {
|
|
|
return item.value === params.currentGradeNum
|
|
@@ -214,7 +209,6 @@ Page({
|
|
|
showArea: false,
|
|
|
|
|
|
searchName: "",
|
|
|
- tempChangeSchoolAreaId: '',
|
|
|
schoolAreaId: '',
|
|
|
schoolAreaName: '',
|
|
|
schoolAreaIndex: 0,
|
|
@@ -306,12 +300,6 @@ Page({
|
|
|
showSchool: false
|
|
|
})
|
|
|
},
|
|
|
- onChangeSchool(e: any) {
|
|
|
- const { value } = e.detail.value
|
|
|
- this.setData({
|
|
|
- tempChangeSchoolAreaId: value
|
|
|
- })
|
|
|
- },
|
|
|
onSearchChange(e: any) {
|
|
|
this.setData({
|
|
|
searchName: e.detail
|
|
@@ -322,14 +310,16 @@ Page({
|
|
|
},
|
|
|
/** 确定选择学校 */
|
|
|
onSubmitSchool() {
|
|
|
- if (!this.data.tempChangeSchoolAreaId) {
|
|
|
+ const schoolAreaVal = this.selectComponent("#schoolAreaId")?.getValues() || []
|
|
|
+ const schoolAreaId = schoolAreaVal[0]?.value
|
|
|
+ if (!schoolAreaId) {
|
|
|
wx.showToast({
|
|
|
title: '未选中值',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- const schoolAreaIndex = this.data.schoolAreaList.findIndex((item: any) => item.value === this.data.tempChangeSchoolAreaId)
|
|
|
+ const schoolAreaIndex = this.data.schoolAreaList.findIndex((item: any) => item.value === schoolAreaId)
|
|
|
const detail = this.data.schoolAreaList[schoolAreaIndex]
|
|
|
if (detail.value == this.data.schoolAreaId) {
|
|
|
this.setData({
|
|
@@ -383,15 +373,16 @@ Page({
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- let tempSchoolId = ''
|
|
|
- if (tempList.length > 0) {
|
|
|
- const first = tempList[0]
|
|
|
- tempSchoolId = first.value || ''
|
|
|
- }
|
|
|
|
|
|
+ const schoolAreaIndex = tempList.findIndex((item: any) => item.value === this.data.schoolAreaId)
|
|
|
this.setData({
|
|
|
- schoolAreaList: tempList,
|
|
|
- tempChangeSchoolAreaId: tempSchoolId
|
|
|
+ schoolAreaIndex,
|
|
|
+ schoolAreaList: tempList
|
|
|
+ }, () => {
|
|
|
+ const schoolRef = this.selectComponent("#schoolAreaId")
|
|
|
+ if (schoolRef && schoolAreaIndex > -1) {
|
|
|
+ schoolRef.setIndexes([schoolAreaIndex])
|
|
|
+ }
|
|
|
})
|
|
|
} catch {
|
|
|
//
|
|
@@ -533,7 +524,7 @@ Page({
|
|
|
gradeName: selectedOptions[0].text,
|
|
|
showGrade: false,
|
|
|
gradeIndex,
|
|
|
-
|
|
|
+
|
|
|
classId: "",
|
|
|
className: "",
|
|
|
classIndex: 0,
|
|
@@ -673,10 +664,6 @@ Page({
|
|
|
schoolAreaId: params.schoolAreaId,
|
|
|
defaultStatus: false
|
|
|
})
|
|
|
- wx.showToast({
|
|
|
- title: '保存成功',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
} else {
|
|
|
const { data } = await api_userBeneficiarySave({
|
|
|
"phone": params.phone,
|
|
@@ -690,13 +677,13 @@ Page({
|
|
|
if (this.data.redirectUrl === "index") {
|
|
|
prevPage.setData({ memberInfo: { id: data.data.id, name: params.name, phone: params.phone, schoolInfo: params.provinceName + params.cityName + (params.regionName || "") + params.schoolAreaName + params.gradeName + params.className } });
|
|
|
}
|
|
|
- wx.showToast({
|
|
|
- title: '保存成功',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
}
|
|
|
wx.hideLoading()
|
|
|
- wx.navigateBack()
|
|
|
+ wx.showToast({
|
|
|
+ title: '保存成功',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ setTimeout(() => { wx.navigateBack() }, 1000)
|
|
|
} catch {
|
|
|
wx.hideLoading()
|
|
|
//
|