ming 3 jaren geleden
bovenliggende
commit
db8690ad2f

+ 5 - 4
src/router/index.js

@@ -53,6 +53,9 @@ export const asyncRoutes = [
     //     }, ],
     // },
 
+
+
+
     {
         path: 'external-link',
         component: Layout,
@@ -64,7 +67,7 @@ export const asyncRoutes = [
 
     {
         path: '/',
-        redirect: '/index',
+        redirect: '/',
         meta: {
             title: '告警管理',
             icon: 'alarmManage',
@@ -75,12 +78,10 @@ export const asyncRoutes = [
             meta: {
                 title: '告警管理',
                 icon: 'alarmManage',
-                affix: true,
             },
             path: 'index',
             component: () =>
                 import ('@/views/alarmManage/index'),
-
         }, ]
     },
     // {
@@ -272,7 +273,7 @@ export const asyncRoutes = [
                     import ('@/views/powerQuality/harmonicReport/index.vue'),
             },
             {
-                meta: { icon: 'realTimeMonitoring', title: '实时监测', },
+                meta: { icon: 'realTimeMonitoring', title: '实时监测' },
                 path: 'realTimeMonitoring',
                 component: () =>
                     import ('@/views/powerQuality/realTimeMonitoring/index.vue'),

+ 21 - 0
src/store/modules/user.js

@@ -3,6 +3,7 @@
  * @description 登录、获取用户信息、退出登录、清除accessToken逻辑,不建议修改
  */
 import { getUserInfo, login, logout } from '@/api/user'
+import { getRouterList } from '@/api/router'
 import {
     getAccessToken,
     removeAccessToken,
@@ -92,6 +93,26 @@ const actions = {
                 message: `登录成功`,
                 description: `${thisTime}!`,
             })
+
+            console.log('登录成功后调用路由信息接口')
+            getRouterList().then((requset) => {
+                if (requset.status === 'SUCCESS') {
+                    console.log('请求成功')
+
+                    //   ElMessage.success({
+                    //     message: '删除成功',
+                    //     type: 'success',
+                    //   })
+                    //   roleList()
+                } else {
+                    //   ElMessage.error(requset.msg)
+                }
+            })
+
+
+
+
+
         } else {
             message.error(`登录接口异常,未正确返回${tokenName}...`)
         }

+ 12 - 4
src/views/systemManage/rolePermission/index.vue

@@ -27,6 +27,7 @@
       <role-info-com
         class="basicInfo"
         style="height: calc(100vh - 130px)"
+        v-if="menuData.length > 0"
         :menuData="menuData"
         :objItem="objItem"
         :radio1="radio1"
@@ -145,14 +146,21 @@ export default defineComponent({
             menuData.value.map((item) => {
               item.authority2 = '0'
             })
-            console.log(checkedKeys.value)
-            console.log(menuData.value)
+
+            if (radio1.value == 1) {
+              menuData.value.map(function (item) {
+                checkedKeys.value.push(item.id)
+                checkedKeys.value.map(function (num) {
+                  if (JSON.stringify(item).indexOf(num) != -1) {
+                    item.authority2 = '1'
+                  }
+                })
+              })
+            }
           } else {
-            // alert('有值')
             menuData.value.map(function (item) {
               checkedKeys.value.map(function (num) {
                 if (JSON.stringify(item).indexOf(num) != -1) {
-                  // alert('被选中')
                   item.authority2 = '1'
                 }
               })

+ 48 - 20
src/views/systemManage/rolePermission/roleInfoCom/index.vue

@@ -5,7 +5,7 @@
       <el-button type="primary" @click="saveMenu()">保存</el-button>
     </div>
 
-    <el-table :data="menuData" border stripe :cell-style="cellStyle">
+    <el-table :data="menuData" border stripe>
       <el-table-column prop="label" label="菜单" width="180"></el-table-column>
       <el-table-column prop="authority2" label="权限" class="roleLeft">
         <template #default="scope">
@@ -13,8 +13,8 @@
             v-model="scope.row.authority2"
             @change="listTabsChange(scope.row)"
           >
-            <el-radio label="1">是</el-radio>
-            <el-radio label="0">否</el-radio>
+            <el-radio label="1"  :disabled="radio1==1? true: false">是</el-radio>
+            <el-radio label="0" :disabled="radio1==1? true: false">否</el-radio>
           </el-radio-group>
         </template>
       </el-table-column>
@@ -23,17 +23,19 @@
 </template>
 
 <script>
-import { defineComponent, ref, onMounted } from 'vue'
+import { defineComponent, ref, onMounted, watch } from 'vue'
 import * as api from '@/api/systemManage/rolePermission.js'
 import { ElMessage } from 'element-plus'
 
 export default defineComponent({
   name: 'RoleInfoCom',
-  props: {
-    menuData: Object,
-    objItem: Object,
-    radio1: Number,
-  },
+  props: ['menuData', 'objItem', 'radio1'],
+
+  // props: {
+  //   menuData: Object,
+  //   objItem: Object,
+  //   radio1: String,
+  // },
 
   setup(props) {
     const aa = ref([])
@@ -56,12 +58,10 @@ export default defineComponent({
         })
         .then((requset) => {
           if (requset.status === 'SUCCESS') {
-
             ElMessage.success({
-            message: '权限修改成功',
-            type: 'success',
-          })
-           
+              message: '权限修改成功',
+              type: 'success',
+            })
           } else {
             ElMessage.error(requset.msg)
           }
@@ -84,19 +84,47 @@ export default defineComponent({
     }
 
     onMounted(() => {
-      props.menuData.forEach(function (item) {
-        if (item.authority2 == '1') {
-          saveArr.value.push(item.id)
-        }
-      })
+      // if (props.radio1 == 1) {
+      //   alert(1)
+      //   props.menuData.forEach(function (item) {
+      //     item.authority2 = '1'
+      //     saveArr.value.push(item.id)
+      //   })
+      //   console.log(' props.menuData')
+      //   console.log(props.menuData)
+      // } else {
+      //   props.menuData.forEach(function (item) {
+      //     if (item.authority2 == '1') {
+      //       saveArr.value.push(item.id)
+      //     }
+      //   })
+      // }
     })
+    //监听变化
+    watch(
+      () => props.radio1,
+      (newVal) => {
+        newVal
+        
+        // console.log('newVal')
+        // console.log(newVal)
+        // if (newVal == '1') {
+        //   alert(1)
+        //   props.menuData.forEach(function (item) {
+        //     item.authority2 = '1'
+        //     saveArr.value.push(item.id)
+        //   })
+        //   console.log(' 22props.menuData')
+        //   console.log(props.menuData)
+        // }
+      }
+    )
 
     return {
       saveMenu,
       aa,
       listTabsChange,
       saveArr,
-      // cellStyle
     }
   },
 })