|
@@ -645,6 +645,88 @@ const updateForm = async (formEl) => {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+/**
|
|
|
+ * 更新密码
|
|
|
+ * @param formEl
|
|
|
+ */
|
|
|
+const updatePwdForm = async (formEl) => {
|
|
|
+ if (!formEl) return
|
|
|
+ await formEl.validate((valid, fields) => {
|
|
|
+ if (valid) {
|
|
|
+
|
|
|
+ // console.log(
|
|
|
+ // "updatePwdDb", updatePwdDb.value
|
|
|
+ // );
|
|
|
+
|
|
|
+ let classInfoArray = [];
|
|
|
+ if (updatePwdDb.value.classInfo != null && updatePwdDb.value.classInfo != undefined) {
|
|
|
+ for (let i = 0; i < updatePwdDb.value.classInfo.length; i++) {
|
|
|
+ let thisClassInfo = updatePwdDb.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": updatePwdDb.value.id,
|
|
|
+ // 账号
|
|
|
+ "userName": updatePwdDb.value.userName,
|
|
|
+ // 0 表示教师,1表示学生
|
|
|
+ "userType": updatePwdDb.value.userType,
|
|
|
+ // 昵称
|
|
|
+ "nickName": updatePwdDb.value.nickName,
|
|
|
+ // 用户分配到的班级数组,可以是多个【通过测试,班级不可以减少,但是新增多个,则会新增】
|
|
|
+ "classInfo": classInfoArray,
|
|
|
+ // 密码
|
|
|
+ "password": updatePwdDb.value.password,
|
|
|
+ // 确认密码
|
|
|
+ "password2": updatePwdDb.value.password2,
|
|
|
+ };
|
|
|
+
|
|
|
+ console.log(
|
|
|
+ "submit", submit
|
|
|
+ );
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+ userUpdate(submit)
|
|
|
+ .then(response => {
|
|
|
+
|
|
|
+ // let data = response?.data?.data;
|
|
|
+ // console.log(
|
|
|
+ // "userUpdateEvent response", response, data
|
|
|
+ // );
|
|
|
+
|
|
|
+ // 重新查找分页数据
|
|
|
+ pageUpdateEvent();
|
|
|
+ // 接口请求完成,隐藏模态框
|
|
|
+ state.value.showUpdatePwd = false;
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // console.log('error submit!', fields)
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 批量删除,同时也可以处理单个删除逻辑
|
|
|
* delIdArray 批量删除的id值
|
|
@@ -1180,7 +1262,7 @@ onMounted(function() {
|
|
|
</el-form>
|
|
|
<div class="dialogFoot">
|
|
|
<el-button color="#EAEAEA" @click="state.showUpdatePwd = false" style="margin-right: 0.6rem">取消</el-button>
|
|
|
- <el-button color="#2C68FF" @click="updateForm(ruleFormRef)">更新密码</el-button>
|
|
|
+ <el-button color="#2C68FF" @click="updatePwdForm(ruleFormRef)">更新密码</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-dialog>
|