1
0
mirror of https://github.com/chillzhuang/Sword synced 2024-12-22 08:59:24 +08:00

🎉 2.8.0.RELEASE 新增在线报表模块

This commit is contained in:
smallchill 2020-11-14 20:44:14 +08:00
parent 2aa10f7930
commit fd278ac92a
14 changed files with 276 additions and 14 deletions

View File

@ -1,9 +1,9 @@
<p align="center">
<img src="https://img.shields.io/badge/Release-V2.7.2-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Release-V2.8.0-green.svg" alt="Downloads">
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status">
<img src="https://img.shields.io/badge/license-Apache%202-blue.svg" alt="Build Status">
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR7-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.2.9.RELEASE-blue.svg" alt="Downloads">
<img src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR8-blue.svg" alt="Coverage Status">
<img src="https://img.shields.io/badge/Spring%20Boot-2.2.11.RELEASE-blue.svg" alt="Downloads">
<a target="_blank" href="https://bladex.vip">
<img src="https://img.shields.io/badge/Author-Small%20Chill-ff69b4.svg" alt="Downloads">
</a>

View File

@ -236,6 +236,15 @@ export default [
},
],
},
{
path: '/report',
routes: [
{
path: '/report/reportlist',
routes: [{ path: '/report/reportlist', component: './Report/Report' }],
},
],
},
{
path: '/tool',
routes: [

View File

@ -1,6 +1,6 @@
{
"name": "sword",
"version": "2.7.3",
"version": "2.8.0",
"description": "An out-of-box UI solution for enterprise applications",
"private": true,
"scripts": {

8
src/actions/report.js Normal file
View File

@ -0,0 +1,8 @@
export const REPORT_NAMESPACE = 'report';
export function REPORT_LIST(payload) {
return {
type: `${REPORT_NAMESPACE}/fetchList`,
payload,
};
}

View File

@ -114,7 +114,7 @@ class ThirdRegister extends PureComponent {
message: '请输入租户编号',
},
],
})(<Input placeholder="请输入租户编号"/>)}
})(<Input placeholder="请输入租户编号" />)}
</FormItem>
</Col>
</Row>
@ -130,7 +130,7 @@ class ThirdRegister extends PureComponent {
},
],
initialValue: user.name,
})(<Input placeholder="请输入用户姓名"/>)}
})(<Input placeholder="请输入用户姓名" />)}
</FormItem>
</Col>
<Col span={10}>
@ -143,7 +143,7 @@ class ThirdRegister extends PureComponent {
},
],
initialValue: user.account,
})(<Input placeholder="请输入账号名称"/>)}
})(<Input placeholder="请输入账号名称" />)}
</FormItem>
</Col>
</Row>
@ -157,7 +157,7 @@ class ThirdRegister extends PureComponent {
message: '请输入密码',
},
],
})(<Input placeholder="请输入账号密码"/>)}
})(<Input placeholder="请输入账号密码" />)}
</FormItem>
</Col>
<Col span={10}>
@ -169,7 +169,7 @@ class ThirdRegister extends PureComponent {
message: '请输入确认密码',
},
],
})(<Input placeholder="请确认账号密码"/>)}
})(<Input placeholder="请确认账号密码" />)}
</FormItem>
</Col>
</Row>

View File

@ -18,4 +18,6 @@ module.exports = {
pwa: true,
// 第三方登陆授权地址
authUrl: 'http://localhost/blade-auth/oauth/render',
// 报表设计器地址(cloud端口为8108,boot端口为80)
reportUrl: 'http://localhost:8108/ureport',
};

View File

