index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <div class="filter-container">
  5. <el-form
  6. label-width="100px"
  7. class="ele-form-search"
  8. @keyup.enter.native="reload"
  9. @submit.native.prevent
  10. >
  11. <el-row :gutter="15">
  12. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  13. <el-form-item label="状态:" prop="readStatus">
  14. <el-select
  15. style="width: 100%"
  16. v-model="params.readStatus"
  17. placeholder="请选择状态"
  18. clearable
  19. >
  20. <el-option :value="1" label="已读"></el-option>
  21. <el-option :value="0" label="未读"></el-option>
  22. </el-select>
  23. </el-form-item>
  24. </el-col>
  25. <el-col
  26. v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  27. <el-form-item label="发送时间:" prop="createTime">
  28. <el-date-picker
  29. v-model="params.createTime"
  30. style="width: 100%"
  31. value-format="yyyy-MM-dd HH:mm:ss"
  32. type="daterange"
  33. range-separator="-"
  34. start-placeholder="开始日期"
  35. end-placeholder="结束日期"
  36. :default-time="['00:00:00', '23:59:59']"
  37. />
  38. </el-form-item>
  39. </el-col>
  40. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  41. <div class="ele-form-actions">
  42. <el-button
  43. type="primary"
  44. icon="el-icon-search"
  45. class="ele-btn-icon"
  46. @click="reload('search')"
  47. >
  48. 查询
  49. </el-button>
  50. <el-button @click="reload('reset')">重置</el-button>
  51. </div>
  52. </el-col>
  53. </el-row>
  54. </el-form>
  55. </div>
  56. <ele-pro-table ref="table" :columns="columns" :datasource="datasource">
  57. <!-- 操作列 -->
  58. <template v-slot:action="{ row }">
  59. <el-link
  60. type="primary"
  61. :underline="false"
  62. icon="el-icon-view"
  63. v-if="!row.readStatus"
  64. @click="handleAddOrEdit(row)"
  65. >
  66. 已读
  67. </el-link>
  68. </template>
  69. <template v-slot:readStatus="{row}">
  70. <el-tag v-if="row.readStatus" type="success">{{ '已读' }}</el-tag>
  71. <el-tag v-else type="danger">{{ '未读' }}</el-tag>
  72. </template>
  73. </ele-pro-table>
  74. </el-card>
  75. </div>
  76. </template>
  77. <script>
  78. import {notifyMessagePageAPI, updateNotifyMessageReadByIdAPI} from "@/api/bpm/task";
  79. import {mapGetters} from "vuex";
  80. export default {
  81. data() {
  82. return {
  83. addOrEditDialogFlag: false,
  84. params: {
  85. createTime: null,
  86. readStatus: null,
  87. },
  88. columns: [
  89. {
  90. columnKey: 'index',
  91. label: '序号',
  92. type: 'index',
  93. width: 55,
  94. align: 'center',
  95. showOverflowTooltip: true,
  96. fixed: 'left'
  97. },
  98. {
  99. prop: 'templateContent',
  100. label: '消息',
  101. minWidth: '250',
  102. },
  103. {
  104. prop: 'readStatus',
  105. label: '状态',
  106. width: '80',
  107. align: "center",
  108. slot:'readStatus',
  109. },
  110. {
  111. prop: 'readTime',
  112. label: '阅读时间',
  113. width: '180',
  114. align: "center",
  115. showOverflowTooltip: true,
  116. },
  117. {
  118. prop: 'templateNickname',
  119. label: '发送人',
  120. width: '80',
  121. align: "center",
  122. },
  123. {
  124. prop: 'createTime',
  125. label: '发送时间',
  126. width: '180',
  127. align: "center",
  128. showOverflowTooltip: true,
  129. },
  130. {
  131. columnKey: 'action',
  132. label: '操作',
  133. width: 100,
  134. align: 'center',
  135. slot: 'action',
  136. fixed: 'right'
  137. }
  138. ],
  139. searchForm: {},
  140. tableData: [],
  141. size: 10,
  142. page: 1,
  143. total: 0
  144. };
  145. },
  146. computed: {
  147. ...mapGetters(['user']),
  148. // 是否开启响应式布局
  149. styleResponsive() {
  150. return this.$store.state.theme.styleResponsive;
  151. }
  152. },
  153. methods: {
  154. //新增或修改模板
  155. async handleAddOrEdit(row) {
  156. await updateNotifyMessageReadByIdAPI([row.id]);
  157. this.$refs.table.reload()
  158. },
  159. reload(type) {
  160. if (type == 'reset') {
  161. this.params = {
  162. createTime: null,
  163. readStatus: null,
  164. }
  165. }
  166. this.$refs.table.reload({pageNum: 1, where: this.params});
  167. },
  168. datasource({page, where, limit, ...row}) {
  169. return notifyMessagePageAPI({
  170. ...where,
  171. pageNum: page,
  172. size: limit,
  173. userId: this.user.info.userId
  174. });
  175. },
  176. }
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. .app-container {
  181. background: #f0f3f3;
  182. min-height: calc(100vh - 84px);
  183. }
  184. .zw-page-table {
  185. background: #ffffff;
  186. padding-top: 20px;
  187. }
  188. .pagination-wrap {
  189. display: flex;
  190. justify-content: flex-end;
  191. padding: 10px 0;
  192. }
  193. .table {
  194. width: 100%;
  195. margin-top: 10px;
  196. }
  197. </style>