0ab8aec8d8259c4e154b9f75127c219d3d5b9ac3.svn-base 17 KB

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