index.vue 8.6 KB

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