Browse Source

首页相关权限处理

master
xuhuajiao 9 months ago
parent
commit
c9bfd28013
  1. 3
      src/router/index.js
  2. 4
      src/views/archivesManage/archivesCheck/module/checkDetail.vue
  3. 19
      src/views/archivesManage/archivesSearch/index.vue
  4. 5
      src/views/archivesManage/lendManage/index.vue
  5. 6
      src/views/archivesManage/outInStorage/module/detailDialog.vue
  6. 27
      src/views/components/AccessDoor.vue
  7. 27
      src/views/components/SecurityDoor.vue
  8. 27
      src/views/components/WarehouseWarning.vue
  9. 53
      src/views/dashboard/PanelGroup.vue
  10. 57
      src/views/home.vue
  11. 2
      src/views/login.vue
  12. 5
      src/views/system/logManage/index.vue

3
src/router/index.js

@ -57,7 +57,8 @@ export const loadMenus = (next, to) => {
const rdata = JSON.parse(JSON.stringify(res)) const rdata = JSON.parse(JSON.stringify(res))
const sidebarRoutes = filterAsyncRouter(sdata) const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true) const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
// 当前用户角色登录后,无上次缓存页面权限,即跳转到首页而不是404
rewriteRoutes.push({ path: '*', redirect: '/', hidden: true })
store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由 store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由
router.addRoutes(rewriteRoutes) // 动态添加可访问路由表 router.addRoutes(rewriteRoutes) // 动态添加可访问路由表

4
src/views/archivesManage/archivesCheck/module/checkDetail.vue

@ -107,8 +107,8 @@
<el-table-column prop="storageNum" align="center" label="在库" min-width="60" /> <el-table-column prop="storageNum" align="center" label="在库" min-width="60" />
<el-table-column prop="borrowNum" align="center" label="已借" min-width="60" /> <el-table-column prop="borrowNum" align="center" label="已借" min-width="60" />
<el-table-column prop="caseName" label="盒名称" :show-overflow-tooltip="true" align="center" min-width="190" /> <el-table-column prop="caseName" label="盒名称" :show-overflow-tooltip="true" align="center" min-width="190" />
<el-table-column prop="tid" label="TID" align="center" min-width="220" />
<el-table-column prop="barcode" label="条形码" align="center" min-width="120" />
<el-table-column prop="tid" label="TID" align="center" min-width="220" :show-overflow-tooltip="true" />
<el-table-column prop="barcode" label="条形码" align="center" min-width="140" :show-overflow-tooltip="true" />
<el-table-column label="存放位置" align="center" min-width="300"> <el-table-column label="存放位置" align="center" min-width="300">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="!scope.row.folderLocationDetails">-</span> <span v-if="!scope.row.folderLocationDetails">-</span>

19
src/views/archivesManage/archivesSearch/index.vue

