999e8a448c95823f9d99094261cb8e4f0ed8ba9d.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. <#assign query_field_no=0>
  8. <#assign query_flag=false>
  9. <#assign list_need_dict=false>
  10. <#assign list_need_category=false>
  11. <#assign list_need_pca=false>
  12. <#-- 开始循环 -->
  13. <#list columns as po>
  14. <#if po.isQuery=='Y'>
  15. <#assign query_flag=true>
  16. <#if query_field_no==2>
  17. <template v-if="toggleSearchStatus">
  18. </#if>
  19. <#assign query_field_dictCode="">
  20. <#if po.dictTable?default("")?trim?length gt 1>
  21. <#assign query_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
  22. <#elseif po.dictField?default("")?trim?length gt 1>
  23. <#assign query_field_dictCode="${po.dictField}">
  24. </#if>
  25. <#if po.queryMode=='single'>
  26. <#if query_field_no gt 1> </#if><a-col :xl="6" :lg="7" :md="8" :sm="24">
  27. <#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
  28. <#if po.classType=='sel_search'>
  29. <#if query_field_no gt 1> </#if><j-search-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dict="${po.dictTable},${po.dictText},${po.dictField}"/>
  30. <#elseif po.classType=='sel_user'>
  31. <#if query_field_no gt 1> </#if><j-select-user-by-dep placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
  32. <#elseif po.classType=='sel_depart'>
  33. <#if query_field_no gt 1> </#if><j-select-depart placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"/>
  34. <#elseif po.classType=='list_multi'>
  35. <#if query_field_no gt 1> </#if><j-multi-select-tag placeholder="请选择${po.filedComment}" dictCode="${query_field_dictCode?default("")}" v-model="queryParam.${po.fieldName}"/>
  36. <#elseif po.classType=='cat_tree'>
  37. <#if query_field_no gt 1> </#if><j-category-select placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" pcode="${po.dictField?default("")}"/>
  38. <#elseif po.classType=='date'>
  39. <#if query_field_no gt 1> </#if><j-date placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
  40. <#elseif po.classType=='datetime'>
  41. <#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}"></j-date>
  42. <#elseif po.classType=='pca'>
  43. <#if query_field_no gt 1> </#if><j-area-linkage type="cascader" v-model="queryParam.${po.fieldName}" placeholder="请选择省市区"/>
  44. <#elseif po.classType=='popup'>
  45. <#if query_field_no gt 1> </#if><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}"/>
  46. <#elseif po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
  47. <#-- ---------------------------下拉或是单选 判断数据字典是表字典还是普通字典------------------------------- -->
  48. <#if po.dictTable?default("")?trim?length gt 1>
  49. <#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictTable},${po.dictText},${po.dictField}"/>
  50. <#elseif po.dictField?default("")?trim?length gt 1>
  51. <#if query_field_no gt 1> </#if><j-dict-select-tag placeholder="请选择${po.filedComment}" v-model="queryParam.${po.fieldName}" dictCode="${po.dictField}"/>
  52. <#else>
  53. <#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
  54. </#if>
  55. <#else>
  56. <#if query_field_no gt 1> </#if><a-input placeholder="请输入${po.filedComment}" v-model="queryParam.${po.fieldName}"></a-input>
  57. </#if>
  58. <#if query_field_no gt 1> </#if></a-form-item>
  59. <#if query_field_no gt 1> </#if></a-col>
  60. <#else>
  61. <#if query_field_no gt 1> </#if><a-col :xl="10" :lg="11" :md="12" :sm="24">
  62. <#if query_field_no gt 1> </#if><a-form-item label="${po.filedComment}">
  63. <#if po.classType=='date'>
  64. <#if query_field_no gt 1> </#if><j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
  65. <#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
  66. <#if query_field_no gt 1> </#if><j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
  67. <#elseif po.classType=='datetime'>
  68. <#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></j-date>
  69. <#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
  70. <#if query_field_no gt 1> </#if><j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></j-date>
  71. <#else>
  72. <#if query_field_no gt 1> </#if><a-input placeholder="请输入最小值" class="query-group-cust" v-model="queryParam.${po.fieldName}_begin"></a-input>
  73. <#if query_field_no gt 1> </#if><span class="query-group-split-cust"></span>
  74. <#if query_field_no gt 1> </#if><a-input placeholder="请输入最大值" class="query-group-cust" v-model="queryParam.${po.fieldName}_end"></a-input>
  75. </#if>
  76. <#if query_field_no gt 1> </#if></a-form-item>
  77. <#if query_field_no gt 1> </#if></a-col>
  78. </#if>
  79. <#assign query_field_no=query_field_no+1>
  80. </#if>
  81. <#if !list_need_dict && po.fieldShowType!='popup' && po.dictField?default("")?trim?length gt 1>
  82. <#assign list_need_dict=true>
  83. </#if>
  84. <#if po.classType=='cat_tree' && po.dictText?default("")?trim?length == 0>
  85. <#assign list_need_category=true>
  86. </#if>
  87. <#if po.classType=='pca'>
  88. <#assign list_need_pca=true>
  89. </#if>
  90. </#list>
  91. <#-- 结束循环 -->
  92. <#t>
  93. <#if query_field_no gt 2>
  94. </template>
  95. </#if>
  96. <#if query_flag>
  97. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  98. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  99. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  100. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  101. <a @click="handleToggleSearch" style="margin-left: 8px">
  102. {{ toggleSearchStatus ? '收起' : '展开' }}
  103. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  104. </a>
  105. </span>
  106. </a-col>
  107. </#if>
  108. </a-row>
  109. </a-form>
  110. </div>
  111. <!-- 查询区域-END -->
  112. <!-- 操作按钮区域 -->
  113. <div class="table-operator">
  114. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  115. <a-button type="primary" icon="download" @click="handleExportXls('${tableVo.ftlDescription}')">导出</a-button>
  116. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  117. <a-button type="primary" icon="import">导入</a-button>
  118. </a-upload>
  119. <!-- 高级查询区域 -->
  120. <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  121. </div>
  122. <!-- table区域-begin -->
  123. <div>
  124. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  125. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  126. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  127. </div>
  128. <a-table
  129. ref="table"
  130. size="middle"
  131. bordered
  132. rowKey="id"
  133. class="j-table-force-nowrap"
  134. :scroll="{x:true}"
  135. :columns="columns"
  136. :dataSource="dataSource"
  137. :pagination="ipagination"
  138. :loading="loading"
  139. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
  140. :customRow="clickThenSelect"
  141. @change="handleTableChange">
  142. <template slot="htmlSlot" slot-scope="text">
  143. <div v-html="text"></div>
  144. </template>
  145. <template slot="imgSlot" slot-scope="text">
  146. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  147. <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  148. </template>
  149. <template slot="fileSlot" slot-scope="text">
  150. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  151. <a-button
  152. v-else
  153. :ghost="true"
  154. type="primary"
  155. icon="download"
  156. size="small"
  157. @click="downloadFile(text)">
  158. 下载
  159. </a-button>
  160. </template>
  161. <#if list_need_pca>
  162. <template slot="pcaSlot" slot-scope="text">
  163. <div>{{ getPcaText(text) }}</div>
  164. </template>
  165. </#if>
  166. <span slot="action" slot-scope="text, record">
  167. <a @click="handleEdit(record)">编辑</a>
  168. <a-divider type="vertical" />
  169. <a-dropdown>
  170. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  171. <a-menu slot="overlay">
  172. <a-menu-item>
  173. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  174. <a>删除</a>
  175. </a-popconfirm>
  176. </a-menu-item>
  177. </a-menu>
  178. </a-dropdown>
  179. </span>
  180. </a-table>
  181. </div>
  182. <a-tabs defaultActiveKey="1">
  183. <#assign sub_seq=1>
  184. <#list subTables as sub>
  185. <a-tab-pane tab="${sub.ftlDescription}" key="${sub_seq}" <#if sub_seq gt 1>forceRender</#if>>
  186. <${sub.entityName}List :mainId="selectedMainId" />
  187. </a-tab-pane>
  188. <#assign sub_seq=sub_seq+1>
  189. </#list>
  190. </a-tabs>
  191. <${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal>
  192. </a-card>
  193. </template>
  194. <script>
  195. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  196. import ${entityName}Modal from './modules/${entityName}Modal'
  197. import { getAction } from '@/api/manage'
  198. <#list subTables as sub>
  199. import ${sub.entityName}List from './${sub.entityName}List'
  200. </#list>
  201. <#if list_need_category>
  202. import { loadCategoryData } from '@/api/api'
  203. </#if>
  204. <#if list_need_dict>
  205. import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  206. </#if>
  207. <#if list_need_pca>
  208. import Area from '@/components/_util/Area'
  209. </#if>
  210. import '@/assets/less/TableExpand.less'
  211. export default {
  212. name: "${entityName}List",
  213. mixins:[JeecgListMixin],
  214. components: {
  215. <#list subTables as sub>
  216. ${sub.entityName}List,
  217. </#list>
  218. ${entityName}Modal
  219. },
  220. data () {
  221. return {
  222. description: '${tableVo.ftlDescription}管理页面',
  223. // 表头
  224. columns: [
  225. <#assign showColNum=0>
  226. <#list columns as po>
  227. <#if po.isShowList =='Y'>
  228. <#assign showColNum=showColNum+1>
  229. {
  230. title:'${po.filedComment}',
  231. align:"center",
  232. <#if po.sort=='Y'>
  233. sorter: true,
  234. </#if>
  235. <#if po.classType=='date'>
  236. dataIndex: '${po.fieldName}',
  237. customRender:function (text) {
  238. return !text?"":(text.length>10?text.substr(0,10):text)
  239. }
  240. <#elseif po.fieldDbType=='Blob'>
  241. dataIndex: '${po.fieldName}String'
  242. <#elseif po.classType=='umeditor'>
  243. dataIndex: '${po.fieldName}',
  244. scopedSlots: {customRender: 'htmlSlot'}
  245. <#elseif po.classType=='pca'>
  246. dataIndex: '${po.fieldName}',
  247. scopedSlots: {customRender: 'pcaSlot'}
  248. <#elseif po.classType=='file'>
  249. dataIndex: '${po.fieldName}',
  250. scopedSlots: {customRender: 'fileSlot'}
  251. <#elseif po.classType=='image'>
  252. dataIndex: '${po.fieldName}',
  253. scopedSlots: {customRender: 'imgSlot'}
  254. <#elseif po.classType=='sel_tree' || po.classType=='sel_search' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox' || po.classType=='sel_depart'>
  255. dataIndex: '${po.fieldName}_dictText',
  256. <#elseif po.classType=='switch'>
  257. dataIndex: '${po.fieldName}',
  258. <#if po.dictField != 'is_open'>
  259. customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
  260. <#else>
  261. customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
  262. </#if>
  263. <#elseif po.classType=='cat_tree'>
  264. <#if list_need_category>
  265. dataIndex: '${po.fieldName}',
  266. customRender:(text)=>{
  267. if(!text){
  268. return ''
  269. }else{
  270. return filterMultiDictText(this.dictOptions['${po.fieldName}'], text+"")
  271. }
  272. }
  273. <#else>
  274. dataIndex: '${po.fieldName}',
  275. customRender:(text,record)=>{
  276. if(!text){
  277. return ''
  278. }else{
  279. return record['${po.dictText}']
  280. }
  281. }
  282. </#if>
  283. <#else>
  284. dataIndex: '${po.fieldName}'
  285. </#if>
  286. },
  287. </#if>
  288. </#list>
  289. {
  290. title: '操作',
  291. dataIndex: 'action',
  292. align:"center",
  293. fixed:"right",
  294. width:147,
  295. scopedSlots: { customRender: 'action' },
  296. }
  297. ],
  298. url: {
  299. list: "/${entityPackage}/${entityName?uncap_first}/list",
  300. delete: "/${entityPackage}/${entityName?uncap_first}/delete",
  301. deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
  302. exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
  303. importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
  304. },
  305. dictOptions:{
  306. <#list columns as po>
  307. <#if (po.isQuery=='Y' || po.isShowList=='Y')>
  308. <#if po.classType='sel_depart' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
  309. ${po.fieldName}:[],
  310. </#if>
  311. </#if>
  312. </#list>
  313. },
  314. /* 分页参数 */
  315. ipagination:{
  316. current: 1,
  317. pageSize: 5,
  318. pageSizeOptions: ['5', '10', '50'],
  319. showTotal: (total, range) => {
  320. return range[0] + "-" + range[1] + " 共" + total + "条"
  321. },
  322. showQuickJumper: true,
  323. showSizeChanger: true,
  324. total: 0
  325. },
  326. selectedMainId:'',
  327. superFieldList:[],
  328. }
  329. },
  330. created() {
  331. <#if list_need_pca>
  332. this.pcaData = new Area()
  333. </#if>
  334. this.getSuperFieldList();
  335. },
  336. computed: {
  337. importExcelUrl: function(){
  338. <#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
  339. }
  340. },
  341. methods: {
  342. <#if list_need_pca>
  343. getPcaText(code){
  344. return this.pcaData.getText(code);
  345. },
  346. </#if>
  347. initDictConfig(){
  348. <#list columns as po>
  349. <#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
  350. <#if po.classType='sel_depart'>
  351. initDictOptions('sys_depart,depart_name,id').then((res) => {
  352. if (res.success) {
  353. this.$set(this.dictOptions, '${po.fieldName}', res.result)
  354. }
  355. })
  356. <#elseif po.classType=='cat_tree' && list_need_category==true>
  357. loadCategoryData({code:"${po.dictField}"}).then((res) => {
  358. if (res.success) {
  359. this.$set(this.dictOptions, '${po.fieldName}', res.result)
  360. }
  361. })
  362. <#elseif po.classType=='sel_search' || po.classType=='list_multi' || po.classType=='list' || po.classType=='radio' || po.classType=='checkbox'>
  363. <#assign list_field_dictCode="">
  364. <#if po.dictTable?default("")?trim?length gt 1>
  365. <#assign list_field_dictCode="${po.dictTable},${po.dictText},${po.dictField}">
  366. <#elseif po.dictField?default("")?trim?length gt 1>
  367. <#assign list_field_dictCode="${po.dictField}">
  368. </#if>
  369. initDictOptions('${list_field_dictCode}').then((res) => {
  370. if (res.success) {
  371. this.$set(this.dictOptions, '${po.fieldName}', res.result)
  372. }
  373. })
  374. </#if>
  375. </#if>
  376. </#list>
  377. },
  378. clickThenSelect(record) {
  379. return {
  380. on: {
  381. click: () => {
  382. this.onSelectChange(record.id.split(","), [record]);
  383. }
  384. }
  385. }
  386. },
  387. onClearSelected() {
  388. this.selectedRowKeys = [];
  389. this.selectionRows = [];
  390. this.selectedMainId=''
  391. },
  392. onSelectChange(selectedRowKeys, selectionRows) {
  393. this.selectedMainId=selectedRowKeys[0]
  394. this.selectedRowKeys = selectedRowKeys;
  395. this.selectionRows = selectionRows;
  396. },
  397. loadData(arg) {
  398. if(!this.url.list){
  399. this.$message.error("请设置url.list属性!")
  400. return
  401. }
  402. //加载数据 若传入参数1则加载第一页的内容
  403. if (arg === 1) {
  404. this.ipagination.current = 1;
  405. }
  406. this.onClearSelected()
  407. var params = this.getQueryParams();//查询条件
  408. this.loading = true;
  409. getAction(this.url.list, params).then((res) => {
  410. if (res.success) {
  411. this.dataSource = res.result.records;
  412. this.ipagination.total = Number(res.result.total);
  413. }
  414. if(res.code===510){
  415. this.$message.warning(res.message)
  416. }
  417. this.loading = false;
  418. })
  419. },
  420. getSuperFieldList(){
  421. <#include "/common/utils.ftl">
  422. let fieldList=[];
  423. <#list columns as po>
  424. fieldList.push(${superQueryFieldList(po)})
  425. </#list>
  426. this.superFieldList = fieldList
  427. }
  428. }
  429. }
  430. </script>
  431. <style scoped>
  432. @import '~@assets/less/common.less'
  433. </style>