Browse Source

角色编辑页添加隐藏节点功能;用户列表页新增账号查询条件;时间传参格式更改

gr 2 years ago
parent
commit
2ddfa5aa20

+ 4 - 4
src/router/index.js

@@ -146,13 +146,13 @@ export function resetRouter() {
 router.beforeEach((to, from, next) => {
   vaildJWT(getCookie("m_token")).then(res=>{
     if (res.code==="200") {
-      if(getCookie('name')==='') {
-        setCookie('name', res.data.name, 1)
+      if(getCookie('userInfo')==='') {
+        setCookie('userInfo', JSON.stringify(res.data), 1)
       }
       next()
     }else {
       deleteCookie('m_token')
-      deleteCookie('name')
+      deleteCookie('userInfo')
       deleteCookie('authority')
       window.open(
         `http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home`,
@@ -164,7 +164,7 @@ router.beforeEach((to, from, next) => {
     }
   },error=>{
     deleteCookie('m_token')
-    deleteCookie('name')
+    deleteCookie('userInfo')
     deleteCookie('authority')
      window.open(
       `http://47.101.207.123:8080/platform-rk/#/login?url=http://47.101.207.123:8080/user_authentication/#/home`,

+ 2 - 1
src/utils/service/user.js

@@ -16,7 +16,8 @@ export function GetUserList(pageSize, pageIndex, formInLine) {
     pageIndex,
     departmentId: formInLine.departmentId
   }
-  if(formInLine.account != '') { data = { ...data, lastName: formInLine.account } }
+  if(formInLine.lastName != '') { data = { ...data, lastName: formInLine.lastName } }
+  if(formInLine.userName != '') { data = { ...data, userName: formInLine.userName } }
   return axios.post('/user/getUserList', qs.stringify(data))
 }
 

+ 3 - 1
src/views/home/AppIndex.vue

@@ -71,7 +71,7 @@
     },
     computed: {
       userName() {
-        return getCookie('name')
+        return JSON.parse(getCookie('userInfo')).name
       }
     },
     methods: {
@@ -96,6 +96,8 @@
           Logout().then(res => {
             if(res.code == 200) {
               deleteCookie('m_token')
+              deleteCookie('userInfo')
+              deleteCookie('authority')
               window.location.reload()
             }
           })

+ 11 - 2
src/views/homePage/Index.vue

@@ -8,10 +8,10 @@
           </el-col>
           <el-col :span="13" class="text-left user-info-col">
             <div class="user-info-one">
-              <span>欢迎,管理员</span>
+              <span>欢迎,{{userName}}</span>
             </div>
             <div class="user-info-two">
-              <span>信息中心</span>
+              <span>{{unitName}}</span>
             </div>
           </el-col>
           <el-col :span="3" class="num-info-col">
@@ -59,6 +59,7 @@
   import { GetDepartmentUser } from '../../utils/service/user'
   import {timeFormatter_13} from '../../utils/formatter/date'
   import {GetUserLogList} from '../../utils/service/log'
+  import { getCookie } from "../../utils/service/cookie"
 
   export default {
     name: "HomePage",
@@ -71,6 +72,14 @@
         departmentSum: 0
       }
     },
+    computed: {
+      userName() {
+        return JSON.parse(getCookie('userInfo')).name
+      },
+      unitName() {
+        return JSON.parse(getCookie('userInfo')).unitName
+      }
+    },
     methods: {
       loadChartBmrytj() {
         var chartDom = document.getElementById("bmrytj-chart");

+ 12 - 8
src/views/logManage/SysOperationLog.vue

@@ -1,27 +1,31 @@
 <template>
   <div class="height-100">
     <el-card class="card-query margin-bottom-20">
-      <el-form label-width="90px" :model="form" size="medium">
+      <el-form ref="form" label-width="90px" :model="form" size="medium">
         <div class="form-input">
-          <el-form-item label="操作用户:">
-            <el-input v-model="form.userName" :clearable="true"></el-input>
+          <el-form-item label="操作用户:" prop="userName">
+            <el-input v-model="form.userName" clearable></el-input>
           </el-form-item>
-          <el-form-item label="操作模块:">
-            <el-select v-model="form.source" placeholder="全部">
+          <el-form-item label="操作模块:" prop="source">
+            <el-select v-model="form.source" clearable placeholder="全部">
               <el-option v-for="item in sourceArr" :key="item" :label="item" :value="item"/>
             </el-select>
           </el-form-item>
-          <el-form-item label="时间:" class="date-picker-left">
+          <el-form-item label="时间:" class="date-picker-left" prop="startTime">
             <el-date-picker
               v-model="form.startTime"
               type="datetime"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              clearable
               placeholder="开始时间">
             </el-date-picker>
           </el-form-item>
-          <el-form-item label="-" class="date-picker-right">
+          <el-form-item label="-" class="date-picker-right" prop="endTime">
             <el-date-picker
               v-model="form.endTime"
               type="datetime"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              clearable
               placeholder="截止时间">
             </el-date-picker>
           </el-form-item>
@@ -120,7 +124,7 @@
         this.getList()
       },
       handleReset() {
-        this.form = { userName: "", source: "", startTime: "", endTime: "" }
+        this.$refs.form.resetFields()
         this.getList()
       }
     },

+ 24 - 8
src/views/logManage/UserLoginLogs.vue

@@ -1,24 +1,26 @@
 <template>
   <div class="height-100">
     <el-card class="card-query margin-bottom-20">
-      <el-form label-width="90px" :model="form" size="medium">
+      <el-form ref="form" label-width="90px" :model="form" size="medium">
         <div class="form-input">
-          <el-form-item label="组织机构:">
-            <el-select v-model="form.departmentId" placeholder="全部">
-              <el-option v-for="item in departmentArr" :key="item.id" :label="item.departmentname" :value="item.id"/>
+          <el-form-item label="组织机构:" prop="departmentId">
+            <el-select v-model="form.departmentId" filterable clearable placeholder="全部">
+              <el-option v-for="item in departmentArr" :key="item.id" :label="item.name" :value="item.id"/>
             </el-select>
           </el-form-item>
-          <el-form-item label="时间:" class="date-picker-left">
+          <el-form-item label="时间:" class="date-picker-left" prop="startTime">
             <el-date-picker
               v-model="form.startTime"
               type="datetime"
+              value-format="yyyy-MM-dd HH:mm:ss"
               placeholder="开始时间">
             </el-date-picker>
           </el-form-item>
-          <el-form-item label="-" class="date-picker-right">
+          <el-form-item label="-" class="date-picker-right" prop="endTime">
             <el-date-picker
               v-model="form.endTime"
               type="datetime"
+              value-format="yyyy-MM-dd HH:mm:ss"
               placeholder="截止时间">
             </el-date-picker>
           </el-form-item>
@@ -100,7 +102,21 @@
       getdepartmentArr() {
         GetDepartmentTree().then(res => {
           if(res.code == 200) {
-            this.departmentArr = res.data.Rows
+            let arr = []
+            res.data.data.forEach(level1 => {
+              arr.push({id: level1.id, name: level1.departmentname})
+              if(level1.children && level1.children.length > 0) {
+                level1.children.forEach(level2 => {
+                  arr.push({id: level2.id, name: level1.departmentname+'-'+level2.departmentname})
+                  if(level2.children && level2.children.length > 0) {
+                    level2.children.forEach(level3 => {
+                      arr.push({id: level3.id, name: level1.departmentname+'-'+level2.departmentname+'-'+level3.departmentname})
+                    })
+                  }
+                })
+              }
+            })
+            this.departmentArr = arr
           }
         })
       },
@@ -109,7 +125,7 @@
         this.getList()
       },
       handleReset() {
-        this.form = { departmentId: "", startTime: "", endTime: "" }
+        this.$refs.form.resetFields()
         this.getList()
       },
       timeFormatter(row) {

+ 9 - 14
src/views/userManage/AuthManageEdit.vue

@@ -24,6 +24,7 @@
               node-key="authorityId"
               :default-expanded-keys="defaultExpand[index]"
               :ref="'tree-'+index"
+              :filter-node-method="filterNode"
               show-checkbox>
             </el-tree>
           </el-col>
@@ -62,6 +63,9 @@
       }
     },
     methods: {
+      filterNode(value, data, node) {   // 隐藏 isShow=0 的节点
+        return +data.isShow===1
+      },
       getTreeData() {
         GetAuthorityList().then(res => {
           if(res.code == 200) {
@@ -73,11 +77,11 @@
             })
             this.treeData = treeTemp
             this.defaultExpand = defaultExpandTemp
-            /* if(this.isDetail) {
-              this.treeData.forEach((item) => {
-                this.loopMuduleTreeDisabled(item, this)
-              })
-            } */
+            this.$nextTick(() => {    // 隐藏 isShow=0 的节点
+              for(let i=0; i<this.treeData.length; i++) {
+                this.$refs[`tree-${i}`][0].filter(0)
+              }
+            })
           }
         })
       },
@@ -135,7 +139,6 @@
               return false
             }
           })
-          
         }
       },
       close() {
@@ -143,14 +146,6 @@
           name: "AuthManage"
         })
       },
