This commit is contained in:
xuyucheng 2022-02-22 16:41:05 +08:00
parent fcf8dea72f
commit 23b82eb8c8
3 changed files with 37 additions and 18 deletions

View File

@ -41,7 +41,7 @@ class Dashboard extends Component {
api.get("/admin/board/get_dashboard_data").then(res => { api.get("/admin/board/get_dashboard_data").then(res => {
this.setState({ this.setState({
data: res.result data: res.result
},()=>{ }, () => {
this.initChart() this.initChart()
this.initPie() this.initPie()
}) })
@ -60,7 +60,7 @@ class Dashboard extends Component {
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: this.state.data['服务次数']&&this.state.data['服务次数']['日期'], data: this.state.data['服务次数'] && this.state.data['服务次数']['日期'],
axisLine: { axisLine: {
show: false show: false
}, },
@ -82,7 +82,7 @@ class Dashboard extends Component {
}, },
series: [ series: [
{ {
data: this.state.data['服务次数']&&this.state.data['服务次数']['次数'], data: this.state.data['服务次数'] && this.state.data['服务次数']['次数'],
type: 'line', type: 'line',
areaStyle: { areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@ -108,9 +108,9 @@ class Dashboard extends Component {
initPie() { initPie() {
const data = [] const data = []
this.state.data['行业分布'].forEach(item=>{ this.state.data['行业分布'].forEach(item => {
Object.keys(item).forEach(key=>{ Object.keys(item).forEach(key => {
data.push({name:key,value:item[key]}) data.push({ name: key, value: item[key] })
}) })
}) })
const myChart = echarts.init(document.getElementById('pie')) const myChart = echarts.init(document.getElementById('pie'))
@ -150,8 +150,15 @@ class Dashboard extends Component {
callback(e, value) { callback(e, value) {
if (e === "详 情") { if (e === "详 情") {
const newPanes = [...this.props.panes] const newPanes = [...this.props.panes]
newPanes.push({ title: value["企业名称"] + '(' + value["企业ID"] + ')', content: "/manager/company/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString() }); const state = newPanes.every(item => {
store.dispatch(operationAction(newPanes, (newPanes[newPanes.length - 1].key))) return item.title === value["企业名称"] + '(' + value["企业ID"] + ')' ? false : true
})
if (state) {
newPanes.push({ title: value["企业名称"] + '(' + value["企业ID"] + ')', content: "/manager/company/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString() });
store.dispatch(operationAction(newPanes, (newPanes[newPanes.length - 1].key)))
} else {
return null
}
} }
} }
@ -190,8 +197,8 @@ class Dashboard extends Component {
<Card title='行业分布'> <Card title='行业分布'>
<div id='pie' style={{ width: '100%', height: '300px' }}></div> <div id='pie' style={{ width: '100%', height: '300px' }}></div>
{ {
this.state.data['行业分布']&&this.state.data['行业分布'].map(item=>{ this.state.data['行业分布'] && this.state.data['行业分布'].map(item => {
return Object.keys(item).map(key=>{ return Object.keys(item).map(key => {
return <p className='space-word'><span>{key}</span><span>{item[key]}</span></p> return <p className='space-word'><span>{key}</span><span>{item[key]}</span></p>
}) })
}) })
@ -200,7 +207,7 @@ class Dashboard extends Component {
</Col> </Col>
<Col span={16}> <Col span={16}>
<Card title="新增企业信息"> <Card title="新增企业信息">
<FeTable data={this.state.data['新增企业信息']} columns={this.state.columns} callback={this.callback.bind(this)}></FeTable> <FeTable data={this.state.data['新增企业信息']} columns={this.state.columns} callback={this.callback.bind(this)}></FeTable>
</Card> </Card>
</Col> </Col>
</Row> </Row>

View File

@ -41,10 +41,15 @@ class ManageCompany extends Component {
} }
callback(e, value) { callback(e, value) {
if (e === "详 情") { const newPanes = [...this.props.panes]
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: "/manager/company/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString() }); newPanes.push({ title: value["企业名称"] + '(' + value["企业ID"] + ')', content: "/manager/company/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString() });
store.dispatch(operationAction(newPanes, (newPanes[newPanes.length - 1].key))) store.dispatch(operationAction(newPanes, (newPanes[newPanes.length - 1].key)))
} else {
return null
} }
} }

View File

@ -17,7 +17,7 @@ class ManageRate extends Component {
data: [], data: [],
columns: [], columns: [],
file: "", file: "",
visible:false visible: false
} }
} }
@ -69,16 +69,23 @@ class ManageRate extends Component {
if (!this.isJump) { if (!this.isJump) {
if (e === "详 情") { if (e === "详 情") {
const newPanes = [...this.props.panes] const newPanes = [...this.props.panes]
newPanes.push({ title: value["评价项目"] + '(' + value["评价ID"] + ')', content: "/manage/rate/details", key: (Number(newPanes[newPanes.length - 1].key) + 1).toString() }); const state = newPanes.every(item => {
store.dispatch(operationAction(newPanes, newPanes[newPanes.length - 1].key)) 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 this.isJump = false
} }
setVisible(value){ setVisible(value) {
this.setState({ this.setState({
visible:value visible: value
}) })
} }