task-pop-list.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="notice-pop-list">
  3. <ul class="npl-box">
  4. <li v-for="(item, index) in listData" :key="index" @click="gotoDetail(item)">
  5. <div class="nplb-l">
  6. <div class="nplb-type">【消息】</div>
  7. <div class="nplb-icon"></div>
  8. <div class="nplb-title">
  9. {{ item.title }}
  10. </div>
  11. </div>
  12. <div class="nplb-r">
  13. {{ item.sendTime }}
  14. </div>
  15. </li>
  16. </ul>
  17. <el-pagination
  18. background
  19. class="smp-pagination"
  20. layout="prev, pager, next"
  21. :pager-count="5"
  22. :page-size="pagingConfig.perPageNum"
  23. :total="pagingConfig.totalNum"
  24. @current-change="pagingChange"
  25. >
  26. </el-pagination>
  27. <el-dialog
  28. title="详情"
  29. :visible.sync="dialogVisible"
  30. width="30%"
  31. :modal-append-to-body="true"
  32. :append-to-body="true">
  33. <div class="npl-detail">
  34. <div class="npld-title">{{detail.title}}</div>
  35. <div class="npld-time-box">
  36. <div class="npld-time">{{detail.sendTime}}</div>
  37. <div class="npld-author">{{detail.sender}}</div>
  38. </div>
  39. <div class="npld-summary">{{detail.detail}}</div>
  40. </div>
  41. </el-dialog>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. props: {
  47. // config: {
  48. // default () {
  49. // return {}
  50. // }
  51. // }
  52. },
  53. data () {
  54. return {
  55. didNum: '',
  56. listData: [],
  57. url: 'http://124.225.17.80:8146/odae/clue/supervisionTask/pressTaskList',
  58. pagingConfig: {
  59. perPageNum: 10,
  60. totalNum: 100,
  61. currentPage: 1
  62. },
  63. dialogVisible: false,
  64. detail: {}
  65. }
  66. },
  67. mounted () {
  68. // this.getData()
  69. },
  70. methods: {
  71. getData () {
  72. this.getList(this.didNum)
  73. },
  74. getList (didNum) {
  75. this.didNum = didNum
  76. let config = {
  77. status: didNum
  78. }
  79. this.$http.get(
  80. '/sys/message/list',
  81. {
  82. params: config
  83. }
  84. ).then(({ data: res }) => {
  85. if (res.code !== 0) {
  86. return this.$message.error(res.msg)
  87. }
  88. this.$emit('update', res.messageList.length)
  89. this.setData(res.messageList)
  90. }).catch(() => {
  91. })
  92. },
  93. pagingChange (num) {
  94. this.pagingConfig.currentPage += 1
  95. this.getData()
  96. },
  97. setData (d) {
  98. this.listData = d.map((e) => {
  99. return {
  100. ...e
  101. }
  102. })
  103. // this.listData
  104. },
  105. gotoDetail (item) {
  106. this.dialogVisible = true
  107. this.detail = item
  108. // console.log(this.$parent.$parent.$parent.$parent.$parent.$refs['mainNavbar'].$refs['navbarnews'])
  109. // console.log(item.id)
  110. if (this.didNum === 0) {
  111. this.pressRead(item)
  112. }
  113. },
  114. pressRead (item) {
  115. this.$http.get('/sys/message/pressRead',
  116. {
  117. params: {
  118. id: item.id
  119. }
  120. }
  121. ).then(({ data: res }) => {
  122. if (res.code !== 0) {
  123. return this.$message.error(res.msg)
  124. }
  125. this.getList(this.didNum)
  126. this.$parent.$parent.$parent.$parent.$parent.$refs['mainNavbar'].$refs['navbarnews'].getTask()
  127. // this.$message.success(res.msg)
  128. }).catch(() => {})
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss">
  134. .smp-list-time {
  135. // padding: 0!important;
  136. }
  137. </style>