|
@@ -558,9 +558,64 @@ const updateForm = async (formEl) => {
|
|
await formEl.validate((valid, fields) => {
|
|
await formEl.validate((valid, fields) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
|
|
- console.log(
|
|
|
|
- "detailsDb", detailsDb.value
|
|
|
|
- );
|
|
|
|
|
|
+ // console.log(
|
|
|
|
+ // "detailsDb", detailsDb.value
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ let classInfoArray = [];
|
|
|
|
+ if (detailsDb.value.classInfo != null && detailsDb.value.classInfo != undefined) {
|
|
|
|
+ for (let i = 0; i < detailsDb.value.classInfo.length; i++) {
|
|
|
|
+ let thisClassInfo = detailsDb.value.classInfo[i];
|
|
|
|
+ let schoolIdJson = getSchoolIdJson(thisClassInfo);
|
|
|
|
+ if (schoolIdJson != null && schoolIdJson != undefined) {
|
|
|
|
+ // console.log( "schoolIdJson", schoolIdJson );
|
|
|
|
+ // 特殊处理,必须选中的是班级
|
|
|
|
+ if (schoolIdJson.type == 3) {
|
|
|
|
+ let addJson = {
|
|
|
|
+ "id": schoolIdJson.id,
|
|
|
|
+ "name": schoolIdJson.name,
|
|
|
|
+ "remark": schoolIdJson.remark,
|
|
|
|
+ "schoolId": schoolIdJson.schoolId,
|
|
|
|
+ };
|
|
|
|
+ classInfoArray.push(addJson);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let submit = {
|
|
|
|
+ "id": detailsDb.value.id,
|
|
|
|
+ // 账号
|
|
|
|
+ "userName": detailsDb.value.userName,
|
|
|
|
+ // 0 表示教师,1表示学生
|
|
|
|
+ "userType": detailsDb.value.userType,
|
|
|
|
+ // 昵称
|
|
|
|
+ "nickName": detailsDb.value.nickName,
|
|
|
|
+ // 用户分配到的班级数组,可以是多个
|
|
|
|
+ "classInfo": classInfoArray,
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // console.log(
|
|
|
|
+ // "submit", submit
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ userUpdate(submit)
|
|
|
|
+ .then(response => {
|
|
|
|
+
|
|
|
|
+ // let data = response?.data?.data;
|
|
|
|
+ // console.log(
|
|
|
|
+ // "userUpdateEvent response", response, data
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ // 重新查找分页数据
|
|
|
|
+ pageUpdateEvent();
|
|
|
|
+ // 接口请求完成,隐藏模态框
|
|
|
|
+ state.value.showDetails = false;
|
|
|
|
+
|
|
|
|
+ }).catch(error => {
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
|
|
} else {
|
|
} else {
|
|
// console.log('error submit!', fields)
|
|
// console.log('error submit!', fields)
|