MessageItem.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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. this.info.messageContent
  131. )
  132. console.log(url)
  133. if (!url) {
  134. EventBus.$emit('error', this.$t('workNotification.noRelatedType'))
  135. } else {
  136. if (
  137. url == 'certificateDetailSecond' ||
  138. url == 'certificateDetailThird'
  139. ) {
  140. let num = url == 'certificateDetailSecond' ? 'second' : 'third'
  141. this.$router.push({
  142. name: 'certificateDetail',
  143. query: {
  144. id: id,
  145. title: title,
  146. code: this.info.businessCode,
  147. tabNum: num
  148. }
  149. })
  150. } else if (url === 'systemOperation') {
  151. localStorage.setItem('ws-pf_systemFile', 2)
  152. this.$router.push({
  153. name: url,
  154. query: { id: id, title: title, code: this.info.businessCode }
  155. })
  156. } else if (url === 'warehousingOrder') {
  157. this.$router.push({
  158. name: url,
  159. query: { status:1 }
  160. })
  161. } else {
  162. this.$router.push({
  163. name: url,
  164. query: { id: id, title: title, code: this.info.businessCode }
  165. })
  166. }
  167. }
  168. }
  169. }
  170. }
  171. </script>
  172. <style scoped lang="scss">
  173. .message-item {
  174. height: 86px;
  175. background: #fff;
  176. padding-left: 20px;
  177. padding-right: 20px;
  178. cursor: pointer;
  179. & + .message-item {
  180. margin-top: 10px;
  181. }
  182. }
  183. .full {
  184. width: 100%;
  185. height: 100%;
  186. }
  187. .item-left {
  188. .icon-place {
  189. width: 15px;
  190. height: 15px;
  191. display: inline-block;
  192. background-position: center;
  193. background-size: contain;
  194. margin-right: 8px;
  195. &.need-handle {
  196. //待处理
  197. color: #f56c6c;
  198. background: url(../../../assets/images/page/notification/mail_blue_close.png)
  199. no-repeat;
  200. background-position: center;
  201. background-size: contain;
  202. }
  203. &.need-confirmed {
  204. //待查看
  205. color: #f56c6c;
  206. background: url(../../../assets/images/page/notification/mail_blue_close.png)
  207. no-repeat;
  208. background-position: center;
  209. background-size: contain;
  210. }
  211. &.confimed {
  212. //已查看
  213. color: #333;
  214. background: url(../../../assets/images/page/notification/mail_gray_open.png)
  215. no-repeat;
  216. background-position: center;
  217. background-size: contain;
  218. }
  219. &.handled {
  220. //已处理
  221. color: #1d6ced;
  222. background: url(../../../assets/images/page/notification/mail_blue_open.png)
  223. no-repeat;
  224. background-position: center;
  225. background-size: contain;
  226. }
  227. &.completed {
  228. //已完成
  229. color: #333;
  230. background: url(../../../assets/images/page/notification/mail_gray_open.png)
  231. no-repeat;
  232. background-position: center;
  233. background-size: contain;
  234. }
  235. }
  236. .title {
  237. color: #333333;
  238. font-size: 18px;
  239. font-weight: bold;
  240. margin-bottom: 6px;
  241. }
  242. .desc {
  243. color: #666666;
  244. font-size: 14px;
  245. }
  246. }
  247. .item-right {
  248. width: 280px;
  249. .time {
  250. color: #999;
  251. font-size: 14px;
  252. text-align: right;
  253. border-right: 1px solid #ccc;
  254. padding-right: 20px;
  255. line-height: 28px;
  256. white-space: nowrap;
  257. text-overflow: ellipsis;
  258. overflow: hidden;
  259. width: 160px;
  260. }
  261. .handle-btn {
  262. width: 90px;
  263. margin-left: 20px;
  264. margin-right: 10px;
  265. font-size: 14px;
  266. &.need-handle {
  267. //待处理
  268. color: #f56c6c;
  269. }
  270. &.need-confirmed {
  271. //待查看
  272. color: #f56c6c;
  273. }
  274. &.confimed {
  275. //已查看
  276. color: #333;
  277. }
  278. &.handled {
  279. //已处理
  280. color: #1d6ced;
  281. }
  282. &.completed {
  283. //已完成
  284. color: #333;
  285. }
  286. }
  287. }
  288. </style>