MessageItem.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <!-- v-loading="isLoading" -->
  3. <div class="message-item"
  4. @click="handleClick">
  5. <el-row class="full"
  6. type="flex"
  7. align="middle">
  8. <el-col class="item-left">
  9. <el-row class="title"
  10. type="flex"
  11. align="middle">
  12. <div class="icon-place"
  13. :class="iconClass"></div>
  14. {{ title }}
  15. </el-row>
  16. <el-row class="desc"
  17. type="flex"
  18. align="middle">
  19. <div class="icon-place"></div>
  20. {{ desc }}
  21. </el-row>
  22. </el-col>
  23. <el-col class="item-right">
  24. <el-row class="full"
  25. type="flex"
  26. align="middle">
  27. <el-col>
  28. <div class="time">{{ time }}</div>
  29. </el-col>
  30. <el-col>
  31. <el-button class="handle-btn"
  32. :class="handleBtnClass"
  33. type="text">{{ statusText }}</el-button>
  34. </el-col>
  35. </el-row>
  36. </el-col>
  37. </el-row>
  38. </div>
  39. </template>
  40. <script>
  41. import handleType from '../types/handleType'
  42. import i18n from '@/lang'
  43. import * as utils from '../utils'
  44. import { msgConfirmed } from '@/model/indexRx'
  45. import { EventBus } from 'base-core-lib'
  46. const HandleConfig = {
  47. [handleType.RETURN]: {
  48. iconClass: 'need-handle',
  49. btnClass: 'need-handle',
  50. btnText: i18n.t('workNotification.msg.needHandle')
  51. },
  52. [handleType.NEED_HANDLE]: {
  53. iconClass: 'need-handle',
  54. btnClass: 'need-handle',
  55. btnText: i18n.t('workNotification.msg.needHandle')
  56. },
  57. [handleType.NEED_CONFIRMED]: {
  58. iconClass: 'need-confirmed',
  59. btnClass: 'need-confirmed',
  60. btnText: i18n.t('workNotification.msg.needConfirmed')
  61. },
  62. [handleType.CONFIRMED]: {
  63. iconClass: 'confirmed',
  64. btnClass: 'confirmed',
  65. btnText: i18n.t('workNotification.msg.confirmed')
  66. },
  67. [handleType.HANDLED]: {
  68. iconClass: 'handled',
  69. btnClass: 'handled',
  70. btnText: i18n.t('workNotification.msg.handled')
  71. },
  72. [handleType.COMPLETED]: {
  73. iconClass: 'completed',
  74. btnClass: 'completed',
  75. btnText: i18n.t('workNotification.msg.completed')
  76. }
  77. }
  78. export default {
  79. name: 'MessageItem',
  80. // filters: {
  81. // datetimeAgo
  82. // },
  83. props: ['info'],
  84. data () {
  85. return {
  86. isLoading: false
  87. }
  88. },
  89. computed: {
  90. title () {
  91. return this.info && this.info.messageTitle
  92. },
  93. desc () {
  94. return this.info && this.info.messageContent
  95. },
  96. time () {
  97. return this.info && this.info.showTime
  98. },
  99. acceptanceType () {
  100. return this.info.acceptanceType
  101. },
  102. iconClass () {
  103. var at = this.info.acceptanceType
  104. return HandleConfig[at] && HandleConfig[at].iconClass
  105. },
  106. statusText () {
  107. var at = this.info.acceptanceType
  108. return HandleConfig[at] && HandleConfig[at].btnText
  109. },
  110. handleBtnClass () {
  111. var at = this.info.acceptanceType
  112. return HandleConfig[at] && HandleConfig[at].btnClass
  113. }
  114. },
  115. methods: {
  116. async handleClick () {
  117. try {
  118. this.isLoading = true
  119. await msgConfirmed({ id: this.info.id }).toPromise()
  120. this.isLoading = false
  121. } catch (error) {
  122. this.isLoading = false
  123. }
  124. const id = this.info.businessId
  125. const title = this.info.messageContent
  126. const url = utils.code2Url(
  127. this.info.businessType,
  128. this.info.businessCode,
  129. this.info.acceptanceType
  130. )
  131. if (!url) {
  132. EventBus.$emit('error', this.$t('workNotification.noRelatedType'))
  133. } else {
  134. if (
  135. url == 'certificateDetailSecond' ||
  136. url == 'certificateDetailThird'
  137. ) {
  138. let num = url == 'certificateDetailSecond' ? 'second' : 'third'
  139. this.$router.push({
  140. name: 'certificateDetail',
  141. query: {
  142. id: id,
  143. title: title,
  144. code: this.info.businessCode,
  145. tabNum: num
  146. }
  147. })
  148. } else if (url === 'systemOperation') {
  149. sessionStorage.setItem('ws-pf_systemFile', 2)
  150. this.$router.push({
  151. name: url,
  152. query: { id: id, title: title, code: this.info.businessCode }
  153. })
  154. } else {
  155. this.$router.push({
  156. name: url,
  157. query: { id: id, title: title, code: this.info.businessCode }
  158. })
  159. }
  160. }
  161. }
  162. }
  163. }
  164. </script>
  165. <style scoped lang="scss">
  166. .message-item {
  167. height: 86px;
  168. background: #fff;
  169. padding-left: 20px;
  170. padding-right: 20px;
  171. cursor: pointer;
  172. & + .message-item {
  173. margin-top: 10px;
  174. }
  175. }
  176. .full {
  177. width: 100%;
  178. height: 100%;
  179. }
  180. .item-left {
  181. .icon-place {
  182. width: 15px;
  183. height: 15px;
  184. display: inline-block;
  185. background-position: center;
  186. background-size: contain;
  187. margin-right: 8px;
  188. &.need-handle {
  189. //待处理
  190. color: #f56c6c;
  191. background: url(../../../assets/images/page/notification/mail_blue_close.png)
  192. no-repeat;
  193. background-position: center;
  194. background-size: contain;
  195. }
  196. &.need-confirmed {
  197. //待查看
  198. color: #f56c6c;
  199. background: url(../../../assets/images/page/notification/mail_blue_close.png)
  200. no-repeat;
  201. background-position: center;
  202. background-size: contain;
  203. }
  204. &.confimed {
  205. //已查看
  206. color: #333;
  207. background: url(../../../assets/images/page/notification/mail_gray_open.png)
  208. no-repeat;
  209. background-position: center;
  210. background-size: contain;
  211. }
  212. &.handled {
  213. //已处理
  214. color: #1d6ced;
  215. background: url(../../../assets/images/page/notification/mail_blue_open.png)
  216. no-repeat;
  217. background-position: center;
  218. background-size: contain;
  219. }
  220. &.completed {
  221. //已完成
  222. color: #333;
  223. background: url(../../../assets/images/page/notification/mail_gray_open.png)
  224. no-repeat;
  225. background-position: center;
  226. background-size: contain;
  227. }
  228. }
  229. .title {
  230. color: #333333;
  231. font-size: 18px;
  232. font-weight: bold;
  233. margin-bottom: 6px;
  234. }
  235. .desc {
  236. color: #666666;
  237. font-size: 14px;
  238. }
  239. }
  240. .item-right {
  241. width: 280px;
  242. .time {
  243. color: #999;
  244. font-size: 14px;
  245. text-align: right;
  246. border-right: 1px solid #ccc;
  247. padding-right: 20px;
  248. line-height: 28px;
  249. white-space: nowrap;
  250. text-overflow: ellipsis;
  251. overflow: hidden;
  252. width: 160px;
  253. }
  254. .handle-btn {
  255. width: 90px;
  256. margin-left: 20px;
  257. margin-right: 10px;
  258. font-size: 14px;
  259. &.need-handle {
  260. //待处理
  261. color: #f56c6c;
  262. }
  263. &.need-confirmed {
  264. //待查看
  265. color: #f56c6c;
  266. }
  267. &.confimed {
  268. //已查看
  269. color: #333;
  270. }
  271. &.handled {
  272. //已处理
  273. color: #1d6ced;
  274. }
  275. &.completed {
  276. //已完成
  277. color: #333;
  278. }
  279. }
  280. }
  281. </style>