3dcb04776e1224a02228cb5ec73706ad20d76830.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 操作按钮区域 -->
  4. <div class="table-operator">
  5. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  6. <a-button
  7. @click="batchDel"
  8. v-if="selectedRowKeys.length > 0"
  9. ghost
  10. type="primary"
  11. icon="delete">批量删除
  12. </a-button>
  13. </div>
  14. <!-- table区域-begin -->
  15. <div>
  16. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  17. <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{
  18. selectedRowKeys.length }}</a>项&nbsp;&nbsp;
  19. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  20. </div>
  21. <a-table
  22. :columns="columns"
  23. :scroll="{x: 1500}"
  24. size="middle"
  25. :pagination="false"
  26. :dataSource="dataSource"
  27. :loading="loading"
  28. :expandedRowKeys="expandedRowKeys"
  29. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  30. @expandedRowsChange="handleExpandedRowsChange">
  31. <span slot="action" slot-scope="text, record">
  32. <a @click="handleEdit(record)">编辑</a>
  33. <a-divider type="vertical"/>
  34. <a-dropdown>
  35. <a class="ant-dropdown-link">
  36. 更多 <a-icon type="down"/>
  37. </a>
  38. <a-menu slot="overlay">
  39. <a-menu-item>
  40. <a href="javascript:;" @click="handleDetail(record)">详情</a>
  41. </a-menu-item>
  42. <a-menu-item>
  43. <a href="javascript:;" @click="handleAddSub(record)">添加下级</a>
  44. </a-menu-item>
  45. <a-menu-item>
  46. <a href="javascript:;" @click="handleDataRule(record)">数据规则</a>
  47. </a-menu-item>
  48. <a-menu-item>
  49. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  50. <a>删除</a>
  51. </a-popconfirm>
  52. </a-menu-item>
  53. </a-menu>
  54. </a-dropdown>
  55. </span>
  56. <!-- 字符串超长截取省略号显示 -->
  57. <span slot="url" slot-scope="text">
  58. <j-ellipsis :value="text" :length="25"/>
  59. </span>
  60. <!-- 字符串超长截取省略号显示-->
  61. <span slot="component" slot-scope="text">
  62. <j-ellipsis :value="text"/>
  63. </span>
  64. </a-table>
  65. </div>
  66. <!-- table区域-end -->
  67. <permission-modal ref="modalForm" @ok="modalFormOk"></permission-modal>
  68. <permission-data-rule-list ref="PermissionDataRuleList" @ok="modalFormOk"></permission-data-rule-list>
  69. </a-card>
  70. </template>
  71. <script>
  72. import PermissionModal from './modules/PermissionModal'
  73. import { getPermissionList } from '@/api/api'
  74. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  75. import PermissionDataRuleList from './PermissionDataRuleList'
  76. import JEllipsis from '@/components/jeecg/JEllipsis'
  77. const columns = [
  78. {
  79. title: '菜单名称',
  80. dataIndex: 'name',
  81. key: 'name'
  82. }, {
  83. title: '菜单类型',
  84. dataIndex: 'menuType',
  85. key: 'menuType',
  86. customRender: function(text) {
  87. if (text == 0) {
  88. return '菜单'
  89. } else if (text == 1) {
  90. return '菜单'
  91. } else if (text == 2) {
  92. return '按钮/权限'
  93. } else {
  94. return text
  95. }
  96. }
  97. },/*{
  98. title: '权限编码',
  99. dataIndex: 'perms',
  100. key: 'permissionCode',
  101. },*/{
  102. title: 'icon',
  103. dataIndex: 'icon',
  104. key: 'icon'
  105. },
  106. {
  107. title: '组件',
  108. dataIndex: 'component',
  109. key: 'component',
  110. scopedSlots: { customRender: 'component' }
  111. },
  112. {
  113. title: '路径',
  114. dataIndex: 'url',
  115. key: 'url',
  116. scopedSlots: { customRender: 'url' }
  117. },
  118. {
  119. title: '排序',
  120. dataIndex: 'sortNo',
  121. key: 'sortNo'
  122. },
  123. {
  124. title: '操作',
  125. dataIndex: 'action',
  126. fixed: 'right',
  127. scopedSlots: { customRender: 'action' },
  128. align: 'center',
  129. width: 150
  130. }
  131. ]
  132. export default {
  133. name: 'PermissionList',
  134. mixins: [JeecgListMixin],
  135. components: {
  136. PermissionDataRuleList,
  137. PermissionModal,
  138. JEllipsis
  139. },
  140. data() {
  141. return {
  142. description: '这是菜单管理页面',
  143. // 表头
  144. columns: columns,
  145. loading: false,
  146. // 展开的行,受控属性
  147. expandedRowKeys: [],
  148. url: {
  149. list: '/sys/permission/list',
  150. delete: '/sys/permission/delete',
  151. deleteBatch: '/sys/permission/deleteBatch'
  152. }
  153. }
  154. },
  155. methods: {
  156. loadData() {
  157. this.dataSource = []
  158. getPermissionList().then((res) => {
  159. if (res.success) {
  160. console.log(res.result)
  161. this.dataSource = res.result
  162. }
  163. })
  164. },
  165. // 打开数据规则编辑
  166. handleDataRule(record) {
  167. this.$refs.PermissionDataRuleList.edit(record)
  168. },
  169. handleAddSub(record) {
  170. this.$refs.modalForm.title = "添加子菜单";
  171. this.$refs.modalForm.disableSubmit = false;
  172. this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id,menuType:1});
  173. },
  174. handleExpandedRowsChange(expandedRows) {
  175. this.expandedRowKeys = expandedRows
  176. },
  177. }
  178. }
  179. </script>
  180. <style scoped>
  181. @import '~@assets/less/common.less';
  182. </style>