myNotify.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="app-container">
  3. <!-- 搜索工作栏 -->
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px">
  5. <el-form-item label="模板标题" prop="title">
  6. <el-input v-model="queryParams.title" placeholder="请输入模板标题" clearable @keyup.enter.native="handleQuery"/>
  7. </el-form-item>
  8. <el-form-item label="读取状态" prop="readStatus">
  9. <el-select v-model="queryParams.readStatus" placeholder="请选择状态" clearable>
  10. <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS)"
  11. :key="dict.value" :label="dict.label" :value="dict.value"/>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="创建时间" prop="createTime">
  15. <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
  16. range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  20. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  21. </el-form-item>
  22. </el-form>
  23. <!-- 操作工具栏 -->
  24. <el-row :gutter="10" class="mb8">
  25. <el-col :span="1.5">
  26. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUpdateList">标记已读</el-button>
  27. </el-col>
  28. <el-col :span="1.5">
  29. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleUpdateAll">全部已读</el-button>
  30. </el-col>
  31. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  32. </el-row>
  33. <!-- 列表 -->
  34. <el-table v-loading="loading" ref="tables" :data="list">
  35. <el-table-column type="selection" width="55" />
  36. <el-table-column label="模板标题" align="center" prop="title" />
  37. <el-table-column label="模板内容" align="center" prop="content" width="300" />
  38. <el-table-column label="发送人" align="center" prop="sendUserName" />
  39. <el-table-column label="发送时间" align="center" prop="sendTime" width="180">
  40. <template slot-scope="scope">
  41. <span>{{ parseTime(scope.row.sendTime) }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="读取状态" align="center" prop="readStatus">
  45. <template slot-scope="scope">
  46. <dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_READ_STATUS" :value="scope.row.readStatus"/>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
  50. <template slot-scope="scope">
  51. <el-button v-show="!scope.row.readStatus" size="mini" type="text" icon="el-icon-check" @click="handleUpdateSingle(scope.row)">已读</el-button>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <!-- 分页组件 -->
  56. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
  57. @pagination="getList"/>
  58. </div>
  59. </template>
  60. <script>
  61. import { getNotifyMessagePage, updateNotifyMessageListRead, updateNotifyMessageAllRead} from "@/api/system/notify/myNotify";
  62. export default {
  63. name: "myNotify",
  64. data() {
  65. return {
  66. // 遮罩层
  67. loading: true,
  68. // 导出遮罩层
  69. exportLoading: false,
  70. // 显示搜索条件
  71. showSearch: true,
  72. // 总条数
  73. total: 0,
  74. // 我的站内信列表
  75. list: [],
  76. // 弹出层标题
  77. title: "",
  78. // 是否显示弹出层
  79. open: false,
  80. // 查询参数
  81. queryParams: {
  82. pageNo: 1,
  83. pageSize: 10,
  84. readStatus: null,
  85. code: null,
  86. title: null,
  87. createTime: []
  88. },
  89. };
  90. },
  91. created() {
  92. this.getList();
  93. },
  94. methods: {
  95. /** 查询列表 */
  96. getList() {
  97. this.loading = true;
  98. // 执行查询
  99. getNotifyMessagePage(this.queryParams).then(response => {
  100. this.list = response.data.list;
  101. this.total = response.data.total;
  102. this.loading = false;
  103. });
  104. },
  105. /** 搜索按钮操作 */
  106. handleQuery() {
  107. this.queryParams.pageNo = 1;
  108. this.getList();
  109. },
  110. /** 重置按钮操作 */
  111. resetQuery() {
  112. this.resetForm("queryForm");
  113. this.handleQuery();
  114. },
  115. handleUpdateList(){
  116. let list = this.$refs["tables"].selection;
  117. if(list.length != 0){
  118. this.handleUpdate(list.map(v=>v.id))
  119. }
  120. },
  121. handleUpdateSingle(row){
  122. this.handleUpdate([row.id])
  123. },
  124. handleUpdate(ids){
  125. updateNotifyMessageListRead(ids).then(response => {
  126. this.$modal.msgSuccess("修改成功");
  127. this.getList();
  128. });
  129. },
  130. handleUpdateAll(){
  131. updateNotifyMessageAllRead().then(response => {
  132. this.$modal.msgSuccess("修改成功");
  133. this.getList();
  134. });
  135. }
  136. }
  137. }
  138. </script>