@ -25,6 +25,9 @@ export default {
'menu.monitor.log.log_error': 'error log',
'menu.monitor.admin': 'service admin',
'menu.monitor.doc': 'api doc',
'menu.report': 'report',
'menu.report.report_setting': 'report setting',
'menu.report.report_list': 'report list',
'menu.tool': 'develop',
'menu.tool.code': 'code generate',
'menu.tool.datasource': 'datasource',

View File

@ -25,6 +25,9 @@ export default {
'menu.monitor.log.log_error': '错误日志',
'menu.monitor.admin': '服务治理',
'menu.monitor.doc': '接口文档',
'menu.report': '报表管理',
'menu.report.report_setting': '报表配置',
'menu.report.report_list': '报表列表',
'menu.tool': '研发工具',
'menu.tool.code': '代码生成',
'menu.tool.datasource': '数据源管理',

View File

@ -25,6 +25,9 @@ export default {
'menu.monitor.log.log_error': '錯誤日志',
'menu.monitor.admin': '服務治理',
'menu.monitor.doc': '接口文檔',
'menu.report': '報表管理',
'menu.report.report_setting': '報表配置',
'menu.report.report_list': '報表列表',
'menu.tool': '研發工具',
'menu.tool.code': '代碼生成',
'menu.tool.datasource': '數據源管理',

39
src/models/report.js Normal file
View File

@ -0,0 +1,39 @@
import { REPORT_NAMESPACE } from '../actions/report';
import { list } from '../services/report';
export default {
namespace: REPORT_NAMESPACE,
state: {
data: {
list: [],
pagination: false,
},
detail: {},
},
effects: {
*fetchList({ payload }, { call, put }) {
const response = yield call(list, payload);
if (response.success) {
yield put({
type: 'saveList',
payload: {
list: response.data.records,
pagination: {
total: response.data.total,
current: response.data.current,
pageSize: response.data.size,
},
},
});
}
},
},
reducers: {
saveList(state, action) {
return {
...state,
data: action.payload,
};
},
},
};

View File

@ -20,14 +20,14 @@ class Workplace extends PureComponent {
<Row gutter={24}>
<Col span={24}>
<div style={{ textAlign: 'center' }}>
<img src="https://img.shields.io/badge/Release-V2.7.3-green.svg" alt="Downloads" />
<img src="https://img.shields.io/badge/Release-V2.8.0-green.svg" alt="Downloads" />
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status" />
<img
src="https://img.shields.io/badge/Spring%20Cloud-Hoxton.SR8-blue.svg"
alt="Coverage Status"
/>
<img
src="https://img.shields.io/badge/Spring%20Boot-2.2.9.RELEASE-blue.svg"
src="https://img.shields.io/badge/Spring%20Boot-2.2.11.RELEASE-blue.svg"
alt="Downloads"
/>
<a href="https://bladex.vip">
@ -212,7 +212,25 @@ class Workplace extends PureComponent {
</Row>
<Row gutter={24}>
<Card className={styles.card} bordered={false}>
<Collapse bordered={false} defaultActiveKey={['20']}>
<Collapse bordered={false} defaultActiveKey={['21']}>
<Panel header="2.8.0发布 增加在线报表模块" key="21">
<div>1.升级 SpringBoot 2.2.11.RELEASE</div>
<div>2.升级 SpringCloud Hoxton.SR8</div>
<div>3.升级 AlibabaCloud 2.2.3.RELEASE</div>
<div>4.升级 Knife4j 2.0.6</div>
<div>5.升级 Swagger 2.10.5</div>
<div>6.升级 SwaggerModel 1.6.2</div>
<div>7.升级 SpringPlugin 2.2.0.RELEASE</div>
<div>8.升级 JustAuth 1.15.8</div>
<div>9.升级 FastJson 1.2.74</div>
<div>10.升级 Guava 30.0-jre</div>
<div>11.升级 JJWT 0.11.2</div>
<div>12.集成UReport2新增在线报表模块</div>
<div>13.优化Swagger封装以支持Knife4j最新API</div>
<div>14.引入Knife4j增强配置,生产环境将完全隔离文档访问</div>
<div>15.优化架构适配最新版本API</div>
<div>16.优化部署脚本</div>
</Panel>
<Panel header="2.7.3发布 增强多租户功能" key="20">
<div>1.升级至 SpringCloud Hoxton.SR8</div>
<div>2.升级至 Mybatis-Plus 3.4.0</div>

View File

@ -78,8 +78,10 @@ class LoginPage extends Component {
handleSubmit = (err, values) => {
const { type } = this.state;
if (!err) {
const { dispatch,
tenant: { info } } = this.props;
const {
dispatch,
tenant: { info },
} = this.props;
const { tenantId } = info;
dispatch({
type: 'login/login',

161
src/pages/Report/Report.js Normal file
View File

@ -0,0 +1,161 @@
import React, { Fragment, PureComponent } from 'react';
import { connect } from 'dva';
import { Button, Col, Divider, Form, Input, message, Modal, Row, Tag } from 'antd';
import Panel from '../../components/Panel';
import { REPORT_LIST } from '../../actions/report';
import Grid from '../../components/Sword/Grid';
import { reportUrl } from '../../defaultSettings';
import { remove } from '../../services/report';
const FormItem = Form.Item;
@connect(({ report, loading }) => ({
report,
loading: loading.models.report,
}))
@Form.create()
class Report extends PureComponent {
state = {
params: {},
};
// ============ 查询 ===============
handleSearch = params => {
const { dispatch } = this.props;
this.setState({ params });
dispatch(REPORT_LIST(params));
};
handleRemove = id => {
const { params } = this.state;
const refresh = this.handleSearch;
Modal.confirm({
title: '删除确认',
content: '确定删除该条记录?',
okText: '确定',
okType: 'danger',
cancelText: '取消',
onOk() {
remove({ ids: id }).then(resp => {
if (resp.success) {
message.success(resp.msg);
refresh(params);
} else {
message.error(resp.msg || '删除失败');
}
});
},
onCancel() {},
});
};
handleDesign = name => {
window.open(`${reportUrl}/designer?_u=blade-${name}`);
};
handlePreview = name => {
window.open(`${reportUrl}/preview?_u=blade-${name}`);
};
// ============ 查询表单 ===============
renderSearchForm = onReset => {
const { form } = this.props;
const { getFieldDecorator } = form;
return (
<Row gutter={{ md: 8, lg: 24, xl: 48 }}>
<Col md={6} sm={24}>
<FormItem label="查询文件名">
{getFieldDecorator('name')(<Input placeholder="查询文件名" />)}
</FormItem>
</Col>
<Col>
<div style={{ float: 'right' }}>
<Button type="primary" htmlType="submit">
查询
</Button>
<Button style={{ marginLeft: 8 }} onClick={onReset}>
重置
</Button>
</div>
</Col>
</Row>
);
};
renderActionButton = (keys, rows) => (
<Fragment key="copy">
<a
onClick={() => {
this.handleRemove(keys[0]);
}}
>
删除
</a>
<Divider type="vertical" />
<a
onClick={() => {
this.handleDesign(rows[0].name);
}}
>
设计
</a>
<Divider type="vertical" />
<a
onClick={() => {
this.handlePreview(rows[0].name);
}}
>
预览
</a>
</Fragment>
);
render() {
const code = 'report';
const {
form,
loading,
report: { data },
} = this.props;
const columns = [
{
title: '文件名',
dataIndex: 'name',
render: name => (
<span>
<Tag color="geekblue" key={name}>
v{name}
</Tag>
</span>
),
},
{
title: '创建时间',
dataIndex: 'createTime',
},
{
title: '更新时间',
dataIndex: 'updateTime',
},
];
return (
<Panel>
<Grid
code={code}
form={form}
onSearch={this.handleSearch}
renderSearchForm={this.renderSearchForm}
renderActionButton={this.renderActionButton}
loading={loading}
data={data}
columns={columns}
/>
</Panel>
);
}
}
export default Report;

14
src/services/report.js Normal file
View File

@ -0,0 +1,14 @@
import { stringify } from 'qs';
import func from '../utils/Func';
import request from '../utils/request';
export async function list(params) {
return request(`/api/blade-report/report/rest/list?${stringify(params)}`);
}
export async function remove(params) {
return request('/api/blade-report/report/rest/remove', {
method: 'POST',
body: func.toFormData(params),
});
}