Browse Source

修改组织架构问题

plg 7 months ago
parent
commit
82c1fba8a3

+ 25 - 5
src/components/Register.vue

@@ -21,12 +21,13 @@
             <p v-if="!isView" class="dig_title">编辑</p>
             <div slot=""></div>
             <div slot="footer"></div>
+            <!-- :show-all-levels="false" -->
             <el-form-item label="所属组织架构" prop="group">
               <el-cascader
                 placeholder="请选择组织架构"
                 v-model="ruleForm.group"
                 :options="groupData"
-                :show-all-levels="false"
+                
                 clearable
               ></el-cascader>
             </el-form-item>
@@ -192,7 +193,8 @@ export default {
             // console.log('格式化的结构')
             // console.log(forRes)
             let resultRes = this.deleteChildren(forRes);
-            this.groupData = resultRes;
+
+            this.groupData = resultRes[0].children;
           } else {
             this.groupData = [];
           }
@@ -286,6 +288,8 @@ export default {
     },
     edit(val) {
       this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
+      console.log("userInfo");
+      console.log(this.userInfo);
       this.getChannel();
       this.dialogVisible = true;
       this.isView = false;
@@ -303,8 +307,24 @@ export default {
           //根据将数据存储
           this.userDetailData = res.data;
           let a = [];
-          a.push(this.userInfo.orgNo);
-          a.push(res.data.orgNo);
+
+          //当角色等于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(this.userInfo.orgNo);
+          // a.push(res.data.orgNo);
+          //判断用户登录类型
 
           console.log("a------------------");
           console.log(a);
@@ -320,7 +340,7 @@ export default {
           //回显性别
           this.ruleForm.sex = res.data.gender;
           //
-          this.ruleForm.group = a;
+          this.ruleForm.group = a.reverse();
         } else {
           // this.$toast.fail(res.msg);
           this.$message.error(res.msg);

+ 21 - 16
src/components/manageRegister.vue

@@ -22,12 +22,13 @@
             <div slot=""></div>
             <div slot="footer"></div>
             <!-- :show-all-levels="false" -->
+            <!-- :props="{ checkStrictly: true }" -->
             <el-form-item label="所属组织架构" prop="group">
               <el-cascader
                 placeholder="请选择组织架构"
                 v-model="ruleForm.group"
                 :options="groupData"
-                :props="{ checkStrictly: true }"
+                
                 clearable
               ></el-cascader>
             </el-form-item>
@@ -199,7 +200,11 @@ export default {
             let resultRes = this.deleteChildren(forRes);
             console.log("格式化的结构且去掉children");
             console.log(resultRes);
-            this.groupData = resultRes;
+            let listTmp =resultRes[0].children;
+            for(let i=0;i<listTmp.length;i++){
+              delete listTmp[i].children
+            }
+            this.groupData = listTmp;
           } else {
             this.groupData = [];
           }
@@ -300,11 +305,11 @@ export default {
           //获取返回值
           //根据将数据存储
           this.userDetailData = res.data;
-          let a = [];
-          for (let i = res.data.orgList.length; i > 0; i--) {
-            //
-            a.push(res.data.orgList[i - 1].orgNo);
-          }
+          let a = [res.data.orgNo];
+          // for (let i = res.data.orgList.length; i > 0; i--) {
+          //   //
+          //   a.push(res.data.orgList[i - 1].orgNo);
+          // }
           //回显学号
           this.ruleForm.studentNumber = res.data.userNo;
           //回显姓名
@@ -373,14 +378,14 @@ export default {
     },
     register() {
       this.queryOrgName();
-      if (this.ruleForm.group.length != 2) {
-        this.$message({
-          message: "院管理员请选择二级组织架构",
-          type: "error",
-        });
-        return;
-      }
-      console.log(this.ruleForm.group);
+      // if (this.ruleForm.group.length != 2) {
+      //   this.$message({
+      //     message: "院管理员请选择二级组织架构",
+      //     type: "error",
+      //   });
+      //   return;
+      // }
+      // console.log(this.ruleForm.group);
       let that = this;
       // this.ruleForm.password = md5(this.ruleForm.password);
       this.$http.post(
@@ -388,7 +393,7 @@ export default {
         {
           orgNo: this.ruleForm.group[this.ruleForm.group.length - 1],
           orgName: this.groupName,
-          userNo: this.ruleForm.studentNumber,
+          userNo: this.ruleForm.studentNumber.trim(),
           userName: this.ruleForm.name,
           gender: this.ruleForm.sex,
           password: md5(this.ruleForm.password),

+ 10 - 4
src/views/manage/channelInfo/channelInfo.vue

@@ -17,9 +17,10 @@
               placeholder="请选择组织架构"
               v-model="group"
               :options="groupData"
-              :props="{ checkStrictly: true }"
+         
               clearable
             ></el-cascader>
+            <!-- :props="{ checkStrictly: true }" -->
             <!-- <el-select v-model="channel" placeholder="请选择所属组织架构">
               <el-option
                 :label="item.name"
@@ -99,7 +100,7 @@
                 </div>
                 <div class="detail_button" @click="editUser(scope.row)">
                   <img src="../../../assets/img/table/edit.png" />
-                  <span> 编辑编辑个人详情 </span>
+                  <span>编辑个人详情 </span>
                 </div>
                 <!-- 弹出提示框 提示是否确认重置-->
                 <div class="detail_button" @click="resetUser(false, scope.row)">
@@ -412,7 +413,7 @@ export default {
     },
     //获取组织架构方法--------------------开始-----------------------
     getChannel() {
-      this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (res) => {
+      this.$http.get(`/org/findAllOrgByPOrgNo?orgNo=${this.userInfo.orgNo}`, {}, (res) => {
         //  this.$toast.success({message:'成功'});
         if (res && res.code == 200) {
           //将值赋值给list
@@ -425,7 +426,12 @@ export default {
             let resultRes = this.deleteChildren(forRes);
             console.log("格式化的结构且去掉children");
             console.log(resultRes);
-            this.groupData = resultRes;
+
+            let listTmp =resultRes[0].children;
+            for(let i=0;i<listTmp.length;i++){
+              delete listTmp[i].children
+            }
+            this.groupData = listTmp;
           } else {
             this.groupData = [];
           }

+ 12 - 2
src/views/manage/channelInfo/channelUserManage.vue

@@ -14,12 +14,22 @@
             ></el-input
             >&nbsp;&nbsp;&nbsp;&nbsp;
             <el-cascader
+              v-show="userInfo.roleType=='3'"
               placeholder="请选择组织架构"
               v-model="group"
               :options="groupData"
               :props="{ checkStrictly: true }"
               clearable
             ></el-cascader>
+            <!-- :props="{ checkStrictly: true }" -->
+            <el-cascader
+              v-show="userInfo.roleType=='2'"
+              placeholder="请选择组织架构"
+              v-model="group"
+              :options="groupData"
+             
+              clearable
+            ></el-cascader>
             <!-- <el-select v-model="channel" placeholder="请选择所属组织架构">
               <el-option
                 :label="item.name"
@@ -291,7 +301,7 @@ export default {
     },
     //获取组织架构方法--------------------开始-----------------------
     getChannel() {
-      this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (res) => {
+      this.$http.get(`/org/findAllOrgByPOrgNo?orgNo=${this.userInfo.orgNo}`, {}, (res) => {
         //  this.$toast.success({message:'成功'});
         if (res && res.code == 200) {
           //将值赋值给list
@@ -304,7 +314,7 @@ export default {
             let resultRes = this.deleteChildren(forRes);
             console.log("格式化的结构且去掉children");
             console.log(resultRes);
-            this.groupData = resultRes;
+            this.groupData = resultRes[0].children;
           } else {
             this.groupData = [];
           }

+ 40 - 22
src/views/manage/channelManagement/channelManagement.vue

@@ -16,13 +16,22 @@
             >
             </el-date-picker>
             <el-cascader
+              v-show="userInfo.roleType == '3'"
               placeholder="请选择组织架构"
               v-model="group"
               :options="groupData"
               :props="{ checkStrictly: true }"
               clearable
-            ></el-cascader
-            >&nbsp;&nbsp;&nbsp;&nbsp;
+            ></el-cascader>
+            <!-- :props="{ checkStrictly: true }" -->
+            <el-cascader
+              v-show="userInfo.roleType == '2'"
+              placeholder="请选择组织架构"
+              v-model="group"
+              :options="groupData"
+              clearable
+            ></el-cascader>
+            &nbsp;&nbsp;&nbsp;&nbsp;
             <el-select v-model="planStatus" placeholder="请选择计划状态">
               <el-option
                 :label="item.name"
@@ -67,7 +76,12 @@
           </el-table-column>
           <el-table-column prop="planEndTime" label="结束时间" align="center" width="">
           </el-table-column>
-          <el-table-column prop="planOrgName" label="所属组织架构" align="center" width="">
+          <el-table-column
+            prop="planOrgName"
+            label="所属组织架构"
+            align="center"
+            width=""
+          >
           </el-table-column>
           <!-- <el-table-column prop="userNo" label="测试人数" align="center" width="">
           </el-table-column> -->
@@ -303,28 +317,32 @@ export default {
     },
     //获取组织架构方法--------------------开始-----------------------
     getChannel() {
-      this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (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);
-            console.log("格式化的结构且去掉children");
-            console.log(resultRes);
-            this.groupData = resultRes;
+      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);
+              console.log("格式化的结构且去掉children");
+              console.log(resultRes);
+              this.groupData = resultRes[0].children;
+            } 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) {

+ 50 - 26
src/views/manage/channelManagement/contract.vue

@@ -39,12 +39,21 @@
             ></el-input>
             <div v-show="!isUser">&nbsp;&nbsp;&nbsp;&nbsp;</div>
             <el-cascader
+              v-show="userInfo.roleType == '3'"
               placeholder="请选择组织架构"
               v-model="group"
               :options="groupData"
               :props="{ checkStrictly: true }"
               clearable
             ></el-cascader>
+            <!-- :props="{ checkStrictly: true }" -->
+            <el-cascader
+              v-show="userInfo.roleType == '2'"
+              placeholder="请选择组织架构"
+              v-model="group"
+              :options="groupData"
+              clearable
+            ></el-cascader>
             &nbsp;&nbsp;&nbsp;&nbsp;
             <el-button type="primary" round icon="el-icon-search" @click="searchTarget"
               >搜索</el-button
@@ -228,7 +237,10 @@
                     <span> 个人报告列表 </span>
                   </div>
                 </div>
-                <div class="detail_button_out" v-if="!isUser &&scope.row.planStatus=='3'">
+                <div
+                  class="detail_button_out"
+                  v-if="!isUser && scope.row.planStatus == '3'"
+                >
                   <div class="detail_button" @click="planReport(scope.row)">
                     <img src="../../../assets/img/table/search.png" />
                     <span> 专业报告对比 </span>
@@ -442,7 +454,7 @@ export default {
     },
     //每页多少条
     handleSizeChange(val) {
-      this.pageSize=val;
+      this.pageSize = val;
       this.searchTarget();
       console.log(`每页 ${val} 条`);
       //将首页重置为1时---且总条数变化
@@ -450,28 +462,32 @@ export default {
     },
     //获取组织架构方法--------------------开始-----------------------
     getChannel() {
-      this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (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);
-            console.log("格式化的结构且去掉children");
-            console.log(resultRes);
-            this.groupData = resultRes;
+      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);
+              console.log("格式化的结构且去掉children");
+              console.log(resultRes);
+              this.groupData = resultRes[0].children;
+            } 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) {
@@ -488,7 +504,7 @@ export default {
         item.children = arr.filter((e) => {
           return item.orgNo === e.parentOrgNo;
         });
-        return this.userInfo.orgNo == item.orgNo
+        return this.userInfo.orgNo == item.orgNo;
         // return !item.parentOrgNo;
       });
       return data;
@@ -568,13 +584,21 @@ export default {
       if (this.isUser) {
         url = `/user/findUserListByPage?pageSize=${this.pageSize}&pageNum=${
           this.pageNum
-        }${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}`}`;
+        }${
+          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 {
         url = `/plan/findListByPage?pageSize=${this.pageSize}&pageNum=${this.pageNum}${
           this.planName == "" ? "" : `&planName=${this.planName}`
-        }${this.group.length == 0 ? `&orgNo=${this.userInfo.orgNo}` : `&orgNo=${this.group[this.group.length - 1]}`}`;
+        }${
+          this.group.length == 0
+            ? `&orgNo=${this.userInfo.orgNo}`
+            : `&orgNo=${this.group[this.group.length - 1]}`
+        }`;
       }
       this.$http.get(url, {}, (res) => {
         console.log(res);

+ 44 - 31
src/views/manage/userManage.vue

@@ -14,12 +14,22 @@
             ></el-input
             >&nbsp;&nbsp;&nbsp;&nbsp;
             <el-cascader
+             v-show="userInfo.roleType=='3'"
               placeholder="请选择组织架构"
               v-model="group"
               :options="groupData"
               :props="{ checkStrictly: true }"
               clearable
             ></el-cascader>
+            <!-- :props="{ checkStrictly: true }" -->
+            <el-cascader
+              v-show="userInfo.roleType=='2'"
+              placeholder="请选择组织架构"
+              v-model="group"
+              :options="groupData"
+            
+              clearable
+            ></el-cascader>
             &nbsp;&nbsp;&nbsp;&nbsp;
             <!-- <span style="font-size: 16px;">性别:</span>&nbsp;&nbsp; -->
             <div style="display: flex; flex-direction: row; align-items: center">
@@ -91,7 +101,7 @@
                 </div>
                 <div class="detail_button" @click="editUser(scope.row)">
                   <img src="../../assets/img/table/edit.png" />
-                  <span> 编辑编辑个人详情 </span>
+                  <span>编辑个人详情</span>
                 </div>
                 <!-- 弹出提示框 提示是否确认重置-->
                 <div class="detail_button" @click="resetUser(false, scope.row)">
@@ -199,11 +209,11 @@
           <p v-show="!isDelete" class="dig_title">批量导入</p>
 
           <!-- 先选择组织架构 -->
+          <!-- :props="{ checkStrictly: true }" -->
           <el-cascader
             placeholder="请选择组织架构"
             v-model="groupLead"
             :options="groupData"
-            :props="{ checkStrictly: true }"
             clearable
           ></el-cascader>
           <el-upload
@@ -211,7 +221,9 @@
             style="margin-top: 40px"
             drag
             :before-upload="beforeUploadFun"
-            :action="basePath + `/user/userImport?orgNo=${groupLead[groupLead.length-1]}`"
+            :action="
+              basePath + `/user/userImport?orgNo=${groupLead[groupLead.length - 1]}`
+            "
             :on-success="fileSuccess"
             :on-error="fileError"
           >
@@ -330,14 +342,14 @@ export default {
   },
   methods: {
     //文件上传之前
-    beforeUploadFun(file){
+    beforeUploadFun(file) {
       //查询是否选择了组织架构
-      if(this.groupLead.length==0){
+      if (this.groupLead.length == 0) {
         this.$message({
-          message:'请选择组织架构',
-          type:'error'
-        })
-        return false
+          message: "请选择组织架构",
+          type: "error",
+        });
+        return false;
       }
     },
     //文件上传成功
@@ -397,28 +409,32 @@ export default {
     },
     //获取组织架构方法--------------------开始-----------------------
     getChannel() {
-      this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (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);
-            console.log("格式化的结构且去掉children");
-            console.log(resultRes);
-            this.groupData = resultRes;
+      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);
+              console.log("格式化的结构且去掉children");
+              
+              this.groupData = resultRes[0].children;
+            } 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) {
@@ -467,9 +483,6 @@ export default {
       this.isDelete = flag;
       this.userId = val.id;
       this.userName = val.userName;
-      //当前用户id
-
-      //重置密码
     },
     editUser(row) {
       this.editRegisterUser(row);