a98f9c75917cb1bddfd02c166562221b65e39aa6.svn-base 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <a-card :bordered="false">
  3. <j-tree-table
  4. :url="url"
  5. topValue="0"
  6. queryKey="id"
  7. :columns="columns"
  8. :tableProps="tableProps">
  9. <template v-slot:action="props">
  10. <!-- 可使用的参数: -->
  11. <!-- props.text -->
  12. <!-- props.record -->
  13. <!-- props.index -->
  14. <a @click="()=>handleEdit(props.record)">编辑</a>
  15. </template>
  16. </j-tree-table>
  17. </a-card>
  18. </template>
  19. <script>
  20. import JTreeTable from '@/components/jeecg/JTreeTable'
  21. export default {
  22. name: 'JeecgTreeTable',
  23. components: { JTreeTable },
  24. data() {
  25. return {
  26. url: '/mock/api/asynTreeList',
  27. columns: [
  28. {
  29. title: '菜单名称',
  30. dataIndex: 'name'
  31. },
  32. {
  33. title: '组件',
  34. dataIndex: 'component'
  35. },
  36. {
  37. title: '排序',
  38. dataIndex: 'orderNum'
  39. },
  40. {
  41. title: '操作',
  42. dataIndex: 'action',
  43. scopedSlots: { customRender: 'action' }
  44. }
  45. ],
  46. selectedRowKeys: []
  47. }
  48. },
  49. computed: {
  50. tableProps() {
  51. let _this = this
  52. return {
  53. // 列表项是否可选择
  54. // https://vue.ant.design/components/table-cn/#rowSelection
  55. rowSelection: {
  56. selectedRowKeys: _this.selectedRowKeys,
  57. onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
  58. }
  59. }
  60. }
  61. },
  62. methods: {
  63. handleEdit(record) {
  64. this.$info({
  65. width: 600,
  66. title: '编辑',
  67. content: '编辑ID:' + record.id+";名称:"+record.name,
  68. okText: '确定',
  69. maskClosable: true
  70. })
  71. }
  72. }
  73. }
  74. </script>
  75. <style scoped></style>