a45e90ddb3c1fc126c32e4765cfb47a2d7f993fd.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <#-- noinspection JSDuplicatedDeclaration,RequiredAttributes,NpmUsedModulesInstalled -->
  2. <#-- ** 引入全局工具方法 ** -->
  3. <#--<#include "/common/utils.ftl">-->
  4. <#include "../../../../../../common/utils.ftl">
  5. <#-- ** 定义全局使用的变量 ** -->
  6. <#-- 是否有查询条件 -->
  7. <#assign query_flag=false>
  8. <#-- 是否有下拉查询条件 -->
  9. <#assign query_field_select=false>
  10. <#-- 是否有日期查询条件 -->
  11. <#assign query_field_date=false>
  12. <#-- 是否有字典 -->
  13. <#assign list_need_dict=false>
  14. <#-- 是否有分类字典 -->
  15. <#assign list_need_category=false>
  16. <#-- 是否有省市区 -->
  17. <#assign list_need_pca=false>
  18. <#-- 是否有用户选择 -->
  19. <#assign query_sel_user=false>
  20. <#-- 是否有部门选择 -->
  21. <#assign query_sel_dep=false>
  22. <#-- 是否有下拉多选框 -->
  23. <#assign query_sel_multi=false>
  24. <#-- 是否有下拉搜索框 -->
  25. <#assign query_sel_search=false>
  26. <#-- 是否有省市区组件 -->
  27. <#assign query_field_pca=false>
  28. <#-- 是否有分类字典树 -->
  29. <#assign query_sel_cat=false>
  30. <template>
  31. <a-card class="j-inner-table-wrapper" :bordered="false">
  32. <!-- 查询区域 begin -->
  33. <div class="table-page-search-wrapper">
  34. <a-form layout="inline">
  35. <a-row :gutter="24">
  36. <#-- 查询区域 开始循环 -->
  37. <#assign query_field_index=0>
  38. <#list columns as po>
  39. <#if po.isQuery=='Y'>
  40. <#assign query_field_dictCode="">
  41. <#if po.dictTable?default("")?trim?length gt 1>
  42. <#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
  43. <#elseif po.dictField?default("")?trim?length gt 1>
  44. <#assign query_field_dictCode="${po.dictField}">
  45. </#if>
  46. <#assign query_flag=true>
  47. <#-- 定义组件可能会需要的属性 -->
  48. <#assign attr_showTime="show-time date-format=\"YYYY-MM-DD HH:mm:ss\"">
  49. <#assign indent="">
  50. <#-- 将index>=2的查询条件隐藏起来 -->
  51. <#if query_field_index==2>
  52. <#-- 由于多了一层标签,所以需要多一层缩进 -->
  53. <#assign indent=" ">
  54. <template v-if="toggleSearchStatus">
  55. </#if>
  56. ${indent}<a-col :xl="6" :lg="7" :md="8" :sm="24">
  57. ${indent}<a-form-item label="${po.filedComment}">
  58. <#-- 普通查询 -->
  59. <#if po.queryMode=='single'>
  60. <#-- 日期组件 -->
  61. <#if po.classType=='date'>
  62. <#assign query_field_date=true>
  63. ${indent}<j-date ${getVModel(po)} ${getPlaceholder(po,"请选择")}/>
  64. <#-- 日期时间组件 -->
  65. <#elseif po.classType=='datetime'>
  66. <#assign query_field_date=true>
  67. ${indent}<j-date ${getVModel(po)} ${getPlaceholder(po,"请选择")} ${attr_showTime}/>
  68. <#-- 下拉组件 -->
  69. <#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
  70. <#assign query_field_select=true>
  71. <#-- 下拉或是单选,判断数据字典是表字典还是普通字典 -->
  72. <#if (po.dictTable!"")?trim?length gt 1>
  73. ${indent}<j-dict-select-tag ${getVModel(po)} ${getPlaceholder(po,"请选择")} dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
  74. <#elseif (po.dictField!"")?trim?length gt 1>
  75. ${indent}<j-dict-select-tag ${getVModel(po)} ${getPlaceholder(po,"请选择")} dictCode="${po.dictField}"/>
  76. <#else>
  77. ${indent}<a-input ${getVModel(po)} ${getPlaceholder(po,"请输入")}/>
  78. </#if>
  79. <#-- 用户选择组件 -->
  80. <#elseif po.classType=='sel_user'>
  81. <#assign query_sel_user=true>
  82. ${indent}<j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
  83. <#-- 部门选择组件 -->
  84. <#elseif po.classType=='sel_depart'>
  85. <#assign query_sel_dep=true>
  86. ${indent}<j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
  87. <#elseif po.classType=='list_multi'>
  88. <#-- 下拉多选框组件 -->
  89. <#assign query_sel_multi=true>
  90. ${indent}<j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
  91. <#-- popup组件 -->
  92. <#elseif po.classType=='popup'>
  93. ${indent}<j-popup placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" code="${po.dictTable}" org-fields="${po.dictField}" dest-fields="${po.dictText}" :field="getPopupField('${po.dictText}')" :multi="${po.extendParams.popupMulti?c}"/>
  94. <#-- 下拉搜索框 -->
  95. <#elseif po.classType=='sel_search'>
  96. <#assign query_sel_search=true>
  97. ${indent}<j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
  98. <#elseif po.classType=='pca'>
  99. <#assign query_field_pca=true>
  100. ${indent}<j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
  101. <#elseif po.classType=='cat_tree'>
  102. <#assign query_sel_cat=true>
  103. ${indent}<j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
  104. <#-- 其他都归为输入框组件 -->
  105. <#else>
  106. ${indent}<a-input ${getVModel(po)} ${getPlaceholder(po,"请输入")}/>
  107. </#if>
  108. <#-- 范围查询 -->
  109. <#else>
  110. <#-- 范围日期组件 -->
  111. <#if po.classType=='date'>
  112. <#assign query_field_date=true>
  113. ${indent}<j-date class="query-group-cust" ${getVModel(po, "_begin")} ${getPlaceholder(po, "请选择开始日期",false)}/>
  114. ${indent}<span class="query-group-split-cust"></span>
  115. ${indent}<j-date class="query-group-cust" ${getVModel(po, "_end")} ${getPlaceholder(po, "请选择结束日期",false)}/>
  116. <#-- 范围日期时间组件 -->
  117. <#elseif po.classType=='datetime'>
  118. <#assign query_field_date=true>
  119. ${indent}<j-date class="query-group-cust" ${getVModel(po, "_begin")} ${getPlaceholder(po, "请选择开始时间",false)} ${attr_showTime}/>
  120. ${indent}<span class="query-group-split-cust"></span>
  121. ${indent}<j-date class="query-group-cust" ${getVModel(po, "_end")} ${getPlaceholder(po, "请选择结束时间",false)} ${attr_showTime}/>
  122. <#-- 其他都归为范围输入框组件 -->
  123. <#else>
  124. ${indent}<a-input class="query-group-cust" ${getVModel(po, "_begin")} ${getPlaceholder(po, "请输入最开始值",false)}/>
  125. ${indent}<span class="query-group-split-cust"></span>
  126. ${indent}<a-input class="query-group-cust" ${getVModel(po, "_end")} ${getPlaceholder(po, "请输入最结束值",false)}/>
  127. </#if>
  128. </#if>
  129. ${indent}</a-form-item>
  130. ${indent}</a-col>
  131. <#assign query_field_index=query_field_index+1>
  132. </#if>
  133. <#-- 判断是否需要字典 -->
  134. <#if !list_need_dict && po.fieldShowType != 'popup' && (po.dictField!"")?trim?length gt 1>
  135. <#assign list_need_dict=true>
  136. </#if>
  137. <#-- 判断是否需要分类字典 -->
  138. <#if po.classType == 'cat_tree' && (po.dictText!"")?trim?length == 0>
  139. <#assign list_need_category=true>
  140. </#if>
  141. <#-- 判断是否需要省市区 -->
  142. <#if po.classType=='pca'>
  143. <#assign list_need_pca=true>
  144. </#if>
  145. </#list>
  146. <#-- 查询区域-结束循环 -->
  147. <#if query_field_index gt 2>
  148. </template>
  149. </#if>
  150. <#if query_flag>
  151. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  152. <span class="table-page-search-submitButtons table-operator">
  153. <a-button type="primary" icon="search" @click="searchQuery">查询</a-button>
  154. <a-button type="primary" icon="reload" @click="searchReset">重置</a-button>
  155. <a @click="handleToggleSearch" style="margin-left: 8px">
  156. <span>{{ toggleSearchStatus ? '收起' : '展开' }}</span>
  157. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  158. </a>
  159. </span>
  160. </a-col>
  161. </#if>
  162. </a-row>
  163. </a-form>
  164. </div>
  165. <!-- 查询区域 end -->
  166. <!-- 操作按钮区域 begin -->
  167. <div class="table-operator">
  168. <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
  169. <a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
  170. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  171. <a-button type="primary" icon="import">导入</a-button>
  172. </a-upload>
  173. <!-- 高级查询区域 -->
  174. <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  175. <a-dropdown v-if="selectedRowKeys.length > 0">
  176. <a-menu slot="overlay">
  177. <a-menu-item key="1" @click="batchDel">
  178. <a-icon type="delete"/>
  179. <span>删除</span>
  180. </a-menu-item>
  181. </a-menu>
  182. <a-button>
  183. <span>批量操作</span>
  184. <a-icon type="down"/>
  185. </a-button>
  186. </a-dropdown>
  187. </div>
  188. <!-- 操作按钮区域 end -->
  189. <!-- table区域 begin -->
  190. <div>
  191. <a-alert type="info" showIcon style="margin-bottom: 16px;">
  192. <template slot="message">
  193. <span>已选择</span>
  194. <a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
  195. <span>项</span>
  196. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  197. </template>
  198. </a-alert>
  199. <a-table
  200. ref="table"
  201. size="middle"
  202. bordered
  203. rowKey="id"
  204. class="j-table-force-nowrap"
  205. :scroll="{x:true}"
  206. :loading="loading"
  207. :columns="columns"
  208. :dataSource="dataSource"
  209. :pagination="ipagination"
  210. :expandedRowKeys="expandedRowKeys"
  211. :rowSelection="{selectedRowKeys, onChange: onSelectChange}"
  212. @expand="handleExpand"
  213. @change="handleTableChange"
  214. >
  215. <!-- 内嵌table区域 begin -->
  216. <template slot="expandedRowRender" slot-scope="record">
  217. <a-tabs tabPosition="top">
  218. <#list subTables as sub>
  219. <a-tab-pane tab="${sub.ftlDescription}" key="${sub.entityName?uncap_first}" forceRender>
  220. <#assign subTableCompName=camelToHorizontal("${sub.entityName?uncap_first}", "lower")/>
  221. <${subTableCompName}-sub-table :record="record"/>
  222. </a-tab-pane>
  223. </#list>
  224. </a-tabs>
  225. </template>
  226. <!-- 内嵌table区域 end -->
  227. <template slot="htmlSlot" slot-scope="text">
  228. <div v-html="text"></div>
  229. </template>
  230. <template slot="imgSlot" slot-scope="text">
  231. <div style="font-size: 12px;font-style: italic;">
  232. <span v-if="!text">无图片</span>
  233. <img v-else :src="getImgView(text)" alt="" style="max-width:80px;height:25px;"/>
  234. </div>
  235. </template>
  236. <#if list_need_pca>
  237. <template slot="pcaSlot" slot-scope="text">
  238. <div>{{ getPcaText(text) }}</div>
  239. </template>
  240. </#if>
  241. <template slot="fileSlot" slot-scope="text">
  242. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  243. <a-button
  244. v-else
  245. ghost
  246. type="primary"
  247. icon="download"
  248. size="small"
  249. @click="downloadFile(text)"
  250. >
  251. <span>下载</span>
  252. </a-button>
  253. </template>
  254. <template slot="action" slot-scope="text, record">
  255. <a @click="handleEdit(record)">编辑</a>
  256. <a-divider type="vertical"/>
  257. <a-dropdown>
  258. <a class="ant-dropdown-link">
  259. <span>更多 <a-icon type="down"/></span>
  260. </a>
  261. <a-menu slot="overlay">
  262. <a-menu-item>
  263. <a-popconfirm title="确定删除吗?" @confirm="handleDelete(record.id)">
  264. <a>删除</a>
  265. </a-popconfirm>
  266. </a-menu-item>
  267. </a-menu>
  268. </a-dropdown>
  269. </template>
  270. </a-table>
  271. </div>
  272. <!-- table区域 end -->
  273. <!-- 表单区域 -->
  274. <#assign modalForm=camelToHorizontal("${entityName?uncap_first}", "lower")/>
  275. <${modalForm}-modal ref="modalForm" @ok="modalFormOk"/>
  276. </a-card>
  277. </template>
  278. <script>
  279. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  280. import ${entityName}Modal from './modules/${entityName}Modal'
  281. <#list subTables as sub>
  282. import ${sub.entityName}SubTable from './subTables/${sub.entityName}SubTable'
  283. </#list>
  284. <#if query_field_select>
  285. import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
  286. </#if>
  287. <#if query_field_date>
  288. import JDate from '@/components/jeecg/JDate.vue'
  289. </#if>
  290. <#if list_need_dict>
  291. import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  292. </#if>
  293. <#if list_need_category>
  294. import { loadCategoryData } from '@/api/api'
  295. </#if>
  296. <#if query_sel_user>
  297. import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
  298. </#if>
  299. <#if query_sel_dep>
  300. import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
  301. </#if>
  302. <#if query_sel_multi>
  303. import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
  304. </#if>
  305. <#if query_sel_search>
  306. import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
  307. </#if>
  308. <#if query_field_pca>
  309. import JAreaLinkage from '@comp/jeecg/JAreaLinkage'
  310. </#if>
  311. <#if query_sel_cat>
  312. import JCategorySelect from '@comp/jeecg/JCategorySelect'
  313. </#if>
  314. <#if list_need_pca>
  315. import Area from '@/components/_util/Area'
  316. </#if>
  317. import '@/assets/less/TableExpand.less'
  318. export default {
  319. name: '${entityName}List',
  320. mixins: [JeecgListMixin],
  321. components: {
  322. ${entityName}Modal,
  323. <#list subTables as sub>
  324. ${sub.entityName}SubTable,
  325. </#list>
  326. <#if query_field_date>
  327. JDate,
  328. </#if>
  329. <#if query_field_select>
  330. JDictSelectTag,
  331. </#if>
  332. <#if query_sel_user>
  333. JSelectUserByDep,
  334. </#if>
  335. <#if query_sel_dep>
  336. JSelectDepart,
  337. </#if>
  338. <#if query_sel_multi>
  339. JMultiSelectTag,
  340. </#if>
  341. <#if query_sel_search>
  342. JSearchSelectTag,
  343. </#if>
  344. <#if query_field_pca>
  345. JAreaLinkage,
  346. </#if>
  347. <#if query_sel_cat>
  348. JCategorySelect,
  349. </#if>
  350. },
  351. data() {
  352. return {
  353. description: '${tableVo.ftlDescription}列表管理页面',
  354. // 表头
  355. columns: [
  356. {
  357. title: '#',
  358. key: 'rowIndex',
  359. width: 60,
  360. align: 'center',
  361. customRender: (t, r, index) => parseInt(index) + 1
  362. },
  363. <#-- begin 遍历表头 -->
  364. <#list columns as po>
  365. <#if po.isShowList == 'Y'>
  366. {
  367. title: '${po.filedComment}',
  368. align: 'center',
  369. <#if po.sort=='Y'>
  370. sorter: true,
  371. </#if>
  372. <#if po.classType == 'date'>
  373. dataIndex: '${po.fieldName}',
  374. <#elseif po.fieldDbType=='Blob'>
  375. dataIndex: '${po.fieldName}String'
  376. <#elseif po.classType=='umeditor'>
  377. dataIndex: '${po.fieldName}',
  378. scopedSlots: {customRender: 'htmlSlot'}
  379. <#elseif po.classType=='pca'>
  380. dataIndex: '${po.fieldName}',
  381. scopedSlots: {customRender: 'pcaSlot'}
  382. <#elseif po.classType=='file'>
  383. dataIndex: '${po.fieldName}',
  384. scopedSlots: {customRender: 'fileSlot'}
  385. <#elseif po.classType=='image'>
  386. dataIndex: '${po.fieldName}',
  387. scopedSlots: {customRender: 'imgSlot'}
  388. <#elseif po.classType == 'sel_tree' || po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart' || po.classType=='sel_user'>
  389. dataIndex: '${po.fieldName}_dictText'
  390. <#elseif po.classType=='cat_tree'>
  391. <#if list_need_category>
  392. dataIndex: '${po.fieldName}',
  393. customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
  394. <#else>
  395. dataIndex: '${po.fieldName}',
  396. customRender: (text, record) => (text ? record['${po.dictText}'] : '')
  397. </#if>
  398. <#elseif po.classType=='switch'>
  399. dataIndex: '${po.fieldName}',
  400. <#if po.dictField != 'is_open'>
  401. customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
  402. <#else>
  403. customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
  404. </#if>
  405. <#else>
  406. dataIndex: '${po.fieldName}',
  407. </#if>
  408. },
  409. </#if>
  410. </#list>
  411. <#-- end 遍历表头 -->
  412. {
  413. title: '操作',
  414. dataIndex: 'action',
  415. align: 'center',
  416. width:147,
  417. scopedSlots: { customRender: 'action' },
  418. },
  419. ],
  420. // 字典选项
  421. dictOptions: {},
  422. // 展开的行test
  423. expandedRowKeys: [],
  424. <#assign urlPrefix="/${entityPackage}/${entityName?uncap_first}">
  425. url: {
  426. list: '${urlPrefix}/list',
  427. delete: '${urlPrefix}/delete',
  428. deleteBatch: '${urlPrefix}/deleteBatch',
  429. exportXlsUrl: '${urlPrefix}/exportXls',
  430. importExcelUrl: '${urlPrefix}/importExcel',
  431. },
  432. <#if list_need_pca>
  433. pcaData:'',
  434. </#if>
  435. superFieldList:[],
  436. }
  437. },
  438. created() {
  439. <#if list_need_pca>
  440. this.pcaData = new Area()
  441. </#if>
  442. this.getSuperFieldList();
  443. },
  444. computed: {
  445. importExcelUrl() {
  446. return window._CONFIG['domianURL'] + this.url.importExcelUrl
  447. }
  448. },
  449. methods: {
  450. <#if list_need_pca>
  451. getPcaText(code){
  452. return this.pcaData.getText(code);
  453. },
  454. </#if>
  455. initDictConfig() {
  456. <#list columns as po>
  457. <#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
  458. <#if po.classType=='cat_tree' && list_need_category==true>
  459. loadCategoryData({ code: "${po.dictField?default('')}" }).then((res) => {
  460. if (res.success) {
  461. this.$set(this.dictOptions, '${po.fieldName}', res.result)
  462. }
  463. })
  464. </#if>
  465. </#if>
  466. </#list>
  467. },
  468. handleExpand(expanded, record) {
  469. this.expandedRowKeys = []
  470. if (expanded === true) {
  471. this.expandedRowKeys.push(record.id)
  472. }
  473. },
  474. getSuperFieldList(){
  475. <#include "/common/utils.ftl">
  476. let fieldList=[];
  477. <#list columns as po>
  478. fieldList.push(${superQueryFieldList(po)})
  479. </#list>
  480. this.superFieldList = fieldList
  481. }
  482. }
  483. }
  484. </script>
  485. <style lang="less" scoped>
  486. @import '~@assets/less/common.less';
  487. </style>