Jelajahi Sumber

vue 20241227 教师管理 修改

贾小兵 5 bulan lalu
induk
melakukan
4252ea81d8
1 mengubah file dengan 5 tambahan dan 3 penghapusan
  1. 5 3
      ruoyi-ui/src/views/teacher/index.vue

+ 5 - 3
ruoyi-ui/src/views/teacher/index.vue

@@ -251,6 +251,8 @@ export default {
       open: false,
       open: false,
       // 默认密码
       // 默认密码
       initPassword: undefined,
       initPassword: undefined,
+      // 角色选项
+      roleOptions: [],
       // 日期范围
       // 日期范围
       dateRange: [],
       dateRange: [],
       // 表单参数
       // 表单参数
@@ -346,6 +348,7 @@ export default {
         phonenumber: undefined,
         phonenumber: undefined,
         status: "0",
         status: "0",
         remark: undefined,
         remark: undefined,
+        roleIds: []
       };
       };
       this.resetForm("form");
       this.resetForm("form");
     },
     },
@@ -392,6 +395,8 @@ export default {
       const userId = row.userId || this.ids;
       const userId = row.userId || this.ids;
       getTeacher(userId).then(response => {
       getTeacher(userId).then(response => {
         this.form = response.data;
         this.form = response.data;
+        this.roleOptions = response.roles;
+        this.$set(this.form, "roleIds", response.roleIds);
         this.open = true;
         this.open = true;
         this.title = "修改";
         this.title = "修改";
       });
       });
@@ -420,9 +425,6 @@ export default {
       this.$refs["form"].validate(valid => {
       this.$refs["form"].validate(valid => {
         if (valid) {
         if (valid) {
           if (this.form.userId != undefined) {
           if (this.form.userId != undefined) {
-            console.log(this.form);
-            console.log('ddddd')
-            return false;
             updateTeacher(this.form).then(response => {
             updateTeacher(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.open = false;