kimi
2020-01-22 e377cf8730f94f2a16f856c60b9da877ea345fec
Merge branch 'master' of http://highdatas.com:9000/r/~kimi/srs

# Conflicts:
# src/views/Home.vue
# src/views/login.vue
1个文件已修改
108 ■■■■■ 已修改文件
src/views/Home.vue 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Home.vue
@@ -42,7 +42,8 @@
          <el-container>
            <el-header style="text-align: right; font-size: 15px;padding-right: 40px;">
                    <i class="el-icon-user-solid"></i>
                    <span>{{user.name}}</span>
                    <span>admin</span>
                    <el-button size="small" type="primary" @click="Cancel">退 出</el-button>
            </el-header>
            
            <el-main style="background-color: #f7f8f9;">
@@ -62,54 +63,91 @@
  data() {
        return {
            user:{},
            breadcrumbItems:[],
            defaultActive: "",
            navList:[
                {
                    title:"首页", path:"mine",children:[]
                },
              {
                title:"项目管理", path:"0_1",children:[
                  {title:"信息广场", path:"square",children:[]},
                  {title:"项目总览", path:"list",children:[]},
                  {title:"项目分析", path:"Overview",children:[]},
                  {title:"归档报告", path:"project4",children:[]},
                ]
              },
              {
                title:"任务管理", path:"0_2",children:[
                  {title:"任务列表", path:"calendarTask",children:[]},
                ]
              }
            ],
            navList:[],
        }
  },
    created() {
        let userId = localStorage.getItem('userId');
        let userName = localStorage.getItem('userName');
        let roleId = localStorage.getItem('roleId');
        let roleName = localStorage.getItem('roleName');
        let departId = localStorage.getItem('departId');
        let departName = localStorage.getItem('departName');
        this.user = {
            id:userId,
            name:userName,
            roleId:roleId,
            roleName:roleName,
            departId:departId,
            departName:departName,
        };
        if (!user) {
        let userId_ = localStorage.getItem('userId');
        let userType = localStorage.getItem('userType');
        if (!userId_) {
            this.$router.push('/login');
        }
        else {
            this.defaultActive = "mine";
            this.$router.push('/mine');
            this.getMenu(userType);
        }
    },
    
  methods: {
        getMenu(userType) {
            let DayDatas = {
                 all: [
                    {'id': "110", 'title': "首页", 'path': "mine"}, //返回的数组字段
                    {'id': "111", 'title': "项目管理", 'path': "0_111"}, //返回的数组字段
                    {'id': "112", 'title': "任务管理", 'path': "0_112"},
                    {'id': "111_1", 'title': "信息广场", 'path': 'project2', 'parentId': "111"}, //
                    {'id': "111_2", 'title': "项目总览", 'path': 'Overview', 'parentId': "111"}, //
                    {'id': "111_3", 'title': "项目分析", 'path': 'project3', 'parentId': "111"}, //
                    {'id': "111_4", 'title': "归档报告", 'path': 'project4', 'parentId': "111"}, //
                    {'id': "112_1", 'title': "任务列表", 'path': 'calendarTask', 'parentId': "112"}, //
                ],
                role1: [
                    {'id': "110", 'title': "首页", 'path': "mine"}, //返回的数组字段
                    {'id': "111", 'title': "项目管理", 'path': "0_111"}, //返回的数组字段
                    {'id': "111_1", 'title': "信息广场", 'path': 'project2', 'parentId': "111"}, //
                    {'id': "111_2", 'title': "项目总览", 'path': 'Overview', 'parentId': "111"}, //
                    {'id': "111_3", 'title': "项目分析", 'path': 'project3', 'parentId': "111"}, //
                    {'id': "111_4", 'title': "归档报告", 'path': 'project4', 'parentId': "111"}, //
                ],
                role2: [
                    {'id': "110", 'title': "首页", 'path': "mine"}, //返回的数组字段
                    {'id': "112", 'title': "任务管理", 'path': "0_112"},
                    {'id': "112_1", 'title': "任务列表", 'path': 'calendarTask', 'parentId': "112"}, //
                ],
            };
            let list = [];
            if (!userType || userType=='undefined') {
                list = DayDatas['all'];
            }
            else {
                list = DayDatas[userType];
            }
            let parId = "";
            let obj = {};
            let result = [];
            list.map(el => {
                obj[el.id] = el;
            })
            for(let i=0, len = list.length; i < len; i++) {
                let id = list[i].parentId;
                //设置显示字段
                list[i].title = list[i].title;
                if(id == parId || !id) {
                    if(!obj[list[i].id].children) {
                      obj[list[i].id].children = [];
                    }
                    result.push(list[i]);
                    continue;
                }
                if(obj[id].children) {
                    obj[id].children.push(list[i]);
                } else {
                    obj[id].children = [list[i]];
                }
            }
            this.navList = result;
        },
        Cancel() {
            this.$router.push('/login');
        },
        menuSelect(index, a){
         let isPage = index.substring(0,2);
         if (isPage != "0_") {