123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- <template>
- <div class="navbar">
- <div class="nav-header">
- <!-- <span class="nav-heander-name">重载铁路线路环境机车远程监视系统</span> -->
- <span class="nav-heander-name">{{ projectName }}</span>
- <img class="titleImg" src="@/assets/表头背景.png" />
- <img class="logo" src="@/assets/机车LOGO.png" />
- <div
- class="right-menu"
- style="display: flex; align-items: center; line-height: 1em"
- >
- <el-popover
- v-model="allMessageShow"
- placement="bottom-end"
- width="500"
- trigger="click"
- ref="popoveraite"
- popper-class="home-el-popover"
- style="cursor: pointer"
- >
- <!-- <img src="../../assets/tishi.png" alt=""> -->
- <div class="msgAlarmMessage">
- <!-- <div
- class="msgAlarmMessage-head"
- :class="{ 'no-home': isHome == false }"
- >
- <div>
- 共{{ $store.state.app.warningSocket.list.length }}条消息
- </div>
- <div class="message" @click="toMessageAll">全部消息</div>
- </div> -->
- <div class="msgAlarmMessage-list">
- <div
- class="msgAlarmMessage-head"
- :class="{ 'no-home': isHome == false }"
- >
- <div>
- 共{{ $store.state.app.warningSocket.list.length }}条消息
- </div>
- <div class="message" @click="toMessageAll">更多消息</div>
- </div>
- <div
- v-for="item in $store.state.app.warningSocket.list"
- @click="linkClick(item)"
- class="msgAlarmMessage-item"
- >
- <div class="item-title">
- <div class="item-text1">【报警】</div>
- <div class="item-text2">{{ item.railwayName }}</div>
- <!-- <div class="item-text3">{{ item.releasedTime }}</div> -->
- </div>
- <div class="item-content">
- <span>{{ item.alarmTime }}</span>
- <span style="display: inline-block; margin-left: 5px"
- >,里程位置{{ item.alarmMile }},</span
- >
- <span>{{ item.lineDir == 1 ? "上行" : "下行" }},</span>
- <span style="display: inline-block; margin-left: 5px">{{
- item.alarmType == 1 ? "泥石流" : ""
- }}</span>
- <!-- {{ item.alarmType === 1 ? "泥石流" : "" }} -->
- <!-- {{ item.lineDirStr }} 里程位置 里程范围
- {{ item.beginMile }}-{{ item.endMile }} -->
- </div>
- </div>
- </div>
- </div>
- <el-badge
- slot="reference"
- :value="$store.state.app.warningSocket.list.length==0?'':$store.state.app.warningSocket.list.length"
- class="item"
- >
- <img
- :src="
- !isHome
- ? require('../../assets/xiaoxi-1.png')
- : require('../../assets/xiaoxi-1.png')
- "
- alt=""
- />
- </el-badge>
- </el-popover>
- <div
- style="
- width: 1px;
- height: 60%;
- background-color: none;
- margin-left: 0px;
- margin-right: 20px;
- "
- />
- <el-dropdown class="avatar-container" trigger="click">
- <div class="avatar-wrapper">
- <img
- :src="
- !isHome
- ? require('../../assets/btn_cards1.png')
- : require('../../assets/btn_cards1.png')
- "
- class="user-avatar"
- />
- <div :style="{ color: isHome == true ? '#fff' : '#fff' }">
- {{ name }}
- </div>
- <i style="color: #fff" class="el-icon-caret-bottom" />
- </div>
- <el-dropdown-menu slot="dropdown" class="user-dropdown">
- <!-- <router-link to="/">
- <el-dropdown-item>
- Home
- </el-dropdown-item>
- </router-link> -->
- <el-dropdown-item divided @click.native="logout">
- <span style="display: block">退出登陆</span>
- </el-dropdown-item>
- <el-dropdown-item>
- <span style="display: block" @click="personalCenter()"
- >个人中心</span
- >
- </el-dropdown-item>
- <el-dropdown-item>
- <span style="display: block" @click="updatePwd">修改密码</span>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <updatePwd
- v-if="updatePwdData.dialogVisible"
- :updatePwdData="updatePwdData"
- @updatePwdBtn="updatePwdBtn"
- >
- </updatePwd>
- </div>
- </div>
- <hamburger
- :is-active="sidebar.opened"
- class="hamburger-container"
- @toggleClick="toggleSideBar"
- />
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import Breadcrumb from "@/components/Breadcrumb";
- import Hamburger from "@/components/Hamburger";
- import store from "@/store";
- import { msgAlarmWebAlarm, readById } from "@/api/alarmList";
- import updatePwd from "./updatePwd.vue";
- import { updatepwd } from "@/api/sysManage";
- import { projectName } from '@/api/user'
- export default {
- components: {
- Breadcrumb,
- Hamburger,
- updatePwd,
- },
- computed: {
- ...mapGetters(["sidebar", "avatar", "name"]),
- isHome() {
- return this.$route.path == "/dashboard";
- },
- },
- created() {
- projectName().then(res => {
- this.projectName = res
- })
- },
- data() {
- return {
- updatePwdData: {
- dialogVisible: false,
- },
- allMessageShow: false,
- qrCodeData: {
- dialogVisible: true,
- },
- projectName:'',
- };
- },
- mounted() {
- msgAlarmWebAlarm().then((res) => {
- if(res.code==200){
- let data = res.data.webAlarm;
- if (data.length > 0) {
- data.forEach((element) => {
- this.$store.commit("app/warningSocketAdd", element);
- });
- }
- }else{
- }
-
- });
- },
- methods: {
- updatePwdBtn(payload) {
- updatepwd(payload).then((res) => {
- if (res.code == 200) {
- this.$message({
- type: "success",
- message: "修改成功!",
- });
- this.updatePwdData.dialogVisible = false;
- } else {
- this.$message({
- type: "error",
- message: res.msg,
- });
- }
- });
- },
- linkClick(item) {
- readById({
- pushId: item.pushId,
- }).then((res) => {
- if (res.code == "200") {
- for (
- var i = 0;
- i < this.$store.state.app.warningSocket.list.length;
- i++
- ) {
- if (item.id === this.$store.state.app.warningSocket.list[i].id) {
- this.$store.state.app.warningSocket.list.splice(i, 1);
- }
- }
- }
- });
- this.$router.push({ path: "/alarmDetail?id=" + item.id });
- },
- updatePwd() {
- this.updatePwdData.dialogVisible = true;
- },
- showQrcode() {
- this.qrCodeData.dialogVisible = true;
- },
- toggleSideBar() {
- this.$store.dispatch("app/toggleSideBar");
- },
- async logout() {
- // await this.$store.dispatch('user/logout')
- // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
- store.dispatch("user/resetToken").then(() => {
- location.reload();
- });
- },
- homeClearScreenClick() {
- this.$store.commit("app/homeClearScreenClick");
- },
- // 去全部消息
- toMessageAll() {
- this.allMessageShow = false;
- this.$router.push("/message/list");
- },
- //跳转个人中心
- personalCenter() {
- this.$router.push("/personalCenter/list");
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .nav-header {
- position: relative;
- width: 100%;
- height: 50px;
- position: fixed;
- top: 0px;
- left: 0;
- background-color: #2250c8;
- /* background: linear-gradient(187deg, #0b244f 0%, #05448c 100%); */
- color: #fff;
- line-height: 50px;
- padding-left: 15px;
- .nav-heander-name {
- position: absolute;
- z-index: 60;
- text-indent: 60px;
- font-size: 20px;
- letter-spacing: 4px;
- font-weight: 800;
- }
- .titleImg {
- display: block;
- position: absolute;
- left: -183px;
- top: -24px;
- z-index: 50;
- }
- .logo {
- position: absolute;
- z-index: 50;
- }
- }
- .nav-headers {
- width: 100%;
- height: 50px;
- position: fixed;
- top: 15px;
- left: 0;
- background-color: #2250c8;
- /* background: linear-gradient(187deg, #0b244f 0%, #05448c 100%); */
- color: #fff;
- line-height: 50px;
- padding-left: 56px;
- }
- .el-badge__content {
- background-color: #ff0000;
- }
- .home-el-popover {
- background: transparent !important;
- border: none;
- padding: 0;
- box-shadow: none;
- }
- </style>
- <style lang="scss" scoped>
- .navbar {
- height: 0px;
- overflow: hidden;
- position: relative;
- // background: #fff;
- box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
- .hamburger-container {
- display: none;
- line-height: 46px;
- height: 100%;
- float: left;
- cursor: pointer;
- transition: background 0.3s;
- -webkit-tap-highlight-color: transparent;
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- }
- .breadcrumb-container {
- float: left;
- }
- .right-menu {
- float: right;
- height: 100%;
- line-height: 50px;
- .qrCode {
- cursor: pointer;
- margin-left: 10px;
- border-radius: 3px;
- font-size: 16px;
- background: -webkit-linear-gradient(top, #0251af, #00c7fb);
- line-height: 25px;
- height: 25px;
- width: 70px;
- text-align: center;
- }
- &:focus {
- outline: none;
- }
- .cls {
- width: 74px;
- height: 24px;
- // border: 1px solid #000000;
- border-image: linear-gradient(
- 151deg,
- rgba(0, 105, 237, 0.6),
- rgba(0, 199, 251, 0.6)
- )
- 3 3;
- border-radius: 3px;
- color: #fff;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 10px;
- background: -webkit-linear-gradient(top, #0251af, #00c7fb);
- cursor: pointer;
- }
- &: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 0.3s;
- &:hover {
- background: rgba(0, 0, 0, 0.025);
- }
- }
- }
- .avatar-container {
- margin-right: 30px;
- .avatar-wrapper {
- position: relative;
- display: flex;
- align-items: center;
- .user-avatar {
- cursor: pointer;
- width: 28.5px;
- height: 28.5px;
- border-radius: 50%;
- margin-right: 5px;
- }
- .el-icon-caret-bottom {
- margin-left: 5px;
- cursor: pointer;
- font-size: 12px;
- color: #0556db;
- }
- }
- }
- }
- }
- .msgAlarmMessage {
- box-shadow: none;
- margin-top: 5px;
- .message {
- cursor: pointer;
- color: #4d85f4;
- }
- // .message:hover {
- // background: #4d85f4;
- // }
- // .message:active {
- // background: #144ebf;
- // }
- .msgAlarmMessage-head {
- display: flex;
- justify-content: space-between;
- padding-bottom: 8px;
- margin-top: 5px;
- border-bottom: 1px solid #f2f2f2;
- color: #333333;
- font-size: 12px;
- // width: 100%;
- // color: #fff;
- &.no-home {
- color: #000;
- }
- }
- .msgAlarmMessage-list {
- display: flex;
- flex-direction: column;
- font-size: 14px;
- max-height: 412px;
- overflow-y: auto;
- background-color: #fff;
- padding: 24px;
- margin-top: 5px;
- border-radius: 2px;
- // box-shadow: 0px 2px 4px 0px rgba(221, 217, 217, 1);
- .msgAlarmMessage-item {
- padding-bottom: 8px;
- margin-top: 5px;
- border-bottom: 1px solid rgba(242, 242, 242, 1);
- cursor: pointer;
- // border: 1px solid rgba(242,242,242,1);
- .item-title {
- display: flex;
- align-items: center;
- .item-text1 {
- flex-shrink: 0;
- color: red;
- // margin-right: 10px;
- }
- .item-text2 {
- flex: 1;
- color: #000000;
- font-size: 14px;
- }
- .item-text3 {
- flex-shrink: 0;
- }
- }
- .item-content {
- // padding: 5px 20px;
- // width: 520px;
- height: 33px;
- line-height: 33px;
- padding-left: 12px;
- background: #f5f5f5;
- margin-top: 5px;
- border-radius: 5px;
- color: #565656;
- font-size: 12px;
- }
- }
- }
- }
- </style>
|