index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <a-card :bordered="false" class="card-area">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <!-- 搜索区域 -->
  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="名称" :label-col="{span: 5}" :wrapper-col="{span: 18, offset: 1}">
  10. <a-input v-model="queryParam.roleName" placeholder="请输入名称查询" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="8">
  14. <a-form-item label="创建时间" :label-col="{span: 5}" :wrapper-col="{span: 18, offset: 1}">
  15. <a-input v-model="queryParam.roleName" placeholder="请输入名称查询" />
  16. </a-form-item>
  17. </a-col>
  18. <span class="table-page-search-submitButtons">
  19. <a-col :md="6" :sm="24">
  20. <a-button type="primary" @click="searchQuery">查询</a-button>
  21. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  22. </a-col>
  23. </span>
  24. </a-row>
  25. </a-form>
  26. </div>
  27. <!-- 操作按钮区域 -->
  28. <div class="table-operator" style="margin-top: 5px">
  29. <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
  30. <a-button type="primary" icon="download" @click="handleExportXls('角色信息')">导出</a-button>
  31. <a-upload name="file" :show-upload-list="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @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"><a-icon type="delete" />删除</a-menu-item>
  37. </a-menu>
  38. <a-button style="margin-left: 8px">
  39. 批量操作 <a-icon type="down" />
  40. </a-button>
  41. </a-dropdown>
  42. </div>
  43. <!-- table区域-begin -->
  44. <div>
  45. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  46. <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
  47. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  48. </div>
  49. <a-table
  50. ref="table"
  51. size="middle"
  52. bordered
  53. row-key="id"
  54. :columns="columns"
  55. :data-source="dataSource"
  56. :pagination="ipagination"
  57. :loading="loading"
  58. :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  59. @change="handleTableChange"
  60. >
  61. <span slot="action" slot-scope="text, record">
  62. <a @click="handleEdit(record)">编辑</a>
  63. <a-divider type="vertical" />
  64. <a-dropdown>
  65. <a class="ant-dropdown-link">
  66. 更多 <a-icon type="down" />
  67. </a>
  68. <a-menu slot="overlay">
  69. <a-menu-item>
  70. <a @click="handlePerssion(record.id)">授权</a>
  71. </a-menu-item>
  72. <a-menu-item>
  73. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  74. <a>删除</a>
  75. </a-popconfirm>
  76. </a-menu-item>
  77. </a-menu>
  78. </a-dropdown>
  79. </span>
  80. </a-table>
  81. </div>
  82. <!-- table区域-end -->
  83. <!-- 表单区域 -->
  84. </a-card>
  85. </template>
  86. <script>
  87. import { listMixin } from '@/mixin/listMixin'
  88. export default {
  89. name: 'RoleList',
  90. components: {
  91. },
  92. mixins: [listMixin],
  93. data() {
  94. return {
  95. description: '角色管理页面',
  96. // 查询条件
  97. queryParam: { roleName: '' },
  98. // 表头
  99. columns: [
  100. {
  101. title: '#',
  102. dataIndex: '',
  103. key: 'rowIndex',
  104. width: 60,
  105. align: 'center',
  106. customRender: function(t, r, index) {
  107. return parseInt(index) + 1
  108. }
  109. },
  110. {
  111. title: '角色名称',
  112. align: 'center',
  113. dataIndex: 'roleName'
  114. },
  115. {
  116. title: '角色编码',
  117. align: 'center',
  118. dataIndex: 'roleCode'
  119. },
  120. {
  121. title: '备注',
  122. align: 'center',
  123. dataIndex: 'description'
  124. },
  125. {
  126. title: '创建时间',
  127. dataIndex: 'createTime',
  128. align: 'center',
  129. sorter: true
  130. },
  131. {
  132. title: '更新时间',
  133. dataIndex: 'updateTime',
  134. align: 'center',
  135. sorter: true
  136. },
  137. {
  138. title: '操作',
  139. dataIndex: 'action',
  140. align: 'center',
  141. scopedSlots: { customRender: 'action' }
  142. }
  143. ],
  144. url: {
  145. list: '/sys/role/list',
  146. delete: '/sys/role/delete',
  147. deleteBatch: '/sys/role/deleteBatch',
  148. exportXlsUrl: '/sys/role/exportXls',
  149. importExcelUrl: 'sys/role/importExcel'
  150. }
  151. }
  152. },
  153. computed: {
  154. importExcelUrl: function() {
  155. return `${this.url.importExcelUrl}`
  156. }
  157. },
  158. methods: {
  159. handlePerssion: function(roleId) {
  160. // alert(roleId);
  161. this.$refs.modalUserRole.show(roleId)
  162. }
  163. }
  164. }
  165. </script>
  166. <style scoped>
  167. @import '~@/assets/less/common.less'
  168. </style>