websiteDetail.js
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React, { Component, Fragment } from 'react';
import { connect } from 'dva';
import { Toast } from 'antd-mobile';
import shareHide from "../../utils/shareHide";
import css from './index.css';
import {getPlanInListWithCode} from '../../utils/dataFilter'
class Index extends Component{
constructor(props) {
super(props);
this.state = {
userInfo: JSON.parse(localStorage.getItem('userInfo')) || {},
websiteList:[]
}
}
componentDidMount() {
document.title = '所辖网点';
const _this = this;
shareHide();
if(this.props.location.params){
this.setState({websiteList:this.props.location.params})
return;
}
Toast.loading('loading...',0)
this.props.dispatch({
type: "governortraining/getOrzList",
payload: {
orgId:this.state.userInfo.project
},
callback: (res) => {
if (res.status && res.data.length) {
let project = _this.state.userInfo.website ? _this.state.userInfo.website.split(',') : [];
let myProjectList=[];
for(let ii in project){
myProjectList.push(getPlanInListWithCode('orgId',project[ii],res.data))
}
_this.setState({websiteList:myProjectList})
}
Toast.hide();
}
});
}
render() {
const { userInfo ,websiteList} = this.state;
if(websiteList.length == 0) return <div/>
return (
<div className={css.websiteSection}>
{
websiteList.length>0 && websiteList.map((item,index)=>{
return (
<div key={index} className={css.item}>
<div className={css.left}>{index+1}</div>
<div style={{textAlign:'right',width:'100%'}}>{item.orgName}</div>
</div>
)
})
}
</div>
)
}
}
export default connect()(Index);