Просмотр исходного кода

1、登陆后保存性别、状态、角色等字典到缓存里
2、修改权限管理-系统管理-角色管理下选中角色菜单授权出现的问题
3、人员管理-综合查询-人员查询中新增编辑功能

lihongxiao 3 лет назад
Родитель
Сommit
96fec0707c

+ 7 - 0
src/api/user.js

@@ -22,3 +22,10 @@ export function logout() {
     method: 'post'
   })
 }
+
+export function loginUser () {
+  return request({
+      url: '/user/loginUser',
+      method: 'get'
+  })
+}

+ 0 - 4
src/router/index.js

@@ -123,15 +123,11 @@ function addDynamicMenuAndRoutes(userName, to, from) {
     // 保存菜单树
     store.commit('setNavTree', res.data)
   }).then(res => {
-
     api.user.findPermissions({ 'name': userName }).then(res => {
       // 保存用户权限标识集合
       store.commit('setPerms', res.data)
     })
   })
-    .catch(function (res) {
-
-    })
 }
 
 /**

+ 10 - 6
src/store/modules/user.js

@@ -1,12 +1,13 @@
 import { getToken, setToken, removeToken } from '@/utils/auth'
-import { login } from '@/api/user'
+import { login,loginUser } from '@/api/user'
 export default {
     state: {
         perms: [],  // 用户权限标识集合
         token: getToken(),
+        roles:{}
     },
     getters: {
-   
+      // roles: state => state.roles
     },
     mutations: {
         setPerms(state, perms){  // 用户权限标识集合
@@ -15,6 +16,9 @@ export default {
         SET_TOKEN: (state, token) => {
             state.token = token
           },
+        SET_USER: (state, roles) => {
+          state.roles = roles
+        }
     },
     actions: {
         login({ commit }, userInfo) {
@@ -29,14 +33,14 @@ export default {
               })
             })
           },
-          getInfo({ commit, state }) {
+          getInfo({ commit }) {
             return new Promise((resolve, reject) => {
-              getInfo(state.token).then(response => {
+              loginUser().then(response => {
                 const { data } = response
                 if (!data) {
                   reject('Verification failed, please Login again.')
                 }
-                commit('SET_INFO', data)
+                commit('SET_USER', data)
                 resolve(data)
               }).catch(error => {
                 reject(error)
@@ -47,7 +51,7 @@ export default {
             return new Promise((resolve, reject) => {
               logout(state.token).then(() => {
                 commit('SET_TOKEN', '')
-                commit('SET_INFO', [])
+                commit('SET_USER', [])
                 removeToken()
                 resolve()
               }).catch(error => {

+ 5 - 1
src/views/Core/KtCommonTable.vue

@@ -67,7 +67,11 @@
               color: #ffffff;
             " icon="fa fa-trash" v-if="button1Name" :label="button1Name" :perms="permsButton1" :size="size"
             @click="handleButton1(scope.$index, scope.row)" />
-            <kt-button type="primary" v-if="button4Name" :label="button4Name" :perms="permsButton4" :size="size"
+            <kt-button style="
+              background: #1e87ed;
+              border: 1px solid #1e87ed;
+              color: #ffffff;
+            " v-if="button4Name" :label="button4Name" :perms="permsButton4" :size="size"
             @click="handleButton4(scope.$index, scope.row)" />
         </template>
       </el-table-column>

+ 7 - 2
src/views/Core/PersonalPanel.vue

@@ -118,8 +118,12 @@ export default {
     }
   },
   created(){
-// console.log(this.user,1111111)
-
+      // if (Cookies.get("user") != 'admin') {
+      //   this.userData.registeInfo = "入司时间:" + this.transformTime( this.userData.esmUserInternal.intime);
+      //   this.$api.dept.getDeptById( this.user.deptId).then(deptRes => {
+      //     this.user.deptName = deptRes.data.name;
+      //   });
+      // }
   },
   methods: {
    
@@ -134,6 +138,7 @@ export default {
         type: "warning"
       })
         .then(() => {
+          localStorage.clear()
           sessionStorage.removeItem("user")
           this.deleteCookie("token")
           this.deleteCookie("user")

+ 12 - 28
src/views/HeadBar/HeadBar.vue

@@ -61,7 +61,7 @@
         </el-menu-item>
         <el-menu-item index="5" v-popover:popover-personal>
           <!-- 用户信息 -->
-          <span class="user-info"><img :src="userData.avatar" />{{ userData.name }}</span>
+          <span class="user-info"><img :src="avatar" />{{ userData.name }}</span>
           <el-popover ref="popover-personal" placement="bottom-end" trigger="click" :visible-arrow="false">
             <personal-panel :user="userData"></personal-panel>
           </el-popover>
@@ -96,7 +96,7 @@ export default {
       appName: state => state.app.appName,
       themeColor: state => state.app.themeColor,
       collapse: state => state.app.collapse,
-      navTree: state => state.menu.navTree
+      navTree: state => state.menu.navTree,
     }),
     leftNavItems: function () {
       if (this.sum > 0) {
@@ -119,12 +119,19 @@ export default {
       sum: null,
       datawidth: 1920,
       screenWidth: document.body.clientWidth,
-      userData: {},
+      userData: JSON.parse(localStorage.getItem('user_data'))  ,
       activeIndex: '86',
-      langVisible: false
+      langVisible: false,
+      avatar: require("@/assets/user.png")
+
     }
   },
   created() {
+    if(!JSON.parse(localStorage.getItem('user_data'))){
+      this.$api.user.getLoginUser().then((response) => {
+             this.userData=response.data 
+          })
+    }
     if (this.leftNavItems.length > 8) {
       if (this.screenWidth < this.datawidth) {
         this.sum = Math.ceil((this.datawidth - this.screenWidth) / 70)
@@ -164,31 +171,8 @@ export default {
     }
     this.sysName = "Zgdd Platform";
     // var user = sessionStorage.getItem("user")
-    var user = Cookies.get("user")
-    this.$api.user.getLoginUser().then((personRes) => {
-      if(personRes.code==200){
-        this.userData = personRes.data;
-        Cookies.set("userData",personRes.data)
-        this.userData.avatar = require("@/assets/user.png")
-        if (user != 'admin') {
-          this.userData.registeInfo = "入司时间:" + this.transformTime(personRes.data.esmUserInternal.intime);
-          this.userData.deptId = personRes.data.deptId;
-          // this.user.jobCode = personRes.data.jobCode;
-          this.$api.dept.getDeptById(personRes.data.deptId).then(deptRes => {
-            this.userData.deptName = deptRes.data.name;
-          });
-          // this.$api.dict.findByLableName("jobcode").then((response) => {
-          //   var jobList = response.data; // 把获取到的数据赋给this.data
-          //   for (let i = 0; i < jobList.length; i++) {
-          //     if (jobList[i].value == this.user.jobCode) {
-          //       this.user.jobName = jobList[i].label;
-          //     }
-          //   }
-          // })
-        }
-      }
+  
       
-    })
     // if (user) {
     //   this.user.id = user;
     //   this.$api.user.findById(user).then((personRes) => {

+ 17 - 3
src/views/Login.vue

@@ -160,6 +160,12 @@ export default {
           Cookies.set('token', res.data) // 放置token到Cookie
           Cookies.set('user', userInfo.account) // 放置token到Cookie
           this.getDictItems()
+          this.$api.user.getLoginUser().then((response) => {
+              localStorage.setItem('user_data', JSON.stringify(response.data)) // 保存用户到本地会话
+          })
+          this.$api.role.findAll().then((res) => {
+            localStorage.setItem('find_all', JSON.stringify(res.data)) // 保存用户到本地会话
+          })
           sessionStorage.setItem('user', userInfo.account) // 保存用户到本地会话
           this.$store.commit('menuRouteLoaded', false) // 要求重新加载导航菜单
           this.$router.push('/') // 登录成功,跳转到主页
@@ -207,15 +213,23 @@ export default {
       this.$api.dict
         .findByLableName('sex')
         .then((response) => {
-          Cookies.set('sexOptions', response.data) // 放置token到Cookie
+          localStorage.setItem('sexOptions', JSON.stringify(response.data)) // 保存用户到本地会话
         })
         // 状态
         this.$api.dict
         .findByLableName('user_status')
         .then((response) => {
-          Cookies.set('user_statusoptions', response.data) // 放置token到Cookie
+          localStorage.setItem('user_statusoptions', JSON.stringify(response.data)) // 保存用户到本地会话
         })
-      
+    },
+    // 用户信息
+    getUser(){
+      this.$api.user.getLoginUser().then((response) => {
+      if(response.code==200){
+        this.$store.commit("SET_USER", response.data)
+        localStorage.setItem('user_data', JSON.stringify(response.data)) // 保存用户到本地会话
+      }
+    })
     },
     refreshCaptcha() {
       // this.loginForm.src = this.global.baseUrl + "/captcha.jpg?t=" + new Date().getTime();

+ 5 - 7
src/views/PeopleManage/Agent/AgentExamine.vue

@@ -193,12 +193,12 @@
 </template>
 
 <script>
-import KtButton from "@/views/Core/KtButton"; // 按钮权限组件
 import tree from "@/components/ztree.vue"; // 机构树组件
 import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
+import Cookies from "js-cookie";
+
 export default {
   components: {
-    KtButton,
     tree,
     KtCommonTable
   },
@@ -285,8 +285,8 @@ export default {
       dialogVisible: false, // 新增编辑界面是否显示
       departmentList: [], // 选中公司的所有部门的集合
       deptInfo: {}, //选中机构的基本信息
-      sexoptions: [],
-      user_statusoptions: [],
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
+      user_statusoptions: JSON.parse(localStorage.getItem('user_statusoptions')) ,
       option: [] //机构列表
     };
   },
@@ -294,9 +294,6 @@ export default {
     this.$api.role.findAll().then(res => {
       this.roles = res.data;
     });
-    //获取所有下拉框数据(字典)
-    this.getDictItems("sex");
-    this.getDictItems("user_status");
     this.findLeftTreeData(); // 获取机构树的数据
   },
   mounted() {
@@ -326,6 +323,7 @@ export default {
       // 点击事件
       this.currentTreeNode = evt;
       this.pageData.deptId = this.currentTreeNode.id;
+      this.pageData.pageNum =1;
       this.findPage();
       this.formData.deptId = [];
       this.platform(treeId);

+ 10 - 9
src/views/PeopleManage/Agent/AgentManage.vue

@@ -288,7 +288,6 @@ export default {
         mobile:'',
       },
       formData:{},
-      roles:[],
       formDataRules:{
         deptId:[{ required: true, message: "请选择机构", trigger: "change" }],
         mobile: [
@@ -372,18 +371,19 @@ export default {
       dialogVisible: false, // 新增编辑界面是否显示
       departmentList: [], // 选中公司的所有部门的集合
       deptInfo: {}, //选中机构的基本信息
-      sexoptions: [],
-      user_statusoptions: [],
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
+      user_statusoptions: JSON.parse(localStorage.getItem('user_statusoptions')) ,
+      roles: JSON.parse(localStorage.getItem('find_all')) ,
       option: [], //机构列表
     };
   },
   created() {
-    this.$api.role.findAll().then((res) => {
-      this.roles = res.data
-    })
+    // this.$api.role.findAll().then((res) => {
+    //   this.roles = res.data
+    // })
     //获取所有下拉框数据(字典)
-    this.getDictItems("sex");
-    this.getDictItems("user_status");
+    // this.getDictItems("sex");
+    // this.getDictItems("user_status");
     this.findLeftTreeData(); // 获取机构树的数据
 
   },
@@ -427,6 +427,7 @@ export default {
       // 点击事件
       this.currentTreeNode = evt;
       this.pageData.deptId = this.currentTreeNode.id;
+      this.pageData.pageNum =1;
       this.findPage();
       this.formData.deptId = [];
       this.platform(treeId);
@@ -454,7 +455,7 @@ export default {
        let dto={
         deptId:this.pageData.deptId,
         mobile:this.pageData.mobile,
-        name:this.pageData.realName,
+        name:this.pageData.name,
         userId:this.pageData.userId,
         status:this.pageData.status,
         roleId:'20',

+ 95 - 20
src/views/PeopleManage/Seo/StaffSeo.vue

@@ -69,10 +69,12 @@
             :data="pageResult"
             :columns="columns"
             button4Name="查看"
+            editButtonName="编辑"
             :showBatchDelete="false"
             @findPage="findPage"
             button1Background="#F2904B"
-            @handleButton4="handleTableEdit"
+            @handleButton4="handleDetail"
+            @handleEdit="handleTableEdit"
           ></kt-common-table>
         </SplitArea>
         <!-- 右侧列表页面End -->
@@ -80,7 +82,7 @@
     </el-main>
 
     <el-dialog
-      title="详情"
+      :title="dialogTitle"
       width="60%"
       :visible.sync="dialogVisible"
       :close-on-click-modal="false"
@@ -90,9 +92,10 @@
     >
       <el-form
         :model="formData"
+        :rules="formDataRules"
         ref="formData"
         :inline="true"
-        disabled
+        :disabled="isDisabled"
         label-width="130px"
         size="small"
       >
@@ -176,20 +179,31 @@
         </el-row>
       </el-form>
       <span slot="footer" class="dialog-footer">
-        <el-button size="small" type="primary" @click="closeDialog">关闭</el-button>
+        <el-button
+          size="small"
+          type="primary"
+          style="background-color: #ffc000; border: 1px solid #ffc000"
+          @click="closeDialog"
+          >取消</el-button
+        >
+        <el-button
+          size="small"
+          type="primary"
+          @click="submitForm"
+          >提交</el-button
+        >
       </span>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import KtButton from "@/views/Core/KtButton"; // 按钮权限组件
 import tree from "@/components/ztree.vue"; // 机构树组件
 import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
+import Cookies from "js-cookie";
 
 export default {
   components: {
-    KtButton,
     tree,
     KtCommonTable
   },
@@ -203,7 +217,10 @@ export default {
         realName: "",
         mobile: ""
       },
+      dialogTitle:'',
+      isDisabled:false,
       formData: {},
+      
       roles: [],
       peopledeptid: "",
       /**Split 开始 */
