aba6098d6d8dab3f87d9fb9cb2717339fdf44f93.svn-base 18 KB

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