0a9d162d08a5a3a50595ff13a3ecd62d5758594d.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <#list subTables as subTab>
  2. #segment#${subTab.entityName}List.vue
  3. <template>
  4. <a-card :bordered="false">
  5. <!-- 操作按钮区域 -->
  6. <div class="table-operator" :md="24" :sm="24" style="margin: 0px 0px 20px 0px">
  7. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  8. <a-dropdown v-if="selectedRowKeys.length > 0">
  9. <a-menu slot="overlay">
  10. <a-menu-item key="1" @click="batchDel">
  11. <a-icon type="delete"/>删除
  12. </a-menu-item>
  13. </a-menu>
  14. <a-button style="margin-left: 8px"> 批量操作
  15. <a-icon type="down"/>
  16. </a-button>
  17. </a-dropdown>
  18. </div>
  19. <!-- table区域-begin -->
  20. <div>
  21. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  22. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  23. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  24. </div>
  25. <a-table
  26. ref="table"
  27. size="middle"
  28. bordered
  29. rowKey="id"
  30. :columns="columns"
  31. :dataSource="dataSource"
  32. :pagination="ipagination"
  33. :loading="loading"
  34. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  35. @change="handleTableChange">
  36. <span slot="action" slot-scope="text, record">
  37. <a @click="handleEdit(record)">编辑</a>
  38. <a-divider type="vertical"/>
  39. <a-dropdown>
  40. <a class="ant-dropdown-link">
  41. 更多 <a-icon type="down"/>
  42. </a>
  43. <a-menu slot="overlay">
  44. <a-menu-item>
  45. <a href="javascript:;" @click="handleDetail(record)">详情</a>
  46. </a-menu-item>
  47. <a-menu-item>
  48. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  49. <a>删除</a>
  50. </a-popconfirm>
  51. </a-menu-item>
  52. </a-menu>
  53. </a-dropdown>
  54. </span>
  55. </a-table>
  56. </div>
  57. <!-- table区域-end -->
  58. <!-- 表单区域 -->
  59. <${subTab.entityName}-modal ref="modalForm" @ok="modalFormOk"/>
  60. </a-card>
  61. </template>
  62. <script>
  63. import ${subTab.entityName}Modal from './modules/${subTab.entityName}Modal'
  64. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  65. import {getAction} from '@/api/manage'
  66. export default {
  67. name: "${subTab.entityName}List",
  68. mixins: [JeecgListMixin],
  69. components: {
  70. ${subTab.entityName}Modal,
  71. },
  72. data() {
  73. return {
  74. description: '信息',
  75. // 表头
  76. columns: [
  77. <#list subTab.colums as po><#rt/>
  78. <#if po.fieldName !='id' && subTab.foreignKeys[0]?uncap_first != po.fieldName>
  79. {
  80. title: '${po.filedComment}',
  81. align:"center",
  82. dataIndex: '${po.fieldName}'
  83. },
  84. </#if>
  85. </#list>
  86. {
  87. title: '操作',
  88. key: 'operation',
  89. align: "center",
  90. width: 130,
  91. scopedSlots: {customRender: 'action'},
  92. }],
  93. url: {
  94. list: "/${entityPackage}/${entityName?uncap_first}/list${subTab.entityName}ByMainId",
  95. delete: "/${entityPackage}/${entityName?uncap_first}/delete${subTab.entityName}",
  96. deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch${subTab.entityName}",
  97. }
  98. }
  99. },
  100. methods: {
  101. loadData(arg) {
  102. if (arg === 1) {
  103. this.ipagination.current = 1;
  104. }
  105. var params = this.getQueryParams();
  106. <#-- update-begin--Author:kangxiaolin Date:20190905 for:[442]主子表分开维护,生成的代码子表的分页改为真实的分页-------------------- -->
  107. getAction(this.url.list, { <#list subTab.foreignKeys as key> <#if key?lower_case?index_of("${primaryKeyField}")!=-1>${key?uncap_first} </#if> </#list> : params.mainId
  108. , pageNo : this.ipagination.current, pageSize :this.ipagination.pageSize}).then((res) => {
  109. if (res.success) {
  110. this.dataSource = res.result.records;
  111. this.ipagination.total = Number(res.result.total);
  112. } else {
  113. this.dataSource = null;
  114. }
  115. })
  116. <#-- update-end--Author:kangxiaolin Date:20190905 for:[442]主子表分开维护,生成的代码子表的分页改为真实的分页-------------------- -->
  117. },
  118. getMain(mainId) {
  119. this.queryParam.mainId = mainId;
  120. this.loadData(1);
  121. },
  122. handleAdd: function () {
  123. this.$refs.modalForm.add(this.queryParam.mainId);
  124. this.$refs.modalForm.title = "添加${subTab.ftlDescription}";
  125. },
  126. }
  127. }
  128. </script>
  129. <style scoped>
  130. .ant-card {
  131. margin-left: -30px;
  132. margin-right: -30px;
  133. }
  134. </style>
  135. </#list>