提交 38e6586c 编写于 作者: JEECG低代码平台's avatar JEECG低代码平台

Jeecg-Boot 2.1.4 版本发布 | 重构较大,较多新功能

上级 d7ca307f
...@@ -6,18 +6,18 @@ ...@@ -6,18 +6,18 @@
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="6"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="报表编码"> <a-form-item label="报表编码">
<a-input placeholder="请输入报表编码" v-model="queryParam.code"></a-input> <a-input placeholder="请输入报表编码" v-model="queryParam.code"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="6"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="报表名字"> <a-form-item label="报表名字">
<a-input placeholder="请输入报表名字" v-model="queryParam.name"></a-input> <a-input placeholder="请输入报表名字" v-model="queryParam.name"></a-input>
</a-form-item> </a-form-item>
</a-col> </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"> <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="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
......
...@@ -58,18 +58,34 @@ ...@@ -58,18 +58,34 @@
style="min-height: 300px" 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> </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> </a-card>
</template> </template>
<script> <script>
import { HrefJump } from '@/mixins/OnlAutoListMixin'
import { getAction,downFile } from '@/api/manage' import { getAction,downFile } from '@/api/manage'
import { filterMultiDictText } from '@/components/dict/JDictSelectUtil' import { filterMultiDictText } from '@/components/dict/JDictSelectUtil'
import {filterObj} from '@/utils/util'; import {filterObj} from '@/utils/util';
export default { export default {
name: 'OnlCgreportAutoList', name: 'OnlCgreportAutoList',
mixins: [HrefJump],
components: { components: {
}, },
data() { data() {
...@@ -89,8 +105,7 @@ ...@@ -89,8 +105,7 @@
reportCode: '', reportCode: '',
description: '在线报表功能测试页面', description: '在线报表功能测试页面',
url: { url: {
getColumns: '/online/cgreport/api/getColumns/', getColumnsAndData: '/online/cgreport/api/getColumnsAndData/',
getData: '/online/cgreport/api/getData/',
getQueryInfo: '/online/cgreport/api/getQueryInfo/', getQueryInfo: '/online/cgreport/api/getQueryInfo/',
getParamsInfo:'/online/cgreport/api/getParamsInfo/' getParamsInfo:'/online/cgreport/api/getParamsInfo/'
}, },
...@@ -153,7 +168,7 @@ ...@@ -153,7 +168,7 @@
} }
this.selfParam={} 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.success) {
if(res.result && res.result.length>0){ if(res.result && res.result.length>0){
for(let i of res.result){ for(let i of res.result){
...@@ -167,10 +182,10 @@ ...@@ -167,10 +182,10 @@
}) })
}, },
initQueryInfo() { initQueryInfo() {
if(!this.$route.params.code){ if(!this.reportCode){
return false return false
} }
getAction(`${this.url.getQueryInfo}${this.$route.params.code}`).then((res) => { getAction(`${this.url.getQueryInfo}${this.reportCode}`).then((res) => {
console.log("获取查询条件", res); console.log("获取查询条件", res);
if (res.success) { if (res.success) {
this.queryInfo = res.result this.queryInfo = res.result
...@@ -180,7 +195,7 @@ ...@@ -180,7 +195,7 @@
}) })
}, },
loadData(arg) { loadData(arg) {
if(!this.$route.params.code){ if(!this.reportCode){
return false return false
} }
if (arg == 1) { if (arg == 1) {
...@@ -189,42 +204,43 @@ ...@@ -189,42 +204,43 @@
let params = this.getQueryParams();//查询条件 let params = this.getQueryParams();//查询条件
console.log(params) console.log(params)
//获取报表ID
console.log(' 动态报表 reportCode : ' + this.reportCode); console.log(' 动态报表 reportCode : ' + this.reportCode);
this.table.loading = true this.table.loading = true
Promise.all([
getAction(`${this.url.getColumns}${this.reportCode}`), getAction(`${this.url.getColumnsAndData}${this.reportCode}`, params).then(res => {
getAction(`${this.url.getData}${this.reportCode}`, params) if (res.success) {
]).then(results => { let { data, columns, cgreportHeadName, dictOptions, fieldHrefSlots } = res.result
let [{result: {columns,cgreportHeadName,dictOptions}}, {result: data}] = results
let columnWidth = 230 let columnWidth = 230
this.dictOptions = dictOptions this.dictOptions = dictOptions
for(let a=0;a<columns.length;a++){ for(let a=0;a<columns.length;a++){
if(columns[a].customRender){ if(columns[a].customRender){
let field_name = columns[a].customRender; let field_name = columns[a].customRender;
columns[a].customRender=(text)=>{ columns[a].customRender = (t => t ? filterMultiDictText(this.dictOptions[field_name], t + '') : t)
if(!text){
return ''
}else{
return filterMultiDictText(this.dictOptions[field_name], text+"");
}
} }
columns.width = columnWidth
} }
columns.width = columnWidth this.table.scroll.x = columns.length * columnWidth
} this.table.columns = [...columns]
this.table.scroll.x = columns.length * columnWidth this.cgreportHeadName = cgreportHeadName
this.table.columns = [...columns] this.fieldHrefSlots = fieldHrefSlots
this.cgreportHeadName = cgreportHeadName if (data) {
if (data) { this.table.pagination.total = Number(data.total)
this.table.pagination.total = Number(data.total) this.table.dataSource = data.records
this.table.dataSource = data.records } else {
} else { this.table.pagination.total = 0
this.table.pagination.total = 0 this.table.dataSource = []
this.table.dataSource = [] }
}else{
this.$message.warn('查询失败:'+res.message)
} }
}).catch((e) => { }).catch((e) => {
console.error(e) console.error(e)
this.$message.error('查询失败') this.$message.error('查询失败')
}).then(() => { }).finally(() => {
this.table.loading = false this.table.loading = false
}) })
}, },
...@@ -246,7 +262,14 @@ ...@@ -246,7 +262,14 @@
}, },
exportExcel() { exportExcel() {
let fileName = this.cgreportHeadName 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) { if (!data) {
this.$message.warning("文件下载失败") this.$message.warning("文件下载失败")
return return
...@@ -275,6 +298,9 @@ ...@@ -275,6 +298,9 @@
if (Object.keys(sorter).length > 0) { if (Object.keys(sorter).length > 0) {
this.sorter.column = sorter.field this.sorter.column = sorter.field
this.sorter.order = 'ascend' == sorter.order ? 'asc' : 'desc' this.sorter.order = 'ascend' == sorter.order ? 'asc' : 'desc'
} else {
this.sorter.column = null
this.sorter.order = null
} }
this.table.pagination = pagination this.table.pagination = pagination
this.loadData() this.loadData()
......
...@@ -96,7 +96,7 @@ spring: ...@@ -96,7 +96,7 @@ spring:
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
datasource: datasource:
master: 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 username: root
password: root password: root
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册