Commit ae29751ffad79428f07b6aff6d49203543b376e5
1 parent
3670dbbf
Jeecg-Boot 2.1.4 版本发布 | 重构较大,较多新功能
Showing
4 changed files
with
66 additions
and
40 deletions
ant-design-vue-jeecg/README.md
... | ... | @@ -7,7 +7,7 @@ Overview |
7 | 7 | ---- |
8 | 8 | |
9 | 9 | 基于 [Ant Design of Vue](https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/) 实现的 Ant Design Pro Vue 版 |
10 | -Jeecg-boot 的前端UI框架,采用前后端分离框架,提供强大代码生成器的快速开发平台。 | |
10 | +Jeecg-boot 的前段UI框架,采用前后端分离方案,提供强大代码生成器的快速开发平台。 | |
11 | 11 | 前端页面代码和后端功能代码一键生成,不需要写任何代码,保持jeecg一贯的强大!! |
12 | 12 | |
13 | 13 | |
... | ... |
ant-design-vue-jeecg/src/views/modules/online/cgreport/OnlCgreportHeadList.vue
... | ... | @@ -6,18 +6,18 @@ |
6 | 6 | <a-form layout="inline"> |
7 | 7 | <a-row :gutter="24"> |
8 | 8 | |
9 | - <a-col :span="6"> | |
9 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
10 | 10 | <a-form-item label="报表编码"> |
11 | 11 | <a-input placeholder="请输入报表编码" v-model="queryParam.code"></a-input> |
12 | 12 | </a-form-item> |
13 | 13 | </a-col> |
14 | - <a-col :span="6"> | |
14 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
15 | 15 | <a-form-item label="报表名字"> |
16 | 16 | <a-input placeholder="请输入报表名字" v-model="queryParam.name"></a-input> |
17 | 17 | </a-form-item> |
18 | 18 | </a-col> |
19 | 19 | |
20 | - <a-col :span="8"> | |
20 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
21 | 21 | <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
22 | 22 | <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> |
23 | 23 | <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> |
... | ... |
ant-design-vue-jeecg/src/views/modules/online/cgreport/auto/OnlCgreportAutoList.vue
... | ... | @@ -58,18 +58,34 @@ |
58 | 58 | style="min-height: 300px" |
59 | 59 | > |
60 | 60 | |
61 | + <!-- 支持链接href跳转 --> | |
62 | + <template | |
63 | + v-for="field of fieldHrefSlots" | |
64 | + :slot="field.slotName" | |
65 | + slot-scope="text, record" | |
66 | + > | |
67 | + <a @click="handleClickFieldHref(field,record)">{{ text }}</a> | |
68 | + </template> | |
69 | + | |
61 | 70 | </a-table> |
62 | 71 | |
72 | + <!-- 跳转Href的动态组件方式 --> | |
73 | + <a-modal v-bind="hrefComponent.model" v-on="hrefComponent.on"> | |
74 | + <component :is="hrefComponent.is" v-bind="hrefComponent.params"/> | |
75 | + </a-modal> | |
76 | + | |
63 | 77 | </a-card> |
64 | 78 | </template> |
65 | 79 | |
66 | 80 | <script> |
81 | + import { HrefJump } from '@/mixins/OnlAutoListMixin' | |
67 | 82 | import { getAction,downFile } from '@/api/manage' |
68 | 83 | import { filterMultiDictText } from '@/components/dict/JDictSelectUtil' |
69 | 84 | import {filterObj} from '@/utils/util'; |
70 | 85 | |
71 | 86 | export default { |
72 | 87 | name: 'OnlCgreportAutoList', |
88 | + mixins: [HrefJump], | |
73 | 89 | components: { |
74 | 90 | }, |
75 | 91 | data() { |
... | ... | @@ -89,8 +105,7 @@ |
89 | 105 | reportCode: '', |
90 | 106 | description: '在线报表功能测试页面', |
91 | 107 | url: { |
92 | - getColumns: '/online/cgreport/api/getColumns/', | |
93 | - getData: '/online/cgreport/api/getData/', | |
108 | + getColumnsAndData: '/online/cgreport/api/getColumnsAndData/', | |
94 | 109 | getQueryInfo: '/online/cgreport/api/getQueryInfo/', |
95 | 110 | getParamsInfo:'/online/cgreport/api/getParamsInfo/' |
96 | 111 | }, |
... | ... | @@ -153,7 +168,7 @@ |
153 | 168 | } |
154 | 169 | |
155 | 170 | this.selfParam={} |
156 | - getAction(`${this.url.getParamsInfo}${this.$route.params.code}`).then((res) => { | |
171 | + getAction(`${this.url.getParamsInfo}${this.reportCode}`).then((res) => { | |
157 | 172 | if (res.success) { |
158 | 173 | if(res.result && res.result.length>0){ |
159 | 174 | for(let i of res.result){ |
... | ... | @@ -167,10 +182,10 @@ |
167 | 182 | }) |
168 | 183 | }, |
169 | 184 | initQueryInfo() { |
170 | - if(!this.$route.params.code){ | |
185 | + if(!this.reportCode){ | |
171 | 186 | return false |
172 | 187 | } |
173 | - getAction(`${this.url.getQueryInfo}${this.$route.params.code}`).then((res) => { | |
188 | + getAction(`${this.url.getQueryInfo}${this.reportCode}`).then((res) => { | |
174 | 189 | console.log("获取查询条件", res); |
175 | 190 | if (res.success) { |
176 | 191 | this.queryInfo = res.result |
... | ... | @@ -180,7 +195,7 @@ |
180 | 195 | }) |
181 | 196 | }, |
182 | 197 | loadData(arg) { |
183 | - if(!this.$route.params.code){ | |
198 | + if(!this.reportCode){ | |
184 | 199 | return false |
185 | 200 | } |
186 | 201 | if (arg == 1) { |
... | ... | @@ -189,42 +204,43 @@ |
189 | 204 | let params = this.getQueryParams();//查询条件 |
190 | 205 | console.log(params) |
191 | 206 | |
207 | + //获取报表ID | |
192 | 208 | console.log(' 动态报表 reportCode : ' + this.reportCode); |
193 | 209 | this.table.loading = true |
194 | - Promise.all([ | |
195 | - getAction(`${this.url.getColumns}${this.reportCode}`), | |
196 | - getAction(`${this.url.getData}${this.reportCode}`, params) | |
197 | - ]).then(results => { | |
198 | - let [{result: {columns,cgreportHeadName,dictOptions}}, {result: data}] = results | |
199 | - let columnWidth = 230 | |
200 | - this.dictOptions = dictOptions | |
201 | - for(let a=0;a<columns.length;a++){ | |
202 | - if(columns[a].customRender){ | |
203 | - let field_name = columns[a].customRender; | |
204 | - columns[a].customRender=(text)=>{ | |
205 | - if(!text){ | |
206 | - return '' | |
207 | - }else{ | |
208 | - return filterMultiDictText(this.dictOptions[field_name], text+""); | |
209 | - } | |
210 | + | |
211 | + getAction(`${this.url.getColumnsAndData}${this.reportCode}`, params).then(res => { | |
212 | + if (res.success) { | |
213 | + let { data, columns, cgreportHeadName, dictOptions, fieldHrefSlots } = res.result | |
214 | + | |
215 | + let columnWidth = 230 | |
216 | + this.dictOptions = dictOptions | |
217 | + for(let a=0;a<columns.length;a++){ | |
218 | + if(columns[a].customRender){ | |
219 | + let field_name = columns[a].customRender; | |
220 | + columns[a].customRender = (t => t ? filterMultiDictText(this.dictOptions[field_name], t + '') : t) | |
210 | 221 | } |
222 | + columns.width = columnWidth | |
211 | 223 | } |
212 | - columns.width = columnWidth | |
213 | - } | |
214 | - this.table.scroll.x = columns.length * columnWidth | |
215 | - this.table.columns = [...columns] | |
216 | - this.cgreportHeadName = cgreportHeadName | |
217 | - if (data) { | |
218 | - this.table.pagination.total = Number(data.total) | |
219 | - this.table.dataSource = data.records | |
220 | - } else { | |
221 | - this.table.pagination.total = 0 | |
222 | - this.table.dataSource = [] | |
224 | + this.table.scroll.x = columns.length * columnWidth | |
225 | + this.table.columns = [...columns] | |
226 | + this.cgreportHeadName = cgreportHeadName | |
227 | + this.fieldHrefSlots = fieldHrefSlots | |
228 | + if (data) { | |
229 | + this.table.pagination.total = Number(data.total) | |
230 | + this.table.dataSource = data.records | |
231 | + } else { | |
232 | + this.table.pagination.total = 0 | |
233 | + this.table.dataSource = [] | |
234 | + } | |
235 | + | |
236 | + }else{ | |
237 | + this.$message.warn('查询失败:'+res.message) | |
223 | 238 | } |
239 | + | |
224 | 240 | }).catch((e) => { |
225 | 241 | console.error(e) |
226 | 242 | this.$message.error('查询失败') |
227 | - }).then(() => { | |
243 | + }).finally(() => { | |
228 | 244 | this.table.loading = false |
229 | 245 | }) |
230 | 246 | }, |
... | ... | @@ -246,7 +262,14 @@ |
246 | 262 | }, |
247 | 263 | exportExcel() { |
248 | 264 | let fileName = this.cgreportHeadName |
249 | - downFile(`/online/cgreport/api/exportXls/${this.reportCode}`,this.queryParam).then((data)=>{ | |
265 | + let selfParam = {} | |
266 | + for (let queryName in this.$route.query) { | |
267 | + if (this.$route.query.hasOwnProperty(queryName)) { | |
268 | + let value = this.$route.query[queryName] | |
269 | + selfParam['self_' + queryName] = value || '' | |
270 | + } | |
271 | + } | |
272 | + downFile(`/online/cgreport/api/exportXls/${this.reportCode}`, Object.assign(selfParam, this.queryParam)).then((data) => { | |
250 | 273 | if (!data) { |
251 | 274 | this.$message.warning("文件下载失败") |
252 | 275 | return |
... | ... | @@ -275,6 +298,9 @@ |
275 | 298 | if (Object.keys(sorter).length > 0) { |
276 | 299 | this.sorter.column = sorter.field |
277 | 300 | this.sorter.order = 'ascend' == sorter.order ? 'asc' : 'desc' |
301 | + } else { | |
302 | + this.sorter.column = null | |
303 | + this.sorter.order = null | |
278 | 304 | } |
279 | 305 | this.table.pagination = pagination |
280 | 306 | this.loadData() |
... | ... |
jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml
... | ... | @@ -96,7 +96,7 @@ spring: |
96 | 96 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 |
97 | 97 | datasource: |
98 | 98 | master: |
99 | - url: jdbc:mysql://127.0.0.1:3306/jeecg-boot-?characterEncoding=UTF-8&useUnicode=true&useSSL=false | |
99 | + url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false | |
100 | 100 | username: root |
101 | 101 | password: root |
102 | 102 | driver-class-name: com.mysql.jdbc.Driver |
... | ... |