eb6c9b3a74df41a678d02103073a51225675d34a.svn-base 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <#list subTables as sub>
  2. #segment#${sub.entityName}List.vue
  3. <template>
  4. <a-card :bordered="false" :class="'cust-erp-sub-tab'">
  5. <!-- 操作按钮区域 -->
  6. <div class="table-operator" v-if="mainId">
  7. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  8. <a-button type="primary" icon="download" @click="handleExportXls('${sub.ftlDescription}')">导出</a-button>
  9. <a-upload
  10. name="file"
  11. :showUploadList="false"
  12. :multiple="false"
  13. :headers="tokenHeader"
  14. :action="importExcelUrl"
  15. @change="handleImportExcel">
  16. <a-button type="primary" icon="import">导入</a-button>
  17. </a-upload>
  18. <!-- 高级查询区域 -->
  19. <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  20. <a-dropdown v-if="selectedRowKeys.length > 0">
  21. <a-menu slot="overlay">
  22. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  23. </a-menu>
  24. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  25. </a-dropdown>
  26. </div>
  27. <!-- table区域-begin -->
  28. <div>
  29. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  30. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  31. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  32. </div>
  33. <a-table
  34. ref="table"
  35. size="middle"
  36. bordered
  37. rowKey="id"
  38. :scroll="{x:true}"
  39. :columns="columns"
  40. :dataSource="dataSource"
  41. :pagination="ipagination"
  42. :loading="loading"
  43. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  44. @change="handleTableChange">
  45. <template slot="htmlSlot" slot-scope="text">
  46. <div v-html="text"></div>
  47. </template>
  48. <template slot="imgSlot" slot-scope="text">
  49. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  50. <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  51. </template>
  52. <template slot="fileSlot" slot-scope="text">
  53. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  54. <a-button
  55. v-else
  56. :ghost="true"
  57. type="primary"
  58. icon="download"
  59. size="small"
  60. @click="downloadFile(text)">
  61. 下载
  62. </a-button>
  63. </template>
  64. <span slot="action" slot-scope="text, record">
  65. <a @click="handleEdit(record)">编辑</a>
  66. <a-divider type="vertical" />
  67. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  68. <a>删除</a>
  69. </a-popconfirm>
  70. </span>
  71. </a-table>
  72. </div>
  73. <${sub.entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></${sub.entityName?uncap_first}-modal>
  74. </a-card>
  75. </template>
  76. <script>
  77. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  78. import ${sub.entityName}Modal from './modules/${sub.entityName}Modal'
  79. export default {
  80. name: "${sub.entityName}List",
  81. mixins:[JeecgListMixin],
  82. components: { ${sub.entityName}Modal },
  83. props:{
  84. mainId:{
  85. type:String,
  86. default:'',
  87. required:false
  88. }
  89. },
  90. watch:{
  91. mainId:{
  92. immediate: true,
  93. handler(val) {
  94. if(!this.mainId){
  95. this.clearList()
  96. }else{
  97. <#list sub.foreignKeys as key>
  98. this.queryParam['${key?uncap_first}'] = val
  99. </#list>
  100. this.loadData(1);
  101. }
  102. }
  103. }
  104. },
  105. data () {
  106. return {
  107. description: '${tableVo.ftlDescription}管理页面',
  108. disableMixinCreated:true,
  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. <#assign showColNum=0>
  122. <#list sub.originalColumns as po>
  123. <#if po.isShowList =='Y'>
  124. <#assign showColNum=showColNum+1>
  125. {
  126. title:'${po.filedComment}',
  127. align:"center",
  128. <#if po.sort=='Y'>
  129. sorter: true,
  130. </#if>
  131. <#if po.classType=='date'>
  132. dataIndex: '${po.fieldName}',
  133. customRender:function (text) {
  134. return !text?"":(text.length>10?text.substr(0,10):text)
  135. }
  136. <#elseif po.fieldDbType=='Blob'>
  137. dataIndex: '${po.fieldName}String'
  138. <#elseif po.classType=='umeditor'>
  139. dataIndex: '${po.fieldName}',
  140. scopedSlots: {customRender: 'htmlSlot'}
  141. <#elseif po.classType=='file'>
  142. dataIndex: '${po.fieldName}',
  143. scopedSlots: {customRender: 'fileSlot'}
  144. <#elseif po.classType=='image'>
  145. dataIndex: '${po.fieldName}',
  146. scopedSlots: {customRender: 'imgSlot'}
  147. <#elseif po.classType =='list' || po.classType =='radio' || po.classType =='list_multi' || po.classType =='checkbox' || po.classType =='sel_search' || po.classType =='cat_tree' || po.classType =='sel_depart'>
  148. dataIndex: '${po.fieldName}_dictText',
  149. <#elseif po.classType=='switch'>
  150. dataIndex: '${po.fieldName}',
  151. <#if po.dictField != 'is_open'>
  152. customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
  153. <#else>
  154. customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
  155. </#if>
  156. <#else>
  157. dataIndex: '${po.fieldName}'
  158. </#if>
  159. },
  160. </#if>
  161. </#list>
  162. {
  163. title: '操作',
  164. dataIndex: 'action',
  165. align:"center",
  166. fixed:"right",
  167. width:147,
  168. scopedSlots: { customRender: 'action' },
  169. }
  170. ],
  171. url: {
  172. list: "/${entityPackage}/${entityName?uncap_first}/list${sub.entityName}ByMainId",
  173. delete: "/${entityPackage}/${entityName?uncap_first}/delete${sub.entityName}",
  174. deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch${sub.entityName}",
  175. exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/export${sub.entityName}",
  176. importUrl: "/${entityPackage}/${entityName?uncap_first}/import${sub.entityName}",
  177. },
  178. dictOptions:{
  179. <#list columns as po>
  180. <#if (po.isQuery=='Y' || po.isShowList=='Y')>
  181. <#if po.classType='sel_depart' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
  182. ${po.fieldName}:[],
  183. </#if>
  184. </#if>
  185. </#list>
  186. },
  187. superFieldList:[],
  188. }
  189. },
  190. created() {
  191. this.getSuperFieldList();
  192. },
  193. computed: {
  194. importExcelUrl(){
  195. return `${'$'}{window._CONFIG['domianURL']}/${'$'}{this.url.importUrl}/${'$'}{this.mainId}`;
  196. }
  197. },
  198. methods: {
  199. clearList(){
  200. this.dataSource=[]
  201. this.selectedRowKeys=[]
  202. this.ipagination.current = 1
  203. },
  204. getSuperFieldList(){
  205. <#include "/common/utils.ftl">
  206. let fieldList=[];
  207. <#list columns as po>
  208. fieldList.push(${superQueryFieldList(po)})
  209. </#list>
  210. this.superFieldList = fieldList
  211. }
  212. }
  213. }
  214. </script>
  215. <style scoped>
  216. @import '~@assets/less/common.less'
  217. </style>
  218. </#list>