소스 검색

提交移动端权限控制

Lijy 3 년 전
부모
커밋
707ada4a26

+ 102 - 92
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -37,21 +37,7 @@
                     require('../../assets/img/index/banner4.jpeg'),
                     // require('../../assets/img/index/banner_3.png'),
                 ],
-                routers: [
-                    {
-                        name: '查看日报',
-                        url: '/calendar',
-                        icon: 'description'
-                    },
-                    
-                    {
-                        name: '填写日报',
-                        url: '/edit',
-                        icon: 'edit'
-                    },
-                    
-                    
-                ],
+                routers: [],
             };
         },
         created() {
@@ -74,90 +60,114 @@
                     icon: 'todo-list-o'
                 });
             }
-            if (this.user.role == 0) {
-                //普通员工
-                if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
-                    this.routers.push(
-                    {
-                        name: '部门审核',
-                        url: '/department_review',
-                        icon: 'todo-list-o'
-                    });
+            var list = this.user.moduleList
+            for (var i in list) {
+                if(list[i].name == '工时报告') {
+                    this.routers.push({name: '查看日报',url: '/calendar',icon: 'description'})
+                    this.routers.push({name: '填写日报',url: '/edit',icon: 'edit'})
                 }
-                if (this.user.leader) {
-                    this.routers.push({
-                        name: '项目报告审核',
-                        url: '/review',
-                        icon: 'todo-list-o'
-                    });
-                } 
-            } else if (this.user.role == 1 || this.user.role == 2 || this.user.role == 5){
-            // } else if (this.user.role == 1 || this.user.role == 2){
-                if (this.user.company.packageEngineering == 1) {
-                    this.routers.push(
-                    {
-                        name: '部门审核',
-                        url: '/department_review',
-                        icon: 'todo-list-o'
-                    });
-                }
-                
-                this.routers.push({
-                        name: '项目报告审核',
-                        url: '/review',
-                        icon: 'todo-list-o'
-                    });
-                this.routers.push({
-                        name: '项目管理',
-                        url: '/project',
-                        icon: 'label-o'
-                    });
-                
-                    // 自己加的
-                // this.routers.push({
-                //         name: '导入日报审核',
-                //         url: '/audit',
-                //         icon: 'label-o'
-                //     });
-            } else {
-                if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
-                    this.routers.push(
-                    {
-                        name: '部门审核',
-                        url: '/department_review',
-                        icon: 'todo-list-o'
-                    });
+                if(list[i].name == '项目报告审核') {
+                    this.routers.push({name: '项目报告审核',url: '/review',icon: 'todo-list-o'})
                 }
-                if (this.user.role == 3||this.user.role == 5||this.user.role == 6) {//项目管理员,公司领导,公司高层
-                    this.routers.push({
-                        name: '项目管理',
-                        url: '/project',
-                        icon: 'label-o'
-                    });
+                if(list[i].name == '项目管理') {
+                    this.routers.push({name: '项目管理',url: '/project',icon: 'label-o'})
                 }
-                if (this.user.leader) {
-                    this.routers.push({
-                        name: '项目报告审核',
-                        url: '/review',
-                        icon: 'todo-list-o'
-                    });
+                if(list[i].name == '导入日报审核') {
+                    this.routers.push({name: '导入日报审核',url: '/audit',icon: 'label-o'})
                 }
             }
-            if(this.user.role == 1 || this.user.role == 2) {
-                this.routers.push({
-                    name: '导入日报审核',
-                    url: '/audit',
-                    icon: 'label-o'
+            if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
+                this.routers.push(
+                {
+                    name: '部门审核',
+                    url: '/department_review',
+                    icon: 'todo-list-o'
                 });
-            } else {
-                if(this.user.role == 6 && this.user.timeType.needDeptAudit == 1) {
-                    this.routers.push({
-                        name: '导入日报审核',
-                        url: '/audit',
-                        icon: 'label-o'
-                    });
-                }
             }
+            // if (this.user.role == 0) {
+            //     //普通员工
+            //     if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
+            //         this.routers.push(
+            //         {
+            //             name: '部门审核',
+            //             url: '/department_review',
+            //             icon: 'todo-list-o'
+            //         });
+            //     }
+            //     if (this.user.leader) {
+            //         this.routers.push({
+            //             name: '项目报告审核',
+            //             url: '/review',
+            //             icon: 'todo-list-o'
+            //         });
+            //     } 
+            // } else if (this.user.role == 1 || this.user.role == 2 || this.user.role == 5){
+            // // } else if (this.user.role == 1 || this.user.role == 2){
+            //     if (this.user.company.packageEngineering == 1) {
+            //         this.routers.push(
+            //         {
+            //             name: '部门审核',
+            //             url: '/department_review',
+            //             icon: 'todo-list-o'
+            //         });
+            //     }
+                
+            //     this.routers.push({
+            //             name: '项目报告审核',
+            //             url: '/review',
+            //             icon: 'todo-list-o'
+            //         });
+            //     this.routers.push({
+            //             name: '项目管理',
+            //             url: '/project',
+            //             icon: 'label-o'
+            //         });
+                
+            //         // 自己加的
+            //     // this.routers.push({
+            //     //         name: '导入日报审核',
+            //     //         url: '/audit',
+            //     //         icon: 'label-o'
+            //     //     });
+            // } else {
+            //     if (this.user.manageDeptId != 0 && this.user.company.packageEngineering == 1) {
+            //         this.routers.push(
+            //         {
+            //             name: '部门审核',
+            //             url: '/department_review',
+            //             icon: 'todo-list-o'
+            //         });
+            //     }
+            //     if (this.user.role == 3||this.user.role == 5||this.user.role == 6) {//项目管理员,公司领导,公司高层
+            //         this.routers.push({
+            //             name: '项目管理',
+            //             url: '/project',
+            //             icon: 'label-o'
+            //         });
+            //     }
+            //     if (this.user.leader) {
+            //         this.routers.push({
+            //             name: '项目报告审核',
+            //             url: '/review',
+            //             icon: 'todo-list-o'
+            //         });
+            //     }
+            // }
+            // if(this.user.role == 1 || this.user.role == 2) {
+            //     this.routers.push({
+            //         name: '导入日报审核',
+            //         url: '/audit',
+            //         icon: 'label-o'
+            //     });
+            // } else {
+            //     if(this.user.role == 6 && this.user.timeType.needDeptAudit == 1) {
+            //         this.routers.push({
+            //             name: '导入日报审核',
+            //             url: '/audit',
+            //             icon: 'label-o'
+            //         });
+            //     }
+            // }
             this.routers.push({
                                 name: '消息记录',
                                 url: '/msg',

+ 15 - 4
fhKeeper/formulahousekeeper/timesheet_h5/src/views/project/index.vue

@@ -1,13 +1,13 @@
 <template>
     <div>
-        <van-nav-bar title="项目管理" left-text="返回" @click-left="back" :right-text="canEdit?'新增项目':''" @click-right="openDialog(-1)" fixed left-arrow/>
+        <van-nav-bar title="项目管理" left-text="返回" @click-left="back" :right-text="projectAdd?'新增项目':''" @click-right="openDialog(-1)" fixed left-arrow/>
         
         <div class="login_form">
             <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
                 <van-list v-model="loading" :finished="finished" finished-text="没有更多了" :error.sync="error" error-text="请求失败,点击重新加载" @load="getProject">
                     <van-swipe-cell v-for="(item,index) in list" :key="index">
                         <van-cell :border="false" :title="item.projectName" :value="item.projectCode"/>
-                        <template slot="right" v-if="canEdit">
+                        <template slot="right" v-if="projectManagement">
                             <van-button square type="info" text="编辑" @click="openDialog(index)"/>
                             <van-button square type="danger" text="删除" @click="delPro(index)"/>
                         </template>
@@ -76,7 +76,9 @@
                     projectName: "",
                 },
                 cliklss: false,
-                ause: []
+                ause: [],
+                projectAdd: false, // 新增项目
+                projectManagement: false, // 管理项目
             };
         },
         created() {
@@ -387,7 +389,16 @@
         mounted() {
             this.getUsers();
             this.yanjiuzx()
-            this.canEdit = (this.user.role==1||this.user.role==2||this.user.role==5);
+            // this.canEdit = (this.user.role==1||this.user.role==2||this.user.role==5);
+            var list = this.user.functionList
+            for(var i in list) {
+                if(list[i].name == '新增项目') {
+                    this.projectAdd = true
+                }
+                if(list[i].name == '管理全部项目') {
+                    this.projectManagement = true
+                }
+            }
         }
     };
 </script>

+ 10 - 3
fhKeeper/formulahousekeeper/timesheet_h5/src/views/review/index.vue

@@ -74,9 +74,9 @@
                         </div>
                     </div>
                     <div class="form_btn" slot="footer">
-                        <van-button v-if="(user.role != 0 || user.id == item.data[0].inchargerId) && item.state == 0" size="small" type="info" @click="approve(item.id, item)">通过</van-button>
-                        <van-button v-if="(user.role != 0 || user.id == item.data[0].inchargerId) && item.state == 0" size="small" type="danger" @click="showDenyDialog(item.id,0,item.dateStr, item)">驳回</van-button>
-                        <van-button v-if="(user.role != 0 || user.id == item.data[0].inchargerId) && item.state == 1" size="small" type="danger" @click="showDenyDialog(item.id,1,item.dateStr, item)">撤销</van-button>
+                        <van-button v-if="flg" size="small" type="info" @click="approve(item.id, item)">通过</van-button>
+                        <van-button v-if="flg" size="small" type="danger" @click="showDenyDialog(item.id,0,item.dateStr, item)">驳回</van-button>
+                        <van-button v-if="(flg || user.id == item.data[0].inchargerId) && item.state == 1" size="small" type="danger" @click="showDenyDialog(item.id,1,item.dateStr, item)">撤销</van-button>
                     </div>
                     <van-popup v-model="imgShow" position="bottom" closeable >
                         <van-swipe class="my-swipe"  indicator-color="white">
@@ -114,6 +114,7 @@
                 nowTime: this.format(new Date(new Date()),"yyyy-MM-dd"),
                 showPicker: false,
                 report: [],
+                flg: false
             };
         },
         created() {
@@ -239,6 +240,12 @@
 
         mounted() {
             this.getReport();
+            var list = this.user.functionList
+            for(var i in list) {
+                if(list[i].name == '审核全员日报') {
+                    this.flg = true
+                }
+            }
         }
     };
 </script>