|
@@ -18,16 +18,25 @@
|
|
<!-- </el-tooltip>-->
|
|
<!-- </el-tooltip>-->
|
|
|
|
|
|
<!-- 消息中心 -->
|
|
<!-- 消息中心 -->
|
|
- <el-badge is-dot class="item">
|
|
|
|
- <span class="el-icon-bell"></span>
|
|
|
|
- </el-badge>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ <span v-show="alarmIconShow">
|
|
|
|
+ <span v-if="isMessage" key="1">
|
|
|
|
+ <el-tooltip content="告警消息" placement="bottom">
|
|
|
|
+ <a href='javascript:;' @click="showAlarm" >
|
|
|
|
+ <svg-icon icon-class="notice" class="right-menu-item1 hover-effect1"/>
|
|
|
|
+ </a>
|
|
|
|
+ </el-tooltip>
|
|
|
|
+ </span>
|
|
|
|
+ <span v-else key="2">
|
|
|
|
+ <el-tooltip content="告警消息" placement="bottom">
|
|
|
|
+ <svg-icon icon-class="notice_none" class="right-menu-item1 hover-effect1"/>
|
|
|
|
+ </el-tooltip>
|
|
|
|
+ </span>
|
|
|
|
+ </span>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <el-tooltip content="全屏" placement="bottom">
|
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
|
-
|
|
|
|
|
|
+ </el-tooltip>
|
|
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom">-->
|
|
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom">-->
|
|
<!-- <size-select id="size-select" class="right-menu-item hover-effect" />-->
|
|
<!-- <size-select id="size-select" class="right-menu-item hover-effect" />-->
|
|
<!-- </el-tooltip>-->
|
|
<!-- </el-tooltip>-->
|
|
@@ -49,6 +58,41 @@
|
|
</el-dropdown-menu>
|
|
</el-dropdown-menu>
|
|
</el-dropdown>
|
|
</el-dropdown>
|
|
</div>
|
|
</div>
|
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="750px" append-to-body>
|
|
|
|
+ <div style="padding-top: 10px">
|
|
|
|
+ <vxe-table
|
|
|
|
+ ref="xTable"
|
|
|
|
+ align="center"
|
|
|
|
+ :loading="loading"
|
|
|
|
+ class="mytable-style"
|
|
|
|
+ auto-resize
|
|
|
|
+ border
|
|
|
|
+ resizable
|
|
|
|
+ export-config
|
|
|
|
+ highlight-current-row
|
|
|
|
+ show-overflow
|
|
|
|
+ max-height="700"
|
|
|
|
+ :data="alarmList"
|
|
|
|
+ >
|
|
|
|
+ <vxe-table-column field="alarmContent" title="告警内容" />
|
|
|
|
+ <vxe-table-column field="createTime" title="时间" width="200px"/>
|
|
|
|
+ <vxe-table-column title="操作" width="100px">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-reading"
|
|
|
|
+ @click="readDone(scope.row)"
|
|
|
|
+ >查收
|
|
|
|
+ </el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </vxe-table-column>
|
|
|
|
+ </vxe-table>
|
|
|
|
+ </div>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="cancel">关 闭</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -59,6 +103,10 @@ import TopNav from '@/components/TopNav'
|
|
import Hamburger from '@/components/Hamburger'
|
|
import Hamburger from '@/components/Hamburger'
|
|
import {removeToken} from "@/utils/auth";
|
|
import {removeToken} from "@/utils/auth";
|
|
import Screenfull from '@/components/Screenfull'
|
|
import Screenfull from '@/components/Screenfull'
|
|
|
|
+import XEUtils from 'xe-utils'
|
|
|
|
+import moment from "moment";
|
|
|
|
+import {userinfoDecrypt, userinfoEncrypt} from "@/utils/smutil";
|
|
|
|
+import {debounce} from "lodash";
|
|
// import SizeSelect from '@/components/SizeSelect'
|
|
// import SizeSelect from '@/components/SizeSelect'
|
|
// import Search from '@/components/HeaderSearch'
|
|
// import Search from '@/components/HeaderSearch'
|
|
// import RuoYiGit from '@/components/RuoYi/Git'
|
|
// import RuoYiGit from '@/components/RuoYi/Git'
|
|
@@ -67,10 +115,17 @@ import Screenfull from '@/components/Screenfull'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ interval: null,
|
|
|
|
+ isMessage:false,
|
|
|
|
+ alarmIconShow:false,
|
|
|
|
+ title:'告警消息',
|
|
|
|
+ loading:false,
|
|
|
|
+ alarmList:null,
|
|
|
|
+ // 是否显示弹出层
|
|
|
|
+ open: false,
|
|
message: 2
|
|
message: 2
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
components: {
|
|
components: {
|
|
Breadcrumb,
|
|
Breadcrumb,
|
|
TopNav,
|
|
TopNav,
|
|
@@ -81,6 +136,14 @@ export default {
|
|
// RuoYiGit,
|
|
// RuoYiGit,
|
|
// RuoYiDoc
|
|
// RuoYiDoc
|
|
},
|
|
},
|
|
|
|
+ created() {
|
|
|
|
+ this.getCurrentUser()
|
|
|
|
+ },
|
|
|
|
+ beforeDestroy() {
|
|
|
|
+ if (this.interval) {
|
|
|
|
+ clearInterval(this.interval)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
computed: {
|
|
computed: {
|
|
...mapGetters([
|
|
...mapGetters([
|
|
'sidebar',
|
|
'sidebar',
|
|
@@ -105,6 +168,116 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ async getCurrentUser(){
|
|
|
|
+ var user;
|
|
|
|
+ await this.$axios.get('/sysUserController/getCurrentUser').then((res) => {
|
|
|
|
+ user = res.data.sysUser
|
|
|
|
+ // 用户信息+菜单权限加密存储
|
|
|
|
+ let encryptUserInfo = userinfoEncrypt(JSON.stringify(res.data))
|
|
|
|
+ sessionStorage.setItem('active',encryptUserInfo)
|
|
|
|
+ if (user.lastUpdatePwdTime==null){
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'warning',
|
|
|
|
+ message: '需要修改初始密码!'
|
|
|
|
+ });
|
|
|
|
+ this.$router.push("/user/profile")
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ var dateBegin = new Date(user.lastUpdatePwdTime);
|
|
|
|
+ var dateEnd = new Date();
|
|
|
|
+ var dateDiff = dateEnd.getTime() - dateBegin.getTime(); //时间差的毫秒数
|
|
|
|
+ var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000)); //计算出相差天数
|
|
|
|
+ if (dayDiff>=30){
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'warning',
|
|
|
|
+ message: '密码超过30天需要修改!'
|
|
|
|
+ })
|
|
|
|
+ this.$router.push("/user/profile")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }).catch((error) => {
|
|
|
|
+ this.$message.error('获取当前用户数据出错' + error)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // 获取角色是否系统管理员
|
|
|
|
+ const searchParams = {
|
|
|
|
+ userId: user.id
|
|
|
|
+ }
|
|
|
|
+ this.$axios.get('/sysUserController/getUserRole',{params: searchParams}).then((res) => {
|
|
|
|
+ let userRole = res.data
|
|
|
|
+ if (userRole.roleId==1){
|
|
|
|
+ this.getAlarmData()
|
|
|
|
+ // 系统管理员角色显示告警图标
|
|
|
|
+ this.alarmIconShow=true
|
|
|
|
+ // 增加定时每分钟获取告警消息
|
|
|
|
+ this.interval = setInterval(() => {
|
|
|
|
+ if (!this.open){
|
|
|
|
+ // 窗口关闭可以调用自动查询
|
|
|
|
+ this.getAlarmData()
|
|
|
|
+ }
|
|
|
|
+ }, 60000)
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ this.alarmIconShow=false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }).catch((error) => {
|
|
|
|
+ // this.$message.error(error)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 删除提交
|
|
|
|
+ */
|
|
|
|
+ readDone:debounce(function(row){
|
|
|
|
+ const param = {
|
|
|
|
+ id: row.id
|
|
|
|
+ }
|
|
|
|
+ this.$axios.post('/sysAlarmController/readDone', param).then((res) => {
|
|
|
|
+ if (res.code == 0) {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '查收成功!'
|
|
|
|
+ });
|
|
|
|
+ this.$refs.xTable.remove(row)
|
|
|
|
+ } else {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'error',
|
|
|
|
+ message: res.data
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }).catch((error) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'error',
|
|
|
|
+ message: '查收失败!'
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ },1000),
|
|
|
|
+ // 取消按钮
|
|
|
|
+ cancel() {
|
|
|
|
+ this.getAlarmData()
|
|
|
|
+ this.open = false
|
|
|
|
+ },
|
|
|
|
+ getAlarmData(){
|
|
|
|
+ this.loading = true
|
|
|
|
+ // 查询告警消息
|
|
|
|
+ this.$axios.get('/sysAlarmController/getAll').then((res) => {
|
|
|
|
+ this.alarmList = res.data
|
|
|
|
+ if (res.data.length>0){
|
|
|
|
+ // 改变消息图标
|
|
|
|
+ this.isMessage = true;
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ this.isMessage = false;
|
|
|
|
+ }
|
|
|
|
+ this.loading = false
|
|
|
|
+ }).catch((error) => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ // this.$message.error(error)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ showAlarm(){
|
|
|
|
+ this.open = true
|
|
|
|
+ },
|
|
toggleSideBar() {
|
|
toggleSideBar() {
|
|
this.$store.dispatch('app/toggleSideBar')
|
|
this.$store.dispatch('app/toggleSideBar')
|
|
},
|
|
},
|
|
@@ -133,26 +306,14 @@ export default {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
-.item {
|
|
|
|
- margin-top: 0px;
|
|
|
|
- margin-right: 15px;
|
|
|
|
|
|
+.right-menu-item1 {
|
|
|
|
+ position:relative;
|
|
|
|
+ top:-15px;
|
|
|
|
+ font-size: 18px;
|
|
}
|
|
}
|
|
-.btn-bell{
|
|
|
|
- position: relative;
|
|
|
|
- text-align: center;
|
|
|
|
- border-radius: 15px;
|
|
|
|
- cursor: pointer;
|
|
|
|
-}
|
|
|
|
-.btn-bell-badge{
|
|
|
|
- position: absolute;
|
|
|
|
- right: 0;
|
|
|
|
- top: -2px;
|
|
|
|
- border-radius: 4px;
|
|
|
|
- background: #f56c6c;
|
|
|
|
- color: #fff;
|
|
|
|
-}
|
|
|
|
-.btn-bell .el-icon-bell{
|
|
|
|
- color: #fff;
|
|
|
|
|
|
+.item{
|
|
|
|
+ margin-tip:5px;
|
|
|
|
+ margin-right:15px;
|
|
}
|
|
}
|
|
.navbar {
|
|
.navbar {
|
|
height: 50px;
|
|
height: 50px;
|
|
@@ -238,6 +399,24 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .right-menu-item1 {
|
|
|
|
+
|
|
|
|
+ height: 100%;
|
|
|
|
+ width: 27px;
|
|
|
|
+ font-size: 18px;
|
|
|
|
+ color: #5a5e66;
|
|
|
|
+ vertical-align: text-bottom;
|
|
|
|
+ top:0px;
|
|
|
|
+ &.hover-effect1 {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ transition: background .3s;
|
|
|
|
+
|
|
|
|
+ &:hover {
|
|
|
|
+ background: rgba(0, 0, 0, .025)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|