|
@@ -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;
|