Browse Source

修改辅导员管理权限

plg 6 months ago
parent
commit
be30f4ef51

+ 141 - 33
src/components/Register.vue

@@ -22,8 +22,32 @@
             <p v-if="!isView" class="dig_title">编辑</p>
             <div slot=""></div>
             <div slot="footer"></div>
+            <el-form-item
+              label="所属组织架构"
+              prop="group3"
+              v-if="userInfo.roleType == '3'"
+            >
+              <el-select
+                v-model="ruleForm.group3"
+                clearable
+                placeholder="请选择组织架构"
+                style="width: 100%"
+              >
+                <el-option
+                  v-for="item in options3"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
             <!-- :show-all-levels="false" -->
-            <el-form-item label="所属组织架构" prop="group">
+            <el-form-item
+              label="所属组织架构"
+              prop="group"
+              v-if="userInfo.roleType == '4'"
+            >
               <el-cascader
                 placeholder="请选择组织架构"
                 v-model="ruleForm.group"
@@ -152,6 +176,7 @@ export default {
           ],
         },
       ],
+      options3: [],
       disableFlag: false,
       phoneFlag: false,
       flag: 3,
@@ -161,6 +186,7 @@ export default {
       ruleForm: {
         //所属组织架构
         group: "",
+        group3: "",
         //所属届数
         grade: "",
         //学号
@@ -176,6 +202,7 @@ export default {
       isView: true,
       rules: {
         group: [{ required: true, message: "请选择组织架构", trigger: "change" }],
+        group3: [{ required: true, message: "请选择组织架构", trigger: "change" }],
         studentNumber: [{ required: true, message: "请输入学号", trigger: "blur" }],
         name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
         sex: [{ required: true, message: "请选择性别", trigger: "blur" }],
@@ -191,6 +218,31 @@ export default {
     // this.ruleForm.type = "3";
   },
   methods: {
+    //获取辅导员组织架构方法
+    getInstructor() {
+      this.options3 = [];
+      //根据辅导员ID查询其下边的组织架构
+      let url = `/user/findUserById?id=${this.userInfo.id}`;
+      this.$http.get(url, {}, (res) => {
+        console.log("res");
+        console.log(res);
+        debugger;
+        if (res && res.code == 200) {
+          //辅导员组织架构
+          res.data.gradeEntities;
+          for (let i = 0; i < res.data.gradeEntities.length; i++) {
+            let obj = {
+              value: res.data.gradeEntities[i].orgNo,
+              label: res.data.gradeEntities[i].orgName,
+            };
+            this.options3.push(obj);
+          }
+        } else {
+          // this.$toast.fail(res.msg);
+          this.$message.error(res.msg);
+        }
+      });
+    },
     //获取当前届数
     getGradeFun() {
       this.gradeOption = [];
@@ -324,9 +376,16 @@ export default {
     },
     open(val) {
       this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
+
       this.getGradeFun();
       this.cancle();
-      this.getChannel();
+
+      if (this.userInfo.roleType == "3") {
+        this.getInstructor();
+      } else if (this.userInfo.roleType == "4") {
+        this.getChannel();
+      }
+
       this.dialogVisible = true;
       this.isView = val;
 
@@ -338,7 +397,11 @@ export default {
       this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
       console.log("userInfo");
       console.log(this.userInfo);
-      this.getChannel();
+      if (this.userInfo.roleType == "3") {
+        this.getInstructor();
+      } else if (this.userInfo.roleType == "4") {
+        this.getChannel();
+      }
       this.dialogVisible = true;
       this.isView = false;
       this.getGradeFun();
@@ -388,8 +451,13 @@ export default {
           this.ruleForm.name = res.data.userName;
           //回显性别
           this.ruleForm.sex = res.data.gender;
-          //
-          this.ruleForm.group =[res.data.orgNo];
+
+          if (this.userInfo.roleType == "3") {
+            this.ruleForm.group3 = res.data.orgNo;
+          } else if (this.userInfo.roleType == "4") {
+            this.ruleForm.group = [res.data.orgNo];
+          }
+
           this.ruleForm.grade = res.data.grade;
           // this.ruleForm.group = a.reverse();
         } else {
@@ -402,6 +470,7 @@ export default {
       this.$refs["ruleForm"].clearValidate();
       //清空表单
       this.ruleForm.grade = "";
+      this.ruleForm.group3 = "";
       this.ruleForm.group = "";
       this.ruleForm.name = "";
       this.ruleForm.studentNumber = "";
@@ -422,9 +491,17 @@ export default {
       this.disableFlag = true;
       let validSp = [];
       if (this.isView) {
-        validSp = ["group", "studentNumber", "name", "sex", "grade"];
+        if (this.userInfo.roleType == "3") {
+          validSp = ["group3", "studentNumber", "name", "sex", "grade"];
+        } else if (this.userInfo.roleType == "4") {
+          validSp = ["group", "studentNumber", "name", "sex", "grade"];
+        }
       } else {
-        validSp = ["group", "studentNumber", "name", "sex", "grade"];
+        if (this.userInfo.roleType == "3") {
+          validSp = ["group3", "studentNumber", "name", "sex", "grade"];
+        } else if (this.userInfo.roleType == "4") {
+          validSp = ["group", "studentNumber", "name", "sex", "grade"];
+        }
       }
       let aa = [];
       this.$refs["ruleForm"].validateField(validSp, (valid) => {
@@ -452,6 +529,13 @@ export default {
         }
       });
     },
+    queryOrgName3() {
+      for (let i = 0; i < this.options3.length; i++) {
+        if (this.options3[i].value == this.ruleForm.group3) {
+          this.groupName = this.options3[i].label;
+        }
+      }
+    },
     register() {
       // if (this.ruleForm.group.length == 1) {
       //   this.$message({
@@ -460,14 +544,11 @@ export default {
       //   });
       //   return;
       // }
-      this.queryOrgName();
-
-      console.log(this.ruleForm.group);
-      let that = this;
-      // this.ruleForm.password = md5(this.ruleForm.password);
-      this.$http.post(
-        `/user/addOrUpdateUser`,
-        {
+      let params = {};
+      //当用户是院管理员时
+      if (this.userInfo.roleType == "4") {
+        this.queryOrgName();
+        params = {
           grade: this.ruleForm.grade,
           orgNo: this.ruleForm.group[this.ruleForm.group.length - 1],
           orgName: this.groupName,
@@ -477,29 +558,56 @@ export default {
           // password: md5(this.ruleForm.password),
           //roleType     1学生
           roleType: "1",
-        },
-        (res) => {
-          this.disableFlagStatus();
-          // this.disableFlag = false;
-          if (res && res.code == 200) {
-            this.dialogVisible = false;
+        };
+      }
+      //当用户时辅导员时
+      if (this.userInfo.roleType == "3") {
+        this.queryOrgName3();
+        //获取当前用户的groupName
+        params = {
+          grade: this.ruleForm.grade,
+          orgNo: this.ruleForm.group3,
+          orgName: this.groupName,
+          userNo: this.ruleForm.studentNumber,
+          userName: this.ruleForm.name,
+          gender: this.ruleForm.sex,
+          // password: md5(this.ruleForm.password),
+          //roleType     1学生
+          roleType: "1",
+        };
+      }
 
-            // this.$toast.success({ message: "成功" });
-            //调用父组件的查询方法
-            that.$emit("search");
-          } else {
-            // this.$toast.fail({ message: res.msg });
-            this.$message.error(res.msg);
-          }
-          //清空缓存
-          this.cancle();
+      console.log(this.ruleForm.group);
+      let that = this;
+      // this.ruleForm.password = md5(this.ruleForm.password);
+      this.$http.post(`/user/addOrUpdateUser`, params, (res) => {
+        this.disableFlagStatus();
+        // this.disableFlag = false;
+        if (res && res.code == 200) {
+          this.dialogVisible = false;
+
+          // this.$toast.success({ message: "成功" });
+          //调用父组件的查询方法
+          that.$emit("search");
+        } else {
+          // this.$toast.fail({ message: res.msg });
+          this.$message.error(res.msg);
         }
-      );
+        //清空缓存
+        this.cancle();
+      });
     },
     editUserFun() {
       let that = this;
-      this.queryOrgName();
-      this.userDetailData.orgNo = this.ruleForm.group[this.ruleForm.group.length - 1];
+
+      if (this.userInfo.roleType == "3") {
+        this.queryOrgName3();
+        this.userDetailData.orgNo = this.ruleForm.group3;
+      } else if (this.userInfo.roleType == "4") {
+        this.queryOrgName();
+        this.userDetailData.orgNo = this.ruleForm.group[this.ruleForm.group.length - 1];
+      }
+
       this.userDetailData.grade = this.ruleForm.grade;
       this.userDetailData.orgName = this.groupName;
       this.userDetailData.userName = this.ruleForm.name;

+ 1 - 0
src/components/instructorRegister.vue

@@ -352,6 +352,7 @@ export default {
       this.$http.get(url, {}, (res) => {
         console.log("res");
         console.log(res);
+        debugger;
         if (res && res.code == 200) {
           //获取返回值
           //根据将数据存储

+ 0 - 1
src/views/loginNew.vue

@@ -175,7 +175,6 @@ export default {
                 // type等于3  超级管理员
                 // type等于2  普通管理员
                 // type等于1  普通用户等不能登录
-
                 oSessionStorage.setItem("userInfo", JSON.stringify(res.data.user));
                 oSessionStorage.setItem("token", res.data.token);
                 // oSessionStorage.setItem("invitationCode", res.data.user.invitationCode);

+ 81 - 3
src/views/manage/manageMain.vue

@@ -65,7 +65,7 @@
                   <span class="menu_name">{{ item.name }}</span>
                 </div>
               </template>
-              <el-menu-item-group style="background-color: #000000;">
+              <el-menu-item-group style="background-color: #000000">
                 <el-menu-item v-for="el in item.child" :key="el.id" :index="el.path">
                   <span class="menu_sub_tt"
                     ><span class="menu_sub_t1">&nbsp;</span>{{ el.name }}</span
@@ -530,6 +530,84 @@ export default {
             ],
           },
         ];
+      } else if (this.userType == "3") {
+        this.menuList = [
+          {
+            id: "10",
+            name: "概况",
+            icon: require("../../assets/menu/user.png"),
+            showItem: true,
+            path: "/manage/generalSituation",
+          },
+          {
+            id: "0",
+            name: "学生管理",
+            icon: require("../../assets/menu/user.png"),
+            showItem: true,
+            path: "/manage/userManage",
+          },
+          // {
+          //   id: "5",
+          //   name: "教师管理",
+          //   icon: require("../../assets/menu/user.png"),
+          //   showItem: true,
+          //   path: "/manage/teacherManage",
+          // },
+          // {
+          //   id: "6",
+          //   name: "辅导员管理",
+          //   icon: require("../../assets/menu/user.png"),
+          //   showItem: true,
+          //   path: "/manage/instructorManage",
+          // },
+          {
+            id: "2",
+            name: "组织架构",
+            icon: require("../../assets/menu/zu.png"),
+            showItem: true,
+            path: "/manage/organizational",
+          },
+          {
+            id: "3",
+            name: "测试计划",
+            icon: require("../../assets/menu/plan.png"),
+            showItem: true,
+            path: "/manage/testPlan",
+          },
+          {
+            id: "4",
+            name: "报告分析",
+            icon: require("../../assets/menu/plan.png"),
+            showItem: true,
+            path: "/manage/recordListAll",
+            child: [
+              {
+                id: "41",
+                name: "用户报告",
+                parentName: "报告分析",
+                icon: "el-icon-user-solid",
+                path: "/manage/userReport",
+                showItem: true,
+              },
+              {
+                id: "42",
+                name: "计划报告",
+                parentName: "报告分析",
+                icon: "el-icon-user-solid",
+                path: "/manage/planReport",
+                showItem: true,
+              },
+              {
+                id: "43",
+                name: "对比分析",
+                parentName: "报告分析",
+                icon: "el-icon-user-solid",
+                path: "/manage/comparaAnalysis",
+                showItem: true,
+              },
+            ],
+          },
+        ];
       }
     }
   },
@@ -1107,8 +1185,8 @@ export default {
   /* for Opera */
 }
 .aac {
-  padding-left:20px;
-  padding-right:20px;
+  padding-left: 20px;
+  padding-right: 20px;
   text-align: center;
   color: #48d68e;
   // margin-left: 20px;

+ 96 - 25
src/views/manage/userManage.vue

@@ -13,16 +13,31 @@
               placeholder="请输入学号"
             ></el-input
             >&nbsp;&nbsp;&nbsp;&nbsp;
-            <el-cascader
+            <!-- :props="{ checkStrictly: true }" -->
+            <!-- <el-cascader
               v-show="userInfo.roleType == '3'"
               placeholder="请选择组织架构"
               v-model="group"
               :options="groupData"
-              :props="{ checkStrictly: true }"
               clearable
-            ></el-cascader>
+            ></el-cascader> -->
+            <el-select
+              v-model="group3"
+              clearable
+              placeholder="请选择组织架构"
+              v-show="userInfo.roleType == '3'"
+            >
+              <el-option
+                v-for="item in options3"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
             <!-- :props="{ checkStrictly: true }" -->
             <el-cascader
+              v-show="userInfo.roleType == '4'"
               placeholder="请选择组织架构"
               v-model="group"
               :options="groupData"
@@ -88,7 +103,13 @@
             :formatter="genderFun"
           >
           </el-table-column>
-          <el-table-column prop="grade" label="届数" align="center" width="" :formatter="gradeFormatter">
+          <el-table-column
+            prop="grade"
+            label="届数"
+            align="center"
+            width=""
+            :formatter="gradeFormatter"
+          >
           </el-table-column>
           <el-table-column prop="orgName" label="所属组织架构" align="center" width="">
           </el-table-column>
@@ -244,7 +265,9 @@
             :before-upload="beforeUploadFun"
             :action="
               basePath +
-              `/user/userImport?orgNo=${groupLead[groupLead.length - 1]}&roleType=1&grade=${grade}`
+              `/user/userImport?orgNo=${
+                groupLead[groupLead.length - 1]
+              }&roleType=1&grade=${grade}`
             "
             :headers="headers"
             :on-success="fileSuccess"
@@ -266,11 +289,6 @@
           >
             下载模版
           </a>
-          <!-- <div class="dig_button">
-            <el-button type="info" round @click="cancle()">取消</el-button>
-     
-            <el-button type="success" round @click="submitCom()">确定</el-button>
-          </div> -->
         </div>
       </div>
     </el-dialog>
@@ -306,6 +324,10 @@ export default {
       //搜索的组织架构
       // 搜索需要的性别
       sex: "",
+      // 辅导用户的group
+      group3: "",
+      //辅导员用户的选项
+      options3: [],
 
       group: "",
       ppData: [],
@@ -347,7 +369,7 @@ export default {
         sex: "",
         orgName: "",
         //当前学生的届数
-        grade:''
+        grade: "",
       },
       channel: "",
       channelList: [{ name: "渠道天成", id: "1" }],
@@ -367,7 +389,14 @@ export default {
     this.getGradeFun();
     console.log("this.userInfo");
     console.log(this.userInfo);
-    this.getChannel();
+
+    if (this.userInfo.roleType == "4") {
+      this.getChannel();
+    } else if (this.userInfo.roleType == "3") {
+      //辅导员进来时调用的组织架构方法
+      this.getInstructor();
+    }
+
     if (!this.userInfo) {
       //如果用户信息不存在跳转登陆页
       this.$router.push({ path: "/" });
@@ -375,10 +404,9 @@ export default {
     this.searchTarget();
   },
   methods: {
-    gradeFormatter(row){
+    gradeFormatter(row) {
       //格式化当前届数
-      return row.grade+'届'
-
+      return row.grade + "届";
     },
     //获取当前届数
     getGradeFun() {
@@ -473,6 +501,32 @@ export default {
       //将首页重置为1时---且总条数变化
       //设置为当前总条数
     },
+
+    //获取辅导员组织架构方法
+    getInstructor() {
+      this.options3 = [];
+      //根据辅导员ID查询其下边的组织架构
+      let url = `/user/findUserById?id=${this.userInfo.id}`;
+      this.$http.get(url, {}, (res) => {
+        console.log("res");
+        console.log(res);
+        debugger;
+        if (res && res.code == 200) {
+          //辅导员组织架构
+          res.data.gradeEntities;
+          for (let i = 0; i < res.data.gradeEntities.length; i++) {
+            let obj = {
+              value: res.data.gradeEntities[i].orgNo,
+              label: res.data.gradeEntities[i].orgName,
+            };
+            this.options3.push(obj);
+          }
+        } else {
+          // this.$toast.fail(res.msg);
+          this.$message.error(res.msg);
+        }
+      });
+    },
     //获取组织架构方法--------------------开始-----------------------
     getChannel() {
       this.$http.get(
@@ -558,7 +612,7 @@ export default {
       this.view.studentNumber = row.userNo;
       this.view.sex = row.gender == "0" ? "女" : "男";
       this.view.orgName = row.orgName;
-      this.view.grade=row.grade+'届'
+      this.view.grade = row.grade + "届";
       this.centerDialogVisible = true;
     },
     addUser() {
@@ -572,6 +626,7 @@ export default {
       // 搜索需要的性别
       this.sex = "";
       this.group = "";
+      this.group3='';
       this.searchTarget();
     },
 
@@ -611,15 +666,31 @@ export default {
     },
     //根据现有情况进行搜索
     searchList() {
-      let url = `/user/findUserListByPage?pageSize=${this.pageSize}&pageNum=${
-        this.pageNum
-      }&roleType=1${this.sex == "" ? "" : `&gender=${this.sex}`}${
-        this.group.length == 0
-          ? `&orgNo=${this.userInfo.orgNo}`
-          : `&orgNo=${this.group[this.group.length - 1]}`
-      }${this.name == "" ? "" : `&userName=${this.name}`}${
-        this.studentNumber == "" ? "" : `&userNo=${this.studentNumber}`
-      }`;
+      let url = "";
+      //院管理员进来的时候
+      if (this.userInfo.roleType == "4") {
+        url = `/user/findUserListByPage?pageSize=${this.pageSize}&pageNum=${
+          this.pageNum
+        }&roleType=1${this.sex == "" ? "" : `&gender=${this.sex}`}${
+          this.group.length == 0
+            ? `&orgNo=${this.userInfo.orgNo}`
+            : `&orgNo=${this.group[this.group.length - 1]}`
+        }${this.name == "" ? "" : `&userName=${this.name}`}${
+          this.studentNumber == "" ? "" : `&userNo=${this.studentNumber}`
+        }`;
+          //辅导员进来的时候
+      } else if (this.userInfo.roleType == "3") {
+        url = `/user/findUserListByPage?pageSize=${this.pageSize}&pageNum=${
+          this.pageNum
+        }&roleType=1${this.sex == "" ? "" : `&gender=${this.sex}`}${
+          this.group3== ''
+            ? `&orgNo=${this.userInfo.orgNo}`
+            : `&orgNo=${this.group3}`
+        }${this.name == "" ? "" : `&userName=${this.name}`}${
+          this.studentNumber == "" ? "" : `&userNo=${this.studentNumber}`
+        }`;
+      }
+
       this.$http.get(url, {}, (res) => {
         console.log(res);
         if (res && res.code == 200) {