提交 741c3139 authored 作者: 钟是志's avatar 钟是志

12501 所有-自定义统计,查询结果优化

上级 512fe19b
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
.title2{ .title2{
position: absolute; position: absolute;
top: 43px; top: 43px;
right:-50px; right:-70px;
transform:rotate(30deg) transform:rotate(30deg)
} }
.title3{ .title3{
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
top: 30px; top: 30px;
left:0px; left:0px;
} }
.tableCantainer{ .tableCantainer{
width: 100%; width: 100%;
} }
...@@ -121,7 +121,7 @@ padding: 0 25px; ...@@ -121,7 +121,7 @@ padding: 0 25px;
align-items: center; align-items: center;
} }
.evaluation p{ .evaluation p{
margin-bottom: 0; margin-bottom: 0;
} }
.evaluation div{ .evaluation div{
...@@ -182,7 +182,7 @@ justify-content: center; ...@@ -182,7 +182,7 @@ justify-content: center;
} }
.yjTable tr:nth-child(1){ .yjTable tr:nth-child(1){
width: 100%; width: 100%;
font-size: 14px; font-size: 14px;
color: #617489; color: #617489;
} }
...@@ -201,7 +201,7 @@ justify-content: center; ...@@ -201,7 +201,7 @@ justify-content: center;
} }
.tableStys tr{ .tableStys tr{
width: 100%; width: 100%;
} }
.tableStys tr:nth-child(1){ .tableStys tr:nth-child(1){
...@@ -222,5 +222,5 @@ font-size: 14px; ...@@ -222,5 +222,5 @@ font-size: 14px;
width: 100%; width: 100%;
padding: 12px 0; padding: 12px 0;
text-align: center; text-align: center;
} }
\ No newline at end of file
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { Select, Button, Modal, Input, Table, Row, Col, Tag, Form, message ,notification } from 'antd'; import {Select, Button, Modal, Input, Table, Row, Col, Tag, Form, message, notification} from 'antd';
import { connect } from 'dva'; import {connect} from 'dva';
import { getToken } from '../utils/token' import {getToken} from '../utils/token'
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import QueryItem from './QueryItem'; import QueryItem from './QueryItem';
import OrderItem from './OrderItem'; import OrderItem from './OrderItem';
import styles from './Ability.css'; import styles from './Ability.css';
import FormdataWrapper from '../utils/object-to-formdata-custom'; import FormdataWrapper from '../utils/object-to-formdata-custom';
import ButtonDiy from './ButtonDiy/ButtonDiy'; import ButtonDiy from './ButtonDiy/ButtonDiy';
const Option = Select.Option; const Option = Select.Option;
const nameSpan = { const nameSpan = {
small: 9, small: 9,
...@@ -31,7 +32,7 @@ function swapArray(arr, index1, index2) { ...@@ -31,7 +32,7 @@ function swapArray(arr, index1, index2) {
} }
const FormItem = Form.Item; const FormItem = Form.Item;
@connect(({ cms, loading }) => ({ @connect(({cms, loading}) => ({
cms, cms,
loading: loading.models.cms, loading: loading.models.cms,
})) }))
...@@ -40,7 +41,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -40,7 +41,7 @@ export default class StatisticsInfo extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
exportLoading:false, exportLoading: false,
visiable: false, visiable: false,
queryVisiable: false, queryVisiable: false,
groupVisiable: false, groupVisiable: false,
...@@ -74,17 +75,17 @@ export default class StatisticsInfo extends React.Component { ...@@ -74,17 +75,17 @@ export default class StatisticsInfo extends React.Component {
} }
onSelectChange = (sourceSelectedKeys, targetSelectedKeys) => { onSelectChange = (sourceSelectedKeys, targetSelectedKeys) => {
this.setState({ sourceSelectedKeys, targetSelectedKeys }); this.setState({sourceSelectedKeys, targetSelectedKeys});
}; };
deleteQuery = (i) => { deleteQuery = (i) => {
const querys = this.state.querys; const querys = this.state.querys;
querys.splice(i); querys.splice(i);
this.setState({ querys }); this.setState({querys});
}; };
deleteOrder = (i) => { deleteOrder = (i) => {
const orders = this.state.orders; const orders = this.state.orders;
orders.splice(i); orders.splice(i);
this.setState({ orders }); this.setState({orders});
}; };
deleteGroup = (i) => { deleteGroup = (i) => {
const groups = this.state.groups; const groups = this.state.groups;
...@@ -92,12 +93,12 @@ export default class StatisticsInfo extends React.Component { ...@@ -92,12 +93,12 @@ export default class StatisticsInfo extends React.Component {
this.setState( this.setState(
{ {
groups groups
},()=>{ }, () => {
this.finish(); this.finish();
}); });
}; };
open = () => { open = () => {
const { dispatch } = this.props; const {dispatch} = this.props;
dispatch({ dispatch({
...@@ -149,30 +150,30 @@ export default class StatisticsInfo extends React.Component { ...@@ -149,30 +150,30 @@ export default class StatisticsInfo extends React.Component {
} }
this.setState({ this.setState({
mockData, mockXZData,infos, visiable: true, qs, gs, os, mockData, mockXZData, infos, visiable: true, qs, gs, os,
}); });
}, },
}); });
}; };
onCancle = () => { onCancle = () => {
this.setState({ visiable: false }); this.setState({visiable: false});
}; };
handleChange = (targetKeys, direction, moveKeys) => { handleChange = (targetKeys, direction, moveKeys) => {
this.setState({ targetKeys }); this.setState({targetKeys});
}; };
addOrder = () => { addOrder = () => {
this.setState({ orderVisiable: true }); this.setState({orderVisiable: true});
}; };
okOrder = () => { okOrder = () => {
const orders = this.state.orders; const orders = this.state.orders;
orders.push(this.state.infos[this.state.currentOrderKey]); orders.push(this.state.infos[this.state.currentOrderKey]);
this.setState({ orders, orderVisiable: false, currentOrderKey: null }); this.setState({orders, orderVisiable: false, currentOrderKey: null});
}; };
okGroup = () => { okGroup = () => {
...@@ -185,19 +186,20 @@ export default class StatisticsInfo extends React.Component { ...@@ -185,19 +186,20 @@ export default class StatisticsInfo extends React.Component {
this.setState({ this.setState({
groups, groups,
groupVisiable: false, groupVisiable: false,
currentGroupKey: null },()=>{ currentGroupKey: null
}, () => {
this.finish(); this.finish();
}); });
}; };
addGroup = () => { addGroup = () => {
this.setState({ groupVisiable: true }); this.setState({groupVisiable: true});
}; };
addQuery = () => { addQuery = () => {
this.setState({ queryVisiable: true }); this.setState({queryVisiable: true});
}; };
okQuery = () => { okQuery = () => {
...@@ -207,12 +209,12 @@ export default class StatisticsInfo extends React.Component { ...@@ -207,12 +209,12 @@ export default class StatisticsInfo extends React.Component {
} }
const querys = this.state.querys; const querys = this.state.querys;
querys.push(this.state.infos[this.state.currentQueryKey]); querys.push(this.state.infos[this.state.currentQueryKey]);
this.setState({ querys, queryVisiable: false, currentQueryKey: null }); this.setState({querys, queryVisiable: false, currentQueryKey: null});
}; };
finish = () => { finish = () => {
const { dispatch, objId } = this.props; const {dispatch, objId} = this.props;
const { x, y, z, infos, XxX, currentKey, groups } = this.state; const {x, y, z, infos, XxX, currentKey, groups} = this.state;
if (x == null) { if (x == null) {
message.error('请选择第一统计项'); message.error('请选择第一统计项');
...@@ -248,7 +250,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -248,7 +250,7 @@ export default class StatisticsInfo extends React.Component {
} }
for (var i = 0; i < groups.length; i++) { for (var i = 0; i < groups.length; i++) {
ggs.push({ hql: groups[i].hql }) ggs.push({hql: groups[i].hql})
} }
const tx = infos[x] const tx = infos[x]
const ty = infos[y] const ty = infos[y]
...@@ -256,34 +258,34 @@ export default class StatisticsInfo extends React.Component { ...@@ -256,34 +258,34 @@ export default class StatisticsInfo extends React.Component {
var ttx; var ttx;
var tty; var tty;
var ttz; var ttz;
if(tx.notes){ if (tx.notes) {
if(tx.notes.indexOf("com.")==-1){ if (tx.notes.indexOf("com.") == -1) {
ttx=infos[x].hql.replace(".id",".dictName") ttx = infos[x].hql.replace(".id", ".dictName")
}else{ } else {
ttx=infos[x].hql ttx = infos[x].hql
} }
}else{ } else {
ttx=infos[x].hql ttx = infos[x].hql
} }
if(ty.notes){ if (ty.notes) {
if(ty.notes.indexOf("com.")==-1){ if (ty.notes.indexOf("com.") == -1) {
tty=infos[y].hql.replace(".id",".dictName") tty = infos[y].hql.replace(".id", ".dictName")
}else{ } else {
tty=infos[y].hql tty = infos[y].hql
} }
}else{ } else {
tty=infos[y].hql tty = infos[y].hql
} }
if(z!=null){ if (z != null) {
const tz = infos[z] const tz = infos[z]
if(tz&&tz.notes){ if (tz && tz.notes) {
if(tz.notes.indexOf("com.")==-1){ if (tz.notes.indexOf("com.") == -1) {
ttz=infos[z].hql.replace(".id",".dictName") ttz = infos[z].hql.replace(".id", ".dictName")
}else{ } else {
ttz=infos[z].hql ttz = infos[z].hql
} }
}else{ } else {
ttz=infos[z].hql ttz = infos[z].hql
} }
} }
dispatch({ dispatch({
...@@ -293,14 +295,14 @@ export default class StatisticsInfo extends React.Component { ...@@ -293,14 +295,14 @@ export default class StatisticsInfo extends React.Component {
y: tty, y: tty,
z: ttz, z: ttz,
objId, objId,
xXx: XxX, xXx: XxX,
hql: currentKey && infos[currentKey] ? infos[currentKey].hql : null, hql: currentKey && infos[currentKey] ? infos[currentKey].hql : null,
querys: JSON.stringify(qqs), querys: JSON.stringify(qqs),
groups: JSON.stringify(ggs), groups: JSON.stringify(ggs),
}, },
callback: (data) => { callback: (data) => {
this.setState({ dataSource: data.dataSource, columns: data.columns }); this.setState({dataSource: data.dataSource, columns: data.columns});
}, },
}); });
...@@ -309,24 +311,25 @@ export default class StatisticsInfo extends React.Component { ...@@ -309,24 +311,25 @@ export default class StatisticsInfo extends React.Component {
}; };
downloadFile(url, params) { downloadFile(url, params) {
this.setState({ exportLoading: true }); this.setState({exportLoading: true});
fetch(url, { fetch(url, {
method: 'POST', method: 'POST',
body: FormdataWrapper(params) body: FormdataWrapper(params)
}).then(res=>{ }).then(res => {
if (res.status != '200') { if (res.status != '200') {
return res.json(); return res.json();
}else { } else {
return res.blob(); return res.blob();
} }
}).then(data=>{ }).then(data => {
if (data instanceof Blob) { if (data instanceof Blob) {
let a = document.createElement('a'); let a = document.createElement('a');
let url = window.URL.createObjectURL(data); let url = window.URL.createObjectURL(data);
let filename = (this.props.fileName ? this.props.fileName:'导出文件') + '.xlsx'; let filename = (this.props.fileName ? this.props.fileName : '导出文件') + '.xlsx';
a.href = url; a.href = url;
a.download = filename; a.download = filename;
a.click(); a.click();
...@@ -339,17 +342,18 @@ export default class StatisticsInfo extends React.Component { ...@@ -339,17 +342,18 @@ export default class StatisticsInfo extends React.Component {
}); });
} }
}).catch(err=>{ }).catch(err => {
notification.error({ notification.error({
message: `网络请求超时`, message: `网络请求超时`,
}); });
}).finally(()=>{ }).finally(() => {
this.setState({ exportLoading: false }); this.setState({exportLoading: false});
}); });
} }
export = () => { export = () => {
const { dispatch, objId} = this.props; const {dispatch, objId} = this.props;
const { x, y, z, infos, XxX, currentKey, groups } = this.state; const {x, y, z, infos, XxX, currentKey, groups} = this.state;
if (x == null) { if (x == null) {
message.error('请选择第一统计项'); message.error('请选择第一统计项');
...@@ -385,7 +389,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -385,7 +389,7 @@ export default class StatisticsInfo extends React.Component {
} }
for (var i = 0; i < groups.length; i++) { for (var i = 0; i < groups.length; i++) {
ggs.push({ hql: groups[i].hql }) ggs.push({hql: groups[i].hql})
} }
const tx = infos[x] const tx = infos[x]
const ty = infos[y] const ty = infos[y]
...@@ -393,41 +397,41 @@ export default class StatisticsInfo extends React.Component { ...@@ -393,41 +397,41 @@ export default class StatisticsInfo extends React.Component {
var ttx; var ttx;
var tty; var tty;
var ttz; var ttz;
if(tx.notes){ if (tx.notes) {
if(tx.notes.indexOf("com.")==-1){ if (tx.notes.indexOf("com.") == -1) {
ttx=infos[x].hql.replace(".id",".dictName") ttx = infos[x].hql.replace(".id", ".dictName")
}else{ } else {
ttx=infos[x].hql ttx = infos[x].hql
} }
}else{ } else {
ttx=infos[x].hql ttx = infos[x].hql
} }
if(ty.notes){ if (ty.notes) {
if(ty.notes.indexOf("com.")==-1){ if (ty.notes.indexOf("com.") == -1) {
tty=infos[y].hql.replace(".id",".dictName") tty = infos[y].hql.replace(".id", ".dictName")
}else{ } else {
tty=infos[y].hql tty = infos[y].hql
} }
}else{ } else {
tty=infos[y].hql tty = infos[y].hql
} }
if(z!=null){ if (z != null) {
const tz = infos[z] const tz = infos[z]
if(tz&&tz.notes){ if (tz && tz.notes) {
if(tz.notes.indexOf("com.")==-1){ if (tz.notes.indexOf("com.") == -1) {
ttz=infos[z].hql.replace(".id",".dictName") ttz = infos[z].hql.replace(".id", ".dictName")
}else{ } else {
ttz=infos[z].hql ttz = infos[z].hql
} }
}else{ } else {
ttz=infos[z].hql ttz = infos[z].hql
} }
} }
const param = { const param = {
x: ttx, x: ttx,
y: tty, y: tty,
z: ttz, z: ttz,
objId, objId,
xXx: XxX, xXx: XxX,
hql: currentKey && infos[currentKey] ? infos[currentKey].hql : null, hql: currentKey && infos[currentKey] ? infos[currentKey].hql : null,
querys: JSON.stringify(qqs), querys: JSON.stringify(qqs),
...@@ -435,34 +439,33 @@ export default class StatisticsInfo extends React.Component { ...@@ -435,34 +439,33 @@ export default class StatisticsInfo extends React.Component {
} }
let downloadUrl = config.httpServer + '/DataObjApi/exportStatistics?'; let downloadUrl = config.httpServer + '/DataObjApi/exportStatistics?';
const token = getToken()!=null&&getToken()!="null"?getToken():"0000"; const token = getToken() != null && getToken() != "null" ? getToken() : "0000";
downloadUrl = `${downloadUrl}token=${token}`; downloadUrl = `${downloadUrl}token=${token}`;
this.downloadFile(downloadUrl, param); this.downloadFile(downloadUrl, param);
}); });
}; };
cancelGroup = () => { cancelGroup = () => {
this.setState({ currentGroupKey: null, groupVisiable: false }); this.setState({currentGroupKey: null, groupVisiable: false});
}; };
cancelQuery = () => { cancelQuery = () => {
this.setState({ currentQueryKey: null, queryVisiable: false }); this.setState({currentQueryKey: null, queryVisiable: false});
}; };
cancelOrder = () => { cancelOrder = () => {
this.setState({ currentOrderKey: null, orderVisiable: false }); this.setState({currentOrderKey: null, orderVisiable: false});
}; };
selectOrder = (e) => { selectOrder = (e) => {
this.setState({ currentOrderKey: e }); this.setState({currentOrderKey: e});
}; };
selectQuery = (e) => { selectQuery = (e) => {
this.setState({ currentQueryKey: e, flag: !this.state.flag }); this.setState({currentQueryKey: e, flag: !this.state.flag});
}; };
selectGroup = (e) => { selectGroup = (e) => {
this.setState({ currentGroupKey: e, flag: !this.state.flag }); this.setState({currentGroupKey: e, flag: !this.state.flag});
}; };
changeX = (x) => { changeX = (x) => {
...@@ -470,7 +473,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -470,7 +473,7 @@ export default class StatisticsInfo extends React.Component {
x, x,
flag: !this.state.flag, flag: !this.state.flag,
},()=>{ }, () => {
this.finish(); this.finish();
}); });
}; };
...@@ -478,25 +481,25 @@ export default class StatisticsInfo extends React.Component { ...@@ -478,25 +481,25 @@ export default class StatisticsInfo extends React.Component {
this.setState({ this.setState({
y, y,
flag: !this.state.flag flag: !this.state.flag
},()=>{ }, () => {
this.finish(); this.finish();
}); });
}; };
changeZ = (z) => { changeZ = (z) => {
this.setState({ z, flag: !this.state.flag }); this.setState({z, flag: !this.state.flag});
}; };
cancelZ = () => { cancelZ = () => {
this.setState({ z: null, flag: !this.state.flag }); this.setState({z: null, flag: !this.state.flag});
}; };
selectXxX = (XxX) => { selectXxX = (XxX) => {
this.setState({ XxX, flag: !this.state.flag }); this.setState({XxX, flag: !this.state.flag});
}; };
selectCurrentKey = (currentKey) => { selectCurrentKey = (currentKey) => {
this.setState({ currentKey, XxX: null, flag: !this.state.flag }); this.setState({currentKey, XxX: null, flag: !this.state.flag});
}; };
cancelCurrentKey = () => { cancelCurrentKey = () => {
this.setState({ currentKey: null, XxX: null, flag: !this.state.flag }); this.setState({currentKey: null, XxX: null, flag: !this.state.flag});
}; };
componentDidMount() { componentDidMount() {
...@@ -505,18 +508,36 @@ export default class StatisticsInfo extends React.Component { ...@@ -505,18 +508,36 @@ export default class StatisticsInfo extends React.Component {
pageConfig = (item = 0) => { pageConfig = (item = 0) => {
const { const {
visiable, queryVisiable, querys, groups, currentKey, XxX, visiable,
infos, mockData, mockXZData, columns, dataSource, qs, os, gs, x, y, z, currentQueryKey, currentGroupKey, groupVisiable, queryVisiable,
querys,
groups,
currentKey,
XxX,
infos,
mockData,
mockXZData,
columns,
dataSource,
qs,
os,
gs,
x,
y,
z,
currentQueryKey,
currentGroupKey,
groupVisiable,
} = this.state; } = this.state;
let xxxs = []; let xxxs = [];
if (currentKey != null) { if (currentKey != null) {
if (infos[currentKey].type == 'java.lang.Integer' || infos[currentKey].type == 'java.lang.Double' || infos[currentKey].type == 'java.lang.Long') { if (infos[currentKey].type == 'java.lang.Integer' || infos[currentKey].type == 'java.lang.Double' || infos[currentKey].type == 'java.lang.Long') {
xxxs = [{ label: '数量', value: 'count' }, { label: '最大值', value: 'max' }, { xxxs = [{label: '数量', value: 'count'}, {label: '最大值', value: 'max'}, {
label: '最小值', label: '最小值',
value: 'min', value: 'min',
}, { label: '平均值', value: 'avg' }, { label: '求和', value: 'sum' }]; }, {label: '平均值', value: 'avg'}, {label: '求和', value: 'sum'}];
} else { } else {
xxxs = [{ label: '数量', value: 'count' }]; xxxs = [{label: '数量', value: 'count'}];
} }
} }
...@@ -558,7 +579,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -558,7 +579,7 @@ export default class StatisticsInfo extends React.Component {
name: '第一统计项', name: '第一统计项',
value: x, value: x,
onChange: this.changeX, onChange: this.changeX,
options: mockXZData, options: mockXZData,
optionKey: 'key', optionKey: 'key',
optionName: 'title', optionName: 'title',
}, },
...@@ -571,7 +592,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -571,7 +592,7 @@ export default class StatisticsInfo extends React.Component {
name: '第二统计项', name: '第二统计项',
value: z, value: z,
onChange: this.changeZ, onChange: this.changeZ,
options: mockXZData, options: mockXZData,
optionKey: 'key', optionKey: 'key',
optionName: 'title', optionName: 'title',
}, },
...@@ -696,7 +717,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -696,7 +717,7 @@ export default class StatisticsInfo extends React.Component {
const nameSpanThis = dataIndex > 0 ? nameSpan2 : nameSpan; const nameSpanThis = dataIndex > 0 ? nameSpan2 : nameSpan;
return ( return (
<Col span={4} <Col span={4}
style={{ paddingLeft: '15px' }} style={{paddingLeft: '15px'}}
key={dataIndex}> key={dataIndex}>
<FormItem label={selectConfigItem.name} <FormItem label={selectConfigItem.name}
required={config.required || false} required={config.required || false}
...@@ -710,7 +731,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -710,7 +731,7 @@ export default class StatisticsInfo extends React.Component {
xxl: 24 - nameSpanThis.big, xxl: 24 - nameSpanThis.big,
}} }}
> >
<Select style={{ width: '100%' }} <Select style={{width: '100%'}}
onChange={selectConfigItem.onChange} onChange={selectConfigItem.onChange}
value={selectConfigItem.value}> value={selectConfigItem.value}>
{selectConfigItem.options.map((r) => { {selectConfigItem.options.map((r) => {
...@@ -728,7 +749,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -728,7 +749,7 @@ export default class StatisticsInfo extends React.Component {
return ( return (
<Col span={1} <Col span={1}
key={buttonDs.key} key={buttonDs.key}
style={{ paddingLeft: '15px' }}> style={{paddingLeft: '15px'}}>
<FormItem colon={false} <FormItem colon={false}
labelCol={{ labelCol={{
xl: nameSpan.small, xl: nameSpan.small,
...@@ -742,7 +763,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -742,7 +763,7 @@ export default class StatisticsInfo extends React.Component {
<ButtonDiy name={buttonDs.name} <ButtonDiy name={buttonDs.name}
type='default' type='default'
className={buttonDs.className} className={buttonDs.className}
handleClick={buttonDs.handleClick} /> handleClick={buttonDs.handleClick}/>
</FormItem> </FormItem>
</Col> </Col>
); );
...@@ -756,23 +777,23 @@ export default class StatisticsInfo extends React.Component { ...@@ -756,23 +777,23 @@ export default class StatisticsInfo extends React.Component {
render() { render() {
const { form, loading } = this.props; const {form, loading} = this.props;
const { const {
visiable, querys, groups, currentKey, XxX,exportLoading, visiable, querys, groups, currentKey, XxX, exportLoading,
infos, mockData, columns, dataSource, qs, os, gs, x, y, z, currentQueryKey, currentGroupKey, groupVisiable, infos, mockData, columns, dataSource, qs, os, gs, x, y, z, currentQueryKey, currentGroupKey, groupVisiable,
} = this.state; } = this.state;
const loadingxxx=loading||exportLoading; const loadingxxx = loading || exportLoading;
let columnsTemp = columns; let columnsTemp = columns;
if (columnsTemp.length > 0) { if (columnsTemp.length > 0) {
if (z == null) { if (z == null) {
columnsTemp[0].title = <div className={styles.out2} style={{ fontSize: 14 }}> columnsTemp[0].title = <div className={styles.out2} style={{fontSize: 14}}>
<span className={styles.title1}>{infos[x] ? infos[x].name : ''}</span> <span <span className={styles.title1}>{infos[x] ? infos[x].name : ''}</span> <span
className={styles.title3}>{infos[y] ? infos[y].name : ''}</span> className={styles.title3}>{infos[y] ? infos[y].name : ''}</span>
</div>; </div>;
columnsTemp[0].width = 200; columnsTemp[0].width = 200;
} else { } else {
columnsTemp[0].title = <div className={styles.out} style={{ fontSize: 14 }}> columnsTemp[0].title = <div className={styles.out} style={{fontSize: 14}}>
<span className={styles.title1}>{infos[x] ? infos[x].name : ''}</span> <span <span className={styles.title1}>{infos[x] ? infos[x].name : ''}</span> <span
className={styles.title2}>{infos[z] ? infos[z].name : ''}</span> <span className={styles.title2}>{infos[z] ? infos[z].name : ''}</span> <span
className={styles.title3}>{infos[y] ? infos[y].name : ''}</span> className={styles.title3}>{infos[y] ? infos[y].name : ''}</span>
...@@ -785,12 +806,12 @@ export default class StatisticsInfo extends React.Component { ...@@ -785,12 +806,12 @@ export default class StatisticsInfo extends React.Component {
if (infos[currentKey].type === 'java.lang.Integer' || if (infos[currentKey].type === 'java.lang.Integer' ||
infos[currentKey].type === 'java.lang.Double' || infos[currentKey].type === 'java.lang.Double' ||
infos[currentKey].type === 'java.lang.Long') { infos[currentKey].type === 'java.lang.Long') {
xxxs = [{ label: '数量', value: 'count' }, { label: '最大值', value: 'max' }, { xxxs = [{label: '数量', value: 'count'}, {label: '最大值', value: 'max'}, {
label: '最小值', label: '最小值',
value: 'min', value: 'min',
}, { label: '平均值', value: 'avg' }, { label: '求和', value: 'sum' }]; }, {label: '平均值', value: 'avg'}, {label: '求和', value: 'sum'}];
} else { } else {
xxxs = [{ label: '数量', value: 'count' }]; xxxs = [{label: '数量', value: 'count'}];
} }
} }
return ( return (
...@@ -799,9 +820,9 @@ export default class StatisticsInfo extends React.Component { ...@@ -799,9 +820,9 @@ export default class StatisticsInfo extends React.Component {
<ButtonDiy name='自定义统计' <ButtonDiy name='自定义统计'
type='default' type='default'
className='defaultBlue' className='defaultBlue'
handleClick={this.open} /> handleClick={this.open}/>
<div id='downloadDiv' <div id='downloadDiv'
style={{ display: 'none' }}> style={{display: 'none'}}>
</div> </div>
<Modal <Modal
...@@ -811,7 +832,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -811,7 +832,7 @@ export default class StatisticsInfo extends React.Component {
title="自定义统计" title="自定义统计"
visible={visiable} visible={visiable}
footer={null} footer={null}
onCancel={this.onCancle} onCancel={this.onCancle}
> >
{this.selectDom(0)} {this.selectDom(0)}
...@@ -819,7 +840,10 @@ export default class StatisticsInfo extends React.Component { ...@@ -819,7 +840,10 @@ export default class StatisticsInfo extends React.Component {
{this.selectDom(2)} {this.selectDom(2)}
{this.selectDom(3)} {this.selectDom(3)}
{this.selectDom(4)} {this.selectDom(4)}
<div style={{ textAlign: 'left', paddingLeft: '25px' }}> <div style={{
textAlign: 'left',
paddingLeft: '25px',
}}>
{querys.map((r, i) => {querys.map((r, i) =>
<FormItem key={i} <FormItem key={i}
labelCol={{ labelCol={{
...@@ -832,7 +856,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -832,7 +856,7 @@ export default class StatisticsInfo extends React.Component {
}} }}
label={r.name}> label={r.name}>
{form.getFieldDecorator(i + 'q__', { {form.getFieldDecorator(i + 'q__', {
initialValue: { stringX: '=' }, rules: [{ initialValue: {stringX: '='}, rules: [{
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
var errors = []; var errors = [];
if (value == null) { if (value == null) {
...@@ -846,7 +870,7 @@ export default class StatisticsInfo extends React.Component { ...@@ -846,7 +870,7 @@ export default class StatisticsInfo extends React.Component {
}, },
}], }],
})(<QueryItem obj={r} })(<QueryItem obj={r}
deleteQuery={this.deleteQuery.bind(this, i)} />)} deleteQuery={this.deleteQuery.bind(this, i)}/>)}
</FormItem>)} </FormItem>)}
</div> </div>
{this.selectDom(5)} {this.selectDom(5)}
...@@ -863,11 +887,11 @@ export default class StatisticsInfo extends React.Component { ...@@ -863,11 +887,11 @@ export default class StatisticsInfo extends React.Component {
</Tag>, </Tag>,
)} )}
</Row> </Row>
<Row style={{ paddingTop: '20px' }}> <Row style={{paddingTop: '20px'}}>
<Col span={24} style={{ textAlign: 'left' }}> <Col span={24} style={{textAlign: 'left'}}>
<ButtonDiy handleClick={this.finish} <ButtonDiy handleClick={this.finish}
name={'查询'} name={'查询'}
loading={loadingxxx} /> loading={loadingxxx}/>
<ButtonDiy handleClick={this.export} <ButtonDiy handleClick={this.export}
name={'导出'} name={'导出'}
loading={loadingxxx}/> loading={loadingxxx}/>
...@@ -881,19 +905,24 @@ export default class StatisticsInfo extends React.Component { ...@@ -881,19 +905,24 @@ export default class StatisticsInfo extends React.Component {
</Button> </Button>
结果:*/} 结果:*/}
</Col> </Col>
<Col span={24}> <Col span={24}
style={{
overFlow: 'auto',
minHeight: '500px',
}}
>
<Table size="small" <Table size="small"
bordered bordered
dataSource={dataSource} dataSource={dataSource}
rowKey={'col0'} rowKey={'col0'}
columns={columnsTemp} columns={columnsTemp}
pagination={false} /> pagination={false}/>
{/*{columns.length > 0 ?*/} {/*{columns.length > 0 ?*/}
{/*<Table size="small"*/} {/*<Table size="small"*/}
{/*bordered*/} {/*bordered*/}
{/*dataSource={dataSource}*/} {/*dataSource={dataSource}*/}
{/*columns={columnsTemp}*/} {/*columns={columnsTemp}*/}
{/*pagination={false} /> : ''}*/} {/*pagination={false} /> : ''}*/}
</Col> </Col>
</Row> </Row>
</Modal> </Modal>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论