trunk/pc4mobx/organization/public/tree/standard_node.jsx

37 lines
1.2 KiB
JavaScript

import { Component } from "react";
import './node.less'
import StandardCommon from './standard_common';
import StandardJob from './standard_job';
import StandardPerson from './standard_person';
import SliderPage from '../../components/tree/side.js'
export default class StandardNode extends Component {
render() {
const {data} = this.props;
const { empname, job, label, onduty, prepared, nodeType, icon } = data;
let colorValue = nodeType == 0 ? "deepskyblue" : ((nodeType == 1 || nodeType == 2) ? "green" : "blue")
let style = {
backgroundColor: colorValue
}
return (
<div className="node-card" onClick={this.props.openSidePage.bind(this,data)}>
<div className="top" style={style}>
<i className={icon} id="org-icon" />
<p >{label}</p>
</div>
{(nodeType == 0 || nodeType == 1 || nodeType == 2) ? <StandardCommon data={this.props.data} /> :
(nodeType == 3 ? <StandardJob data={this.props.data} /> : <StandardPerson data={this.props.data} />)}
</div>
)
}
}