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