scorpio 2 năm trước cách đây
mục cha
commit
cce4e89854

+ 1 - 0
src/layout/index.vue

@@ -44,6 +44,7 @@ export default {
     getPermission() {
       this.$api.login.getPermission().then(res => {
         if (res.code === 200) {
+          this.permission.cleanPermission()
           this.permission.addPermission(res.data)
         }
       })

+ 9 - 1
src/layout/left.vue

@@ -75,13 +75,21 @@ export default {
         this.active = menu.active
         this.subActive = menu.subActive
       }
+      const dataType = localStorage.getItem('data-type')
+      console.log(dataType)
+      if (
+        dataType === null ||
+        dataType === undefined ||
+        dataType.length === 0
+      ) {
+        this.navClick(this.data[0], 0)
+      }
     },
     menus() {
       this.$api.common.getMenus().then(res => {
         if (res.code === 200) {
           this.data = res.data
           this.init()
-          // this.navClick(this.data[0], 0)
         }
       })
     },

+ 1 - 0
src/page/login.vue

@@ -264,6 +264,7 @@ export default {
       })
       const menu = { active: 0, subActive: 0 }
       localStorage.setItem('index', JSON.stringify(menu))
+      localStorage.removeItem('data-type')
     },
     submint() {
       this.$refs.loginForm.validate(res => {

+ 1 - 2
src/store/permission.js

@@ -10,12 +10,11 @@ export const permissionStore = defineStore('permissionStore', {
      * 设置用户信息
      */
     addPermission(list = []) {
-      this.permissions = {}
       list.forEach(sub => {
         if (typeof sub === 'object') {
           const children = sub.children
           const code = sub.code
-          if (children) {
+          if (children !== undefined) {
             this.addPermission(children)
           } else {
             const item = { [code]: true }

+ 2 - 2
src/views/home/component/params/params7.vue

@@ -12,7 +12,7 @@
     </div>
     <!-- content list -->
     <div style="width: 93%" class="mt-20">
-      <div class="flex flex-justify-start ml-20">
+      <div class="flex flex-justify-start ml-20" v-if="detail.can_update">
         <el-select v-model="selectYear">
           <el-option
             v-for="item in years"
@@ -76,7 +76,7 @@
 
     <!-- 纳统投资 -->
     <div style="width: 93%" class="mt-20">
-      <div class="flex flex-justify-start ml-20">
+      <div class="flex flex-justify-start ml-20" v-if="detail.can_update">
         <el-select v-model="selectYear2">
           <el-option
             v-for="item in years"

+ 10 - 2
src/views/invest/components/years.vue

@@ -29,7 +29,11 @@
               }}</span>
               <el-icon
                 :size="15"
-                v-if="i.index === 0 && user.info.viewStage === 1"
+                v-if="
+                  (i.index === 0 && user.info.viewStage === 1) ||
+                  (i.index === 0 &&
+                    permissions.vaildPermission('edit_plan_amount'))
+                "
                 class="ml-10 pointer"
                 @click="edit(i)"
               >
@@ -69,6 +73,8 @@ import wave from '@/views/invest/components/wave.vue'
 import { useStore } from '@/store/user.js'
 import { ElMessageBox } from 'element-plus'
 import index from '@/views/task/Index.vue'
+import permission from '@/store/permission.js'
+import permissionStore from '@/store/permission.js'
 
 export default {
   name: 'years',
@@ -80,7 +86,8 @@ export default {
   components: { basicTab, wave },
   setup() {
     const user = useStore()
-    return { user }
+    const permissions = permissionStore()
+    return { user, permissions }
   },
   props: {
     deptId: {
@@ -170,6 +177,7 @@ export default {
     this.init()
   },
   methods: {
+    permission,
     load() {
       this.tabs[0].name = this.year + '年总览'
       this.$api.invest