You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

361 lines
10 KiB
Vue

<template>
<div class="navbar">
<hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!topNav"/>
<top-nav id="topmenu-container" class="topmenu-container" v-if="topNav"/>
<div class="right-menu">
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>-->
<!-- <el-tooltip content="文档地址" effect="dark" placement="bottom">-->
<!-- <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>-->
<el-tooltip content="异常处理" class="right-menu-item hover-effect" >
<span
class="exceptionHandling"
:class="{ warnTxt: (pointRouterList && pointRouterList.length) || 0 }"
@click="getAlarmData(true)"
><i class="el-icon-message"></i>{{
(pointRouterList && pointRouterList.length > 0 && pointRouterList.length) || ""
}}
</span>
</el-tooltip>
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar">
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<!-- 警告对话框 -->
<el-dialog
:title="alarmTitle"
:visible.sync="alarmOpen"
width="800px"
append-to-body
>
<el-table
v-loading="alarmLoading"
:data="pointRouterList"
@selection-change="handleSelectionChangeAlarm"
>
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="功能模块" align="center" prop="moduleCode" >
<template slot-scope="scope">
<dict-tag :options="dict.type.module_code" :value="scope.row.moduleCode"/>
</template>
</el-table-column>
<el-table-column label="提示类型" align="center" prop="pointType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.point_type" :value="scope.row.pointType"/>
</template>
</el-table-column>
<el-table-column label="提示信息" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="100">
<template slot-scope="scope">
<el-button
icon="el-icon-d-arrow-right"
size="small"
type="Info"
@click="jumpProcessing(scope.row)"
>跳转
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="pointRouterTotal > 0"
:total="pointRouterTotal"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageNum"
@pagination="getPointRouterList"
/>
<div slot="footer" class="dialog-footer">
<!-- <el-button type="primary" @click="editAlarmStatus"> </el-button>-->
<el-button @click="alarmOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
import Screenfull from '@/components/Screenfull'
import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
import {listPointRouter, updatePointRouter} from "@//api/system/common/pointRouter";
import router from "@//router";
export default {
dicts: ['point_type', 'router_flag', 'module_code'],
data() {
return {
poolNameList: [],
poolName: "",
alarmTitle: "异常处理",
alarmOpen: false,
alarmLoading: false,
pointRouterList: [],
pointRouterTotal: 0,
// 选中数组
routerIds: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
routerFlag: '0',
},
};
},
created() {
localStorage.setItem("this.pointRouterTotal", 0);
},
mounted() {
// 定时获取提示路由信息
this.getAlarmData();
// setInterval(() => this.getAlarmData(), 1000 * 60);
},
components: {
Breadcrumb,
TopNav,
Hamburger,
Screenfull,
SizeSelect,
Search,
RuoYiGit,
RuoYiDoc
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'device'
]),
setting: {
get() {
return this.$store.state.settings.showSettings
},
set(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
}
},
topNav: {
get() {
return this.$store.state.settings.topNav
}
}
},
methods: {
// 打开右下角异常
openAlarm() {
this.$notify({
title: "异常数据提示",
position: "bottom-right",
message: this.$createElement(
"div",
{
on: {
click: () => {
this.getAlarmData(true);
},
},
},
[this.$createElement("el-button", {}, ["点击查看"])]
),
});
},
/** 跳转处理 */
jumpProcessing(row) {
let params = {};
if (row.routerAddressDetail != null){
params = JSON.parse(row.routerAddressDetail)
}
updatePointRouter({pointRouterId: row.pointRouterId, routerFlag: '1'}).then(response => {
this.$tab.openPage(row.moduleCode + this.selectDictLabel(this.dict.type.point_type, row.pointType),
row.routerAddress, params);
this.alarmOpen = false;
});
},
// 处理报警
// editAlarmStatus() {
// editAlarmStatus({ objIds: this.routerIds }).then((res) => {
// this.$message({
// type: "success",
// message: "异常数据已处理!",
// duration: 1500,
// });
// this.getAlarmData();
// });
// },
/** 报警列表 */
getAlarmData(open) {
this.alarmOpen = open;
this.alarmLoading = true;
this.getPointRouterList();
},
getPointRouterList() {
listPointRouter(this.queryParams).then((response) => {
this.pointRouterList = response.rows;
this.pointRouterTotal = response.total;
this.alarmLoading = false;
// if (localStorage.getItem("this.pointRouterTotal") != this.pointRouterTotal) {
// localStorage.setItem("this.pointRouterTotal", this.pointRouterTotal);
// this.openAlarm();
// }
});
},
// 多选框选中数据
handleSelectionChangeAlarm(selection) {
this.routerIds = selection.map((item) => item.pointRouterId);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
toggleSideBar() {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
this.$confirm('确定退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index';
})
}).catch(() => {});
}
}
}
</script>
<style lang="scss" scoped>
.navbar {
height: 50px;
overflow: hidden;
position: relative;
background: #fff;
box-shadow: 0 1px 4px rgba(0,21,41,.08);
.hamburger-container {
line-height: 46px;
height: 100%;
float: left;
cursor: pointer;
transition: background .3s;
-webkit-tap-highlight-color:transparent;
&:hover {
background: rgba(0, 0, 0, .025)
}
}
.breadcrumb-container {
float: left;
}
.topmenu-container {
position: absolute;
left: 50px;
}
.errLog-container {
display: inline-block;
vertical-align: top;
}
.right-menu {
float: right;
height: 100%;
line-height: 50px;
&:focus {
outline: none;
}
.right-menu-item {
display: inline-block;
padding: 0 8px;
height: 100%;
font-size: 18px;
color: #5a5e66;
vertical-align: text-bottom;
&.hover-effect {
cursor: pointer;
transition: background .3s;
&:hover {
background: rgba(0, 0, 0, .025)
}
}
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
margin-top: 5px;
position: relative;
.user-avatar {
cursor: pointer;
width: 40px;
height: 40px;
border-radius: 10px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 25px;
font-size: 12px;
}
}
}
}
}
</style>