Bladeren bron

bug修复

ming 3 jaren geleden
bovenliggende
commit
e02d815968

+ 1 - 0
src/store/index.js

@@ -19,6 +19,7 @@ export default createStore({
     modules,
     state: {
         query: null,
+        auth: 0,
         siteId: 1, //公共api请求参数->siteId
         siteList: [], //公共api站点下拉列表存储->siteId
         deviceList: [], //公共站点下拉列表

+ 12 - 1
src/store/modules/routes.js

@@ -5,6 +5,8 @@
 import { asyncRoutes, constantRoutes } from '@/router'
 import { getRouterList } from '@/api/router'
 import { convertRouter, filterRoutes } from '@/utils/routes'
+import { ElMessage } from 'element-plus'
+import store from '..'
 // import { Layout } from 'ant-design-vue'
 
 const state = () => ({
@@ -42,7 +44,16 @@ const actions = {
      * @returns
      */
     async setAllRoutes({ commit }) {
-        let { data } = await getRouterList()
+        let { data } = await getRouterList();
+
+        if (data.length == 0) {
+            store.state.auth = 0
+            ElMessage.warning('此角色暂无分配权限,请先联系超级管理员分配权限 ! ')
+
+        } else {
+            store.state.auth = 1
+
+        }
 
         data.unshift({
             path: 'external-link',

+ 10 - 5
src/store/modules/user.js

@@ -10,6 +10,7 @@ import {
 } from '@/utils/accessToken'
 import { title, tokenName } from '@/config'
 import { message, notification } from 'ant-design-vue'
+import store from '..'
 
 const state = () => ({
     accessToken: getAccessToken(),
@@ -86,11 +87,15 @@ const actions = {
                 '晚上好'
 
             title
-            notification.open({
-                // message: `欢迎登录${title}`,
-                message: `登录成功`,
-                description: `${thisTime}!`,
-            })
+            if (store.state.auth == 1) {
+                notification.open({
+                    // message: `欢迎登录${title}`,
+                    message: `登录成功`,
+                    description: `${thisTime}!`,
+                })
+
+            }
+
         } else {
             message.error(`登录接口异常,未正确返回${tokenName}...`)
         }

+ 1 - 1
src/views/alarmManage/alarmTotal.vue

@@ -48,7 +48,7 @@
       ></el-table-column>
       <el-table-column prop="check" label="详情" width="">
         <template #default="scope">
-          <span v-if="scope.row.handlingStatus!=1&&store.state.authorities.indexOf('修改')==-1" style="cursor:default"></span>
+          <span v-if="scope.row.handlingStatus!=1&&store.state.authorities.indexOf('修改')==-1" style="cursor:default;color:#ccc">查看</span>
                     <span @click="checkItem_addItem(scope.row)" v-else>查看</span>
 
         </template>

+ 1 - 1
src/views/deviceManage/powerEquip/communicateEquip/index.vue

@@ -170,7 +170,7 @@
               type="text"
               size="small"
               style="color: #409eff"
-              :disabled="store.state.authorities.indexOf('克隆')==-1"
+    
             >
               克隆
             </el-button>

+ 7 - 0
src/views/systemManage/rolePermission/addRoleCom.vue

@@ -105,6 +105,13 @@ export default defineComponent({
                   type: 'success',
                 })
                 closeDialog()
+
+
+                //角色新增成功后,提交全选按钮权限给后台
+
+
+
+
               } else {
                 ElMessage.error(requset.msg)
               }

+ 22 - 15
src/views/systemManage/rolePermission/roleInfoCom/index.vue

@@ -21,7 +21,9 @@
             :label="item.name"
             :key="item.actionid"
             v-model="item.checked"
-            :disabled="(radio1 == 1 ||scope.row.menu=='权限管理')? true : false"
+            :disabled="
+              radio1 == 1 || scope.row.menu == '权限管理' ? true : false
+            "
             @change="handleCheckedChange"
           ></el-checkbox>
         </template>
@@ -63,10 +65,10 @@ export default defineComponent({
     function saveMenu() {
       console.log('checkedArr')
       console.log(checkedArr.value)
-      if(checkedArr.value.length==0){
-        
-         ElMessage.warning('权限不能为空! 请至少选择一个权限按钮')
-         return
+
+      if (checkedArr.value.length == 0) {
+        ElMessage.warning('菜单权限不能为空! 请至少选择一个菜单查询权限')
+        return
       }
       api
         .saveMenu({
@@ -111,22 +113,27 @@ export default defineComponent({
       props.menuData2.forEach(function (item) {
         if (item.children) {
           item.children.forEach(function (a) {
-            a.authority.forEach(function (i) {
+            if (a.authority[0].checked) {
+              a.authority.forEach(function (i) {
+                 if (i.checked) {
+                  checkedArr.value.push(i.id)
+                }
+              })
+            }
+          })
+        } else {
+          // 如果查询的id被选中,那么塞入数组
+          if (item.authority[0].checked) {
+            item.authority.forEach(function (i) {
               if (i.checked) {
                 checkedArr.value.push(i.id)
               }
             })
-          })
-        } else {
-          item.authority.forEach(function (i) {
-            if (i.checked) {
-              checkedArr.value.push(i.id)
-            }
-          })
+          }
         }
       })
-    //   console.log('checkedArr.value')
-    //   console.log(checkedArr.value)
+      console.log('checkedArr.value')
+      console.log(checkedArr.value)
     }
 
     onMounted(() => {