index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item prop="noticeTitle">
  5. <el-input v-model="queryParams.noticeTitle" placeholder="请输入公告标题" clearable @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  9. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  10. </el-form-item>
  11. </el-form>
  12. <el-row :gutter="10" class="mb8">
  13. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  14. </el-row>
  15. <Page uri="/system/notice/workbench/list" :request-params="queryParams" ref="pagination">
  16. <el-table-column label="序号" align="center" prop="noticeId" width="100" />
  17. <el-table-column label="公告标题" align="center" prop="noticeTitle" :show-overflow-tooltip="true" />
  18. <el-table-column label="公告类型" align="center" prop="noticeType" width="100">
  19. <template slot-scope="scope">
  20. <dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType" />
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="状态" align="center" prop="status" width="100">
  24. <template slot-scope="scope">
  25. <dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status" />
  26. </template>
  27. </el-table-column>
  28. <el-table-column label="发布者" align="center" prop="createBy" width="100" />
  29. <el-table-column label="创建时间" align="center" prop="createTime" width="100">
  30. <template slot-scope="scope">
  31. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200px">
  35. <template slot-scope="scope">
  36. <el-button type="text" icon="el-icon-edit" @click="openDetail(scope.row)">详情</el-button>
  37. </template>
  38. </el-table-column>
  39. </Page>
  40. <!-- 添加或修改公告对话框 -->
  41. <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
  42. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  43. <el-row>
  44. <el-col :span="24">
  45. <p style="text-align: center; font-size: 25px">{{ form.noticeTitle }}</p>
  46. </el-col>
  47. <el-col :span="12">
  48. <p style="text-align: right; width: 40%">发布者: {{ form.createBy }}</p>
  49. </el-col>
  50. <el-col :span="12">
  51. <p style="text-align: right; width: 90%">发布时间: {{ form.createTime }}</p>
  52. </el-col>
  53. <el-col :span="24">
  54. <div style="text-align: center; margin-left: 30px; margin-right: 30px" v-html="form.noticeContent"></div>
  55. </el-col>
  56. </el-row>
  57. </el-form>
  58. </el-dialog>
  59. </div>
  60. </template>
  61. <script>
  62. import { listWorkbenchNotice } from '@/api/system/notice'
  63. export default {
  64. name: 'Notice',
  65. dicts: ['sys_notice_status', 'sys_notice_type'],
  66. data() {
  67. return {
  68. // 遮罩层
  69. loading: true,
  70. // 选中数组
  71. ids: [],
  72. // 非单个禁用
  73. single: true,
  74. // 非多个禁用
  75. multiple: true,
  76. // 显示搜索条件
  77. showSearch: true,
  78. // 总条数
  79. total: 0,
  80. // 公告表格数据
  81. noticeList: [],
  82. // 弹出层标题
  83. title: '',
  84. // 是否显示弹出层
  85. open: false,
  86. // 查询参数
  87. queryParams: {
  88. noticeTitle: undefined,
  89. createBy: undefined,
  90. status: undefined
  91. },
  92. // 表单参数
  93. form: {},
  94. // 表单校验
  95. rules: {}
  96. }
  97. },
  98. created() {
  99. this.getList()
  100. },
  101. methods: {
  102. /** 查询公告列表 */
  103. getList() {
  104. this.$nextTick(() => {
  105. this.$refs.pagination.handleSearch(true)
  106. })
  107. },
  108. // 表单重置
  109. reset() {
  110. this.form = {
  111. noticeId: undefined,
  112. noticeTitle: undefined,
  113. noticeType: undefined,
  114. noticeContent: undefined,
  115. status: '0'
  116. }
  117. this.resetForm('form')
  118. },
  119. /** 搜索按钮操作 */
  120. handleQuery() {
  121. this.getList()
  122. },
  123. /** 重置按钮操作 */
  124. resetQuery() {
  125. this.resetForm('queryForm')
  126. this.handleQuery()
  127. },
  128. openDetail(row) {
  129. this.open = true
  130. this.form = row
  131. }
  132. }
  133. }
  134. </script>