index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="ibps-mr-5">
  3. <el-tooltip
  4. v-if="messageCount === 0"
  5. :content="tooltipContent"
  6. effect="dark"
  7. placement="bottom"
  8. >
  9. <el-button class="ibps-ml-0 ibps-mr btn-text can-hover" type="text" @click="clickMore">
  10. <el-badge :max="9999" :value="messageCount">
  11. <ibps-icon name="bell-o" size="16" />
  12. </el-badge>
  13. </el-button>
  14. </el-tooltip>
  15. <el-popover
  16. v-else
  17. v-model="popShow"
  18. placement="bottom-end"
  19. width="350"
  20. trigger="manual"
  21. popper-class="header-message-popper"
  22. >
  23. <el-button
  24. slot="reference"
  25. class="ibps-ml-0 ibps-mr btn-text can-hover"
  26. type="text"
  27. @click="openPop"
  28. >
  29. <el-badge :max="9999" :value="messageCount">
  30. <ibps-icon name="bell-o" size="16" />
  31. </el-badge>
  32. </el-button>
  33. <el-card body-style="padding:0;">
  34. <div slot="header" style="font-size: 20px; font-weight: 600;">
  35. {{ $t('layout.header-aside.header-message.message-count', { messageCount: messageCount }) }}
  36. </div>
  37. <div style="height: 250px;">
  38. <el-scrollbar style="height: 100%; width: 100%;" wrap-class="ibps-scrollbar-wrapper ">
  39. <ibps-list class="ibps-p-10">
  40. <ibps-list-item
  41. v-for="(message, index) in messageList"
  42. :key="index"
  43. @click.native="handelInteriorClick(message)"
  44. >
  45. <ibps-list-item-meta :title="message.subject" :description="message.ownerName">
  46. <el-avatar
  47. slot="avatar"
  48. :icon="message.messageType === 'bulletin' ? 'ibps-icon-bullhorn' : 'ibps-icon-user'"
  49. shape="circle"
  50. style="background-color: #87d068;"
  51. />
  52. </ibps-list-item-meta>
  53. <div slot="extra">
  54. {{ message.createTime | formatRelativeTime({ year: 'yyyy-MM-dd' }) }}
  55. </div>
  56. </ibps-list-item>
  57. </ibps-list>
  58. </el-scrollbar>
  59. </div>
  60. <div class="message-more">
  61. <el-link type="primary" @click="clickMore">{{ $t('layout.header-aside.header-message.viewmore') }}</el-link>
  62. </div>
  63. </el-card>
  64. </el-popover>
  65. <!-- 消息明细 -->
  66. <inner-detail-dialog
  67. :id="editId"
  68. :subId="subId"
  69. :visible="dialogFormVisible"
  70. :title="$t('layout.header-aside.header-message.details')"
  71. inside
  72. readonly
  73. @callback="loadData"
  74. @close="closeDialog"
  75. />
  76. </div>
  77. </template>
  78. <script>
  79. import { getMsgList, queryReceivePageList } from '@/api/platform/message/innerMessage'
  80. import InnerDetailDialog from '@/views/platform/message/inner/detail/dialog'
  81. import Watermark from './watermark/watermark-cont.js'
  82. export default {
  83. components: {
  84. InnerDetailDialog
  85. },
  86. data() {
  87. return {
  88. editId: '',
  89. subId: '',
  90. dialogFormVisible: false,
  91. isControl: true,
  92. messageList: [],
  93. messageCount: 0,
  94. infoMessage: '',
  95. countNumber: 0,
  96. popShow: false
  97. }
  98. },
  99. computed: {
  100. tooltipContent() {
  101. return this.messageCount === 0 ? this.$t('layout.header-aside.header-message.empty') : ''
  102. }
  103. },
  104. mounted() {
  105. //轮询弹窗任务提醒
  106. // setTimeout(() => {
  107. // this.isControl=true
  108. // this.loadData()
  109. // }, 1000)
  110. // Watermark.set('线上试用版本','深圳市金源信通')
  111. this.loadData()
  112. },
  113. beforeDestroy() {
  114. Watermark.set('', '')
  115. },
  116. methods: {
  117. // 加载数据
  118. loadData() {
  119. getMsgList({
  120. parameters: [
  121. // { key: 'Q^subject^SL', value: '提醒' },
  122. // { key: 'Q^messageType^SL', value: 'system' }
  123. ],
  124. requestPage: { limit: 5, pageNo: 1, totalCount: 0 },
  125. sorts: []
  126. }).then((response) => {
  127. const data = response.data
  128. this.messageList = data.dataResult
  129. this.messageCount = data.pageResult ? data.pageResult.totalCount : 0
  130. this.countNumber = data.pageResult.totalCount
  131. // if (this.countNumber == 0) {
  132. // // if(response.data.pageResult.totalCount>0){
  133. // // this.$message.warning('您有'+response.data.pageResult.totalCount+'条未处理的 [ 待审批 / 被驳回任务消息 ],请及时处理!!!')
  134. // // }
  135. // } else if (this.countNumber < data.pageResult.totalCount) {
  136. // //如果上次记录数量低于本次 进行提醒,准备待办
  137. // let _this = this
  138. // let h = this.$createElement
  139. // let num = data.pageResult.totalCount - this.countNumber
  140. // this.infoMessage = this.$notify({
  141. // title: '您有新的待办任务产生!',
  142. // message: h('p', null, [
  143. // h('span', null, '任务内容: ' + data.dataResult[0].subject),
  144. // h('br'),
  145. // h('span', null, '生成时间: '),
  146. // h('span', { style: 'color: #FF8C00;font-size:12px;' }, data.dataResult[0].createTime),
  147. // h('br'),
  148. // h('el-button', {
  149. // attrs: {
  150. // size: 'mini',
  151. // type: 'primary',
  152. // plain: true
  153. // },
  154. // on: {
  155. // click: () => {
  156. // _this.cancelInfo()
  157. // }
  158. // }
  159. // }, '进入办理'),
  160. // h('el-button', {
  161. // attrs: {
  162. // size: 'mini',
  163. // plain: true
  164. // },
  165. // on: {
  166. // click: () => {
  167. // _this.$notify.closeAll()
  168. // } // 路由加载之后,调用关闭消息弹窗的方法
  169. // }
  170. // }, '忽略全部')
  171. // ]),
  172. // type: 'warning',
  173. // duration: 0
  174. // })
  175. // }
  176. // if (this.countNumber == 0) {
  177. // this.countNumber = data.pageResult.totalCount
  178. // // setInterval(() => {
  179. // // if(this.isControl && response.message == "获取收到的内部消息列表成功!"){
  180. // // this.loadData()
  181. // // }
  182. // // }, 60000)
  183. // } else {
  184. // this.countNumber = data.pageResult.totalCount
  185. // }
  186. }).catch(() => {
  187. this.isControl = false
  188. })
  189. },
  190. cancelInfo() {
  191. this.$router.push('/officeDesk/pendingItems')
  192. this.$notify.closeAll()
  193. },
  194. handelInteriorClick(message) {
  195. this.subId = message.subId
  196. this.editId = message.id
  197. this.dialogFormVisible = true
  198. },
  199. openPop() {
  200. this.popShow = !this.popShow
  201. if (this.popShow) {
  202. this.loadData()
  203. }
  204. },
  205. clickMore() {
  206. // 更多消息
  207. this.popShow = !this.popShow
  208. this.$router.push('/message')
  209. },
  210. closeDialog(visible) {
  211. this.dialogFormVisible = visible
  212. this.loadData()
  213. }
  214. },
  215. // 销毁事件
  216. beforeDestroy() {
  217. this.isControl = false
  218. }
  219. }
  220. </script>
  221. <style lang="scss">
  222. .header-message-popper {
  223. padding: 0 !important;
  224. .message-more {
  225. padding: 15px 0;
  226. text-align: center;
  227. border-top: 1px solid #ebeef5;
  228. }
  229. }
  230. </style>