From ae29751ffad79428f07b6aff6d49203543b376e5 Mon Sep 17 00:00:00 2001 From: zhangdaiscott <zhangdaiscott@163.com> Date: Mon, 24 Feb 2020 03:26:29 +0800 Subject: [PATCH] Jeecg-Boot 2.1.4 版本发布 | 重构较大,较多新功能 --- ant-design-vue-jeecg/README.md | 2 +- ant-design-vue-jeecg/src/views/modules/online/cgreport/OnlCgreportHeadList.vue | 6 +++--- ant-design-vue-jeecg/src/views/modules/online/cgreport/auto/OnlCgreportAutoList.vue | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------- jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml | 2 +- 4 files changed, 66 insertions(+), 40 deletions(-) diff --git a/ant-design-vue-jeecg/README.md b/ant-design-vue-jeecg/README.md index 82fa55e..8d056d8 100644 --- a/ant-design-vue-jeecg/README.md +++ b/ant-design-vue-jeecg/README.md @@ -7,7 +7,7 @@ Overview ---- 基于 [Ant Design of Vue](https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/) 实现的 Ant Design Pro Vue 版 -Jeecg-boot 的前端UI框架,采用前后端分离框架,提供强大代码生成器的快速开发平台。 +Jeecg-boot 的前段UI框架,采用前后端分离方案,提供强大代码生成器的快速开发平台。 前端页面代码和后端功能代码一键生成,不需要写任何代码,保持jeecg一贯的强大!! diff --git a/ant-design-vue-jeecg/src/views/modules/online/cgreport/OnlCgreportHeadList.vue b/ant-design-vue-jeecg/src/views/modules/online/cgreport/OnlCgreportHeadList.vue index b9e0afe..2532f53 100644 --- a/ant-design-vue-jeecg/src/views/modules/online/cgreport/OnlCgreportHeadList.vue +++ b/ant-design-vue-jeecg/src/views/modules/online/cgreport/OnlCgreportHeadList.vue @@ -6,18 +6,18 @@ <a-form layout="inline"> <a-row :gutter="24"> - <a-col :span="6"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="报表编码"> <a-input placeholder="请输入报表编码" v-model="queryParam.code"></a-input> </a-form-item> </a-col> - <a-col :span="6"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-form-item label="报表名字"> <a-input placeholder="请输入报表名字" v-model="queryParam.name"></a-input> </a-form-item> </a-col> - <a-col :span="8"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> diff --git a/ant-design-vue-jeecg/src/views/modules/online/cgreport/auto/OnlCgreportAutoList.vue b/ant-design-vue-jeecg/src/views/modules/online/cgreport/auto/OnlCgreportAutoList.vue index 698701d..d94e1cb 100644 --- a/ant-design-vue-jeecg/src/views/modules/online/cgreport/auto/OnlCgreportAutoList.vue +++ b/ant-design-vue-jeecg/src/views/modules/online/cgreport/auto/OnlCgreportAutoList.vue @@ -58,18 +58,34 @@ style="min-height: 300px" > + <!-- 支持链接href跳转 --> + <template + v-for="field of fieldHrefSlots" + :slot="field.slotName" + slot-scope="text, record" + > + <a @click="handleClickFieldHref(field,record)">{{ text }}</a> + </template> + </a-table> + <!-- 跳转Href的动态组件方式 --> + <a-modal v-bind="hrefComponent.model" v-on="hrefComponent.on"> + <component :is="hrefComponent.is" v-bind="hrefComponent.params"/> + </a-modal> + </a-card> </template> <script> + import { HrefJump } from '@/mixins/OnlAutoListMixin' import { getAction,downFile } from '@/api/manage' import { filterMultiDictText } from '@/components/dict/JDictSelectUtil' import {filterObj} from '@/utils/util'; export default { name: 'OnlCgreportAutoList', + mixins: [HrefJump], components: { }, data() { @@ -89,8 +105,7 @@ reportCode: '', description: '在线报表功能测试页面', url: { - getColumns: '/online/cgreport/api/getColumns/', - getData: '/online/cgreport/api/getData/', + getColumnsAndData: '/online/cgreport/api/getColumnsAndData/', getQueryInfo: '/online/cgreport/api/getQueryInfo/', getParamsInfo:'/online/cgreport/api/getParamsInfo/' }, @@ -153,7 +168,7 @@ } this.selfParam={} - getAction(`${this.url.getParamsInfo}${this.$route.params.code}`).then((res) => { + getAction(`${this.url.getParamsInfo}${this.reportCode}`).then((res) => { if (res.success) { if(res.result && res.result.length>0){ for(let i of res.result){ @@ -167,10 +182,10 @@ }) }, initQueryInfo() { - if(!this.$route.params.code){ + if(!this.reportCode){ return false } - getAction(`${this.url.getQueryInfo}${this.$route.params.code}`).then((res) => { + getAction(`${this.url.getQueryInfo}${this.reportCode}`).then((res) => { console.log("获取查询条件", res); if (res.success) { this.queryInfo = res.result @@ -180,7 +195,7 @@ }) }, loadData(arg) { - if(!this.$route.params.code){ + if(!this.reportCode){ return false } if (arg == 1) { @@ -189,42 +204,43 @@ let params = this.getQueryParams();//查询条件 console.log(params) + //获取报表ID console.log(' 动态报表 reportCode : ' + this.reportCode); this.table.loading = true - Promise.all([ - getAction(`${this.url.getColumns}${this.reportCode}`), - getAction(`${this.url.getData}${this.reportCode}`, params) - ]).then(results => { - let [{result: {columns,cgreportHeadName,dictOptions}}, {result: data}] = results - let columnWidth = 230 - this.dictOptions = dictOptions - for(let a=0;a<columns.length;a++){ - if(columns[a].customRender){ - let field_name = columns[a].customRender; - columns[a].customRender=(text)=>{ - if(!text){ - return '' - }else{ - return filterMultiDictText(this.dictOptions[field_name], text+""); - } + + getAction(`${this.url.getColumnsAndData}${this.reportCode}`, params).then(res => { + if (res.success) { + let { data, columns, cgreportHeadName, dictOptions, fieldHrefSlots } = res.result + + let columnWidth = 230 + this.dictOptions = dictOptions + for(let a=0;a<columns.length;a++){ + if(columns[a].customRender){ + let field_name = columns[a].customRender; + columns[a].customRender = (t => t ? filterMultiDictText(this.dictOptions[field_name], t + '') : t) } + columns.width = columnWidth } - columns.width = columnWidth - } - this.table.scroll.x = columns.length * columnWidth - this.table.columns = [...columns] - this.cgreportHeadName = cgreportHeadName - if (data) { - this.table.pagination.total = Number(data.total) - this.table.dataSource = data.records - } else { - this.table.pagination.total = 0 - this.table.dataSource = [] + this.table.scroll.x = columns.length * columnWidth + this.table.columns = [...columns] + this.cgreportHeadName = cgreportHeadName + this.fieldHrefSlots = fieldHrefSlots + if (data) { + this.table.pagination.total = Number(data.total) + this.table.dataSource = data.records + } else { + this.table.pagination.total = 0 + this.table.dataSource = [] + } + + }else{ + this.$message.warn('查询失败:'+res.message) } + }).catch((e) => { console.error(e) this.$message.error('查询失败') - }).then(() => { + }).finally(() => { this.table.loading = false }) }, @@ -246,7 +262,14 @@ }, exportExcel() { let fileName = this.cgreportHeadName - downFile(`/online/cgreport/api/exportXls/${this.reportCode}`,this.queryParam).then((data)=>{ + let selfParam = {} + for (let queryName in this.$route.query) { + if (this.$route.query.hasOwnProperty(queryName)) { + let value = this.$route.query[queryName] + selfParam['self_' + queryName] = value || '' + } + } + downFile(`/online/cgreport/api/exportXls/${this.reportCode}`, Object.assign(selfParam, this.queryParam)).then((data) => { if (!data) { this.$message.warning("文件下载失败") return @@ -275,6 +298,9 @@ if (Object.keys(sorter).length > 0) { this.sorter.column = sorter.field this.sorter.order = 'ascend' == sorter.order ? 'asc' : 'desc' + } else { + this.sorter.column = null + this.sorter.order = null } this.table.pagination = pagination this.loadData() diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml index 8e9c5eb..6880d16 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml @@ -96,7 +96,7 @@ spring: connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 datasource: master: - url: jdbc:mysql://127.0.0.1:3306/jeecg-boot-?characterEncoding=UTF-8&useUnicode=true&useSSL=false + url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false username: root password: root driver-class-name: com.mysql.jdbc.Driver -- libgit2 0.22.2