|
@@ -28,10 +28,25 @@
|
|
|
placeholder="请选择组织架构"
|
|
|
v-model="ruleForm.group"
|
|
|
:options="groupData"
|
|
|
-
|
|
|
clearable
|
|
|
></el-cascader>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="所属届" prop="grade">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.grade"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择所属届"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in gradeOption"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="学号" prop="studentNumber">
|
|
|
<el-input v-model="ruleForm.studentNumber"></el-input>
|
|
|
</el-form-item>
|
|
@@ -116,6 +131,7 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
return {
|
|
|
+ gradeOption: [],
|
|
|
userInfo: "",
|
|
|
//编辑返回的值
|
|
|
userDetailData: {},
|
|
@@ -145,6 +161,8 @@ export default {
|
|
|
ruleForm: {
|
|
|
//所属组织架构
|
|
|
group: "",
|
|
|
+ //所属届数
|
|
|
+ grade: "",
|
|
|
//学号
|
|
|
studentNumber: "",
|
|
|
//姓名
|
|
@@ -157,10 +175,11 @@ export default {
|
|
|
},
|
|
|
isView: true,
|
|
|
rules: {
|
|
|
- group: [{ required: true, message: "请选择组织架构", trigger: "blur" }],
|
|
|
+ group: [{ required: true, message: "请选择组织架构", trigger: "change" }],
|
|
|
studentNumber: [{ required: true, message: "请输入学号", trigger: "blur" }],
|
|
|
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
|
|
sex: [{ required: true, message: "请选择性别", trigger: "blur" }],
|
|
|
+ grade: [{ required: true, message: "请选择届数", trigger: "change" }],
|
|
|
// password: [{ required: true, message: "请输密码", trigger: "blur" }],
|
|
|
// password: [{ required: true, validator: validatePass, trigger: "blur" }],
|
|
|
// comPassword: [{ required: true, validator: validateComPass, trigger: "blur" }],
|
|
@@ -172,9 +191,29 @@ export default {
|
|
|
// this.ruleForm.type = "3";
|
|
|
},
|
|
|
methods: {
|
|
|
+ //获取当前届数
|
|
|
+ getGradeFun() {
|
|
|
+ this.gradeOption = [];
|
|
|
+ //获取当前届数
|
|
|
+ //获取当前年份
|
|
|
+ let date = new Date();
|
|
|
+ let currentYear = date.getFullYear();
|
|
|
+ let preYear = currentYear - 12;
|
|
|
+ let list = [];
|
|
|
+ for (let i = preYear; i < currentYear + 1; i++) {
|
|
|
+ //
|
|
|
+ let obj = {
|
|
|
+ value: i + "",
|
|
|
+ label: i + "届",
|
|
|
+ };
|
|
|
+ list.push(obj);
|
|
|
+ }
|
|
|
+ this.gradeOption = list.reverse();
|
|
|
+ },
|
|
|
resetData() {
|
|
|
this.$refs["ruleForm"].clearValidate();
|
|
|
//清空表单
|
|
|
+ this.ruleForm.grade = "";
|
|
|
this.ruleForm.group = "";
|
|
|
this.ruleForm.name = "";
|
|
|
this.ruleForm.studentNumber = "";
|
|
@@ -184,27 +223,33 @@ export default {
|
|
|
},
|
|
|
//获取组织架构方法--------------------开始-----------------------
|
|
|
getChannel() {
|
|
|
- this.$http.get(`/org/findAllOrgByPOrgNo?orgNo=${this.userInfo.orgNo}`, {}, (res) => {
|
|
|
- // this.$toast.success({message:'成功'});
|
|
|
- if (res && res.code == 200) {
|
|
|
- //将值赋值给list
|
|
|
- if (res.data.length > 0) {
|
|
|
- let resAdd = this.addPro(res.data);
|
|
|
- this.ppData = JSON.parse(JSON.stringify(resAdd));
|
|
|
- let forRes = this.arrToTree(resAdd);
|
|
|
- // console.log('格式化的结构')
|
|
|
- // console.log(forRes)
|
|
|
- let resultRes = this.deleteChildren(forRes);
|
|
|
+ this.$http.get(
|
|
|
+ `/org/findAllOrgByPOrgNo?orgNo=${this.userInfo.orgNo}`,
|
|
|
+ {},
|
|
|
+ (res) => {
|
|
|
+ // this.$toast.success({message:'成功'});
|
|
|
+ if (res && res.code == 200) {
|
|
|
+ //将值赋值给list
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ let resAdd = this.addPro(res.data);
|
|
|
+ this.ppData = JSON.parse(JSON.stringify(resAdd));
|
|
|
+ let forRes = this.arrToTree(resAdd);
|
|
|
+ // console.log('格式化的结构')
|
|
|
+ // console.log(forRes)
|
|
|
+ let resultRes = this.deleteChildren(forRes);
|
|
|
|
|
|
- this.groupData = resultRes[0].children;
|
|
|
+ this.groupData = resultRes[0].children;
|
|
|
+ console.log("groupData");
|
|
|
+ console.log(this.groupData);
|
|
|
+ } else {
|
|
|
+ this.groupData = [];
|
|
|
+ }
|
|
|
+ // this.channelList = res.data;
|
|
|
} else {
|
|
|
- this.groupData = [];
|
|
|
+ this.$message.error(res.msg);
|
|
|
}
|
|
|
- // this.channelList = res.data;
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg);
|
|
|
}
|
|
|
- });
|
|
|
+ );
|
|
|
},
|
|
|
//z增加
|
|
|
addPro(val) {
|
|
@@ -279,6 +324,7 @@ export default {
|
|
|
},
|
|
|
open(val) {
|
|
|
this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
|
|
|
+ this.getGradeFun();
|
|
|
this.cancle();
|
|
|
this.getChannel();
|
|
|
this.dialogVisible = true;
|
|
@@ -295,6 +341,7 @@ export default {
|
|
|
this.getChannel();
|
|
|
this.dialogVisible = true;
|
|
|
this.isView = false;
|
|
|
+ this.getGradeFun();
|
|
|
this.queryUserDetail(val.id);
|
|
|
//调用查询详情的接口
|
|
|
},
|
|
@@ -311,19 +358,19 @@ export default {
|
|
|
let a = [];
|
|
|
|
|
|
//当角色等于2时
|
|
|
- if (this.userInfo.roleType == "2") {
|
|
|
- //
|
|
|
+ // if (this.userInfo.roleType == "2") {
|
|
|
+ // //
|
|
|
|
|
|
- a.push(res.data.orgNo);
|
|
|
- }
|
|
|
- //当角色等于1时
|
|
|
- if (this.userInfo.roleType == "3") {
|
|
|
- for (let i = 0; i < res.data.orgList.length; i++) {
|
|
|
- if (i < 2) {
|
|
|
- a.push(res.data.orgList[i].orgNo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // a.push(res.data.orgNo);
|
|
|
+ // }
|
|
|
+ // //当角色等于1时
|
|
|
+ // if (this.userInfo.roleType == "3") {
|
|
|
+ // for (let i = 0; i < res.data.orgList.length; i++) {
|
|
|
+ // if (i < 2) {
|
|
|
+ // a.push(res.data.orgList[i].orgNo);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
// a.push(this.userInfo.orgNo);
|
|
|
// a.push(res.data.orgNo);
|
|
|
//判断用户登录类型
|
|
@@ -342,7 +389,9 @@ export default {
|
|
|
//回显性别
|
|
|
this.ruleForm.sex = res.data.gender;
|
|
|
//
|
|
|
- this.ruleForm.group = a.reverse();
|
|
|
+ this.ruleForm.group =[res.data.orgNo];
|
|
|
+ this.ruleForm.grade = res.data.grade;
|
|
|
+ // this.ruleForm.group = a.reverse();
|
|
|
} else {
|
|
|
// this.$toast.fail(res.msg);
|
|
|
this.$message.error(res.msg);
|
|
@@ -352,6 +401,7 @@ export default {
|
|
|
cancle() {
|
|
|
this.$refs["ruleForm"].clearValidate();
|
|
|
//清空表单
|
|
|
+ this.ruleForm.grade = "";
|
|
|
this.ruleForm.group = "";
|
|
|
this.ruleForm.name = "";
|
|
|
this.ruleForm.studentNumber = "";
|
|
@@ -372,9 +422,9 @@ export default {
|
|
|
this.disableFlag = true;
|
|
|
let validSp = [];
|
|
|
if (this.isView) {
|
|
|
- validSp = ["group", "studentNumber", "name", "sex"];
|
|
|
+ validSp = ["group", "studentNumber", "name", "sex", "grade"];
|
|
|
} else {
|
|
|
- validSp = ["group", "studentNumber", "name", "sex"];
|
|
|
+ validSp = ["group", "studentNumber", "name", "sex", "grade"];
|
|
|
}
|
|
|
let aa = [];
|
|
|
this.$refs["ruleForm"].validateField(validSp, (valid) => {
|
|
@@ -382,13 +432,13 @@ export default {
|
|
|
aa.push(valid);
|
|
|
//判断是编辑还是新增
|
|
|
if (this.isView) {
|
|
|
- if (aa.length == 4) {
|
|
|
+ if (aa.length == 5) {
|
|
|
this.register();
|
|
|
} else {
|
|
|
this.disableFlagStatus();
|
|
|
}
|
|
|
} else {
|
|
|
- if (aa.length == 4) {
|
|
|
+ if (aa.length == 5) {
|
|
|
this.editUserFun();
|
|
|
} else {
|
|
|
this.disableFlagStatus();
|
|
@@ -418,6 +468,7 @@ export default {
|
|
|
this.$http.post(
|
|
|
`/user/addOrUpdateUser`,
|
|
|
{
|
|
|
+ grade: this.ruleForm.grade,
|
|
|
orgNo: this.ruleForm.group[this.ruleForm.group.length - 1],
|
|
|
orgName: this.groupName,
|
|
|
userNo: this.ruleForm.studentNumber,
|
|
@@ -449,6 +500,7 @@ export default {
|
|
|
let that = this;
|
|
|
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;
|
|
|
this.userDetailData.gender = this.ruleForm.sex;
|
|
@@ -481,8 +533,8 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
-.el-form-item{
|
|
|
- margin-bottom: 5px !important;
|
|
|
+.el-form-item {
|
|
|
+ margin-bottom: 5px !important;
|
|
|
}
|
|
|
.dig_update /deep/.el-cascader {
|
|
|
position: relative;
|