Navbar.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <div class="navbar">
  3. <hamburger
  4. id="hamburger-container"
  5. :is-active="sidebar.opened"
  6. class="hamburger-container"
  7. @toggleClick="toggleSideBar"
  8. />
  9. <breadcrumb
  10. id="breadcrumb-container"
  11. class="breadcrumb-container"
  12. v-if="!topNav"
  13. />
  14. <top-nav id="topmenu-container" class="topmenu-container" v-if="topNav" />
  15. <div class="right-menu">
  16. <template v-if="device !== 'mobile'">
  17. <search id="header-search" class="right-menu-item" />
  18. <!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
  19. <ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
  20. </el-tooltip>
  21. <el-tooltip content="文档地址" effect="dark" placement="bottom">
  22. <ruo-yi-doc id="ruoyi-doc" class="right-menu-item hover-effect" />
  23. </el-tooltip> -->
  24. <el-tooltip content="版本说明" effect="dark" placement="bottom">
  25. <version
  26. id="version"
  27. class="right-menu-item hover-effect"
  28. @openMsg="openMsg"
  29. />
  30. </el-tooltip>
  31. <el-dialog
  32. append-to-body
  33. :visible.sync="dialogVisible"
  34. width="560px"
  35. :show-close="false"
  36. :close-on-click-modal="false"
  37. >
  38. <div slot="title" class="hearders">
  39. <div class="leftTitle">版本说明</div>
  40. <div class="rightBoxs">
  41. <img
  42. src="@/assets/images/Close@2x.png"
  43. alt=""
  44. @click="dialogVisible = false"
  45. />
  46. </div>
  47. </div>
  48. <div class="dialogSty">
  49. <h2>v6.0.0</h2>
  50. <p>1.第六阶段完整版</p>
  51. </div>
  52. <span slot="footer" class="dialog-footer">
  53. <el-button @click="dialogVisible = false">关 闭</el-button>
  54. </span>
  55. </el-dialog>
  56. <screenfull id="screenfull" class="right-menu-item hover-effect" />
  57. <el-tooltip content="布局大小" effect="dark" placement="bottom">
  58. <size-select id="size-select" class="right-menu-item hover-effect" />
  59. </el-tooltip>
  60. </template>
  61. <el-dropdown
  62. class="avatar-container right-menu-item hover-effect"
  63. trigger="click"
  64. >
  65. <div class="avatar-wrapper">
  66. <img :src="avatar" class="user-avatar" />
  67. <i class="el-icon-caret-bottom" />
  68. </div>
  69. <el-dropdown-menu slot="dropdown">
  70. <router-link to="/user/profile">
  71. <el-dropdown-item>个人中心</el-dropdown-item>
  72. </router-link>
  73. <el-dropdown-item @click.native="setting = true">
  74. <span>布局设置</span>
  75. </el-dropdown-item>
  76. <el-dropdown-item divided @click.native="logout">
  77. <span>退出登录</span>
  78. </el-dropdown-item>
  79. </el-dropdown-menu>
  80. </el-dropdown>
  81. </div>
  82. <el-dialog
  83. append-to-body
  84. :visible.sync="dialog_haveRead"
  85. width="440px"
  86. :show-close="false"
  87. :close-on-click-modal="false"
  88. >
  89. <div slot="title" class="hearders">
  90. <div class="leftTitle">{{ total }}条未读消息</div>
  91. <div class="rightBoxs">
  92. <img
  93. src="@/assets/images/Close@2x.png"
  94. alt=""
  95. @click="dialog_haveRead = false"
  96. />
  97. </div>
  98. </div>
  99. <div class="haveRead_style">
  100. <div
  101. v-for="(item, index) in tableData"
  102. :key="index"
  103. class="haveRead_list"
  104. >
  105. <strong>{{ item.remind }}</strong>
  106. <p>
  107. {{ item.text }}
  108. </p>
  109. <p style="time_style">{{ $methodsTools.onlyForma(item.sendTime) }}</p>
  110. <div>
  111. <el-button type="primary" size="small" @click="newSee(item.id)"
  112. >立即查看</el-button
  113. >
  114. <el-button size="small" @click="changeReadStatus(item.id)"
  115. >标记为已读</el-button
  116. >
  117. </div>
  118. </div>
  119. </div>
  120. <span slot="footer" class="dialog-footer">
  121. <el-button @click="seeAllRead">查看所有</el-button>
  122. </span>
  123. </el-dialog>
  124. </div>
  125. </template>
  126. <script>
  127. import { mapGetters } from "vuex";
  128. import Breadcrumb from "@/components/Breadcrumb";
  129. import TopNav from "@/components/TopNav";
  130. import Hamburger from "@/components/Hamburger";
  131. import Screenfull from "@/components/Screenfull";
  132. import SizeSelect from "@/components/SizeSelect";
  133. import version from "@/components/version";
  134. import Search from "@/components/HeaderSearch";
  135. import RuoYiGit from "@/components/RuoYi/Git";
  136. import RuoYiDoc from "@/components/RuoYi/Doc";
  137. export default {
  138. components: {
  139. Breadcrumb,
  140. TopNav,
  141. Hamburger,
  142. Screenfull,
  143. SizeSelect,
  144. Search,
  145. RuoYiGit,
  146. RuoYiDoc,
  147. version,
  148. },
  149. data() {
  150. return {
  151. dialogVisible: false,
  152. dialog_haveRead: false,
  153. tableData: [], //未读列表
  154. total: 0, //未读数量
  155. };
  156. },
  157. computed: {
  158. ...mapGetters(["sidebar", "avatar", "device"]),
  159. setting: {
  160. get() {
  161. return this.$store.state.settings.showSettings;
  162. },
  163. set(val) {
  164. this.$store.dispatch("settings/changeSetting", {
  165. key: "showSettings",
  166. value: val,
  167. });
  168. },
  169. },
  170. topNav: {
  171. get() {
  172. return this.$store.state.settings.topNav;
  173. },
  174. },
  175. },
  176. mounted() {
  177. if (this.$route.name !== "StationLetter") {
  178. this.$api.inquireinformsys_userinformUnReadSum().then((res) => {
  179. if (res.data > 0) {
  180. this.getDontReadList();
  181. }
  182. });
  183. }
  184. },
  185. methods: {
  186. /**
  187. * 立即查看
  188. */
  189. newSee(id) {
  190. this.$router.push({
  191. name: "StationLetter",
  192. params: {
  193. id: id,
  194. },
  195. });
  196. // this.dialog_haveRead = false;
  197. },
  198. /**
  199. * 获取未读数据列表
  200. */
  201. getDontReadList() {
  202. var self = this;
  203. let val = {
  204. receiptStatus: 0,
  205. systemStatus: 1,
  206. };
  207. this.$api.inquireinformsys_userlist(val).then((result) => {
  208. this.tableData = result.rows;
  209. this.total = result.total;
  210. if (this.total > 0) {
  211. const h = this.$createElement;
  212. let arrays = result.rows.map((item, index) => {
  213. return h(
  214. "div",
  215. {
  216. style: {
  217. borderBottom:
  218. result.total === index + 1 ? "none" : "1px solid #D9D9D9",
  219. marginTop: "26px",
  220. paddingBottom: "26px",
  221. },
  222. },
  223. [
  224. h(
  225. "strong",
  226. {
  227. style: {
  228. fontSize: "16px",
  229. fontWeight: "bold",
  230. color: "#222222",
  231. marginBottom: "12px",
  232. },
  233. },
  234. item.remind
  235. ),
  236. h(
  237. "p",
  238. {
  239. style: {
  240. fontSize: "14px",
  241. color: "#606266",
  242. marginBottom: "12px",
  243. },
  244. },
  245. item.text
  246. ),
  247. h(
  248. "p",
  249. {
  250. style: {
  251. fontSize: "12px",
  252. color: "#999999",
  253. marginBottom: "12px",
  254. },
  255. },
  256. this.$methodsTools.onlyForma(item.sendTime)
  257. ),
  258. h(
  259. "el-button",
  260. {
  261. attrs: {
  262. size: "small",
  263. type: "primary",
  264. },
  265. on: {
  266. click: function () {
  267. self.newSee(item.id);
  268. self.$notify.closeAll();
  269. },
  270. },
  271. },
  272. "立即查看"
  273. ),
  274. h(
  275. "el-button",
  276. {
  277. attrs: {
  278. size: "small",
  279. },
  280. on: {
  281. click: async function () {
  282. await self.changeReadStatus(item.id);
  283. self.$notify.closeAll();
  284. self.$nextTick(() => {
  285. self.getDontReadList();
  286. });
  287. },
  288. },
  289. },
  290. "标记为已读"
  291. ),
  292. ]
  293. );
  294. });
  295. this.$notify({
  296. title: `${result.total}条未读信息`,
  297. position: "bottom-right",
  298. dangerouslyUseHTMLString: true,
  299. duration: 0,
  300. customClass: "notiSty",
  301. message: h("div", [
  302. h(
  303. "div",
  304. {
  305. class: "znxStyle",
  306. },
  307. arrays
  308. ),
  309. h(
  310. "div",
  311. {
  312. class: "btn_bottom_style",
  313. on: {
  314. click: function () {
  315. self.seeAllRead();
  316. self.$notify.closeAll();
  317. },
  318. },
  319. },
  320. "查看所有"
  321. ),
  322. ]),
  323. });
  324. // this.dialog_haveRead = true;
  325. } else {
  326. // this.dialog_haveRead = false;
  327. }
  328. });
  329. },
  330. /**
  331. * 更新已读状态
  332. */
  333. changeReadStatus(id) {
  334. return new Promise((resolve, reject) => {
  335. this.$api
  336. .editupdateReadStatusBatch({ ids: [id], receiptStatus: 1 })
  337. .then((res) => {
  338. this.$message.success("已读成功");
  339. resolve();
  340. // this.getDontReadList();
  341. });
  342. });
  343. },
  344. /**
  345. * 查看所有消息
  346. */
  347. seeAllRead() {
  348. this.$router.push({
  349. name: "StationLetter",
  350. });
  351. // this.dialog_haveRead = false;
  352. },
  353. openMsg() {
  354. this.dialogVisible = true;
  355. },
  356. toggleSideBar() {
  357. this.$store.dispatch("app/toggleSideBar");
  358. },
  359. async logout() {
  360. this.$confirm("确定注销并退出系统吗?", "提示", {
  361. confirmButtonText: "确定",
  362. cancelButtonText: "取消",
  363. type: "warning",
  364. })
  365. .then(() => {
  366. const tid = sessionStorage.TenantId
  367. this.$store.dispatch("LogOut").then(() => {
  368. location.href = "/index?TenantId=" + tid
  369. });
  370. })
  371. .catch(() => {
  372. // var message: h("div", [
  373. // h("strong", null, item.text),
  374. // h("p", null, this.$methodsTools.onlyForma(item.sendTime)),
  375. // h(
  376. // "el-button",
  377. // {
  378. // attrs: {
  379. // size: "small",
  380. // type: "primary",
  381. // },
  382. // on: {
  383. // click: function () {
  384. // self.newSee(item.id);
  385. // self.$notify.closeAll();
  386. // },
  387. // },
  388. // },
  389. // "立即查看"
  390. // ),
  391. // h(
  392. // "el-button",
  393. // {
  394. // attrs: {
  395. // size: "small",
  396. // },
  397. // on: {
  398. // click: function () {
  399. // self.changeReadStatus(item.id);
  400. // instance[index].close();
  401. // },
  402. // },
  403. // },
  404. // "标记已读"
  405. // ),
  406. // h(
  407. // "el-button",
  408. // {
  409. // attrs: {
  410. // size: "small",
  411. // type: "success",
  412. // },
  413. // on: {
  414. // click: function () {
  415. // self.seeAllRead()
  416. // self.$notify.closeAll();
  417. // },
  418. // },
  419. // },
  420. // "查看全部"
  421. // ),
  422. // ]),
  423. });
  424. },
  425. },
  426. };
  427. </script>
  428. <style lang="scss" scoped>
  429. .haveRead_list {
  430. margin-top: 24px;
  431. padding-bottom: 28px;
  432. border-bottom: 1px solid #d9d9d9;
  433. & > strong {
  434. color: #000;
  435. }
  436. & > .time_style {
  437. color: #999999;
  438. }
  439. &:last-child {
  440. border-bottom: none;
  441. }
  442. }
  443. /deep/.el-button {
  444. border-radius: 8px;
  445. }
  446. /deep/.el-dialog {
  447. z-index: 9999;
  448. border-radius: 8px;
  449. .el-dialog__header {
  450. padding: 0;
  451. .hearders {
  452. height: 40px;
  453. display: flex;
  454. align-items: center;
  455. justify-content: space-between;
  456. padding: 0px 18px 0px 20px;
  457. border-bottom: 1px solid #e2e2e2;
  458. .leftTitle {
  459. font-size: 14px;
  460. font-weight: bold;
  461. color: #2f4378;
  462. }
  463. .rightBoxs {
  464. display: flex;
  465. align-items: center;
  466. img {
  467. width: 14px;
  468. height: 14px;
  469. margin-left: 13px;
  470. cursor: pointer;
  471. }
  472. }
  473. }
  474. }
  475. .el-dialog__body {
  476. padding: 0px 20px;
  477. max-height: 450px;
  478. overflow: auto;
  479. h2 {
  480. font-weight: bold;
  481. color: #333;
  482. border-bottom: 2px dashed #000;
  483. padding-bottom: 10px;
  484. }
  485. }
  486. .el-dialog__footer {
  487. padding: 0;
  488. .dialog-footer {
  489. padding: 0px 40px;
  490. height: 70px;
  491. border-top: 1px solid #e2e2e2;
  492. display: flex;
  493. align-items: center;
  494. justify-content: flex-end;
  495. }
  496. }
  497. }
  498. .imgBox {
  499. width: 100%;
  500. // height: 210px;
  501. border: 1px solid #e2e2e2;
  502. border-radius: 8px;
  503. padding: 8px 8px 3px;
  504. display: flex;
  505. flex-direction: column;
  506. align-items: center;
  507. .imgLabel {
  508. flex: 1;
  509. width: 100%;
  510. border: 1px dotted #e2e2e2;
  511. color: #999;
  512. font-size: 14px;
  513. cursor: pointer;
  514. border-radius: 8px;
  515. .msPhoto {
  516. display: flex;
  517. justify-content: center;
  518. align-items: center;
  519. max-width: 100%;
  520. max-height: 270px;
  521. img {
  522. max-width: 100%;
  523. max-height: 270px;
  524. }
  525. }
  526. .imgbbx {
  527. display: flex;
  528. flex-direction: column;
  529. align-items: center;
  530. justify-content: center;
  531. width: 100%;
  532. height: 100%;
  533. i {
  534. font-weight: bold;
  535. margin: 14px 0;
  536. font-size: 24px;
  537. }
  538. }
  539. }
  540. p {
  541. margin: 5px 0px;
  542. }
  543. }
  544. .navbar {
  545. height: 50px;
  546. overflow: hidden;
  547. position: relative;
  548. background: #fff;
  549. box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  550. .hamburger-container {
  551. line-height: 46px;
  552. height: 100%;
  553. float: left;
  554. cursor: pointer;
  555. transition: background 0.3s;
  556. -webkit-tap-highlight-color: transparent;
  557. &:hover {
  558. background: rgba(0, 0, 0, 0.025);
  559. }
  560. }
  561. .breadcrumb-container {
  562. float: left;
  563. }
  564. .topmenu-container {
  565. position: absolute;
  566. left: 50px;
  567. }
  568. .errLog-container {
  569. display: inline-block;
  570. vertical-align: top;
  571. }
  572. .right-menu {
  573. float: right;
  574. height: 100%;
  575. line-height: 50px;
  576. &:focus {
  577. outline: none;
  578. }
  579. .right-menu-item {
  580. display: inline-block;
  581. padding: 0 8px;
  582. height: 100%;
  583. font-size: 18px;
  584. color: #5a5e66;
  585. vertical-align: text-bottom;
  586. &.hover-effect {
  587. cursor: pointer;
  588. transition: background 0.3s;
  589. &:hover {
  590. background: rgba(0, 0, 0, 0.025);
  591. }
  592. }
  593. }
  594. .avatar-container {
  595. margin-right: 30px;
  596. .avatar-wrapper {
  597. margin-top: 5px;
  598. position: relative;
  599. .user-avatar {
  600. cursor: pointer;
  601. width: 40px;
  602. height: 40px;
  603. border-radius: 10px;
  604. }
  605. .el-icon-caret-bottom {
  606. cursor: pointer;
  607. position: absolute;
  608. right: -20px;
  609. top: 25px;
  610. font-size: 12px;
  611. }
  612. }
  613. }
  614. }
  615. }
  616. .znxStyle {
  617. max-height: 460px;
  618. overflow-y: auto;
  619. padding: 0px 28px;
  620. &::-webkit-scrollbar {
  621. width: 4px;
  622. }
  623. &::-webkit-scrollbar-thumb {
  624. border-radius: 10px;
  625. -webkit-box-shadow: inset 0 0 5px rgba(165, 165, 165, 0.2);
  626. background: rgba(165, 165, 165, 0.2);
  627. }
  628. &::-webkit-scrollbar-track {
  629. -webkit-box-shadow: inset 0 0 5px rgba(165, 165, 165, 0.2);
  630. border-radius: 0;
  631. background: rgba(226, 225, 225, 0.2);
  632. }
  633. }
  634. .btn_bottom_style {
  635. height: 50px;
  636. border-top: 1px solid #d9d9d9;
  637. line-height: 50px;
  638. text-align: center;
  639. color: #222;
  640. font-size: 16px;
  641. cursor: pointer;
  642. transition: all 0.2s;
  643. &:hover {
  644. background-color: #eee;
  645. }
  646. }
  647. .btnStyle_s {
  648. margin-top: 6px;
  649. background-color: skyblue;
  650. color: #fff;
  651. }
  652. </style>
  653. <style lang="less">
  654. .notiSty {
  655. width: 400px !important;
  656. padding: 0px !important;
  657. & > .el-notification__group {
  658. width: 100%;
  659. margin: 0px;
  660. & > .el-notification__title {
  661. text-align: center;
  662. height: 60px;
  663. line-height: 60px;
  664. color: #fff;
  665. font-size: 18px;
  666. font-weight: bold;
  667. background-color: #409eff;
  668. font-family: OPPOSans-Bold, OPPOSans;
  669. }
  670. & > .el-notification__closeBtn {
  671. color: #fff;
  672. font-size: 18px;
  673. top: 24px;
  674. }
  675. }
  676. }
  677. </style>