enterpriseAnnouncement.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <a-card>
  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 :md="6" :sm="8">
  8. <a-form-item label="标题">
  9. <a-input placeholder="请输入标题查询" v-model="queryParam.title"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <span>
  13. <a-col :md="6" :sm="12">
  14. <a-button type="primary" style="left: 10px" @click="searchQuery" icon="search">查询</a-button>
  15. </a-col>
  16. </span>
  17. </a-row>
  18. </a-form>
  19. </div>
  20. <!-- 新增 批量删除 -->
  21. <div class="table-add">
  22. <a-button @click="addOpen" type="primary">新增</a-button>
  23. <!-- 批量操作-----------------------------------
  24. v-if="selectedRowKeys.length > 0"
  25. ------------------------------------------------>
  26. <a-dropdown>
  27. <a-menu slot="overlay">
  28. <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
  29. </a-menu>
  30. <a-button style="margin-left:24px"> 批量操作 <a-icon type="down"/></a-button>
  31. </a-dropdown>
  32. </div>
  33. <div>
  34. <!-- 已选择 清空 -->
  35. <div class="ant-alert ant-alert-info" style="margin: 20px 0;background:#e6f7ff;">
  36. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
  37. <!-- {{ selectedRowKeys.length }} -->
  38. <a style="font-weight: 600">2</a>项
  39. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  40. </div>
  41. <!-- table -->
  42. <a-row>
  43. <a-table
  44. bordered
  45. :columns="columns"
  46. :dataSource="annDataList"
  47. :loading="loading"
  48. :pagination="pagination"
  49. :row-key="record => record.id"
  50. :rowSelection="rowSelection"
  51. @change="handleTableChange"
  52. >
  53. <!-- 发布 -->
  54. <span slot="isReleaseSlot" slot-scope="text, record">
  55. <a-badge v-if="record.isRelease == '0'" status="warning" text="未发布" />
  56. <a-badge v-else status="success" text="已发布" style="color:red;" />
  57. </span>
  58. <!-- 操作 -->
  59. <span slot="operationSlot" slot-scope="text, record">
  60. <a href="javascript:void(0);" @click="editAnn(record.id)" style="color:#014f86;"> 编辑 </a>
  61. <a-divider type="vertical" />
  62. <a-popconfirm title="确定发布吗?" ok-text="是" cancel-text="否">
  63. <button @click="sendAnn(record.id)" class="sendAnn">发布</button>
  64. </a-popconfirm>
  65. <a-divider type="vertical" />
  66. <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否">
  67. <a href="javascript:void(0);" @click="delAnn(record.id)" style="color:#ff6b6b;"> 删除 </a>
  68. </a-popconfirm>
  69. </span>
  70. </a-table>
  71. </a-row>
  72. </div>
  73. <!-- 新增弹框 组件 -->
  74. <addAnn-modal ref="AddAnnModal" @ok="modalFormOk"></addAnn-modal>
  75. </a-card>
  76. </template>
  77. <script>
  78. // import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  79. import AddAnnModal from '@views/oa/enter-ann/add/addAnnModal.vue'
  80. export default {
  81. name: 'EnterpriseAnnouncement', // 企业公告
  82. // mixins: [JeecgListMixin],
  83. components: {
  84. AddAnnModal
  85. },
  86. data () {
  87. return {
  88. id: '', // 唯一标识 双休绑定后自动生成,删除
  89. loading: false, // 表格加载
  90. pagination: {}, // 分页
  91. queryParam: {}, // 查询条件对象
  92. // 表头
  93. columns: [
  94. {
  95. title: '标题',
  96. dataIndex: 'title',
  97. align: 'center'
  98. },
  99. {
  100. title: '类型',
  101. dataIndex: 'type',
  102. align: 'center'
  103. },
  104. {
  105. title: '创建人',
  106. dataIndex: 'createBy',
  107. align: 'center'
  108. },
  109. {
  110. title: '创建日期',
  111. dataIndex: 'createTime',
  112. align: 'center'
  113. },
  114. {
  115. title: '发布',
  116. dataIndex: 'isRelease',
  117. scopedSlots: { customRender: 'isReleaseSlot' },
  118. align: 'center'
  119. },
  120. {
  121. title: '操作',
  122. dataIndex: 'operation',
  123. scopedSlots: { customRender: 'operationSlot' },
  124. align: 'center',
  125. width: '20%'
  126. }
  127. ],
  128. // 公共数据
  129. annDataList: [
  130. {
  131. id: '1',
  132. title: '企业文化KPI考核',
  133. type: '正常',
  134. createBy: 'admin',
  135. createTime: '2020/09/09',
  136. isRelease: '0'
  137. },
  138. {
  139. id: '2',
  140. title: '周末全体员工聚餐',
  141. type: '财务',
  142. createBy: 'admin',
  143. createTime: '2021/12/19',
  144. isRelease: '1'
  145. }
  146. ]
  147. }
  148. },
  149. created () {},
  150. methods: {
  151. // 新增
  152. addOpen () {
  153. console.log('点击了大页面的新增')
  154. // 拿到子组件的弹框 属性
  155. this.$refs.AddAnnModal.addModalVisible = true
  156. },
  157. // 查询
  158. searchQuery () {
  159. // this.loading = true
  160. },
  161. // 重置
  162. reset () {},
  163. // 批量删除
  164. batchDel () {},
  165. // 清空
  166. onClearSelected () {},
  167. // ??
  168. modalFormOk () {},
  169. // 分页、排序、筛选变化时触发
  170. handleTableChange (pagination, filters, sorter) {
  171. // if (Object.keys(sorter).length > 0) {
  172. // this.isorter.column = sorter.field
  173. // this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc'
  174. // }
  175. // this.ipagination = pagination
  176. // this.loadData();
  177. },
  178. // 编辑
  179. editAnn (id) {
  180. console.log('点击了编辑,该项公共的ID是:', id)
  181. },
  182. // 发布
  183. sendAnn (id) {
  184. console.log('点击了发布')
  185. },
  186. // 撤销
  187. backAnn (id) {
  188. console.log('点击了撤销')
  189. },
  190. // 操作 删除
  191. delAnn () {
  192. console.log('点击了删除,需要发请求、确定提示、重新渲染')
  193. }
  194. },
  195. computed: {
  196. // 选中项
  197. rowSelection () {
  198. return {
  199. onChange: (selectedRowKeys, selectedRows) => {
  200. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  201. },
  202. getCheckboxProps: record => ({
  203. props: {
  204. disabled: record.title === 'Disabled User',
  205. // Column configuration not to be checked
  206. title: record.title
  207. }
  208. })
  209. }
  210. }
  211. },
  212. mounted () {}
  213. }
  214. </script>
  215. <style lang="less" scoped>
  216. @import '~@assets/less/common.less';
  217. .sendAnn {
  218. padding: 2px 6px;
  219. background-color: #95d5b2;
  220. color: #2d6a4f;
  221. border: #1b4332;
  222. border-radius: 4px;
  223. // font-size: 16px;
  224. }
  225. </style>