调整列宽
This commit is contained in:
parent
fe20e6e4d4
commit
7cd81906ce
@ -1,14 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'dva';
|
import { connect } from 'dva';
|
||||||
import { initFilter } from '../../../utils/common';
|
import { initFilter } from '../../../utils/common';
|
||||||
import { Table, Row, Spin, Card, Modal,Col ,Button,Form} from 'antd';
|
import { Table, Row, Spin, Card, Modal, Col, Button, Form } from 'antd';
|
||||||
import DropDownPagination from '../../common/DropDownPaginationEx'
|
import DropDownPagination from '../../common/DropDownPaginationEx';
|
||||||
class BI064FormRunAnalysis extends React.Component {
|
class BI064FormRunAnalysis extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
depart: {},
|
depart: {},
|
||||||
inputText:'',
|
inputText: '',
|
||||||
retData: [], // 表单运行数据
|
retData: [], // 表单运行数据
|
||||||
companyData: [], // 公司数据
|
companyData: [], // 公司数据
|
||||||
loading: true,
|
loading: true,
|
||||||
@ -73,17 +73,16 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
loadData = () => {
|
loadData = () => {
|
||||||
this.getBaseData();
|
this.getBaseData();
|
||||||
|
|
||||||
};
|
};
|
||||||
handleSearch = ({data, record}) => {
|
handleSearch = ({ data, record }) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
depart: {
|
depart: {
|
||||||
...this.state.depart,
|
...this.state.depart,
|
||||||
ID: data[0],
|
ID: data[0],
|
||||||
NAME:record?.NAME,
|
NAME: record?.NAME,
|
||||||
},
|
},
|
||||||
inputText:record? record?.NAME:this.state.inputText,
|
inputText: record ? record?.NAME : this.state.inputText,
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
// 获取公司数据
|
// 获取公司数据
|
||||||
getBaseData = () => {
|
getBaseData = () => {
|
||||||
@ -96,12 +95,11 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
onlyData: false,
|
onlyData: false,
|
||||||
onComplete: (ret) => {
|
onComplete: (ret) => {
|
||||||
if (ret && ret.Data) {
|
if (ret && ret.Data) {
|
||||||
let keyword = ret.Data[0]?.NAME
|
let keyword = ret.Data[0]?.NAME;
|
||||||
if(this.props.login.OrgId ==="00300000-0000-0000-0000-000000000000")
|
if (this.props.login.OrgId === '00300000-0000-0000-0000-000000000000') {
|
||||||
{
|
keyword = ret.Data.filter((t) => t.ID == this.props.login.OrgId)[0]?.NAME;
|
||||||
keyword = ret.Data.filter(t=>t.ID == this.props.login.OrgId)[0]?.NAME
|
|
||||||
}
|
}
|
||||||
this.setState({ companyData: ret.Data,inputText:keyword}, () => {
|
this.setState({ companyData: ret.Data, inputText: keyword }, () => {
|
||||||
this.getrealData();
|
this.getrealData();
|
||||||
// this.processData();
|
// this.processData();
|
||||||
});
|
});
|
||||||
@ -113,7 +111,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
// 获取表单运行数据
|
// 获取表单运行数据
|
||||||
getrealData = () => {
|
getrealData = () => {
|
||||||
// const json = initFilter(this.props.login.OrgId);
|
// const json = initFilter(this.props.login.OrgId);
|
||||||
let json = initFilter("00300000-0000-0000-0000-000000000000",this.state.inputText);
|
let json = initFilter('00300000-0000-0000-0000-000000000000', this.state.inputText);
|
||||||
this.props.dispatch({
|
this.props.dispatch({
|
||||||
type: 'app/getDataByPost',
|
type: 'app/getDataByPost',
|
||||||
url: 'BI/BIStatiscialAnalysisController/GetTaskViewInfo',
|
url: 'BI/BIStatiscialAnalysisController/GetTaskViewInfo',
|
||||||
@ -133,9 +131,9 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
|
|
||||||
// 处理数据,生成表格所需格式
|
// 处理数据,生成表格所需格式
|
||||||
processData = () => {
|
processData = () => {
|
||||||
const { retData, companyData ,inputText} = this.state;
|
const { retData, companyData, inputText } = this.state;
|
||||||
if (!retData.length || !companyData.length) return;
|
if (!retData.length || !companyData.length) return;
|
||||||
let companyDataTemp=companyData.filter(t=>t.NAME === inputText)
|
let companyDataTemp = companyData.filter((t) => t.NAME === inputText);
|
||||||
// 获取所有模块和表单的列表
|
// 获取所有模块和表单的列表
|
||||||
const modules = [...new Set(retData.map((item) => item.MOULD_NAME))];
|
const modules = [...new Set(retData.map((item) => item.MOULD_NAME))];
|
||||||
const forms = [];
|
const forms = [];
|
||||||
@ -266,15 +264,21 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 动态生成表格列
|
// 动态生成表格列
|
||||||
generateColumns = (companyData) => {debugger
|
generateColumns = (companyData) => {
|
||||||
const baseColumns = [
|
const baseColumns = [
|
||||||
{
|
{
|
||||||
width: '150px',
|
// width: '150px',
|
||||||
title: '模块',
|
title: '模块',
|
||||||
dataIndex: 'module',
|
dataIndex: 'module',
|
||||||
key: 'module',
|
key: 'module',
|
||||||
fixed: 'left',
|
// fixed: 'left',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
onCell: (record) => ({
|
||||||
|
style: {
|
||||||
|
minWidth: '150px', // 设置最小宽度
|
||||||
|
whiteSpace: 'nowrap', // 防止换行
|
||||||
|
},
|
||||||
|
}),
|
||||||
render: (value, row, index) => {
|
render: (value, row, index) => {
|
||||||
const obj = {
|
const obj = {
|
||||||
children: value,
|
children: value,
|
||||||
@ -290,12 +294,18 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
width: '200px',
|
// width: '200px',
|
||||||
title: '表单',
|
title: '表单',
|
||||||
dataIndex: 'form',
|
dataIndex: 'form',
|
||||||
key: 'form',
|
key: 'form',
|
||||||
fixed: 'left',
|
// fixed: 'left',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
onCell: () => ({
|
||||||
|
style: {
|
||||||
|
minWidth: '200px',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
},
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -311,7 +321,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
title: '总任务数',
|
title: '总任务数',
|
||||||
dataIndex: `${companyDataKey}_total`,
|
dataIndex: `${companyDataKey}_total`,
|
||||||
key: `${companyDataKey}_total`,
|
key: `${companyDataKey}_total`,
|
||||||
width: '80px',
|
width: '150px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>
|
<span>
|
||||||
@ -323,7 +333,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
title: '正常完成',
|
title: '正常完成',
|
||||||
dataIndex: `${companyDataKey}_normal`,
|
dataIndex: `${companyDataKey}_normal`,
|
||||||
key: `${companyDataKey}_normal`,
|
key: `${companyDataKey}_normal`,
|
||||||
width: '80px',
|
width: '150px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>
|
<span>
|
||||||
@ -335,7 +345,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
title: '超时完成',
|
title: '超时完成',
|
||||||
dataIndex: `${companyDataKey}_overtime`,
|
dataIndex: `${companyDataKey}_overtime`,
|
||||||
key: `${companyDataKey}_overtime`,
|
key: `${companyDataKey}_overtime`,
|
||||||
width: '80px',
|
width: '150px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>
|
<span>
|
||||||
@ -347,7 +357,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
title: '进行中',
|
title: '进行中',
|
||||||
dataIndex: `${companyDataKey}_doing`,
|
dataIndex: `${companyDataKey}_doing`,
|
||||||
key: `${companyDataKey}_doing`,
|
key: `${companyDataKey}_doing`,
|
||||||
width: '80px',
|
width: '150px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>
|
<span>
|
||||||
@ -359,7 +369,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
title: '超期未完成',
|
title: '超期未完成',
|
||||||
dataIndex: `${companyDataKey}_overUnfinish`,
|
dataIndex: `${companyDataKey}_overUnfinish`,
|
||||||
key: `${companyDataKey}_overUnfinish`,
|
key: `${companyDataKey}_overUnfinish`,
|
||||||
width: '80px',
|
width: '150px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>
|
<span>
|
||||||
@ -373,7 +383,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
title: '完成率',
|
title: '完成率',
|
||||||
dataIndex: `${companyDataKey}_finishRate`,
|
dataIndex: `${companyDataKey}_finishRate`,
|
||||||
key: `${companyDataKey}_finishRate`,
|
key: `${companyDataKey}_finishRate`,
|
||||||
width: '80px',
|
width: '150px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
render: (text) => <span>{text}%</span>,
|
render: (text) => <span>{text}%</span>,
|
||||||
},
|
},
|
||||||
@ -381,8 +391,8 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
title: '及时率',
|
title: '及时率',
|
||||||
dataIndex: `${companyDataKey}_normalRate`,
|
dataIndex: `${companyDataKey}_normalRate`,
|
||||||
key: `${companyDataKey}_normalRate`,
|
key: `${companyDataKey}_normalRate`,
|
||||||
width: '80px',
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
width: '150px',
|
||||||
render: (text) => <span>{text}%</span>,
|
render: (text) => <span>{text}%</span>,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -390,6 +400,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
|
|
||||||
baseColumns.push(companyColumns);
|
baseColumns.push(companyColumns);
|
||||||
});
|
});
|
||||||
|
console.log('生成的列:', baseColumns);
|
||||||
|
|
||||||
return baseColumns;
|
return baseColumns;
|
||||||
};
|
};
|
||||||
@ -447,7 +458,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
const formItemLayout = {
|
const formItemLayout = {
|
||||||
labelCol: { span: 8 },
|
labelCol: { span: 8 },
|
||||||
wrapperCol: { span: 16 },
|
wrapperCol: { span: 16 },
|
||||||
}
|
};
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
@ -490,21 +501,26 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
>
|
>
|
||||||
系统运行情况统计分析
|
系统运行情况统计分析
|
||||||
</h1>
|
</h1>
|
||||||
<Row style={{width:"100%",margin:"auto"}}>
|
<Row style={{ width: '100%', margin: 'auto' }}>
|
||||||
<Col span={5}>
|
<Col span={5}>
|
||||||
|
<Form.Item label={'公司名称'} {...formItemLayout}>
|
||||||
<Form.Item
|
<DropDownPagination
|
||||||
label={'公司名称'}
|
inputDataApi={'FM/Organization/OrderPaged'}
|
||||||
{...formItemLayout}
|
fieldName={'NAME'}
|
||||||
>
|
data={this.state.depart}
|
||||||
<DropDownPagination inputDataApi={'FM/Organization/OrderPaged'} fieldName={'NAME'}
|
onSelect={this.handleSearch}
|
||||||
data={this.state.depart} onSelect={this.handleSearch} onFilter={({ params }) => {
|
onFilter={({ params }) => {
|
||||||
params.OrderType = 1
|
params.OrderType = 1;
|
||||||
params.OrgId = this.props.login.OrgId
|
params.OrgId = this.props.login.OrgId;
|
||||||
}} />
|
}}
|
||||||
</Form.Item>
|
/>
|
||||||
</Col>
|
</Form.Item>
|
||||||
<Col span={1} style={{ marginLeft: "20px" }}><Button type='primary' onClick={() => this.getrealData()}>查询</Button></Col>
|
</Col>
|
||||||
|
<Col span={1} style={{ marginLeft: '20px' }}>
|
||||||
|
<Button type="primary" onClick={() => this.getrealData()}>
|
||||||
|
查询
|
||||||
|
</Button>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Spin spinning={loading}>
|
<Spin spinning={loading}>
|
||||||
@ -514,7 +530,7 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
}}
|
}}
|
||||||
scroll={{ x: 'max-content', y: 600 }}
|
scroll={{ x: 1500, y: 600 }}
|
||||||
dataSource={tableData}
|
dataSource={tableData}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
pagination={false}
|
pagination={false}
|
||||||
@ -522,22 +538,6 @@ class BI064FormRunAnalysis extends React.Component {
|
|||||||
size="middle"
|
size="middle"
|
||||||
bordered
|
bordered
|
||||||
rowKey="key"
|
rowKey="key"
|
||||||
summary={() => (
|
|
||||||
<Table.Summary fixed="top">
|
|
||||||
<Table.Summary.Row style={{ backgroundColor: '#fafafa', fontWeight: 'bold' }}>
|
|
||||||
<Table.Summary.Cell index={0} colSpan={2}>
|
|
||||||
汇总
|
|
||||||
</Table.Summary.Cell>
|
|
||||||
{columns.slice(2).map((col, index) => (
|
|
||||||
<Table.Summary.Cell index={index + 2} key={index}>
|
|
||||||
{col.title === '总任务数' && (
|
|
||||||
<span>{tableData.reduce((sum, row) => sum + (row[col.dataIndex] || 0), 0)}</span>
|
|
||||||
)}
|
|
||||||
</Table.Summary.Cell>
|
|
||||||
))}
|
|
||||||
</Table.Summary.Row>
|
|
||||||
</Table.Summary>
|
|
||||||
)}
|
|
||||||
/>
|
/>
|
||||||
{/* </Card> */}
|
{/* </Card> */}
|
||||||
</Spin>
|
</Spin>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user