This commit is contained in:
xuyucheng 2022-02-22 17:16:40 +08:00
parent 23b82eb8c8
commit b6f1359b7b
3 changed files with 83 additions and 13 deletions

View File

@ -157,6 +157,10 @@ span {
cursor: pointer; cursor: pointer;
} }
.ant-card {
margin-bottom: 20px;
}
.ant-card-body { .ant-card-body {
overflow: auto; overflow: auto;
} }

View File

@ -167,22 +167,22 @@ class Dashboard extends Component {
<React.Fragment> <React.Fragment>
<Row gutter={32} style={{ marginBottom: '20px' }}> <Row gutter={32} style={{ marginBottom: '20px' }}>
<Col span={4}> <Col span={4}>
<Card title='异常日志' style={{ marginBottom: '20px' }}> <Card title='异常日志' style={{ marginBottom: '40px' }}>
<p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['异常日志']}</p> <p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['异常日志']}<span style={{marginLeft:2}}>/</span></p>
{/* <span><span className='reduce'>-3.65%</span> Since last week</span> */} {/* <span><span className='reduce'>-3.65%</span> Since last week</span> */}
</Card> </Card>
<Card title='服务次数'> <Card title='服务次数'>
<p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['服务次数']}</p> <p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['服务次数']}<span style={{marginLeft:2}}>/</span></p>
{/* <span><span className='increase'>5.25%</span> Since last week</span> */} {/* <span><span className='increase'>5.25%</span> Since last week</span> */}
</Card> </Card>
</Col> </Col>
<Col span={4}> <Col span={4}>
<Card title='留言反馈' style={{ marginBottom: '20px' }}> <Card title='留言反馈' style={{ marginBottom: '40px' }}>
<p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['留言反馈']}</p> <p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['留言反馈']}<span style={{marginLeft:2}}>/</span></p>
{/* <span><span className='increase'>6.65%</span> Since last week</span> */} {/* <span><span className='increase'>6.65%</span> Since last week</span> */}
</Card> </Card>
<Card title="认证企业"> <Card title="认证企业">
<p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['认证企业']}</p> <p className='content-p'>{this.state.data['监测数据'] && this.state.data['监测数据']['认证企业']}<span style={{marginLeft:2}}>/</span></p>
{/* <span><span className='reduce'>-2.25%</span> Since last week</span> */} {/* <span><span className='reduce'>-2.25%</span> Since last week</span> */}
</Card> </Card>
</Col> </Col>

View File

@ -1,7 +1,12 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import { Descriptions, Card,Tag } from 'antd' import { Descriptions, Card,Tag,Button } from 'antd'
import api from "@/api/request" import api from "@/api/request"
import FeTable from '@/components/table' import FeTable from '@/components/table'
import Pdf from "@/components/pdf"
import { connect } from 'react-redux';
import store from "@/store/index"
import { operationAction } from "@/action/index"
class CompanyDetails extends Component { class CompanyDetails extends Component {
constructor(props) { constructor(props) {
@ -11,10 +16,14 @@ class CompanyDetails extends Component {
businessInformation: [], businessInformation: [],
shareholdersInformation: [], shareholdersInformation: [],
companyMember: [], companyMember: [],
evaluationRecords: [] evaluationRecords: [],
file: "",
visible: false
} }
} }
isJump = false
componentDidMount() { componentDidMount() {
api.post("/admin/company/index", { cid: this.props.id }) api.post("/admin/company/index", { cid: this.props.id })
.then(res => { .then(res => {
@ -35,19 +44,72 @@ class CompanyDetails extends Component {
analysisColumns(val) { analysisColumns(val) {
if (val !== [] && val) { if (val !== [] && val) {
if(val[0]){ if(val[0]){
return Object.keys(val[0]).map((key, i) => { const col = Object.keys(val[0]).map((key, i) => {
return { return key === "证书" || key === "报告" ? {
title: key,
dataIndex: key,
key: i,
align: 'center',
render: (record) => <Button type="primary" onClick={this.handleClick.bind(this, record)}> </Button>,
} : {
title: key, dataIndex: key, align: 'center', key: i title: key, dataIndex: key, align: 'center', key: i
} }
}) })
col.push({
title: '详 情',
dataIndex: '详 情',
key: col.length,
align: 'center',
render: () => <Button type="primary"> </Button>,
})
return col
} }
} }
} }
handleClick(value) {
this.isJump = true
this.setState({
visible: true,
}, () => {
api.BlobGet("/admin" + value).then(res => {
this.setState({
file: res
})
})
})
}
setVisible(value) {
this.setState({
visible: value
})
}
callback(e, value) {
if (!this.isJump) {
if (e === "详 情") {
const newPanes = [...this.props.panes]
const state = newPanes.every(item => {
return item.title === value["评价项目"] + '(' + value["评价ID"] + ')' ? false : true
})
if (state) {
newPanes.push({ title: value["评价项目"] + '(' + value["评价ID"] + ')', content: "/manage/rate/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString() });
store.dispatch(operationAction(newPanes, (newPanes[newPanes.length - 1].key)))
} else {
return null
}
}
}
this.isJump = false
}
render() { render() {
return ( return (
<React.Fragment> <React.Fragment>
<Card> <Card>
<Pdf file={this.state.file} visible={this.state.visible} callback={this.setVisible.bind(this)}></Pdf>
<Descriptions title={this.state.data["企业名称"]} bordered extra={<Tag color={this.state.data["已认证"]==='是'?'#108ee9':'#f50 '}>已认证{this.state.data["已认证"]}</Tag>}> <Descriptions title={this.state.data["企业名称"]} bordered extra={<Tag color={this.state.data["已认证"]==='是'?'#108ee9':'#f50 '}>已认证{this.state.data["已认证"]}</Tag>}>
{this.state.businessInformation} {this.state.businessInformation}
</Descriptions> </Descriptions>
@ -56,11 +118,15 @@ class CompanyDetails extends Component {
<p>主要成员</p> <p>主要成员</p>
<FeTable data={this.state.companyMember} columns={this.analysisColumns(this.state.companyMember)}></FeTable> <FeTable data={this.state.companyMember} columns={this.analysisColumns(this.state.companyMember)}></FeTable>
<p>评价记录</p> <p>评价记录</p>
<FeTable data={this.state.evaluationRecords} columns={this.analysisColumns(this.state.evaluationRecords)}></FeTable> <FeTable data={this.state.evaluationRecords} columns={this.analysisColumns(this.state.evaluationRecords)} callback={this.callback.bind(this)}></FeTable>
</Card> </Card>
</React.Fragment> </React.Fragment>
) )
} }
} }
export default CompanyDetails const mapStateToProps = (state) => {
return state;
};
export default connect(mapStateToProps)(CompanyDetails);