Procházet zdrojové kódy

首页和权限树修改

zhaoke před 3 roky
rodič
revize
59e26efe5f

+ 10 - 0
src/api/apiHome.js

@@ -53,6 +53,16 @@ export function GetAuthAna (params) {
   })
 }
 
+//数据统计
+export function GetStatus (params) {
+  return request({
+    url: '/api/fs4a/status',
+    method: 'post',
+    data: params
+  })
+}
+
+
 //修改密码
 export function EditPwd (params) {
   return request({

+ 27 - 2
src/components/permissiontree/index.vue

@@ -119,14 +119,15 @@ export default {
       oldType: "",
       queryIdArr: [], //历史查询ID
       MainJobId: "",//主岗ID
-      defaultExpandedKeys: [-1]
+      defaultExpandedKeys: [-1],
+      treeChecks: [],
     };
   },
   watch: {
     checkedKeys: {
       handler (val) {
         this.checkedList = val;
-        this.$refs.tree.setCheckedKeys(val);
+        this.treeChecks = val;
       },
       deep: true,
     },
@@ -176,6 +177,14 @@ export default {
         this.getDefaultDataList()
       },
       deep: true
+    },
+    treeChecks: {
+      handler (val) {
+        if (val && val.length) {
+          this.$refs.tree.setCheckedKeys(val);
+        }
+      },
+      deep: true
     }
   },
   created () {
@@ -295,6 +304,22 @@ export default {
       const half = this.$refs.tree.getHalfCheckedNodes();
       const halfAll = half.filter(item => item.AuthId != -1 && item.AuthName != '所有权限');
       const datas = halfAll.concat(arr);
+      if (this.treeChecks && this.treeChecks.length) {
+        const checks = [];
+        datas.forEach(item => {
+          checks.push(item.AuthId);
+        })
+        const handAll = [...checks, ...this.treeChecks].filter(t => {
+          return !(checks.includes(t) && this.treeChecks.includes(t));
+        })
+        setTimeout(() => {
+          handAll.map(item => {
+            this.$refs.tree.setChecked(item, false);
+            this.treeChecks = [];
+          })
+        }, 100);
+
+      }
       datas.forEach((item) => {
         // if(item.disabled==false){
         this.checkedList.push(item.AuthId);

+ 125 - 35
src/views/dashboard/components/analysis.vue

@@ -40,7 +40,7 @@
       </div>
     </div>
     <div class="dashboard-list">
-      <!--异常操作情况-->
+      <!--数据概况-->
       <div class="tu-unusual box-public-shadow flex1">
         <div class="tu-unusual-content h100 flex">
           <div class="tu-unusual-content-left w160 relative">
@@ -93,7 +93,7 @@
         </div>
       </div>
     </div>
-    <div class="dashboard-list">
+    <div v-if="false" class="dashboard-list">
       <!--API调用情况-->
       <div class="tu-api box-public-shadow flex1">
         <div class="tu-api-content h100 flex">
@@ -129,7 +129,7 @@ import commonChartsLine from '@/layout/components/Echarts/commonChartsLine.vue'
 import commonProgress from '@/layout/components/Echarts/commonProgress.vue'
 import commonChartsNum from '@/layout/components/EchartsNum/index.vue'
 import dateType from '@/layout/components/dateType/index.vue'
-import { GetUserAna, GetOfficerAna, GetRoleAna, GetAuthAna } from '@/api/apiHome'
+import { GetUserAna, GetOfficerAna, GetRoleAna, GetAuthAna, GetStatus } from '@/api/apiHome'
 import { mapGetters } from 'vuex'
 export default {
   name: 'Analysis',
@@ -445,9 +445,9 @@ export default {
             name: '登录情况',
             radius: ['40%', '100%'],
             data: [
-              { value: 2780, name: '正常登录' },
-              { value: 735, name: '异常登录' },
-              { value: 165, name: '登录失败' }
+              { value: 2780, name: '正常登录', key: 'normalLogin' },
+              { value: 735, name: '异常登录', key: 'abnormalLogin' },
+              { value: 165, name: '登录失败', key: 'nosystemLogin' }
             ]
           }
         ]
@@ -497,17 +497,20 @@ export default {
         {
           number: 2780,
           txt: '正常登录',
-          color: '#8969BE'
+          color: '#8969BE',
+          key: 'normalLogin'
         },
         {
           number: 735,
           txt: '异常登录',
-          color: '#F4C23A'
+          color: '#F4C23A',
+          key: 'abnormalLogin'
         },
         {
           number: 165,
           txt: '非系统异常',
-          color: '#E752A3'
+          color: '#E752A3',
+          key: 'nosystemLogin'
         }
       ],
       // 授权情况数据
@@ -521,11 +524,11 @@ export default {
             name: '授权情况',
             radius: ['40%', '100%'],
             data: [
-              { value: 1276, name: '账号授权' },
-              { value: 126, name: '分组授权' },
-              { value: 1236, name: '职员授权' },
-              { value: 12736, name: '组织授权' },
-              { value: 127, name: '角色授权' }
+              { value: 1276, name: '账号授权', key: 'accountAuthorization' },
+              { value: 126, name: '分组授权', key: 'groupAuthorization' },
+              { value: 1236, name: '职员授权', key: 'officerAuthorization' },
+              { value: 12736, name: '组织授权', key: 'organAuthorization' },
+              { value: 127, name: '角色授权', key: 'roleAuthorization' }
             ]
           }
         ]
@@ -535,27 +538,32 @@ export default {
         {
           color: '#8969BE',
           name: '账号授权',
-          num: '1276'
+          num: '1276',
+          key: 'accountAuthorization'
         },
         {
           color: '#94C6E0',
           name: '分组授权',
-          num: '126'
+          num: '126',
+          key: 'groupAuthorization'
         },
         {
           color: '#85EAC8',
           name: '职员授权',
-          num: '1236'
+          num: '1236',
+          key: 'officerAuthorization'
         },
         {
           color: '#F4C23A',
           name: '组织授权',
-          num: '12736'
+          num: '12736',
+          key: 'organAuthorization'
         },
         {
           color: '#E752A3',
           name: '角色授权',
-          num: '127'
+          num: '127',
+          key: 'roleAuthorization'
         }
       ],
       // 行为情况数据
@@ -569,12 +577,12 @@ export default {
             name: '行为情况',
             radius: ['40%', '100%'],
             data: [
-              { value: 1275, name: '4A平台' },
-              { value: 2210, name: 'OA系统' },
-              { value: 2220, name: '项目建设' },
-              { value: 2230, name: '勘察设计' },
-              { value: 2210, name: '企业微信' },
-              { value: 2250, name: '智慧工程' }
+              { value: 1275, name: '4A平台', key: 'sys4a' },
+              { value: 2210, name: 'OA系统', key: 'sysOA' },
+              { value: 2220, name: '项目建设', key: 'sysProjectManagementPlatform' },
+              { value: 2230, name: '勘察设计', key: 'sysSurveyAndDesignManagementPlatform' },
+              { value: 2210, name: '企业微信', key: 'sysWechat' },
+              { value: 2250, name: '智慧工程', key: 'sysSmartConstructionSite' }
             ]
           }
         ]
@@ -584,32 +592,38 @@ export default {
         {
           color: '#8969BE',
           name: '4A平台',
-          num: '1275'
+          num: '1275',
+          key: 'sys4a'
         },
         {
           color: '#F25555',
           name: 'OA系统',
-          num: '2210'
+          num: '2210',
+          key: 'sysOA'
         },
         {
           color: '#F4C23A',
           name: '项目建设',
-          num: '2220'
+          num: '2220',
+          key: 'sysProjectManagementPlatform'
         },
         {
           color: '#E752A3',
           name: '勘察设计',
-          num: '2230'
+          num: '2230',
+          key: 'sysSurveyAndDesignManagementPlatform'
         },
         {
           color: '#94C6E0',
           name: '企业微信',
-          num: '2210'
+          num: '2210',
+          key: 'sysWechat'
         },
         {
           color: '#85EAC8',
           name: '智慧工地',
-          num: '2250'
+          num: '2250',
+          key: 'sysSmartConstructionSite'
         }
       ],
       // 数据概况
@@ -656,22 +670,26 @@ export default {
         {
           number: 1275,
           txt: '下发有效',
-          color: '#8969BE'
+          color: '#8969BE',
+          key: 'pushSuccess'
         },
         {
           number: 220,
           txt: '下发无效',
-          color: '#E752A3'
+          color: '#E752A3',
+          key: 'pushFailed'
         },
         {
           number: 220,
           txt: '接收有效',
-          color: '#F4C23A'
+          color: '#F4C23A',
+          key: 'receiveSuccess'
         },
         {
           number: 220,
           txt: '接收无效',
-          color: '#F56C6C'
+          color: '#F56C6C',
+          key: 'receiveFailed'
         }
       ],
       // 权限概览切换
@@ -825,10 +843,82 @@ export default {
         console.log('网络错误:', error)
       }
     },
+    async getStatus () {
+      try {
+        const result = await GetStatus()
+        if (result.code === 0) {
+          const res = result.returnData
+          const keys = Object.entries(res)
+          const { pushSuccess, pushFailed, receiveSuccess, receiveFailed } = res
+          // 数据概况
+          this.unusualOption.series[0].data[0].value = pushSuccess
+          this.unusualOption.series[0].data[1].value = pushFailed
+          this.unusualOption.series[1].data[0].value = receiveSuccess
+          this.unusualOption.series[1].data[1].value = receiveFailed
+          this.unusualTeams.forEach(item => {
+            keys.filter(p => {
+              if (item.key === p[0]) {
+                item.number = p[1]
+              }
+            })
+          })
+          //登录情况
+          this.loginTeams.forEach(item => {
+            keys.filter(p => {
+              if (item.key === p[0]) {
+                item.number = p[1]
+              }
+            })
+          })
+          this.loginOption.series[0].data.forEach(item => {
+            keys.filter(p => {
+              if (item.key === p[0]) {
+                item.value = p[1]
+              }
+            })
+          })
+          //授权情况
+          this.authorizeArr.forEach(item => {
+            keys.filter(p => {
+              if (item.key === p[0]) {
+                item.number = p[1]
+              }
+            })
+          })
+          this.authorizeOption.series[0].data.forEach(item => {
+            keys.filter(p => {
+              if (item.key === p[0]) {
+                item.value = p[1]
+              }
+            })
+          })
+          //行为情况
+          this.behaviorArr.forEach(item => {
+            keys.filter(p => {
+              if (item.key === p[0]) {
+                item.number = p[1]
+              }
+            })
+          })
+          this.behaviorOption.series[0].data.forEach(item => {
+            keys.filter(p => {
+              if (item.key === p[0]) {
+                item.value = p[1]
+              }
+            })
+          })
+        } else {
+          this.$message.error(result.message)
+        }
+      } catch (error) {
+        console.log('网络错误:', error)
+      }
+    },
     pageInit () {
       this.getUserAna()
       this.getRoleAna()
       this.getAuthAna()
+      this.getStatus()
     }
   }
 }

+ 17 - 1
src/views/dashboard/components/journal.vue

@@ -12,7 +12,7 @@
       <div class="title">个人日志</div>
       <div class="search flex-wrap">
         <div class="j-date">
-          <el-date-picker v-model="value1" size="small" value-format="yyyy-MM-dd HH:mm:ss" class="j-date-input" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
+          <el-date-picker v-model="value1" size="small" @change="pickerChange" value-format="yyyy-MM-dd HH:mm:ss" class="j-date-input" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
           </el-date-picker>
         </div>
         <Search @getSearchData="getSearchData" @clearSearchData="clearSearch" :isTitle="false" :isSlot="false" />
@@ -113,6 +113,22 @@ export default {
         BeginTime: "",
         EndTime: ""
       });
+    },
+    pickerChange (val) {
+      if (val) {
+        if (val && val.length) {
+          this.BeginTime = val[0];
+          this.EndTime = val[1];
+        }
+      } else {
+        this.BeginTime = "";
+        this.EndTime = "";
+        this.getLogList({
+          Msg: this.Msg,
+          BeginTime: "",
+          EndTime: ""
+        });
+      }
     }
   }
 }