@ -138,6 +138,7 @@ import { getCategoryTree } from '@/api/category/category'
import { querySeniorArchives } from '@/api/archivesManage/archivesList' import { querySeniorArchives } from '@/api/archivesManage/archivesList'
import { FetchIsExistBorrow, FetchAddArchivesWaitRegister } from '@/api/archivesManage/lendManage' import { FetchIsExistBorrow, FetchAddArchivesWaitRegister } from '@/api/archivesManage/lendManage'
import CallExternal from '@/api/storeManage/deviceManage/device' import CallExternal from '@/api/storeManage/deviceManage/device'
import { mapGetters } from 'vuex'
export default { export default {
name: 'ArchivesSearch', name: 'ArchivesSearch',
components: { ArchivesInfo }, components: { ArchivesInfo },
@ -213,6 +214,11 @@ export default {
] ]
} }
}, },
computed: {
...mapGetters([
'roles'
])
},
async created() { async created() {
await this.getDeviceListAll() await this.getDeviceListAll()
}, },
@ -348,10 +354,17 @@ export default {
return return
} }
if (this.$route.path.indexOf('dashboard') !== -1) { if (this.$route.path.indexOf('dashboard') !== -1) {
this.$router.push('/archivesManage/archivesSearch')
localStorage.setItem('homeSearchWords', this.keywords)
localStorage.setItem('homeSearchSelect', JSON.stringify(this.select))
if (this.roles.includes('admin') || this.roles.includes('archivesSearch:list')) {
this.$router.push('/archivesManage/archivesSearch')
localStorage.setItem('homeSearchWords', this.keywords)
localStorage.setItem('homeSearchSelect', JSON.stringify(this.select))
// localStorage.setItem('homeSearchCheckbox', JSON.stringify([3, 4, 5])) // localStorage.setItem('homeSearchCheckbox', JSON.stringify([3, 4, 5]))
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
} else { } else {
this.dimSearch() this.dimSearch()
} }

5
src/views/archivesManage/lendManage/index.vue

@ -69,6 +69,11 @@ export default {
return 'toLend' return 'toLend'
} }
}, },
created() {
if (this.$route.params.locationIndex) {
this.activeIndex = this.$route.params.locationIndex
}
},
methods: { methods: {
changeActiveTab(data) { changeActiveTab(data) {
this.activeIndex = data this.activeIndex = data

6
src/views/archivesManage/outInStorage/module/detailDialog.vue

@ -37,13 +37,13 @@
</el-table-column> </el-table-column>
<el-table-column prop="categoryName" align="center" label="门类名称" width="140" show-overflow-tooltip /> <el-table-column prop="categoryName" align="center" label="门类名称" width="140" show-overflow-tooltip />
<el-table-column prop="fondsNo" align="center" label="全宗号" width="80" /> <el-table-column prop="fondsNo" align="center" label="全宗号" width="80" />
<el-table-column prop="archiveNo" align="center" label="档号" width="160" />
<el-table-column prop="archiveNo" align="center" label="档号" min-width="200" show-overflow-tooltip />
<el-table-column prop="archiveYear" align="center" label="归档年度" width="100" /> <el-table-column prop="archiveYear" align="center" label="归档年度" width="100" />
<el-table-column prop="maintitle" align="center" label="题名" width="140" show-overflow-tooltip /> <el-table-column prop="maintitle" align="center" label="题名" width="140" show-overflow-tooltip />
<el-table-column prop="securityClass" align="center" label="保密程度" width="140" /> <el-table-column prop="securityClass" align="center" label="保密程度" width="140" />
<el-table-column prop="department" align="center" label="部门" width="100" /> <el-table-column prop="department" align="center" label="部门" width="100" />
<el-table-column prop="caseName" align="center" label="盒名称" width="140" />
<el-table-column prop="folderLocationDetails" align="center" label="所在位置" width="300">
<el-table-column prop="caseName" align="center" label="盒名称" min-width="200" show-overflow-tooltip />
<el-table-column prop="folderLocationDetails" align="center" label="所在位置" width="300" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="!scope.row.folderLocationDetails">-</span> <span v-if="!scope.row.folderLocationDetails">-</span>
<span v-else> <span v-else>

27
src/views/components/AccessDoor.vue

@ -2,12 +2,12 @@
<div class="container-wrap"> <div class="container-wrap">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title">
<p class="title-arrow">
<h3 class="table-title" @click="toPage">
<p class="title-arrow" style="cursor: pointer;">
<svg-icon icon-class="menjin" class-name="warehouse-svg" />通道门记录 <svg-icon icon-class="menjin" class-name="warehouse-svg" />通道门记录
</p> </p>
</h3> </h3>
<el-table ref="table" style="min-width: 100%;" :height="height" :data="tableData" class="warehose-el-table" stripe>
<el-table ref="table" style="min-width: 100%;" :height="height" :data="tableData" class="warehose-el-table" stripe @row-click="toPage">
<el-table-column prop="createTime" label="时间" align="center" width="100"> <el-table-column prop="createTime" label="时间" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.createTime | parseTime }}</div> <div>{{ scope.row.createTime | parseTime }}</div>
@ -24,6 +24,7 @@
</template> </template>
<script> <script>
import { accessDoor } from '@/api/home/accessDoor/accessDoor' import { accessDoor } from '@/api/home/accessDoor/accessDoor'
import { mapGetters } from 'vuex'
export default { export default {
name: 'AccessDoor', name: 'AccessDoor',
props: { props: {
@ -43,6 +44,11 @@ export default {
getDataTimer: null getDataTimer: null
} }
}, },
computed: {
...mapGetters([
'roles'
])
},
watch: { watch: {
// `tableData` // `tableData`
tableData: function(newData, oldData) { tableData: function(newData, oldData) {
@ -57,6 +63,21 @@ export default {
this.scrollTimer = null this.scrollTimer = null
}, },
methods: { methods: {
toPage() {
if (this.roles.includes('admin') || this.roles.includes('logManage:list')) {
this.$router.push({
name: 'LogManage',
params: {
locationIndex: 3
}
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
},
// //
rowBgColor({ row, rowIndex }) { rowBgColor({ row, rowIndex }) {
if (rowIndex % 2 === 1) { if (rowIndex % 2 === 1) {

27
src/views/components/SecurityDoor.vue

@ -2,12 +2,12 @@
<div class="container-wrap"> <div class="container-wrap">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class="table-title">
<p class="title-arrow">
<h3 class="table-title" @click="toPage">
<p class="title-arrow" style="cursor: pointer;">
<svg-icon icon-class="menjin" class-name="warehouse-svg" />门禁记录 <svg-icon icon-class="menjin" class-name="warehouse-svg" />门禁记录
</p> </p>
</h3> </h3>
<el-table ref="table" style="min-width: 100%;" :height="height" :data="tableData" class="warehose-el-table" stripe>
<el-table ref="table" style="min-width: 100%;" :height="height" :data="tableData" class="warehose-el-table" stripe @row-click="toPage">
<el-table-column prop="hisTime" label="时间" align="center" width="160"> <el-table-column prop="hisTime" label="时间" align="center" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ scope.row.hisTime | parseTime }}</div> <div>{{ scope.row.hisTime | parseTime }}</div>
@ -29,6 +29,7 @@
</template> </template>
<script> <script>
import { securitydoor } from '@/api/home/securityDoor/securityDoor' import { securitydoor } from '@/api/home/securityDoor/securityDoor'
import { mapGetters } from 'vuex'
export default { export default {
name: 'SecurityDoor', name: 'SecurityDoor',
props: { props: {
@ -48,6 +49,11 @@ export default {
getDataTimer: null getDataTimer: null
} }
}, },
computed: {
...mapGetters([
'roles'
])
},
watch: { watch: {
// `tableData` // `tableData`
tableData: function(newData, oldData) { tableData: function(newData, oldData) {
@ -62,6 +68,21 @@ export default {
this.scrollTimer = null this.scrollTimer = null
}, },
methods: { methods: {
toPage() {
if (this.roles.includes('admin') || this.roles.includes('logManage:list')) {
this.$router.push({
name: 'LogManage',
params: {
locationIndex: 4
}
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
},
// //
rowBgColor({ row, rowIndex }) { rowBgColor({ row, rowIndex }) {
if (rowIndex % 2 === 1) { if (rowIndex % 2 === 1) {

27
src/views/components/WarehouseWarning.vue

@ -2,13 +2,13 @@
<div class="warehouse-right container-wrap"> <div class="warehouse-right container-wrap">
<span class="right-top-line" /> <span class="right-top-line" />
<span class="left-bottom-line" /> <span class="left-bottom-line" />
<h3 class=" table-title">
<p class="title-arrow">
<h3 class=" table-title" @click="toPage">
<p class="title-arrow" style="cursor: pointer;">
<svg-icon icon-class="alerm" class-name="warehouse-svg" />报警记录 <svg-icon icon-class="alerm" class-name="warehouse-svg" />报警记录
</p> </p>
</h3> </h3>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" style="min-width: 100%;" :width="width" :height="height" :data="tableData" class="warehose-el-table" :row-class-name="rowBgColor">
<el-table ref="table" style="min-width: 100%;" :width="width" :height="height" :data="tableData" class="warehose-el-table" :row-class-name="rowBgColor" @row-click="toPage">
<el-table-column prop="alarm_time" label="时间" align="center" min-width="60" /> <el-table-column prop="alarm_time" label="时间" align="center" min-width="60" />
<el-table-column prop="area_name" label="库房" align="center" :show-overflow-tooltip="true" min-width="30" /> <el-table-column prop="area_name" label="库房" align="center" :show-overflow-tooltip="true" min-width="30" />
<el-table-column prop="event_name" label="警情" align="center" :show-overflow-tooltip="true" min-width="85" /> <el-table-column prop="event_name" label="警情" align="center" :show-overflow-tooltip="true" min-width="85" />
@ -17,6 +17,7 @@
</template> </template>
<script> <script>
import alarmApi from '@/api/home/alarm' import alarmApi from '@/api/home/alarm'
import { mapGetters } from 'vuex'
export default { export default {
name: 'WarehouseWarning', name: 'WarehouseWarning',
props: { props: {
@ -39,6 +40,11 @@ export default {
scrollTimer: null scrollTimer: null
} }
}, },
computed: {
...mapGetters([
'roles'
])
},
watch: { watch: {
// `tableData` // `tableData`
tableData: function(newData, oldData) { tableData: function(newData, oldData) {
@ -53,6 +59,21 @@ export default {
this.scrollTimer = null this.scrollTimer = null
}, },
methods: { methods: {
toPage() {
if (this.roles.includes('admin') || this.roles.includes('logManage:list')) {
this.$router.push({
name: 'LogManage',
params: {
locationIndex: 2
}
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
},
// //
rowBgColor({ row, rowIndex }) { rowBgColor({ row, rowIndex }) {
if (rowIndex % 2 === 1) { if (rowIndex % 2 === 1) {

53
src/views/dashboard/PanelGroup.vue

@ -1,7 +1,7 @@
<template> <template>
<el-row :gutter="20" class="panel-group" type="flex" justify="space-between"> <el-row :gutter="20" class="panel-group" type="flex" justify="space-between">
<el-col class="card-panel-col"> <el-col class="card-panel-col">
<div class="card-panel danganzongliang" @click="handleSetLineChartData('newVisitis')">
<div class="card-panel danganzongliang" @click="handleSetLineChartData('archives')">
<div class="card-panel-icon-wrapper icon-people"> <div class="card-panel-icon-wrapper icon-people">
<svg-icon icon-class="danganzongliang" class-name="card-panel-icon" /> <svg-icon icon-class="danganzongliang" class-name="card-panel-icon" />
</div> </div>
@ -14,7 +14,7 @@
</div> </div>
</el-col> </el-col>
<el-col class="card-panel-col"> <el-col class="card-panel-col">
<div class="card-panel danganhezongliang" @click="handleSetLineChartData('messages')">
<div class="card-panel danganhezongliang" @click="handleSetLineChartData('case')">
<div class="card-panel-icon-wrapper icon-message"> <div class="card-panel-icon-wrapper icon-message">
<svg-icon icon-class="danganhezongliang" class-name="card-panel-icon" /> <svg-icon icon-class="danganhezongliang" class-name="card-panel-icon" />
</div> </div>
@ -27,7 +27,7 @@
</div> </div>
</el-col> </el-col>
<el-col class="card-panel-col"> <el-col class="card-panel-col">
<div class="card-panel quanbushebei" @click="handleSetLineChartData('purchases')">
<div class="card-panel quanbushebei" @click="handleSetLineChartData('device')">
<div class="card-panel-icon-wrapper icon-money"> <div class="card-panel-icon-wrapper icon-money">
<svg-icon icon-class="quanbushebei" class-name="card-panel-icon" /> <svg-icon icon-class="quanbushebei" class-name="card-panel-icon" />
</div> </div>
@ -41,7 +41,7 @@
</div> </div>
</el-col> </el-col>
<el-col class="card-panel-col"> <el-col class="card-panel-col">
<div class="card-panel zaixianshebei" @click="handleSetLineChartData('shoppings')">
<div class="card-panel zaixianshebei" @click="handleSetLineChartData('device')">
<div class="card-panel-icon-wrapper icon-shopping"> <div class="card-panel-icon-wrapper icon-shopping">
<svg-icon icon-class="zaixianshebei" class-name="card-panel-icon" /> <svg-icon icon-class="zaixianshebei" class-name="card-panel-icon" />
</div> </div>
@ -55,7 +55,7 @@
</div> </div>
</el-col> </el-col>
<el-col class="card-panel-col"> <el-col class="card-panel-col">
<div class="card-panel lixianshebei" @click="handleSetLineChartData('shoppings')">
<div class="card-panel lixianshebei" @click="handleSetLineChartData('device')">
<div class="card-panel-icon-wrapper icon-shopping"> <div class="card-panel-icon-wrapper icon-shopping">
<svg-icon icon-class="lixianshebei" class-name="card-panel-icon" /> <svg-icon icon-class="lixianshebei" class-name="card-panel-icon" />
</div> </div>
@ -76,6 +76,7 @@ import CountTo from 'vue-count-to'
import { FetchGetArchivesNum, FetchGetCaseNum } from '@/api/archivesManage/statistics' import { FetchGetArchivesNum, FetchGetCaseNum } from '@/api/archivesManage/statistics'
import { getDeviceList } from '@/api/storeManage/deviceManage/device' import { getDeviceList } from '@/api/storeManage/deviceManage/device'
import { getOnlineDevice } from '@/api/home/device' import { getOnlineDevice } from '@/api/home/device'
import { mapGetters } from 'vuex'
export default { export default {
components: { components: {
@ -91,6 +92,11 @@ export default {
offlineDeviceNum: 0 offlineDeviceNum: 0
} }
}, },
computed: {
...mapGetters([
'roles'
])
},
mounted() { mounted() {
this.handleArchivesNum() this.handleArchivesNum()
this.handleCaseNum() this.handleCaseNum()
@ -98,7 +104,41 @@ export default {
}, },
methods: { methods: {
handleSetLineChartData(type) { handleSetLineChartData(type) {
this.$emit('handleSetLineChartData', type)
// this.$emit('handleSetLineChartData', type)
if (type === 'archives') {
if (this.roles.includes('archivesList:list') || this.roles.includes('admin')) {
this.$router.push({
name: 'ArchivesList'
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
} else if (type === 'case') {
if (this.roles.includes('caseManage:list') || this.roles.includes('admin')) {
this.$router.push({
name: 'caseManage'
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
} else if (type === 'device') {
if (this.roles.includes('deviceManage:list') || this.roles.includes('admin')) {
this.$router.push({
name: 'DeviceManage'
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
}
}, },
// //
handleArchivesNum() { handleArchivesNum() {
@ -132,6 +172,7 @@ export default {
} }
.card-panel { .card-panel {
cursor: pointer;
height: 100px; height: 100px;
// height: 108px; // height: 108px;
// cursor: pointer; // cursor: pointer;

57
src/views/home.vue

@ -88,7 +88,7 @@
</h3> </h3>
<div style="height: calc(100% - 40px);overflow-y: auto;overflow-x: hidden;"> <div style="height: calc(100% - 40px);overflow-y: auto;overflow-x: hidden;">
<ul v-if="waitBorrowerData.length !== 0" class="todo-list"> <ul v-if="waitBorrowerData.length !== 0" class="todo-list">
<li v-for="(item,index) in waitBorrowerData" :key="index">
<li v-for="(item,index) in waitBorrowerData" :key="index" @click="handleToWaiting(item)">
<el-tooltip class="item" effect="dark" :content="item.title" :enterable="false" placement="top"> <el-tooltip class="item" effect="dark" :content="item.title" :enterable="false" placement="top">
<p>{{ item.title }}</p> <p>{{ item.title }}</p>
</el-tooltip> </el-tooltip>
@ -171,6 +171,8 @@ import SearchAcrives from '@/views/archivesManage/archivesSearch/index'
import { statisticsCrud } from '@/views/system/archiveStatistics/mixins/statistics' import { statisticsCrud } from '@/views/system/archiveStatistics/mixins/statistics'
import { FetchWaitBorrower } from '@/api/archivesManage/lendManage' import { FetchWaitBorrower } from '@/api/archivesManage/lendManage'
import { mapGetters } from 'vuex'
export default { export default {
name: 'Dashboard', name: 'Dashboard',
components: { components: {
@ -190,6 +192,11 @@ export default {
isHomeSearch: false isHomeSearch: false
} }
}, },
computed: {
...mapGetters([
'roles'
])
},
created() { created() {
this.getWaitBorrower() this.getWaitBorrower()
}, },
@ -215,13 +222,49 @@ export default {
}) })
}, },
changeActiveTab(floorId, roomId) { changeActiveTab(floorId, roomId) {
this.$router.push({
name: 'warehouse3D',
params: {
floorId: floorId,
roomId: roomId
if (this.roles.includes('admin') || this.roles.includes('warehouse3D')) {
this.$router.push({
name: 'warehouse3D',
params: {
floorId: floorId,
roomId: roomId
}
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
},
handleToWaiting(item) {
if (this.roles.includes('admin') || this.roles.includes('lendManage:list')) {
// 0
// 1
// 2
// 3
let locationIndex = 0
if (item.title.includes('待借档案')) {
locationIndex = 0
} else if (item.title.includes('借出确认')) {
locationIndex = 1
} else if (item.title.includes('逾期警告')) {
locationIndex = 2
} else if (item.title.includes('即将到期')) {
locationIndex = 2
} }
})
this.$router.push({
name: 'lendManage',
params: {
locationIndex: locationIndex
}
})
} else {
this.$message({
message: '当前账号没有权限',
type: 'warning'
})
}
} }
} }
} }

2
src/views/login.vue

@ -192,7 +192,7 @@ export default {
} }
this.$store this.$store
.dispatch('Login', user) .dispatch('Login', user)
.then(() => {
.then((res) => {
this.loading = false this.loading = false
this.$router.push({ path: this.redirect || '/' }) this.$router.push({ path: this.redirect || '/' })
}) })

5
src/views/system/logManage/index.vue

@ -61,6 +61,11 @@ export default {
return 'loginLog' return 'loginLog'
} }
}, },
created() {
if (this.$route.params.locationIndex) {
this.activeIndex = this.$route.params.locationIndex
}
},
methods: { methods: {
changeActiveTab(data) { changeActiveTab(data) {
this.activeIndex = data this.activeIndex = data

Loading…
Cancel
Save