-      /* loopMuduleTreeDisabled (arr, that) {
-        arr.forEach((item) => {
-          that.$set(item, 'disabled', true)
-          if (item.data && item.data.length > 0) {
-            this.loopMuduleTreeDisabled(item.data, that)
-          }
-        })
-      }, */
       getTaskType() {
         if(this.$route.name === 'AuthManageDetail') {
           this.isDetail = true

+ 6 - 5
src/views/userManage/UserList.vue

@@ -21,7 +21,10 @@
           <el-form label-width="60px" :model="formInLine" size="medium">
             <div class="form-input">
               <el-form-item label="姓名:">
-                <el-input v-model="formInLine.account" :clearable="true" @clear="handleNameClear"></el-input>
+                <el-input v-model="formInLine.lastName" :clearable="true" @clear="handleQuery"></el-input>
+              </el-form-item>
+              <el-form-item label="账号:">
+                <el-input v-model="formInLine.userName" :clearable="true" @clear="handleQuery"></el-input>
               </el-form-item>
             </div>
             <div class="form-button">
@@ -84,7 +87,8 @@
     data() {
       return {
         formInLine: {
-          account: '',
+          lastName: '',
+          userName: '',
           departmentId: '',
         },
         tableData: [],
@@ -126,9 +130,6 @@
         }
         this.getList()
       },
-      handleNameClear() {
-        this.getList()
-      },
       toDetail(row) {
         this.$router.push({
           name: "UserListDetail",