Browse Source

修改组织架构--增加届数

plg 6 months ago
parent
commit
f7ea5b0e61

+ 27 - 12
src/components/Register.vue

@@ -55,7 +55,7 @@
                 clearable
               ></el-cascader>
             </el-form-item>
-            <el-form-item label="所属届" prop="grade">
+            <!-- <el-form-item label="所属届" prop="grade">
               <el-select
                 v-model="ruleForm.grade"
                 clearable
@@ -70,7 +70,7 @@
                 >
                 </el-option>
               </el-select>
-            </el-form-item>
+            </el-form-item> -->
             <el-form-item label="学号" prop="studentNumber">
               <el-input v-model="ruleForm.studentNumber"></el-input>
             </el-form-item>
@@ -161,6 +161,8 @@ export default {
       userDetailData: {},
       //组织架构名字
       groupName: "",
+      //属于哪一届
+      grade:'',
       ppData: [],
       groupData: [],
       options: [
@@ -226,11 +228,12 @@ export default {
       this.$http.get(url, {}, (res) => {
         if (res && res.code == 200) {
           //辅导员组织架构
-          res.data.gradeEntities;
+          debugger;
           for (let i = 0; i < res.data.gradeEntities.length; i++) {
             let obj = {
               value: res.data.gradeEntities[i].orgNo,
               label: res.data.gradeEntities[i].orgName,
+              extend:res.data.gradeEntities[i].extend
             };
             this.options3.push(obj);
           }
@@ -348,6 +351,14 @@ export default {
         }
       }
     },
+    //查询属于哪一届
+    queryGrade() {
+      for (let i = 0; i < this.ppData.length; i++) {
+        if (this.ruleForm.group[this.ruleForm.group.length - 1] == this.ppData[i].orgNo) {
+          this.grade = this.ppData[i].extend;
+        }
+      }
+    },
     //获取组织架构方法--------------------结束-----------------------
     timeChange(val) {
       if (val !== null) {
@@ -489,15 +500,15 @@ export default {
       let validSp = [];
       if (this.isView) {
         if (this.userInfo.roleType == "3") {
-          validSp = ["group3", "studentNumber", "name", "sex", "grade"];
+          validSp = ["group3", "studentNumber", "name", "sex"];
         } else if (this.userInfo.roleType == "4") {
-          validSp = ["group", "studentNumber", "name", "sex", "grade"];
+          validSp = ["group", "studentNumber", "name", "sex"];
         }
       } else {
         if (this.userInfo.roleType == "3") {
-          validSp = ["group3", "studentNumber", "name", "sex", "grade"];
+          validSp = ["group3", "studentNumber", "name", "sex"];
         } else if (this.userInfo.roleType == "4") {
-          validSp = ["group", "studentNumber", "name", "sex", "grade"];
+          validSp = ["group", "studentNumber", "name", "sex"];
         }
       }
       let aa = [];
@@ -506,13 +517,13 @@ export default {
           aa.push(valid);
           //判断是编辑还是新增
           if (this.isView) {
-            if (aa.length == 5) {
+            if (aa.length == 4) {
               this.register();
             } else {
               this.disableFlagStatus();
             }
           } else {
-            if (aa.length == 5) {
+            if (aa.length == 4) {
               this.editUserFun();
             } else {
               this.disableFlagStatus();
@@ -530,6 +541,7 @@ export default {
       for (let i = 0; i < this.options3.length; i++) {
         if (this.options3[i].value == this.ruleForm.group3) {
           this.groupName = this.options3[i].label;
+          this.grade=this.options3[i].extend;
         }
       }
     },
@@ -545,8 +557,10 @@ export default {
       //当用户是院管理员时
       if (this.userInfo.roleType == "4") {
         this.queryOrgName();
+        //查询属于哪一届
+        this.queryGrade()
         params = {
-          grade: this.ruleForm.grade,
+          grade: this.grade,
           orgNo: this.ruleForm.group[this.ruleForm.group.length - 1],
           orgName: this.groupName,
           userNo: this.ruleForm.studentNumber,
@@ -562,7 +576,7 @@ export default {
         this.queryOrgName3();
         //获取当前用户的groupName
         params = {
-          grade: this.ruleForm.grade,
+          grade: this.grade,
           orgNo: this.ruleForm.group3,
           orgName: this.groupName,
           userNo: this.ruleForm.studentNumber,
@@ -602,10 +616,11 @@ export default {
         this.userDetailData.orgNo = this.ruleForm.group3;
       } else if (this.userInfo.roleType == "4") {
         this.queryOrgName();
+        this.queryGrade()
         this.userDetailData.orgNo = this.ruleForm.group[this.ruleForm.group.length - 1];
       }
 
-      this.userDetailData.grade = this.ruleForm.grade;
+      this.userDetailData.grade = this.grade;
       this.userDetailData.orgName = this.groupName;
       this.userDetailData.userName = this.ruleForm.name;
       this.userDetailData.gender = this.ruleForm.sex;

+ 7 - 5
src/components/TreeData.vue

@@ -5,18 +5,20 @@
         :colspan="treeData.children ? treeData.children.length * 2 : 1"
         :class="{
           parentLevel: treeData.children,
-          extend: treeData.children && treeData.children.length && treeData.extend,
+          extend: treeData.children && treeData.children.length && treeData.isExtend,
         }"
       >
         <div :class="{ node: true, hasMate: treeData.mate }" >
           <div class="person" @click="$emit('click-node', treeData)">
             <el-popover v-if="!isDetail" placement="top" width="180" trigger="hover"  >
+              <!-- v-if="treeData.level!==3" -->
+                  <!-- v-if="treeData.isAdd" -->
               <div style="margin: 0">
                 <el-button
                   size="mini"
                   type="primary"
                   @click="addStock(0)"
-                  v-if="treeData.level!==3"
+                  v-if="treeData.isAdd"
                   >添加</el-button
                 >
                 <el-button
@@ -62,7 +64,7 @@
       </td>
     </tr>
     <!-- 这是一个递归组件,注意,这里还要调用,需要传递的数据这里也要传递,否则操作时拿不到子级的数据 -->
-    <tr v-if="treeData.children && treeData.children.length && treeData.extend">
+    <tr v-if="treeData.children && treeData.children.length && treeData.isExtend">
       <td
         v-for="(children, index) in treeData.children"
         :key="index"
@@ -112,7 +114,7 @@ export default {
       // 遍历当前的数据
       handler: function (Props) {
         let extendKey = function (jsonData) {
-          jsonData.extend = jsonData.extend === void 0 ? true : !!jsonData.extend;
+          jsonData.isExtend = jsonData.isExtend === void 0 ? true : !!jsonData.isExtend;
           // if (Array.isArray(jsonData.children) && jsonData.children.length) {
           //   jsonData.children.forEach(c => {
           //     extendKey(c);
@@ -133,7 +135,7 @@ export default {
   },
   methods: {
     toggleExtend(treeData) {
-      treeData.extend = !treeData.extend;
+      treeData.isExtend = !treeData.isExtend;
       this.$forceUpdate();
     },
 

+ 3 - 0
src/components/instructorRegister.vue

@@ -462,12 +462,14 @@ export default {
       let list = this.gradeList.filter((item) => {
         return this.ruleForm.grade.includes(item.orgNo);
       });
+      debugger;
       let listTm = [];
       for (let i = 0; i < list.length; i++) {
         let obj = {
           orgName: list[i].orgName,
           orgNo: list[i].orgNo,
           parentOrgNo: list[i].parentOrgNo,
+          extend:list[i].extend
         };
         listTm.push(obj);
       }
@@ -519,6 +521,7 @@ export default {
           orgName: list[i].orgName,
           orgNo: list[i].orgNo,
           parentOrgNo: list[i].parentOrgNo,
+          extend:list[i].extend
         };
         listTm.push(obj);
       }

+ 158 - 14
src/views/manage/channelInfo/orderSettlement.vue

@@ -12,9 +12,32 @@
       :visible.sync="dialogVisible"
       :close-on-click-modal="false"
       width="500px"
+      :before-close="closeDig"
     >
+      <!-- 当符合条件时需要暂时属于哪一届 -->
       <div class="tips">
-        <el-form :model="ruleForm" ref="ruleForm" class="demo-ruleForm">
+        <el-form :model="ruleForm" ref="ruleForm" :rules="rules" class="demo-ruleForm">
+          <el-form-item
+            label="所属届"
+            prop="grade"
+            class="imput_com"
+            v-show="isShowGrade"
+          >
+            <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="orgName" class="imput_com">
             <el-input
               placeholder="输入组织架构名称"
@@ -26,7 +49,7 @@
       </div>
       <span slot="footer" class="dialog-footer">
         <div class="tip-left">
-          <el-button type="info" @click="dialogVisible = false">取消</el-button>
+          <el-button type="info" @click="closeDig">取消</el-button>
           <el-button type="primary" @click="confirm">确定</el-button>
         </div>
       </span>
@@ -44,7 +67,7 @@
         </div>
       </span>
     </el-dialog>
-    <div class="changeDirection" @click="changeDir">切换方向</div>
+    <!-- <div class="changeDirection" @click="changeDir">切换方向</div> -->
   </div>
 </template>
 
@@ -73,7 +96,7 @@ export default {
       //   //公司编号
       //   orgNo: 1,
       // },
-       treeData: {
+      treeData: {
         //公司名称
         orgName: "大米科技公司",
         proportionShares: "100",
@@ -91,6 +114,11 @@ export default {
       //输入表单的对象
       ruleForm: {
         orgName: "",
+        grade: "",
+      },
+      rules: {
+        orgName: [{ required: true, message: "请输入组织名称", trigger: "blur" }],
+        grade: [{ required: true, message: "请选择届数", trigger: "change" }],
       },
       shareholderTypeOptions: [
         {
@@ -112,13 +140,41 @@ export default {
       lastId: 11, // 最后一级id
       currentTreeData: {},
       userInfo: {},
+      gradeOption: [],
+      isShowGrade: false,
     };
   },
   mounted() {
     this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
     this.getChannel();
+    this.getGradeFun();
   },
   methods: {
+    //新增修改框关闭后的回调
+    closeDig(){
+      //重置数据
+      this.$refs['ruleForm'].resetFields();
+      this.dialogVisible=false;
+    },
+    //获取当前届数
+    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();
+    },
     changeDir() {
       //改变方向
       this.isVertical = !this.isVertical;
@@ -136,15 +192,15 @@ export default {
               let resAdd = this.addPro(res.data);
               this.ppData = JSON.parse(JSON.stringify(resAdd));
               let forRes = this.arrToTree(resAdd);
-              console.log("forRes")
-              console.log(forRes)
+              console.log("forRes");
+              console.log(forRes);
               // console.log('格式化的结构')
               // console.log(forRes)
               let resultRes = this.deleteChildren(forRes);
 
               let levelList = this.markersFun(resultRes, 1);
               console.log("格式化的结构且去掉children");
-  
+
               // console.log(JSON.stringify(levelList));
               this.treeData = levelList[0];
               console.log(levelList[0]);
@@ -173,7 +229,7 @@ export default {
         item.children = arr.filter((e) => {
           return item.orgNo === e.parentOrgNo;
         });
-        return item.orgNo==this.userInfo.orgNo;
+        return item.orgNo == this.userInfo.orgNo;
       });
       return data;
     },
@@ -199,6 +255,30 @@ export default {
       }
       arr.forEach((item) => {
         item.level = level;
+        //设置都可以编辑
+        item.isEdit = true;
+        //设置都可以增加
+        item.isAdd = true;
+        //设置都可以删除
+        item.isDelete = true;
+        // item.extend = true;
+        item.isExtend = true;
+
+        //当角色是超级管理员时
+        if (this.userInfo.roleType == "5") {
+          //则level 是三级时
+          if (level == "3") {
+            item.isAdd = false;
+          }
+        }
+        //   //当角色是院管理员时
+        if (this.userInfo.roleType == "4") {
+          //则level 是三级时
+          if (level == "2") {
+            item.isAdd = false;
+          }
+        }
+
         if (item.children && item.children.length) {
           //
           this.markersFun(item.children, level + 1);
@@ -210,17 +290,51 @@ export default {
 
     // 新增编辑股东,val: 0 新增, 1 编辑
     addStock(data) {
+      this.isShowGrade = false;
+      //判断是新增还是编辑
+      //当等于0时是新增
+      //当等于1时是修改
+      if (data.val == "1") {
+        //管理员编辑
+        if (this.userInfo.roleType == "5" && data.data.level == "3") {
+          this.isShowGrade = true;
+        }
+        //院管理员编辑
+        if (this.userInfo.roleType == "4" && data.data.level == "2") {
+          this.isShowGrade = true;
+        }
+      }
+
+      if (data.val == "0") {
+        //管理员新增  是否显示届数
+        if (this.userInfo.roleType == "5" && data.data.level == "2") {
+          this.isShowGrade = true;
+        }
+        //院管理员新增 是否显示届数
+        if (this.userInfo.roleType == "4" && data.data.level == "1") {
+          this.isShowGrade = true;
+        }
+      }
+      //当是管理员登录时
+      // if(this.userInfo.roleType=='5'&&data.data.level=='3'){
+
+      // }
+
+      // this.isShowGrade = true;
+      //判断是修改还是
       console.log(data);
       this.currentSelectObj = data.data;
       // console.log(this.currentSelectObj);
       if (data.val) {
         this.ruleForm.orgName = data.data.orgName;
+        this.ruleForm.grade = data.data.extend;
         // 不使用=赋值,内存相同,改变后,treeData数据也会改变
         // this.ruleForm = data.data;
         // this.ruleForm = Object.assign(this.ruleForm, data.data);
         // this.ruleForm.type = data.data.level;
       } else {
         this.ruleForm.orgName = "";
+        this.ruleForm.grade = "";
       }
       this.isEdit = data.val;
       // 使用=赋值,编辑时改变currentTreeData, 源数据treeData也会改变
@@ -257,11 +371,39 @@ export default {
     confirm() {
       // let loading = Loading.service();
       //判断是否输入值了
-      if (this.ruleForm.orgName != "" && this.ruleForm.orgName != null) {
-        this.sendData();
+      // if (this.ruleForm.orgName != "" && this.ruleForm.orgName != null) {
+      //   this.sendData();
+      // } else {
+      //   this.$message.warning("请输入组织架构名称");
+      // }
+
+      //当届数显示时--需要校验届数字段
+
+      //
+      let validSp = [];
+      let aa = [];
+      if (this.isShowGrade) {
+        validSp = ["orgName", "grade"];
       } else {
-        this.$message.warning("请输入组织架构名称");
+        validSp = ["orgName"];
       }
+      this.$refs["ruleForm"].validateField(validSp, (valid) => {
+        if (!valid) {
+          aa.push(valid);
+          if (this.isShowGrade) {
+            if (aa.length == 2) {
+              this.sendData();
+            }
+          } else {
+            if (aa.length == 1) {
+              this.sendData();
+            }
+          }
+        } else {
+          // console.log("error submit!!");
+          // return false;
+        }
+      });
     },
 
     // 发送添加股东数据
@@ -273,6 +415,7 @@ export default {
         // data.id = this.treeData.id;
         //将参数调用接口
         this.currentSelectObj.orgName = this.ruleForm.orgName;
+        this.currentSelectObj.extend = this.ruleForm.grade;
         this.$http.post(`/org/addOrUpdateOrg`, this.currentSelectObj, (res) => {
           //  this.$toast.success({message:'成功'});
           if (res && res.code == 200) {
@@ -294,6 +437,7 @@ export default {
         let data = {
           parentOrgNo: this.currentSelectObj.orgNo,
           orgName: this.ruleForm.orgName,
+          extend: this.ruleForm.grade,
         };
         //将参数调用接口
         this.$http.post(`/org/addOrUpdateOrg`, data, (res) => {
@@ -345,11 +489,11 @@ export default {
 .imput_com >>> .el-input__inner {
   width: 400px !important;
 }
+.imput_com >>> .el-input {
+  width: 400px !important;
+}
 </style>
 <style lang="less" scoped>
-// :deep(.el-input__inner) {
-
-// }
 .changeDirection {
   position: fixed;
   right: 50px;

+ 7 - 7
src/views/manage/manageMain.vue

@@ -468,13 +468,13 @@ export default {
             showItem: true,
             path: "/manage/userManage",
           },
-          {
-            id: "5",
-            name: "教师管理",
-            icon: require("../../assets/menu/user.png"),
-            showItem: true,
-            path: "/manage/teacherManage",
-          },
+          // {
+          //   id: "5",
+          //   name: "教师管理",
+          //   icon: require("../../assets/menu/user.png"),
+          //   showItem: true,
+          //   path: "/manage/teacherManage",
+          // },
           {
             id: "6",
             name: "辅导员管理",

+ 74 - 37
src/views/manage/userManage.vue

@@ -37,6 +37,7 @@
             </el-select>
             <!-- :props="{ checkStrictly: true }" -->
             <el-cascader
+              change=""
               v-show="userInfo.roleType == '4'"
               placeholder="请选择组织架构"
               v-model="group"
@@ -63,7 +64,7 @@
               >搜索</el-button
             >
             <el-button type="info" round @click="clearSearch">清空</el-button>
-            <el-button type="success" round class="add_class" @click="fileVisible = true"
+            <el-button type="success" round class="add_class" @click="openFileUp"
               >批量导入</el-button
             >
             <el-button type="info" round @click="addUser">单独注册</el-button>
@@ -238,6 +239,7 @@
           <!-- 先选择组织架构 -->
           <!-- :props="{ checkStrictly: true }" -->
           <el-select
+            @change="queryGrade"
             style="width: 100%"
             v-model="group4"
             clearable
@@ -253,13 +255,14 @@
             </el-option>
           </el-select>
           <el-cascader
+            @change="queryGrade"
             v-show="userInfo.roleType == '4'"
             placeholder="请选择组织架构"
             v-model="groupLead"
             :options="groupData"
             clearable
           ></el-cascader>
-
+          <!-- 
           <el-select
             v-model="grade"
             clearable
@@ -273,7 +276,7 @@
               :value="item.value"
             >
             </el-option>
-          </el-select>
+          </el-select> -->
           <el-upload
             class="upload-demo"
             style="margin-top: 20px"
@@ -386,9 +389,8 @@ export default {
       channelList: [{ name: "渠道天成", id: "1" }],
       headers: {},
       grade: "",
-      gradeOption: [],
       group4: "",
-      filePath:''
+      filePath: "/user/userImport",
     };
   },
   created() {},
@@ -399,7 +401,6 @@ export default {
         ? `Bearer ${oSessionStorage.getItem("token")}`
         : "",
     };
-    this.getGradeFun();
     console.log("this.userInfo");
     console.log(this.userInfo);
 
@@ -417,34 +418,63 @@ export default {
     this.searchTarget();
   },
   methods: {
+    openFileUp() {
+      //打开弹出框
+      this.fileVisible = true;
+      this.group4 = "";
+      this.groupLead = [];
+    },
+    //当登录的角色是院管理员时
+    //得到届数
+    queryGrade() {
+      if (this.userInfo.roleType == "4") {
+        for (let i = 0; i < this.ppData.length; i++) {
+          if (this.groupLead[this.groupLead.length - 1] == this.ppData[i].orgNo) {
+            this.grade = this.ppData[i].extend;
+          }
+        }
+        this.filePath =
+          basePath +
+          `/user/userImport?orgNo=${
+            this.groupLead[this.groupLead.length - 1]
+          }&roleType=1&grade=${this.grade}`;
+      } else if (this.userInfo.roleType == "3") {
+        console.log(this.group4);
+        for (let i = 0; i < this.options3.length; i++) {
+          if (this.options3[i].value == this.group4) {
+            // this.groupName = this.options3[i].label;
+            this.grade = this.options3[i].extend;
+          }
+        }
+        this.filePath =
+          basePath +
+          `/user/userImport?orgNo=${this.group4}&roleType=1&grade=${this.grade}`;
+      }
+    },
+    // queryOrgName3() {
+    //   for (let i = 0; i < this.options3.length; i++) {
+    //     if (this.options3[i].value == this.group4) {
+    //       // this.groupName = this.options3[i].label;
+    //       this.grade = this.options3[i].extend;
+    //     }
+    //   }
+    // },
+    // queryGrade() {
+    //   for (let i = 0; i < this.ppData.length; i++) {
+    //     if (this.groupLead[this.groupLead.length - 1] == this.ppData[i].orgNo) {
+    //       this.grade = this.ppData[i].extend;
+    //     }
+    //   }
+    // },
     gradeFormatter(row) {
       //格式化当前届数
       return row.grade + "届";
     },
     //获取当前届数
-    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();
-    },
     //文件上传之前
     beforeUploadFun(file) {
       //判断当前用户时辅导员还是院管理员
-      if (this.userInfo.roleType == 4) {
-
+      if (this.userInfo.roleType == "4") {
         //查询是否选择了组织架构
         if (this.groupLead.length == 0) {
           this.$message({
@@ -453,8 +483,11 @@ export default {
           });
           return false;
         }
-        this.filePath=basePath +`/user/userImport?orgNo=${this.groupLead[this.groupLead.length - 1]}&roleType=1&grade=${this.grade}`
-
+        // this.filePath =
+        //   basePath +
+        //   `/user/userImport?orgNo=${
+        //     this.groupLead[this.groupLead.length - 1]
+        //   }&roleType=1&grade=${this.grade}`;
       } else if (this.userInfo.roleType == "3") {
         if (this.group4 == "") {
           this.$message({
@@ -463,16 +496,20 @@ export default {
           });
           return false;
         }
-        this.filePath=basePath +`/user/userImport?orgNo=${this.group4}&roleType=1&grade=${this.grade}`
-      }
 
-      if (this.grade == "") {
-        this.$message({
-          message: "请选择所属届",
-          type: "error",
-        });
-        return false;
+        // this.filePath =
+        //   basePath +
+        //   `/user/userImport?orgNo=${this.group4}&roleType=1&grade=${this.grade}`;
       }
+      console.log("basePath");
+      console.log(this.grade);
+      // if (this.grade == "") {
+      //   this.$message({
+      //     message: "请选择所属届",
+      //     type: "error",
+      //   });
+      //   return false;
+      // }
     },
     //文件上传成功
     fileSuccess(res) {
@@ -536,7 +573,6 @@ export default {
       //根据辅导员ID查询其下边的组织架构
       let url = `/user/findUserById?id=${this.userInfo.id}`;
       this.$http.get(url, {}, (res) => {
-  
         if (res && res.code == 200) {
           //辅导员组织架构
           // res.data.gradeEntities;
@@ -544,6 +580,7 @@ export default {
             let obj = {
               value: res.data.gradeEntities[i].orgNo,
               label: res.data.gradeEntities[i].orgName,
+              extend: res.data.gradeEntities[i].extend,
             };
             this.options3.push(obj);
           }