index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <!-- 条件区 -->
  5. <search @search="reload"/>
  6. <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :pageSize="this.$store.state.tablePageSize" @filter-change="selectType">
  7. <!-- 操作列 -->
  8. <template v-slot:action="{ row }">
  9. <el-link
  10. type="primary"
  11. :underline="false"
  12. icon="el-icon-view"
  13. @click="handleAddOrEdit('view',row)"
  14. >
  15. 详情
  16. </el-link>
  17. </template>
  18. <template v-slot:readStatus="{row}">
  19. <el-tag v-if="row.readStatus" type="success">{{ '已读' }}</el-tag>
  20. <el-tag v-else type="danger">{{ '未读' }}</el-tag>
  21. </template>
  22. </ele-pro-table>
  23. </el-card>
  24. <!--新增、修改-->
  25. <add-or-edit-dialog v-if="addOrEditDialogFlag" :addOrEditDialogFlag.sync="addOrEditDialogFlag"
  26. ref="addOrEditDialogRef" @done="reload"></add-or-edit-dialog>
  27. </div>
  28. </template>
  29. <script>
  30. import search from './index-search.vue';
  31. import addOrEditDialog from "@/views/notifyManage/templateManage/components/addOrEditDialog.vue";
  32. import {notifyMessagePageAPI} from "@/api/notifyRecord";
  33. export default {
  34. components: {addOrEditDialog, search},
  35. data() {
  36. return {
  37. addOrEditDialogFlag: false,
  38. columns: [
  39. {
  40. columnKey: 'index',
  41. label: '序号',
  42. type: 'index',
  43. width: 55,
  44. align: 'center',
  45. showOverflowTooltip: true,
  46. fixed: 'left'
  47. },
  48. {
  49. prop: 'templateContent',
  50. label: '消息',
  51. minWidth: '150',
  52. },
  53. {
  54. prop: 'templateCode',
  55. label: '模板编码',
  56. minWidth: '120',
  57. align: "center",
  58. },
  59. {
  60. prop: 'userName',
  61. label: '接收人',
  62. minWidth: '60',
  63. align: "center",
  64. },
  65. {//修改此prop名称时,请同步修改columnKey属性和下方selectType方法
  66. prop: 'readStatus',
  67. label: '状态',
  68. width: '90',
  69. slot:'readStatus',
  70. align: "center",
  71. filters: [
  72. { value: 1, text: '已读' },
  73. { value: 0, text: '未读' },
  74. ],
  75. filterMultiple: false,
  76. columnKey: 'readStatus'
  77. },
  78. {
  79. prop: 'readTime',
  80. label: '阅读时间',
  81. width: '170',
  82. align: "center",
  83. showOverflowTooltip: true,
  84. },
  85. {
  86. prop: 'templateNickname',
  87. label: '发送人',
  88. width: '100',
  89. align: "center",
  90. },
  91. {
  92. prop: 'createTime',
  93. label: '创建时间',
  94. width: '170',
  95. align: "center",
  96. showOverflowTooltip: true,
  97. },
  98. // {
  99. // columnKey: 'action',
  100. // label: '操作',
  101. // width: 100,
  102. // align: 'center',
  103. // slot: 'action',
  104. // fixed: 'right'
  105. // }
  106. ],
  107. searchForm: {},
  108. tableData: [],
  109. size: 10,
  110. page: 1,
  111. total: 0
  112. };
  113. },
  114. methods: {
  115. selectType(value) {
  116. let where = {}
  117. if (value.readStatus.length > 0) {
  118. where['readStatus'] = value.readStatus[0]
  119. }
  120. this.reload(where)
  121. },
  122. //新增或修改模板
  123. handleAddOrEdit(type, row) {
  124. this.addOrEditDialogFlag = true
  125. this.$nextTick(() => {
  126. this.$refs.addOrEditDialogRef.init(type, row)
  127. })
  128. },
  129. reload(params) {
  130. this.$refs.table.reload({pageNum: 1, where: params});
  131. },
  132. datasource({page, where, limit,...row}) {
  133. return notifyMessagePageAPI({
  134. ...where,
  135. pageNum: page,
  136. size: limit
  137. });
  138. },
  139. reset() {
  140. },
  141. }
  142. };
  143. </script>
  144. <style lang="scss" scoped>
  145. .app-container {
  146. background: #f0f3f3;
  147. min-height: calc(100vh - 84px);
  148. }
  149. .zw-page-table {
  150. background: #ffffff;
  151. padding-top: 20px;
  152. }
  153. .pagination-wrap {
  154. display: flex;
  155. justify-content: flex-end;
  156. padding: 10px 0;
  157. }
  158. .table {
  159. width: 100%;
  160. margin-top: 10px;
  161. }
  162. </style>