SysAnnouncementList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  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" @change="handleImportExcel">-->
  31. <!-- <a-button type="primary" icon="import">导入</a-button>-->
  32. <!-- </a-upload>-->
  33. <a-dropdown v-if="selectedRowKeys.length > 0">
  34. <a-menu slot="overlay">
  35. <a-menu-item key="1" @click="batchDel">
  36. <a-icon type="delete"/>
  37. 删除
  38. </a-menu-item>
  39. </a-menu>
  40. <a-button style="margin-left: 8px"> 批量操作
  41. <a-icon type="down"/>
  42. </a-button>
  43. </a-dropdown>
  44. </div>
  45. <!-- table区域-begin -->
  46. <div>
  47. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  48. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  49. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  50. </div>
  51. <a-table
  52. ref="table"
  53. size="middle"
  54. bordered
  55. rowKey="id"
  56. :columns="columns"
  57. :dataSource="dataSource"
  58. :pagination="ipagination"
  59. :loading="loading"
  60. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  61. @change="handleTableChange">
  62. <span slot="action" slot-scope="text, record">
  63. <a v-if="record.sendStatus == 0" @click="handleEdit(record)">编辑</a>
  64. <a-divider type="vertical" v-if="record.sendStatus == 0"/>
  65. <a-dropdown>
  66. <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
  67. <a-menu slot="overlay">
  68. <a-menu-item v-if="record.sendStatus != 1">
  69. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  70. <a>删除</a>
  71. </a-popconfirm>
  72. </a-menu-item>
  73. <a-menu-item v-if="record.sendStatus == 0">
  74. <a-popconfirm title="确定发布吗?" @confirm="() => releaseData(record.id)">
  75. <a>发布</a>
  76. </a-popconfirm>
  77. </a-menu-item>
  78. <a-menu-item v-if="record.sendStatus == 1">
  79. <a-popconfirm title="确定撤销吗?" @confirm="() => reovkeData(record.id)">
  80. <a>撤销</a>
  81. </a-popconfirm>
  82. </a-menu-item>
  83. <a-menu-item>
  84. <a @click="handleDetail(record)">查看</a>
  85. </a-menu-item>
  86. </a-menu>
  87. </a-dropdown>
  88. </span>
  89. </a-table>
  90. </div>
  91. <!-- table区域-end -->
  92. <!-- 表单区域 -->
  93. <sysAnnouncement-modal ref="modalForm" @ok="modalFormOk"></sysAnnouncement-modal>
  94. <!-- 查看详情 -->
  95. <j-modal class="detail-modal" title="查看详情" :visible.sync="detailModal.visible" :top="50" :width="600" switchFullscreen :footer="null">
  96. <iframe v-if="detailModal.url" class="detail-iframe" :src="detailModal.url"/>
  97. </j-modal>
  98. </a-card>
  99. </template>
  100. <script>
  101. import SysAnnouncementModal from './modules/SysAnnouncementModal'
  102. import {doReleaseData, doReovkeData} from '@/api/api'
  103. import {getAction} from '@/api/manage'
  104. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  105. import { ACCESS_TOKEN } from '@/store/mutation-types'
  106. export default {
  107. name: "SysAnnouncementList",
  108. mixins: [JeecgListMixin],
  109. components: {
  110. SysAnnouncementModal
  111. },
  112. data() {
  113. return {
  114. description: '系统通告表管理页面',
  115. // 查询条件
  116. queryParam: {},
  117. // 表头
  118. columns: [
  119. {
  120. title: '#',
  121. dataIndex: '',
  122. key: 'rowIndex',
  123. width: 60,
  124. align: "center",
  125. customRender: function (t, r, index) {
  126. return parseInt(index) + 1;
  127. }
  128. },
  129. {
  130. title: '标题',
  131. align: "center",
  132. dataIndex: 'titile'
  133. },
  134. {
  135. title: '消息类型',
  136. align: "center",
  137. dataIndex: 'msgCategory',
  138. customRender: function (text) {
  139. if (text == '1') {
  140. return "通知公告";
  141. } else if (text == "2") {
  142. return "系统消息";
  143. } else {
  144. return text;
  145. }
  146. }
  147. },
  148. /*{
  149. title: '开始时间',
  150. align: "center",
  151. dataIndex: 'startTime'
  152. },
  153. {
  154. title: '结束时间',
  155. align: "center",
  156. dataIndex: 'endTime'
  157. },*/
  158. {
  159. title: '发布人',
  160. align: "center",
  161. dataIndex: 'sender'
  162. },
  163. {
  164. title: '优先级',
  165. align: "center",
  166. dataIndex: 'priority',
  167. customRender: function (text) {
  168. if (text == 'L') {
  169. return "低";
  170. } else if (text == "M") {
  171. return "中";
  172. } else if (text == "H") {
  173. return "高";
  174. } else {
  175. return text;
  176. }
  177. }
  178. },
  179. {
  180. title: '通告对象',
  181. align: "center",
  182. dataIndex: 'msgType',
  183. customRender: function (text) {
  184. if (text == 'USER') {
  185. return "指定用户";
  186. } else if (text == "ALL") {
  187. return "全体用户";
  188. } else {
  189. return text;
  190. }
  191. }
  192. },
  193. {
  194. title: '发布状态',
  195. align: "center",
  196. dataIndex: 'sendStatus',
  197. customRender: function (text) {
  198. if (text == 0) {
  199. return "未发布";
  200. } else if (text == 1) {
  201. return "已发布";
  202. } else if (text == 2) {
  203. return "已撤销";
  204. } else {
  205. return text;
  206. }
  207. }
  208. },
  209. {
  210. title: '发布时间',
  211. align: "center",
  212. dataIndex: 'sendTime'
  213. },
  214. {
  215. title: '撤销时间',
  216. align: "center",
  217. dataIndex: 'cancelTime'
  218. },
  219. /*{
  220. title: '删除状态(0,正常,1已删除)',
  221. align:"center",
  222. dataIndex: 'delFlag'
  223. },*/
  224. {
  225. title: '操作',
  226. dataIndex: 'action',
  227. align: "center",
  228. scopedSlots: {customRender: 'action'},
  229. }
  230. ],
  231. detailModal: {visible: false, url: '',},
  232. url: {
  233. list: "/sys/annountCement/list",
  234. delete: "/sys/annountCement/delete",
  235. deleteBatch: "/sys/annountCement/deleteBatch",
  236. releaseDataUrl: "/sys/annountCement/doReleaseData",
  237. reovkeDataUrl: "sys/annountCement/doReovkeData",
  238. exportXlsUrl: "sys/annountCement/exportXls",
  239. importExcelUrl: "sys/annountCement/importExcel",
  240. },
  241. }
  242. },
  243. computed: {
  244. importExcelUrl: function(){
  245. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  246. }
  247. },
  248. methods: {
  249. //执行发布操作
  250. releaseData: function (id) {
  251. console.log(id);
  252. var that = this;
  253. doReleaseData({id: id}).then((res) => {
  254. if (res.success) {
  255. that.$message.success(res.message);
  256. that.loadData(1);
  257. } else {
  258. that.$message.warning(res.message);
  259. }
  260. });
  261. },
  262. //执行撤销操作
  263. reovkeData: function (id) {
  264. var that = this;
  265. doReovkeData({id: id}).then((res) => {
  266. if (res.success) {
  267. that.$message.success(res.message);
  268. that.loadData(1);
  269. this.syncHeadNotic(id)
  270. } else {
  271. that.$message.warning(res.message);
  272. }
  273. });
  274. },
  275. syncHeadNotic(anntId){
  276. getAction("sys/annountCement/syncNotic",{anntId:anntId})
  277. },
  278. handleDetail:function(record){
  279. const domain = window._CONFIG['domianURL']
  280. const token = this.$ls.get(ACCESS_TOKEN)
  281. this.detailModal.url = `${domain}/sys/annountCement/show/${record.id}?token=${token}`
  282. this.detailModal.visible = true
  283. },
  284. }
  285. }
  286. </script>
  287. <style scoped lang="less">
  288. @import '~@assets/less/common.less';
  289. /** 查看详情弹窗的样式 */
  290. .detail-modal {
  291. .detail-iframe {
  292. border: 0;
  293. width: 100%;
  294. height: 88vh;
  295. min-height: 600px;
  296. }
  297. &.fullscreen .detail-iframe {
  298. height: 100%;
  299. }
  300. }
  301. .detail-modal /deep/ .ant-modal {
  302. top: 30px;
  303. .ant-modal-body {
  304. font-size: 0;
  305. padding: 0;
  306. }
  307. }
  308. .detail-modal.fullscreen /deep/ .ant-modal {
  309. top: 0;
  310. }
  311. </style>