|
@@ -23,6 +23,17 @@ const Option = Select.Option;
|
|
|
class InforChange extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
+ let nature = [];
|
|
|
+ if (props.data.nature !== undefined || props.data.nature !== null) {
|
|
|
+ nature.push(props.data.nature);
|
|
|
+ }
|
|
|
+ if (props.data.enterpriseNature !== undefined || props.data.enterpriseNature !== null) {
|
|
|
+ nature.push(props.data.enterpriseNature);
|
|
|
+ }
|
|
|
+ if (props.data.listedNature !== undefined || props.data.listedNature !== null) {
|
|
|
+ nature.push(props.data.listedNature);
|
|
|
+ }
|
|
|
+
|
|
|
this.state = {
|
|
|
visible: false,
|
|
|
changeType: 0,
|
|
@@ -68,8 +79,80 @@ class InforChange extends Component {
|
|
|
businessScope: props.data.businessScope,
|
|
|
intendedProject: props.data.intendedProject,
|
|
|
industryName: props.data.industry,
|
|
|
- nature: props.data.nature,
|
|
|
+ nature: nature,
|
|
|
+ natureText: "",
|
|
|
natureOther: props.data.natureOther,
|
|
|
+
|
|
|
+ natureOptions: [{
|
|
|
+ value: 1,
|
|
|
+ label: "政府机构"
|
|
|
+ }, {
|
|
|
+ value: 2,
|
|
|
+ label: "科研院所"
|
|
|
+ }, {
|
|
|
+ value: 3,
|
|
|
+ label: "高等院校"
|
|
|
+ }, {
|
|
|
+ value: 4,
|
|
|
+ label: "社会团体"
|
|
|
+ }, {
|
|
|
+ value: 5,
|
|
|
+ label: "企业",
|
|
|
+ children: [{
|
|
|
+ value: 1,
|
|
|
+ label: "国企",
|
|
|
+ children: [{
|
|
|
+ value: 1,
|
|
|
+ label: "上市公司",
|
|
|
+ }, {
|
|
|
+ value: 0,
|
|
|
+ label: "非上市公司",
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ value: 2,
|
|
|
+ label: "央企",
|
|
|
+ children: [{
|
|
|
+ value: 1,
|
|
|
+ label: "上市公司",
|
|
|
+ }, {
|
|
|
+ value: 0,
|
|
|
+ label: "非上市公司",
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ value: 3,
|
|
|
+ label: "私企",
|
|
|
+ children: [{
|
|
|
+ value: 1,
|
|
|
+ label: "上市公司",
|
|
|
+ }, {
|
|
|
+ value: 0,
|
|
|
+ label: "非上市公司",
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ value: 4,
|
|
|
+ label: "合资企业(含港澳台)",
|
|
|
+ children: [{
|
|
|
+ value: 1,
|
|
|
+ label: "上市公司",
|
|
|
+ }, {
|
|
|
+ value: 0,
|
|
|
+ label: "非上市公司",
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ value: 5,
|
|
|
+ label: "外资控股",
|
|
|
+ children: [{
|
|
|
+ value: 1,
|
|
|
+ label: "上市公司",
|
|
|
+ }, {
|
|
|
+ value: 0,
|
|
|
+ label: "非上市公司",
|
|
|
+ }]
|
|
|
+ }]
|
|
|
+ }, {
|
|
|
+ value: 0,
|
|
|
+ label: "其他组织"
|
|
|
+ }]
|
|
|
}
|
|
|
this.onChange = this.onChange.bind(this);
|
|
|
this.onCancel = this.onCancel.bind(this);
|
|
@@ -83,6 +166,11 @@ class InforChange extends Component {
|
|
|
this.onSelect = this.onSelect.bind(this);
|
|
|
}
|
|
|
|
|
|
+ componentDidMount() {
|
|
|
+ let natureText = this.getNatureText(this.state.nature);
|
|
|
+ this.setState({ natureText });
|
|
|
+ }
|
|
|
+
|
|
|
onChange(type) {
|
|
|
if (!this.props.data.level && this.props.data.level != 0) {
|
|
|
Modal.warning({
|
|
@@ -206,8 +294,18 @@ class InforChange extends Component {
|
|
|
data.industry = dataArrar
|
|
|
}
|
|
|
if (this.state.changeType === 5) {
|
|
|
- data.nature = dataArrar
|
|
|
- data.natureOther = this.state.natureOther
|
|
|
+ let enterpriseNature = undefined; // 企业性质 0=其他,1=国企,2=央企,3=私企,4=合资企业(含港澳台),5=外资控股
|
|
|
+ let listedNature = undefined; // 上市 0=否,1=是
|
|
|
+ if (dataArrar.length >= 2) {
|
|
|
+ enterpriseNature = dataArrar[1];
|
|
|
+ }
|
|
|
+ if (dataArrar.length >= 3) {
|
|
|
+ listedNature = dataArrar[2];
|
|
|
+ }
|
|
|
+ data.nature = dataArrar[0];
|
|
|
+ data.enterpriseNature = enterpriseNature;
|
|
|
+ data.listedNature = listedNature;
|
|
|
+ data.natureOther = this.state.natureOther;
|
|
|
}
|
|
|
$.ajax({
|
|
|
url: globalConfig.context + "/api/admin/customer/updateUserDate",
|
|
@@ -252,10 +350,11 @@ class InforChange extends Component {
|
|
|
}
|
|
|
if (this.state.changeType === 5) {
|
|
|
this.setState({
|
|
|
- natureText: getNatureType(dataArrar, this.state.natureOther)
|
|
|
+ natureText: this.getNatureText(dataArrar)
|
|
|
})
|
|
|
}
|
|
|
this.onCancel();
|
|
|
+
|
|
|
} else {
|
|
|
message.warning(data.error[0].message);
|
|
|
}
|
|
@@ -263,6 +362,39 @@ class InforChange extends Component {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 转译客户性质
|
|
|
+ * @param {*} value
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ getNatureText(value) {
|
|
|
+ if (value.length === 1 && value[0] === 0) {
|
|
|
+ // 其他
|
|
|
+ return `其他(${this.state.natureOther})`;
|
|
|
+ } else {
|
|
|
+ let text = [];
|
|
|
+ let level = 0;
|
|
|
+ const loopData = (data) => {
|
|
|
+ for (let i=0; i<data.length; i++) {
|
|
|
+ let item = data[i];
|
|
|
+ if (item.value === value[level]) {
|
|
|
+ text.push(item.label);
|
|
|
+ if (item.children) {
|
|
|
+ level += 1;
|
|
|
+ loopData(item.children)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ loopData(this.state.natureOptions);
|
|
|
+
|
|
|
+ return text.join("/");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
showInput() {
|
|
|
let str = this.state.dataArrar.join('/')
|
|
|
this.setState({
|
|
@@ -598,7 +730,7 @@ class InforChange extends Component {
|
|
|
: this.state.changeType === 5 ?
|
|
|
<div>
|
|
|
<div>
|
|
|
- <Select
|
|
|
+ {/* <Select
|
|
|
style={{ width: 200 }}
|
|
|
placeholder="请选择客户性质"
|
|
|
onChange={e => {
|
|
@@ -612,10 +744,15 @@ class InforChange extends Component {
|
|
|
return <Option key={item.value} value={item.value}>{item.key}</Option>
|
|
|
})
|
|
|
}
|
|
|
- </Select>
|
|
|
+ </Select> */}
|
|
|
+ <Cascader
|
|
|
+ options={this.state.natureOptions}
|
|
|
+ placeholder="请选择客户性质"
|
|
|
+ onChange={e => { this.setState({ dataArrar: e }) }}
|
|
|
+ />
|
|
|
</div>
|
|
|
{
|
|
|
- this.state.dataArrar === '0' &&
|
|
|
+ !!this.state.dataArrar && this.state.dataArrar[0] == 0 &&
|
|
|
<div>
|
|
|
<TextArea
|
|
|
style={{ width: '300px', height: '100px' }}
|