@@ -255,19 +272,35 @@ export default {
           sortable: false
         }
       ],
-      sexoptions: [],
-      user_statusoptions: [],
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
+      user_statusoptions: JSON.parse(localStorage.getItem('user_statusoptions')) ,
+      roles: JSON.parse(localStorage.getItem('find_all')) ,
       option: [],
-      roles: []
-      // 新增编辑界面数据
+      formDataRules:{
+        deptId:[{ required: true, message: "请选择机构", trigger: "change" }],
+        mobile: [
+          { required: true, message: "请输入手机号", trigger: "blur" },
+          { min: 11, max: 11, message: "请输入11位手机号码", trigger: "blur" },
+          {
+            pattern:
+              /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/,
+            message: "请输入正确的手机号",
+            trigger: "blur",
+          },
+        ],
+        name: [{ required: true, message: "请填写名称", trigger: "blur" }],
+        // password: [{ required: true, message: "请填写密码", trigger: "blur" }],
+        status: [{ required: true, message: "请选择状态", trigger: "change" }],
+        roleId: [{ required: true, message: "请填写角色", trigger: "blur" }],
+        },
     };
   },
   created() {
-    this.$api.role.findAll().then(res => {
-      this.roles = res.data;
-    });
-   this.getDictItems("user_status");
-     this.getDictItems("sex");
+    // this.$api.role.findAll().then(res => {
+    //   this.roles = res.data;
+    // });
+  //  this.getDictItems("user_status");
+  //    this.getDictItems("sex");
     this.findLeftTreeData(); // 获取机构树的数据
   },
   mounted() {
@@ -292,6 +325,7 @@ export default {
       // 点击事件
       this.currentTreeNode = evt;
       this.pageData.deptId = this.currentTreeNode.id;
+      this.pageData.pageNum =1;
       this.findPage();
       this.formData.deptId = [];
       this.platform(treeId);
@@ -314,7 +348,6 @@ export default {
 
     // 右侧列表的方法Start
     async findPage(data) {
-    
       // 获取分页数据
       if (data && data.pageRequest) {
         this.pageData.pageNum = data.pageRequest.pageNum;
@@ -323,7 +356,7 @@ export default {
       let dto = {
         deptId: this.pageData.deptId,
         mobile: this.pageData.mobile,
-        name: this.pageData.realName,
+        name: this.pageData.name,
         userId: this.pageData.userId,
         status: this.pageData.status,
         roleId: ""
@@ -372,7 +405,7 @@ export default {
     closeDialog() {
       this.dialogVisible = false;
     },
-    handleTableEdit(params) {
+    detail(params){
       this.$api.dept.findDeptTree().then(res => {
         this.option = res.data;
       });
@@ -383,9 +416,51 @@ export default {
           this.formData.password = "";
         }
       });
-      this.dialogTitle = "编辑后线人员";
+    },
+    handleTableEdit(params){
+     this.detail(params)
+      this.dialogTitle = "编辑";
+      this.isDisabled=false
+      this.dialogVisible = true;
+    },
+    handleDetail(params) {
+      this.detail(params)
+      this.dialogTitle = "详情";
+      this.isDisabled=true
       this.dialogVisible = true;
-    }
+    },
+    // 提交
+  submitForm() {
+      this.$refs.formData.validate((valid) => {
+        if (valid) {
+          this.$confirm("确认提交审核吗?", "提示", {})
+            .then(() => {
+              this.$api.user.saveOrUpdate(this.formData).then((res) => {
+                if (res.code == 200) {
+                  this.$message({
+                    message: "操作成功",
+                    type: "success",
+                  });
+                  this.dialogVisible = false;
+                  this.$refs["formData"].resetFields();
+                  this.findPage();
+                } else {
+                  this.$message({
+                    message: `操作失败,请重新添加,(${res.msg})`,
+                    type: "error",
+                  });
+                }
+              });
+            })
+            .catch(() => {
+              this.$message({
+                type: "info",
+                message: "已取消提交",
+              });
+            });
+        } 
+      });
+  }
   }
 };
 </script>

+ 5 - 8
src/views/PeopleManage/Seo/TeamSeo.vue

@@ -743,7 +743,7 @@
 export default {
   data() {
     return {
-      sexoptions:[],
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
       activeTabs: "first",
       dialogVisible: false, // 新增编辑界面是否显示
       deptInfo: {}, //选中机构的基本信息
@@ -906,13 +906,10 @@ export default {
   },
   created() {
     //获取所有下拉框数据(字典)
-    this.getDictItems("comlevel");
-    this.getDictItems("comattribute");
-    this.getDictItems("comtype");
-
-    this.getDictItems("sex");
-    this.getDictItems("jobcode");
-    // this.findLeftTreeData();
+    // this.getDictItems("comlevel");
+    // this.getDictItems("comattribute");
+    // this.getDictItems("comtype");
+    // this.getDictItems("jobcode");
     this.queryTeam();
   },
   methods: {

+ 9 - 11
src/views/PeopleManage/Staff/StaffExamine.vue

@@ -223,12 +223,12 @@
 </template>
 
 <script>
-import KtButton from "@/views/Core/KtButton"; // 按钮权限组件
 import tree from "@/components/ztree.vue"; // 机构树组件
 import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
+import Cookies from "js-cookie";
+
 export default {
   components: {
-    KtButton,
     tree,
     KtCommonTable,
   },
@@ -243,7 +243,6 @@ export default {
         mobile:'',
       },
       formData:{},
-      roles:[],
       formDataRules:{
         remark: [{ required: true, message: "请填写备注", trigger: "blur" }],
         },
@@ -315,18 +314,16 @@ export default {
       dialogVisible: false, // 新增编辑界面是否显示
       departmentList: [], // 选中公司的所有部门的集合
       deptInfo: {}, //选中机构的基本信息
-      sexoptions: [],
-      user_statusoptions: [],
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
+      user_statusoptions: JSON.parse(localStorage.getItem('user_statusoptions')) ,
+      roles: JSON.parse(localStorage.getItem('find_all')) ,
       option: [], //机构列表
     };
   },
   created() {
-    this.$api.role.findAll().then((res) => {
-      this.roles = res.data
-    })
-    //获取所有下拉框数据(字典)
-    this.getDictItems("sex");
-    this.getDictItems("user_status");
+    // this.$api.role.findAll().then((res) => {
+    //   this.roles = res.data
+    // })
     this.findLeftTreeData(); // 获取机构树的数据
 
   },
@@ -357,6 +354,7 @@ export default {
       // 点击事件
       this.currentTreeNode = evt;
       this.pageData.deptId = this.currentTreeNode.id;
+      this.pageData.pageNum =1;
       this.findPage();
       this.formData.deptId = [];
       this.platform(treeId);

+ 8 - 7
src/views/PeopleManage/Staff/StaffManage.vue

@@ -294,7 +294,6 @@ export default {
         mobile:'',
       },
       formData:{},
-      roles:[],
       formDataRules:{
         deptId:[{ required: true, message: "请选择机构", trigger: "change" }],
         mobile: [
@@ -381,15 +380,16 @@ export default {
       dialogVisible: false, // 新增编辑界面是否显示
       departmentList: [], // 选中公司的所有部门的集合
       deptInfo: {}, //选中机构的基本信息
-      sexoptions: JSON.parse(Cookies.get('sexOptions')) ,
-      user_statusoptions: JSON.parse(Cookies.get('user_statusoptions')) ,
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
+      user_statusoptions: JSON.parse(localStorage.getItem('user_statusoptions')) ,
+      roles: JSON.parse(localStorage.getItem('find_all')) ,
       option: [], //机构列表
     };
   },
   created() {
-    this.$api.role.findAll().then((res) => {
-      this.roles = res.data
-    })
+    // this.$api.role.findAll().then((res) => {
+    //   this.roles = res.data
+    // })
     //获取所有下拉框数据(字典)
     // this.getDictItems("sex");
     // this.getDictItems("user_status");
@@ -436,6 +436,7 @@ export default {
       // 点击事件
       this.currentTreeNode = evt;
       this.pageData.deptId = this.currentTreeNode.id;
+      this.pageData.pageNum =1;
       this.findPage();
       this.formData.deptId = [];
       this.platform(treeId);
@@ -464,7 +465,7 @@ export default {
        let dto={
         deptId:this.pageData.deptId,
         mobile:this.pageData.mobile,
-        name:this.pageData.realName,
+        name:this.pageData.name,
         userId:this.pageData.userId,
         status:this.pageData.status,
         roleId:'22',

+ 5 - 7
src/views/PeopleManage/TeamLeader/TeamLeaderExamine.vue

@@ -223,12 +223,12 @@
 </template>
 
 <script>
-import KtButton from "@/views/Core/KtButton"; // 按钮权限组件
 import tree from "@/components/ztree.vue"; // 机构树组件
 import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
+import Cookies from "js-cookie";
+
 export default {
   components: {
-    KtButton,
     tree,
     KtCommonTable,
   },
@@ -315,8 +315,8 @@ export default {
       dialogVisible: false, // 新增编辑界面是否显示
       departmentList: [], // 选中公司的所有部门的集合
       deptInfo: {}, //选中机构的基本信息
-      sexoptions: [],
-      user_statusoptions: [],
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
+      user_statusoptions: JSON.parse(localStorage.getItem('user_statusoptions')) ,
       option: [], //机构列表
     };
   },
@@ -324,9 +324,6 @@ export default {
     this.$api.role.findAll().then((res) => {
       this.roles = res.data
     })
-    //获取所有下拉框数据(字典)
-    this.getDictItems("sex");
-    this.getDictItems("user_status");
     this.findLeftTreeData(); // 获取机构树的数据
 
   },
@@ -357,6 +354,7 @@ export default {
       // 点击事件
       this.currentTreeNode = evt;
       this.pageData.deptId = this.currentTreeNode.id;
+      this.pageData.pageNum =1;
       this.findPage();
       this.formData.deptId = [];
       this.platform(treeId);

+ 10 - 9
src/views/PeopleManage/TeamLeader/TeamLeaderManage.vue

@@ -288,7 +288,6 @@ export default {
         mobile:'',
       },
       formData:{},
-      roles:[],
       formDataRules:{
         deptId:[{ required: true, message: "请选择机构", trigger: "change" }],
         mobile: [
@@ -376,18 +375,19 @@ export default {
       dialogVisible: false, // 新增编辑界面是否显示
       departmentList: [], // 选中公司的所有部门的集合
       deptInfo: {}, //选中机构的基本信息
-      sexoptions: [],
-      user_statusoptions: [],
+      sexoptions: JSON.parse(localStorage.getItem('sexOptions')) ,
+      user_statusoptions: JSON.parse(localStorage.getItem('user_statusoptions')) ,
+      roles: JSON.parse(localStorage.getItem('find_all')) ,
       option: [], //机构列表
     };
   },
   created() {
-    this.$api.role.findAll().then((res) => {
-      this.roles = res.data
-    })
+    // this.$api.role.findAll().then((res) => {
+    //   this.roles = res.data
+    // })
     //获取所有下拉框数据(字典)
-    this.getDictItems("sex");
-    this.getDictItems("user_status");
+    // this.getDictItems("sex");
+    // this.getDictItems("user_status");
     this.findLeftTreeData(); // 获取机构树的数据
 
   },
@@ -431,6 +431,7 @@ export default {
       // 点击事件
       this.currentTreeNode = evt;
       this.pageData.deptId = this.currentTreeNode.id;
+      this.pageData.pageNum =1;
       this.findPage();
       this.formData.deptId = [];
       this.platform(treeId);
@@ -459,7 +460,7 @@ export default {
        let dto={
         deptId:this.pageData.deptId,
         mobile:this.pageData.mobile,
-        name:this.pageData.realName,
+        name:this.pageData.name,
         userId:this.pageData.userId,
         status:this.pageData.status,
         roleId:'21',

+ 18 - 7
src/views/Sys/Role.vue

@@ -261,8 +261,8 @@ export default {
         if (valid) {
           this.$confirm("确认提交吗?", "提示", {}).then(() => {
             this.editLoading = true;
-            let params = Object.assign({}, this.dataForm);
-            this.$api.role.save(params).then((res) => {
+            // let params = Object.assign({}, this.dataForm);
+            this.$api.role.save(this.dataForm).then((res) => {
               this.editLoading = false;
               if (res.code == 200) {
                 this.$message({ message: "操作成功", type: "success" });
@@ -289,15 +289,26 @@ export default {
       });
     },
     // 角色选择改变监听
-    handleRoleSelectChange(val) {
+    async handleRoleSelectChange(val) {
       if (val == null || val.val == null) {
         return;
       }
       this.selectRole = val.val;
-      this.$api.role.findRoleMenus({ roleId: val.val.id }).then((res) => {
-        this.currentRoleMenus = res.data;
-        this.$refs.menuTree.setCheckedNodes(res.data);
-      });
+      let res=await this.$api.role.findRoleMenus({ roleId: val.val.id })
+      // this.currentRoleMenus = res.data;
+      this.$nextTick(() => {
+        const arr = []
+        // let data=res.data.filter(val=>val.type!==2)
+        res.data.forEach(item => {
+// console.log(this.$refs.menuTree.getNode(item.id),11111111)
+            if (!this.$refs.menuTree.getNode(item.id).childNodes || !this.$refs.menuTree.getNode(item.id).childNodes.length) {
+              arr.push(item)
+            }
+        })
+console.log(arr,11111111)
+
+        this.$refs.menuTree.setCheckedNodes(arr)
+      })
     },
     // 树节点选择监听
     handleMenuCheckChange(data, check, subCheck) {

+ 1 - 1
src/views/Sys/User.vue

@@ -96,7 +96,7 @@
             <el-col :span="12">
               <el-form-item label="角色权限" prop="email">
                 <el-select size="small"  v-model="dataForm.remark" placeholder="请选择" @change="changeRole($event)" >
-                  <el-option :label="roleItem.remark" :value="roleItem.id" v-for="(roleItem,roleIndex) in roleoptions" :key="roleIndex"></el-option>
+                  <el-option :label="roleItem.name" :value="roleItem.id" v-for="(roleItem,roleIndex) in roleoptions" :key="roleIndex"></el-option>
                 </el-select>
               </el-form-item>
             </el-col>