c5e07c6a172bdd8574df657a29b25a69639e30af.svn-base 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <#list columns as po><#rt/>
  8. <#if po.fieldName !='id' && po_index<= tableVo.searchFieldNum>
  9. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  10. <a-form-item label="${po.filedComment}">
  11. <a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
  12. </a-form-item>
  13. </a-col>
  14. </#if>
  15. </#list>
  16. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  17. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  18. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  19. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  20. </span>
  21. </a-col>
  22. </a-row>
  23. </a-form>
  24. </div>
  25. <!-- 操作按钮区域 -->
  26. <div class="table-operator">
  27. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  28. <a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
  29. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  30. <a-button type="primary" icon="import">导入</a-button>
  31. </a-upload>
  32. <a-dropdown v-if="selectedRowKeys.length > 0">
  33. <a-menu slot="overlay">
  34. <a-menu-item key="1" @click="batchDel">
  35. <a-icon type="delete"/>删除
  36. </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"></i>
  47. <span>已选择</span>
  48. <a style="font-weight: 600">
  49. {{ selectedRowKeys.length }}
  50. </a>
  51. <span>项</span>
  52. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  53. </div>
  54. <a-table
  55. ref="table"
  56. size="middle"
  57. bordered
  58. rowKey="id"
  59. :columns="columns"
  60. :dataSource="dataSource"
  61. :pagination="ipagination"
  62. :loading="loading"
  63. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:type}"
  64. @change="handleTableChange"
  65. :customRow="clickThenCheck">
  66. <span slot="action" slot-scope="text, record">
  67. <a @click="handleEdit(record)">编辑</a>
  68. <a-divider type="vertical" />
  69. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  70. <a>删除</a>
  71. </a-popconfirm>
  72. </span>
  73. </a-table>
  74. </div>
  75. <!-- table区域-end -->
  76. <a-tabs defaultActiveKey="1">
  77. <#list subTables as sub><#rt/>
  78. <a-tab-pane tab="${sub.ftlDescription}" :key="refKeys[${sub_index}]" :forceRender="true">
  79. <${sub.entityName?uncap_first}-List ref="${sub.entityName}List"></${sub.entityName?uncap_first}-List>
  80. </a-tab-pane>
  81. </#list>
  82. </a-tabs>
  83. <!-- 表单区域 -->
  84. <${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"/>
  85. </a-card>
  86. </template>
  87. <script>
  88. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  89. import ${entityName}Modal from './modules/${entityName}Modal'
  90. import {deleteAction} from '@/api/manage'
  91. <#list subTables as sub><#rt/>
  92. import ${sub.entityName}List from './${sub.entityName}List'
  93. import ${sub.entityName}Modal from './modules/${sub.entityName}Modal'
  94. </#list>
  95. export default {
  96. name: "${entityName}List",
  97. mixins: [JeecgListMixin],
  98. components: {
  99. ${entityName}Modal,
  100. <#list subTables as sub><#rt/>
  101. ${sub.entityName}Modal,
  102. ${sub.entityName}List,
  103. </#list>
  104. },
  105. data () {
  106. return {
  107. refKeys: [<#list subTables as sub>'${sub.entityName?uncap_first}', </#list>],
  108. description: '${tableVo.ftlDescription}管理页面',
  109. // 表头
  110. columns: [
  111. {
  112. title: '#',
  113. dataIndex: '',
  114. key: 'rowIndex',
  115. width: 60,
  116. align: "center",
  117. customRender:function (t, r, index) {
  118. return parseInt(index)+1;
  119. }
  120. },
  121. <#list columns as po><#rt/>
  122. <#if po.fieldName !='id'>
  123. {
  124. title: '${po.filedComment}',
  125. align:"center",
  126. dataIndex: '${po.fieldName}'
  127. },
  128. </#if>
  129. </#list>
  130. {
  131. title: '操作',
  132. dataIndex: 'action',
  133. align:"center",
  134. scopedSlots: { customRender: 'action' },
  135. }
  136. ],
  137. //操作url
  138. type: "radio",
  139. url: {
  140. list: "/${entityPackage}/${entityName?uncap_first}/list",
  141. delete: "/${entityPackage}/${entityName?uncap_first}/delete",
  142. deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
  143. exportXlsUrl: "${entityPackage}/${entityName?uncap_first}/exportXls",
  144. importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
  145. },
  146. }
  147. },
  148. computed: {
  149. importExcelUrl: function(){
  150. <#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
  151. }
  152. },
  153. methods: {
  154. clickThenCheck(record) {
  155. return {
  156. on: {
  157. click: () => {
  158. this.onSelectChange(record.id.split(","), [record]);
  159. }
  160. }
  161. };
  162. },
  163. onSelectChange(selectedRowKeys, selectionRows) {
  164. this.selectedRowKeys = selectedRowKeys;
  165. this.selectionRows = selectionRows;
  166. <#list subTables as sub><#rt/>
  167. this.$refs.${sub.entityName}List.getMain(this.selectedRowKeys[0]);
  168. </#list>
  169. },
  170. onClearSelected() {
  171. this.selectedRowKeys = [];
  172. this.selectionRows = [];
  173. <#list subTables as sub><#rt/>
  174. this.$refs.${sub.entityName}List.queryParam.mainId = null;
  175. this.$refs.${sub.entityName}List.loadData();
  176. this.$refs.${sub.entityName}List.selectedRowKeys = [];
  177. this.$refs.${sub.entityName}List.selectionRows = [];
  178. </#list>
  179. },
  180. handleDelete: function (id) {
  181. var that = this;
  182. deleteAction(that.url.delete, {id: id}).then((res) => {
  183. if (res.success) {
  184. that.$message.success(res.message);
  185. that.loadData();
  186. <#list subTables as sub><#rt/>
  187. this.$refs.${sub.entityName}List.loadData();
  188. </#list>
  189. } else {
  190. that.$message.warning(res.message);
  191. }
  192. });
  193. },
  194. searchQuery:function(){
  195. this.selectedRowKeys = [];
  196. this.selectionRows = [];
  197. <#list subTables as sub><#rt/>
  198. this.$refs.${sub.entityName}List.queryParam.mainId = null;
  199. this.$refs.${sub.entityName}List.loadData();
  200. this.$refs.${sub.entityName}List.selectedRowKeys = [];
  201. this.$refs.${sub.entityName}List.selectionRows = [];
  202. </#list>
  203. this.loadData();
  204. }
  205. }
  206. }
  207. </script>
  208. <style scoped>
  209. @import '~@assets/less/common.less'
  210. </style>