2f93d6616c367adcd55fa069f7c488cf31e42a91.svn-base 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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_pca=false>
  10. <#assign list_need_dict=false>
  11. <#assign list_need_category=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. <a-dropdown v-if="selectedRowKeys.length > 0">
  122. <a-menu slot="overlay">
  123. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  124. </a-menu>
  125. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  126. </a-dropdown>
  127. </div>
  128. <!-- table区域-begin -->
  129. <div>
  130. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  131. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  132. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  133. </div>
  134. <a-table
  135. ref="table"
  136. size="middle"
  137. bordered
  138. rowKey="id"
  139. class="j-table-force-nowrap"
  140. :scroll="{x:true}"
  141. :columns="columns"
  142. :dataSource="dataSource"
  143. :pagination="ipagination"
  144. :loading="loading"
  145. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  146. @change="handleTableChange">
  147. <template slot="htmlSlot" slot-scope="text">
  148. <div v-html="text"></div>
  149. </template>
  150. <template slot="imgSlot" slot-scope="text">
  151. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  152. <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  153. </template>
  154. <template slot="fileSlot" slot-scope="text">
  155. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  156. <a-button
  157. v-else
  158. :ghost="true"
  159. type="primary"
  160. icon="download"
  161. size="small"
  162. @click="uploadFile(text)">
  163. 下载
  164. </a-button>
  165. </template>
  166. <#if list_need_pca>
  167. <template slot="pcaSlot" slot-scope="text">
  168. <div>{{ getPcaText(text) }}</div>
  169. </template>
  170. </#if>
  171. <span slot="action" slot-scope="text, record">
  172. <a @click="handleEdit(record)">编辑</a>
  173. <a-divider type="vertical" />
  174. <a-dropdown>
  175. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  176. <a-menu slot="overlay">
  177. <a-menu-item>
  178. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  179. <a>删除</a>
  180. </a-popconfirm>
  181. </a-menu-item>
  182. </a-menu>
  183. </a-dropdown>
  184. </span>
  185. </a-table>
  186. </div>
  187. <${entityName?uncap_first}-modal ref="modalForm" @ok="modalFormOk"></${entityName?uncap_first}-modal>
  188. </a-card>
  189. </template>
  190. <script>
  191. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  192. import ${entityName}Modal from './modules/${entityName}Modal'
  193. <#if list_need_category>
  194. import { loadCategoryData } from '@/api/api'
  195. </#if>
  196. <#if list_need_dict>
  197. import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  198. </#if>
  199. <#if list_need_pca>
  200. import Area from '@/components/_util/Area'
  201. </#if>
  202. import '@/assets/less/TableExpand.less'
  203. export default {
  204. name: "${entityName}List",
  205. mixins:[JeecgListMixin],
  206. components: {
  207. ${entityName}Modal
  208. },
  209. data () {
  210. return {
  211. description: '${tableVo.ftlDescription}管理页面',
  212. // 表头
  213. columns: [
  214. {
  215. title: '#',
  216. dataIndex: '',
  217. key:'rowIndex',
  218. width:60,
  219. align:"center",
  220. customRender:function (t,r,index) {
  221. return parseInt(index)+1;
  222. }
  223. },
  224. <#assign showColNum=0>
  225. <#list columns as po>
  226. <#if po.isShowList =='Y'>
  227. <#assign showColNum=showColNum+1>
  228. {
  229. title:'${po.filedComment}',
  230. align:"center",
  231. <#if po.sort=='Y'>
  232. sorter: true,
  233. </#if>
  234. <#if po.classType=='date'>
  235. dataIndex: '${po.fieldName}',
  236. customRender:function (text) {
  237. return !text?"":(text.length>10?text.substr(0,10):text)
  238. }
  239. <#elseif po.fieldDbType=='Blob'>
  240. dataIndex: '${po.fieldName}String'
  241. <#elseif po.classType=='umeditor'>
  242. dataIndex: '${po.fieldName}',
  243. scopedSlots: {customRender: 'htmlSlot'}
  244. <#elseif po.classType=='file'>
  245. dataIndex: '${po.fieldName}',
  246. scopedSlots: {customRender: 'fileSlot'}
  247. <#elseif po.classType=='pca'>
  248. dataIndex: '${po.fieldName}',
  249. scopedSlots: {customRender: 'pcaSlot'}
  250. <#elseif po.classType=='image'>
  251. dataIndex: '${po.fieldName}',
  252. scopedSlots: {customRender: 'imgSlot'}
  253. <#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'>
  254. dataIndex: '${po.fieldName}_dictText'
  255. <#elseif po.classType=='cat_tree'>
  256. <#if list_need_category>
  257. dataIndex: '${po.fieldName}',
  258. customRender: (text) => (text ? filterMultiDictText(this.dictOptions['${po.fieldName}'], text) : '')
  259. <#else>
  260. dataIndex: '${po.fieldName}',
  261. customRender: (text, record) => (text ? record['${po.dictText}'] : '')
  262. </#if>
  263. <#elseif po.classType=='switch'>
  264. dataIndex: '${po.fieldName}',
  265. <#if po.dictField != 'is_open'>
  266. customRender: (text) => (!text ? "" : (text == ${po.dictField}[0] ? "是" : "否"))
  267. <#else>
  268. customRender: (text) => (!text ? "" : (text == "Y" ? "是" : "否"))
  269. </#if>
  270. <#else>
  271. dataIndex: '${po.fieldName}'
  272. </#if>
  273. },
  274. </#if>
  275. </#list>
  276. {
  277. title: '操作',
  278. dataIndex: 'action',
  279. align:"center",
  280. fixed:"right",
  281. width:147,
  282. scopedSlots: { customRender: 'action' },
  283. }
  284. ],
  285. url: {
  286. list: "/${entityPackage}/${entityName?uncap_first}/list",
  287. delete: "/${entityPackage}/${entityName?uncap_first}/delete",
  288. deleteBatch: "/${entityPackage}/${entityName?uncap_first}/deleteBatch",
  289. exportXlsUrl: "/${entityPackage}/${entityName?uncap_first}/exportXls",
  290. importExcelUrl: "${entityPackage}/${entityName?uncap_first}/importExcel",
  291. },
  292. dictOptions:{},
  293. superFieldList:[],
  294. }
  295. },
  296. created() {
  297. <#if list_need_pca>
  298. this.pcaData = new Area()
  299. </#if>
  300. this.getSuperFieldList();
  301. },
  302. computed: {
  303. importExcelUrl: function(){
  304. <#noparse>return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;</#noparse>
  305. }
  306. },
  307. methods: {
  308. <#if list_need_pca>
  309. getPcaText(code){
  310. return this.pcaData.getText(code);
  311. },
  312. </#if>
  313. initDictConfig(){
  314. <#list columns as po>
  315. <#if (po.isQuery=='Y' || po.isShowList=='Y') && po.classType!='popup'>
  316. <#if po.classType=='cat_tree' && list_need_category==true>
  317. loadCategoryData({code:"${po.dictField?default('')}"}).then((res) => {
  318. if (res.success) {
  319. this.$set(this.dictOptions, '${po.fieldName}', res.result)
  320. }
  321. })
  322. </#if>
  323. </#if>
  324. </#list>
  325. },
  326. getSuperFieldList(){
  327. <#include "/common/utils.ftl">
  328. let fieldList=[];
  329. <#list columns as po>
  330. fieldList.push(${superQueryFieldList(po)})
  331. </#list>
  332. this.superFieldList = fieldList
  333. }
  334. }
  335. }
  336. </script>
  337. <style scoped>
  338. @import '~@assets/less/common.less';
  339. </style>