myLinks.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <!-- :bordered="false" -->
  3. <a-card>
  4. <!-- 查询 -->
  5. <div class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="searchQuery">
  7. <a-row :gutter="24">
  8. <a-col :md="6" :sm="8">
  9. <a-form-item label="名称">
  10. <a-input placeholder="请输入公司名称查询" v-model="queryParam.name"></a-input>
  11. </a-form-item>
  12. </a-col>
  13. <span>
  14. <a-col :md="6" :sm="12">
  15. <a-button type="primary" style="left: 10px" @click="searchQuery" icon="search">查询</a-button>
  16. </a-col>
  17. </span>
  18. </a-row>
  19. </a-form>
  20. </div>
  21. <!-- 新增 批量删除 -->
  22. <div class="table-add">
  23. <a-button @click="addOpen" type="primary">新增</a-button>
  24. <!-- 批量操作-----------------------------------
  25. v-if="selectedRowKeys.length > 0"
  26. ------------------------------------------------>
  27. <a-dropdown>
  28. <a-menu slot="overlay">
  29. <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
  30. </a-menu>
  31. <a-button style="margin-left:24px"> 批量操作 <a-icon type="down"/></a-button>
  32. </a-dropdown>
  33. </div>
  34. <div>
  35. <!-- 已选择 清空 -->
  36. <div class="ant-alert ant-alert-info" style="margin: 20px 0;background:#e6f7ff;">
  37. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
  38. <!-- {{ selectedRowKeys.length }} -->
  39. <a style="font-weight: 600">4</a>项
  40. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  41. </div>
  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="default" 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)"> 编辑 </a>
  61. <a-divider type="vertical" />
  62. <a-popconfirm title="确定发布吗?" ok-text="是" cancel-text="否">
  63. <a href="javascript:void(0);" @click="sendAnn(record.id)" class="sendGr"> 发布 </a>
  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)" class="delRed"> 删除 </a>
  68. </a-popconfirm>
  69. </span>
  70. </a-table>
  71. </a-row>
  72. </div>
  73. <!-- 新增弹框 组件 -->
  74. <addLinks-modal ref="AddLinksModal" @ok="modalFormOk"></addLinks-modal>
  75. </a-card>
  76. </template>
  77. <script>
  78. // import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  79. import AddLinksModal from '@views/oa/my-links/add/addLinksModal.vue'
  80. export default {
  81. name: 'MyLinks',
  82. // mixins: [JeecgListMixin],
  83. components: {
  84. AddLinksModal
  85. },
  86. data () {
  87. return {
  88. id: '', // 唯一标识 双休绑定后自动生成,删除
  89. loading: false, // 表格加载
  90. pagination: {}, // 分页
  91. queryParam: {}, // 查询条件对象
  92. // 表头
  93. columns: [
  94. {
  95. title: '名称',
  96. dataIndex: 'name',
  97. align: 'center'
  98. },
  99. {
  100. title: '地址',
  101. dataIndex: 'address',
  102. align: 'center'
  103. },
  104. {
  105. title: '创建人',
  106. dataIndex: 'createBy',
  107. align: 'center'
  108. },
  109. {
  110. title: '发布',
  111. dataIndex: 'isRelease',
  112. scopedSlots: { customRender: 'isReleaseSlot' },
  113. align: 'center'
  114. },
  115. {
  116. title: '操作',
  117. dataIndex: 'operation',
  118. scopedSlots: { customRender: 'operationSlot' },
  119. align: 'center',
  120. width: '20%'
  121. }
  122. ],
  123. // 公共数据
  124. annDataList: [
  125. {
  126. id: '1',
  127. name: '用友',
  128. address: 'https://www.yonyou.com/',
  129. createBy: 'admin',
  130. isRelease: '1'
  131. },
  132. {
  133. id: '2',
  134. name: '哒哒办公',
  135. address: 'http://www.dakabg.com/',
  136. createBy: 'admin',
  137. isRelease: '1'
  138. },
  139. {
  140. id: '3',
  141. name: '钉钉',
  142. address: 'https://www.dingtalk.com/',
  143. createBy: 'admin',
  144. isRelease: '1'
  145. },
  146. {
  147. id: '4',
  148. name: '品医',
  149. address: 'https://www.11467.com/',
  150. createBy: 'admin',
  151. isRelease: '1'
  152. },
  153. {
  154. id: '5',
  155. name: '蚂蚁集团',
  156. address: 'https://www.antgroup.com/',
  157. createBy: 'admin',
  158. isRelease: '1'
  159. }
  160. ]
  161. }
  162. },
  163. created () {},
  164. methods: {
  165. // 新增
  166. addOpen () {
  167. console.log('点击了大页面的新增')
  168. // 拿到子组件的弹框 属性
  169. this.$refs.AddLinksModal.addLinksModVis = true
  170. },
  171. // 查询
  172. searchQuery () {
  173. // this.loading = true
  174. },
  175. // 重置
  176. reset () {},
  177. // 批量删除
  178. batchDel () {},
  179. // 清空
  180. onClearSelected () {},
  181. // ??
  182. modalFormOk () {},
  183. // 分页、排序、筛选变化时触发
  184. handleTableChange (pagination, filters, sorter) {
  185. },
  186. // 编辑
  187. editAnn (id) {
  188. console.log('点击了编辑,该项公共的ID是:', id)
  189. },
  190. // 发布
  191. sendAnn (id) {
  192. console.log('点击了发布')
  193. },
  194. // 撤销
  195. backAnn (id) {
  196. console.log('点击了撤销')
  197. },
  198. // 操作 删除
  199. delAnn () {
  200. console.log('点击了删除,需要发请求、确定提示、重新渲染')
  201. }
  202. },
  203. computed: {
  204. // 选中项
  205. rowSelection () {
  206. return {
  207. onChange: (selectedRowKeys, selectedRows) => {
  208. console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
  209. },
  210. getCheckboxProps: record => ({
  211. props: {
  212. disabled: record.title === 'Disabled User',
  213. // Column configuration not to be checked
  214. title: record.title
  215. }
  216. })
  217. }
  218. }
  219. },
  220. mounted () {}
  221. }
  222. </script>
  223. <style lang="less" scoped>
  224. @import '~@assets/less/common.less';
  225. </style>