journalItem.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <div class='infoWrap'>
  3. <div class="left"
  4. style="width: 110px;">
  5. <div class="unread"
  6. @click="onLookMessage('all')">全部</div>
  7. <div class="unread"
  8. @click="onLookMessage('0')"> <img :src="img.boxicon"
  9. alt=""> 未读消息
  10. <div class="count"
  11. v-if="noReadMessage >= 1">{{ noReadMessage }}</div>
  12. </div>
  13. <div class="read"
  14. @click="onLookMessage('1')">
  15. <img :src="img.bookicon"
  16. alt="">
  17. 已读消息</div>
  18. <!-- <div class="recovery">
  19. <img :src="img.trashicon"
  20. alt="">
  21. 回收站</div> -->
  22. </div>
  23. <div class="middle">
  24. <div class="msgItem"
  25. :class="[isCheckMessage == item.id ? 'active' : '']"
  26. @click="onClickRead(item)"
  27. v-for="(item, index) in dataList"
  28. :key="index">
  29. <!-- <h6 class="type">审批</h6> -->
  30. <h4 class="name">系统消息 <span class='time'>{{ item.createOn| dateForMinFormat}}</span>
  31. <div class="dot"
  32. v-if="item.readStatus == 0"></div>
  33. </h4>
  34. <p class='msg'>{{ item.content }}</p>
  35. </div>
  36. <el-pagination style="text-align: right"
  37. small
  38. v-if="dataList.length > 0"
  39. @current-change="onChange"
  40. :hide-on-single-page="pageInfo.isSinglePage"
  41. layout="prev, pager, next"
  42. :total="pageInfo.total">
  43. </el-pagination>
  44. </div>
  45. <div class="right"
  46. v-if="showRight">
  47. <div class="rightWrap">
  48. <!-- <img src="@/assets/images/base/placehorder-icon.png"
  49. class="header"
  50. alt=""> -->
  51. <div class="info">
  52. <h2>系统消息</h2>
  53. <div class="textWrap">
  54. <p>{{ showMessage.content }}</p>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import { queryCountOfUnread, sysMessageList, setRead } from '@/api/journal'
  63. export default {
  64. name: 'journalItem',
  65. data () {
  66. return {
  67. img: {
  68. bookicon: require('@/assets/images/base/bookicon.png'),
  69. Hbookicon: require('@/assets/images/base/bookicon-h.png'),
  70. trashicon: require('@/assets/images/base/trashicon.png'),
  71. Htrashicon: require('@/assets/images/base/trashicon-h.png'),
  72. boxicon: require('@/assets/images/base/boxicon.png'),
  73. Hboxicon: require('@/assets/images/base/boxicon-h.png')
  74. },
  75. activities: [{}],
  76. pageInfo: {
  77. isSinglePage: false, // 是否只有一页
  78. limit: 10,
  79. page: 1,
  80. readStatus: null,
  81. total: 0,
  82. },
  83. noReadMessage: 0, // 未读消息
  84. dataList: [],
  85. isCheckMessage: null,
  86. showRight: false,
  87. showMessage: {}
  88. }
  89. },
  90. mounted () {
  91. this.__init()
  92. this.sysMessageList()
  93. },
  94. methods: {
  95. __init () {
  96. // 未读消息
  97. queryCountOfUnread().then(res => {
  98. if (res.code == 200) {
  99. if (res.data && res.data.SYSTEM) {
  100. this.noReadMessage = res.data.SYSTEM
  101. }
  102. }
  103. })
  104. },
  105. sysMessageList () { // 列表
  106. sysMessageList({
  107. group: 'SYSTEM',
  108. rows: this.pageInfo.limit,
  109. page: this.pageInfo.page,
  110. readStatus: this.pageInfo.readStatus
  111. }).then(res => {
  112. if (res.code == 200) {
  113. this.dataList = res.data.rows
  114. this.pageInfo.total = res.data.total
  115. }
  116. })
  117. },
  118. onChange (page) { // 分页
  119. this.pageInfo.page = page
  120. this.sysMessageList()
  121. },
  122. onLookMessage (type) { // 查看对应的数据
  123. if (type == "all") {
  124. this.pageInfo.readStatus = null
  125. } else {
  126. this.pageInfo.readStatus = type
  127. }
  128. this.pageInfo.page = 1
  129. this.showRight = false
  130. this.showMessage = {}
  131. this.isCheckMessage = null
  132. this.sysMessageList()
  133. },
  134. onClickRead (item) {
  135. this.isCheckMessage = item.id
  136. if (item.readStatus == 1) {
  137. this.showRight = true
  138. this.showMessage = item
  139. } else {
  140. setRead({ id: item.id }).then(res => {
  141. let result = res.data
  142. if (res.code == 200) {
  143. this.showRight = true
  144. this.showMessage = item
  145. item.readStatus = 1
  146. this.noReadMessage--
  147. }
  148. })
  149. }
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .infoWrap {
  156. display: flex;
  157. flex-direction: row;
  158. justify-content: flex-start;
  159. height: calc(100vh - 266px);
  160. overflow: auto;
  161. .left {
  162. padding-top: 24px;
  163. display: flex;
  164. flex-direction: column;
  165. align-items: left;
  166. > div {
  167. height: 26px;
  168. line-height: 26px;
  169. margin-top: 26px;
  170. img {
  171. position: relative;
  172. top: 6px;
  173. }
  174. }
  175. .unread {
  176. position: relative;
  177. img {
  178. width: 25px;
  179. height: 24px;
  180. }
  181. .count {
  182. position: absolute;
  183. width: 38px;
  184. height: 23px;
  185. background: rgba(20, 146, 138, 0.5);
  186. border-radius: 100px;
  187. font-size: 12px;
  188. line-height: 23px;
  189. text-align: center;
  190. color: #225551;
  191. right: -44px;
  192. top: 8px;
  193. }
  194. }
  195. .unread,
  196. .read,
  197. .recovery {
  198. cursor: pointer;
  199. }
  200. .read {
  201. img {
  202. width: 20px;
  203. height: 26px;
  204. }
  205. }
  206. .recovery {
  207. img {
  208. width: 19px;
  209. height: 26px;
  210. }
  211. }
  212. }
  213. .middle {
  214. width: 25%;
  215. margin-left: 76px;
  216. padding-top: 50px;
  217. overflow: auto;
  218. .msgItem {
  219. padding: 16px 18px 23px 30px;
  220. border-bottom: 1px solid #ccc;
  221. .type {
  222. font-size: 14px;
  223. color: #777;
  224. font-weight: 400;
  225. padding-bottom: 4px;
  226. }
  227. .name {
  228. position: relative;
  229. color: #444;
  230. font-size: 16px;
  231. padding-bottom: 9px;
  232. clear: both;
  233. .time {
  234. font-weight: 400;
  235. color: #aaa;
  236. float: right;
  237. }
  238. .dot {
  239. width: 7px;
  240. height: 7px;
  241. background-color: #f97215;
  242. border-radius: 50%;
  243. position: absolute;
  244. left: -13px;
  245. top: 4px;
  246. }
  247. }
  248. .msg {
  249. color: #444;
  250. font-size: 14px;
  251. line-height: 24px;
  252. text-overflow: -o-ellipsis-lastline;
  253. overflow: hidden;
  254. text-overflow: ellipsis;
  255. display: -webkit-box;
  256. -webkit-line-clamp: 2;
  257. -webkit-box-orient: vertical;
  258. }
  259. }
  260. .msgItem.active {
  261. background-color: #f3f4f8;
  262. border-radius: 5px;
  263. .msg {
  264. color: #aaa;
  265. }
  266. }
  267. }
  268. .right {
  269. display: flex;
  270. flex-direction: column;
  271. justify-content: space-between;
  272. border: 1px solid #e4e8eb;
  273. margin-left: 25px;
  274. position: relative;
  275. overflow: auto;
  276. min-width: 50%;
  277. .rightWrap {
  278. // overflow: auto;
  279. padding: 18px 24px;
  280. display: flex;
  281. flex-direction: row;
  282. justify-content: flex-start;
  283. // width: 570px;
  284. box-sizing: border-box;
  285. .header {
  286. width: 30px;
  287. height: 30px;
  288. position: relative;
  289. top: 7px;
  290. border-radius: 50%;
  291. margin-right: 12px;
  292. }
  293. .info {
  294. position: relative;
  295. width: 100%;
  296. h2 {
  297. color: #212223;
  298. font-size: 16px;
  299. margin-bottom: 0px;
  300. span {
  301. font-size: 12px;
  302. color: #444;
  303. }
  304. }
  305. .subMsg {
  306. position: relative;
  307. font-size: 12px;
  308. color: #444;
  309. margin-bottom: 12px;
  310. .san {
  311. // margin-left: 110px;
  312. float: left;
  313. position: absolute;
  314. top: 0px;
  315. width: 0;
  316. height: 0;
  317. border-width: 5px;
  318. border-style: solid;
  319. border-color: transparent #909191 transparent transparent;
  320. transform: rotate(180deg); /*顺时针旋转90°*/
  321. margin: 0 8px;
  322. }
  323. }
  324. .textWrap {
  325. // width: 316px;
  326. line-height: 21px;
  327. font-size: 14px;
  328. color: #212223;
  329. margin: 12px 0 34px;
  330. }
  331. .dot {
  332. width: 20px;
  333. height: 20px;
  334. }
  335. .timeMsg {
  336. position: relative;
  337. top: 5px;
  338. margin-left: 20px;
  339. .name {
  340. font-size: #444;
  341. font-size: 16px;
  342. margin-bottom: 3px;
  343. font-weight: 600;
  344. }
  345. .status {
  346. font-size: 14px;
  347. color: #62a070;
  348. }
  349. .status.waring {
  350. color: #f97215;
  351. }
  352. .status.end {
  353. color: #aaaaaa;
  354. }
  355. }
  356. }
  357. }
  358. .infoFoot {
  359. min-height: 60px;
  360. height: 60px;
  361. line-height: 60px;
  362. border-top: 1px solid #e4e8eb;
  363. width: 100%;
  364. display: flex;
  365. flex-direction: row;
  366. justify-content: flex-start;
  367. align-items: center;
  368. .noBtn {
  369. cursor: pointer;
  370. width: 100px;
  371. height: 32px;
  372. line-height: 32px;
  373. color: #444;
  374. border-radius: 3px;
  375. border: 1px solid rgba(228, 232, 235, 1);
  376. text-align: center;
  377. margin-left: 70px;
  378. }
  379. .yesBtn {
  380. cursor: pointer;
  381. margin-left: 15px;
  382. text-align: center;
  383. width: 100px;
  384. height: 32px;
  385. line-height: 32px;
  386. background: rgba(249, 114, 21, 1);
  387. border-radius: 3px;
  388. color: #fff;
  389. }
  390. // width: 570px;
  391. }
  392. }
  393. }
  394. .el-timeline-item__dot {
  395. width: 20px;
  396. height: 20px;
  397. }
  398. .el-timeline-item {
  399. min-height: 80px !important;
  400. }
  401. .el-timeline-item__tail {
  402. left: 9px !important;
  403. }
  404. </style>