panhui 6 years ago
parent
commit
fa58b01dda

+ 8 - 0
src/main/vue/src/router.js

@@ -1174,6 +1174,14 @@ const router = new Router({
                     meta: {
                         title: '费用名称'
                     }
+                },
+                {
+                    path: '/normalIndex',
+                    name: 'normalIndex',
+                    component: () => import(/* webpackChunkName: "feeNameList" */ '@/views/NormalIndex.vue'),
+                    meta: {
+                        title: '首页'
+                    }
                 }
                 /**INSERT_LOCATION**/
             ]

+ 16 - 1
src/main/vue/src/store.js

@@ -14,7 +14,10 @@ const store = new Vuex.Store({
         nowUserStore: {},
         role: 'admin',
         selectedStoreId: null,
-        canEdit: false
+        canEdit: false,
+        homePage: 'roomStatus',
+        shiftHandoverEdit: true,
+        nightAuditEdit: true
     },
     mutations: {
         updateTableHeight(state, height) {
@@ -38,6 +41,18 @@ const store = new Vuex.Store({
         },
         updateCanEdit(state, canEdit) {
             state.canEdit = canEdit;
+        },
+        updateAuthoritie(state, authoritie) {
+            if (authoritie == 'ROLE_USER') {
+                state.homePage = 'normalIndex';
+                state.shiftHandoverEdit = false;
+                state.nightAuditEdit = false;
+            }
+            else{
+                state.homePage = 'roomStatus';
+                state.shiftHandoverEdit = true;
+                state.nightAuditEdit = true;
+            }
         }
     },
     actions: {

+ 14 - 6
src/main/vue/src/views/Admin.vue

@@ -48,7 +48,7 @@
                 <span style="margin-right:20px;" v-if="nightAuditStatus"
                     >营业日:{{ nightAuditStatus.openDay }}&nbsp;
                     <span
-                        v-if="!nightAuditStatus.audited"
+                        v-if="!nightAuditStatus.audited && nightAuditEdit"
                         style="cursor:pointer;"
                         @click="$router.push('/nightAuditEdit')"
                         >未夜审</span
@@ -94,7 +94,7 @@
             <el-dropdown trigger="click" @command="onCommand" class="icon">
                 <span><i class="fas fa-power-off"></i></span>
                 <el-dropdown-menu slot="dropdown">
-                    <template v-if="role != 'sale'">
+                    <template v-if="role != 'sale' && shiftHandoverEdit">
                         <el-dropdown-item command="shift">交班</el-dropdown-item>
                         <!-- <el-dropdown-item command="nightAudit">夜审
                         </el-dropdown-item> -->
@@ -189,8 +189,8 @@ export default {
         } else {
             this.tabs = [
                 {
-                    name: 'roomStatus',
-                    title: '房态'
+                    name: this.homePage,
+                    title: this.homePage == 'roomStatus' ? '房态' : '首页'
                 }
             ];
         }
@@ -198,7 +198,7 @@ export default {
         if (this.$route.path === '/') {
             let name = this.role == 'sale' ? 'saleIndex' : 'roomStatus';
             this.$router.replace({
-                name: this.role == 'sale' ? 'saleIndex' : 'roomStatus'
+                name: this.role == 'sale' ? 'saleIndex' : this.homePage
             });
         } else {
             let index = this.tabs.findIndex(i => i.name === this.$route.name);
@@ -265,7 +265,15 @@ export default {
         };
     },
     computed: {
-        ...mapState(['userInfo', 'role', 'selectedStoreId', 'canEdit']),
+        ...mapState([
+            'userInfo',
+            'role',
+            'selectedStoreId',
+            'canEdit',
+            'homePage',
+            'shiftHandoverEdit',
+            'nightAuditEdit'
+        ]),
         stores() {
             return this.userInfo ? this.userInfo.stores || [] : [];
         }

+ 4 - 1
src/main/vue/src/views/Login.vue

@@ -142,10 +142,13 @@ export default {
                             return this.$http.get('/user/my');
                         })
                         .then(res => {
+                            res.authorities.forEach(item => {
+                                this.$store.commit('updateAuthoritie', item.name);
+                            });
                             this.loading = false;
                             this.$store.commit('updateUserInfo', res);
                             this.$router.replace({
-                                name: this.$route.params.name || 'roomStatus'
+                                name: this.$route.params.name || this.$store.state.homePage
                             });
                         })
                         .catch(e => {

+ 17 - 0
src/main/vue/src/views/NormalIndex.vue

@@ -0,0 +1,17 @@
+<template>
+  <div class=''></div>
+</template>
+<script>
+import { mapState } from 'vuex';
+export default {
+  name: '',
+  data() {
+    return {};
+  },
+  computed: {
+        ...mapState(['userInfo'])
+      },
+};
+</script>
+<style lang='less' scoped>
+</style>