SysAnnouncementList.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="24">
  7. <a-col :span="6">
  8. <a-form-item label="标题">
  9. <a-input placeholder="请输入标题" v-model="queryParam.titile"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <!--<a-col :span="6">
  13. <a-form-item label="内容">
  14. <a-input placeholder="请输入内容" v-model="queryParam.msgContent"></a-input>
  15. </a-form-item>
  16. </a-col>-->
  17. <a-col :span="8">
  18. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  19. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  20. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  21. </span>
  22. </a-col>
  23. </a-row>
  24. </a-form>
  25. </div>
  26. <!-- 操作按钮区域 -->
  27. <div class="table-operator">
  28. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  29. <a-button type="primary" icon="download" @click="handleExportXls('系统通告')">导出</a-button>
  30. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
  31. @change="handleImportExcel">
  32. <a-button type="primary" icon="import">导入</a-button>
  33. </a-upload>
  34. <a-dropdown v-if="selectedRowKeys.length > 0">
  35. <a-menu slot="overlay">
  36. <a-menu-item key="1" @click="batchDel">
  37. <a-icon type="delete"/>
  38. 删除
  39. </a-menu-item>
  40. </a-menu>
  41. <a-button style="margin-left: 8px"> 批量操作
  42. <a-icon type="down"/>
  43. </a-button>
  44. </a-dropdown>
  45. </div>
  46. <!-- table区域-begin -->
  47. <div>
  48. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  49. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{
  50. selectedRowKeys.length }}</a>项
  51. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  52. </div>
  53. <a-table
  54. ref="table"
  55. size="middle"
  56. bordered
  57. rowKey="id"
  58. :columns="columns"
  59. :dataSource="dataSource"
  60. :pagination="ipagination"
  61. :loading="loading"
  62. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  63. @change="handleTableChange">
  64. <span slot="action" slot-scope="text, record">
  65. <a @click="handleEdit(record)">编辑</a>
  66. <a-divider type="vertical"/>
  67. <a-dropdown>
  68. <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  69. <a-menu slot="overlay">
  70. <a-menu-item>
  71. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  72. <a>删除</a>
  73. </a-popconfirm>
  74. </a-menu-item>
  75. <a-menu-item v-if="record.sendStatus == 0">
  76. <a-popconfirm title="确定发布吗?" @confirm="() => releaseData(record.id)">
  77. <a>发布</a>
  78. </a-popconfirm>
  79. </a-menu-item>
  80. <a-menu-item v-if="record.sendStatus == 1">
  81. <a-popconfirm title="确定撤销吗?" @confirm="() => reovkeData(record.id)">
  82. <a>撤销</a>
  83. </a-popconfirm>
  84. </a-menu-item>
  85. </a-menu>
  86. </a-dropdown>
  87. </span>
  88. </a-table>
  89. </div>
  90. <!-- table区域-end -->
  91. <!-- 表单区域 -->
  92. <sysAnnouncement-modal ref="modalForm" @ok="modalFormOk"></sysAnnouncement-modal>
  93. </a-card>
  94. </template>
  95. <script>
  96. import SysAnnouncementModal from './modules/SysAnnouncementModal'
  97. import {doReleaseData, doReovkeData} from '@/api/api'
  98. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  99. export default {
  100. name: "SysAnnouncementList",
  101. mixins: [JeecgListMixin],
  102. components: {
  103. SysAnnouncementModal
  104. },
  105. data() {
  106. return {
  107. description: '系统通告表管理页面',
  108. // 查询条件
  109. queryParam: {},
  110. // 表头
  111. columns: [
  112. {
  113. title: '#',
  114. dataIndex: '',
  115. key: 'rowIndex',
  116. width: 60,
  117. align: "center",
  118. customRender: function (t, r, index) {
  119. return parseInt(index) + 1;
  120. }
  121. },
  122. {
  123. title: '标题',
  124. align: "center",
  125. dataIndex: 'titile'
  126. },
  127. {
  128. title: '消息类型',
  129. align: "center",
  130. dataIndex: 'msgCategory',
  131. customRender: function (text) {
  132. if (text == '1') {
  133. return "通知公告";
  134. } else if (text == "2") {
  135. return "系统消息";
  136. } else {
  137. return text;
  138. }
  139. }
  140. },
  141. /*{
  142. title: '开始时间',
  143. align: "center",
  144. dataIndex: 'startTime'
  145. },
  146. {
  147. title: '结束时间',
  148. align: "center",
  149. dataIndex: 'endTime'
  150. },*/
  151. {
  152. title: '发布人',
  153. align: "center",
  154. dataIndex: 'sender'
  155. },
  156. {
  157. title: '优先级',
  158. align: "center",
  159. dataIndex: 'priority',
  160. customRender: function (text) {
  161. if (text == 'L') {
  162. return "低";
  163. } else if (text == "M") {
  164. return "中";
  165. } else if (text == "H") {
  166. return "高";
  167. } else {
  168. return text;
  169. }
  170. }
  171. },
  172. {
  173. title: '通告对象',
  174. align: "center",
  175. dataIndex: 'msgType',
  176. customRender: function (text) {
  177. if (text == 'USER') {
  178. return "指定用户";
  179. } else if (text == "ALL") {
  180. return "全体用户";
  181. } else {
  182. return text;
  183. }
  184. }
  185. },
  186. {
  187. title: '发布状态',
  188. align: "center",
  189. dataIndex: 'sendStatus',
  190. customRender: function (text) {
  191. if (text == 0) {
  192. return "未发布";
  193. } else if (text == 1) {
  194. return "已发布";
  195. } else if (text == 2) {
  196. return "已撤销";
  197. } else {
  198. return text;
  199. }
  200. }
  201. },
  202. {
  203. title: '发布时间',
  204. align: "center",
  205. dataIndex: 'sendTime'
  206. },
  207. {
  208. title: '撤销时间',
  209. align: "center",
  210. dataIndex: 'cancelTime'
  211. },
  212. /*{
  213. title: '删除状态(0,正常,1已删除)',
  214. align:"center",
  215. dataIndex: 'delFlag'
  216. },*/
  217. {
  218. title: '操作',
  219. dataIndex: 'action',
  220. align: "center",
  221. scopedSlots: {customRender: 'action'},
  222. }
  223. ],
  224. url: {
  225. list: "/sys/annountCement/list",
  226. delete: "/sys/annountCement/delete",
  227. deleteBatch: "/sys/annountCement/deleteBatch",
  228. releaseDataUrl: "/sys/annountCement/doReleaseData",
  229. reovkeDataUrl: "sys/annountCement/doReovkeData",
  230. exportXlsUrl: "sys/annountCement/exportXls",
  231. importExcelUrl: "sys/annountCement/importExcel",
  232. },
  233. }
  234. },
  235. computed: {
  236. importExcelUrl: function () {
  237. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  238. }
  239. },
  240. methods: {
  241. //执行发布操作
  242. releaseData: function (id) {
  243. console.log(id);
  244. var that = this;
  245. doReleaseData({id: id}).then((res) => {
  246. if (res.success) {
  247. that.$message.success(res.message);
  248. that.loadData(1);
  249. } else {
  250. that.$message.warning(res.message);
  251. }
  252. });
  253. },
  254. //执行撤销操作
  255. reovkeData: function (id) {
  256. var that = this;
  257. doReovkeData({id: id}).then((res) => {
  258. if (res.success) {
  259. that.$message.success(res.message);
  260. that.loadData(1);
  261. } else {
  262. that.$message.warning(res.message);
  263. }
  264. });
  265. },
  266. }
  267. }
  268. </script>
  269. <style scoped>
  270. @import '~@assets/less/common.less'
  271. </style>