custom/领悦
This commit is contained in:
parent
925394e814
commit
48df3121fd
|
|
@ -30,24 +30,15 @@ class Index extends Component {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { value, fieldConfig } = this.props;
|
const { value, fieldConfig } = this.props;
|
||||||
const { value: defaultValue, browserConditionParam: { replaceDatas = [] } } = fieldConfig;
|
const { browserConditionParam: { replaceDatas = [] } } = fieldConfig;
|
||||||
if ((value || defaultValue) && replaceDatas.length > 0) {
|
if (value && replaceDatas.length > 0) {
|
||||||
this.setState({
|
this.setState({
|
||||||
searchKeys: (value || defaultValue).split(","),
|
searchKeys: value.split(","),
|
||||||
selectedData: _.reduce(replaceDatas, (pre, cur) => ({ ...pre, [cur["id"]]: cur }), {})
|
selectedData: _.reduce(replaceDatas, (pre, cur) => ({ ...pre, [cur["id"]]: cur }), {})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps, nextContext) {
|
|
||||||
if (
|
|
||||||
(nextProps.value !== this.props.value && _.isEmpty(nextProps.value)) ||
|
|
||||||
(nextProps.fieldConfig.value !== this.props.fieldConfig.value && _.isEmpty(nextProps.fieldConfig.value))
|
|
||||||
) {
|
|
||||||
this.setState({ searchKeys: [], selectedData: [] });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
renderSingle = () => {
|
renderSingle = () => {
|
||||||
const { fieldConfig } = this.props;
|
const { fieldConfig } = this.props;
|
||||||
const { selectedData, searchKeys } = this.state;
|
const { selectedData, searchKeys } = this.state;
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,12 @@ class Index extends Component {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
value={value}
|
value={value}
|
||||||
onCustomChange={(value) => {
|
onCustomChange={(value) => onEdit({
|
||||||
console.log("onCustomChange",value);
|
record: {
|
||||||
}}
|
...record, [`${col["column"]}Obj`]: _.values(value),
|
||||||
onChange={(value) => onEdit({
|
[col["column"]]: _.map(_.values(value), o => o.bh).join(",")
|
||||||
record: { ...record, [col["column"]]: value }, index
|
},
|
||||||
|
index, key: "custom", value: _.map(_.values(value), o => o.bh).join(",")
|
||||||
})}
|
})}
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
@ -105,32 +106,44 @@ class Index extends Component {
|
||||||
dataSource: _.head(datas).dataSource,
|
dataSource: _.head(datas).dataSource,
|
||||||
details: _.map(datas, o => ({
|
details: _.map(datas, o => ({
|
||||||
zy: o.zy, kjkm: o.kjkm, jfValue: o.jfValue, dfValue: o.dfValue,
|
zy: o.zy, kjkm: o.kjkm, jfValue: o.jfValue, dfValue: o.dfValue,
|
||||||
fzhsXmqs: !o.fzhsXmqs ? {} : _.isString(o.fzhsXmqs) ? o.fzhsXmqs : {
|
fzhsXmqs: !o.fzhsXmqs ? {} : _.isString(o.fzhsXmqs) ? {
|
||||||
|
bh: o.fzhsXmqsObj[0].bh,
|
||||||
|
fzhslxbh: o.fzhsXmqsObj[0].fzhslxbh
|
||||||
|
} : {
|
||||||
bh: o.fzhsXmqs.bh,
|
bh: o.fzhsXmqs.bh,
|
||||||
fzhslxbh: o.fzhsXmqs.fzhslxbh
|
fzhslxbh: o.fzhsXmqs.fzhslxbh
|
||||||
},
|
},
|
||||||
fzhsFwlb: !o.fzhsFwlb ? {} : _.isString(o.fzhsFwlb) ? o.fzhsFwlb : {
|
fzhsFwlb: !o.fzhsFwlb ? {} : _.isString(o.fzhsFwlb) ? {
|
||||||
|
bh: o.fzhsFwlbObj[0].bh,
|
||||||
|
fzhslxbh: o.fzhsFwlbObj[0].fzhslxbh
|
||||||
|
} : {
|
||||||
bh: o.fzhsFwlb.bh,
|
bh: o.fzhsFwlb.bh,
|
||||||
fzhslxbh: o.fzhsFwlb.fzhslxbh
|
fzhslxbh: o.fzhsFwlb.fzhslxbh
|
||||||
},
|
},
|
||||||
fzhsSllb: !o.fzhsSllb ? {} : _.isString(o.fzhsSllb) ? o.fzhsSllb : {
|
fzhsSllb: !o.fzhsSllb ? {} : _.isString(o.fzhsSllb) ? {
|
||||||
|
bh: o.fzhsSllbObj[0].bh,
|
||||||
|
fzhslxbh: o.fzhsSllbObj[0].fzhslxbh
|
||||||
|
} : {
|
||||||
bh: o.fzhsSllb.bh,
|
bh: o.fzhsSllb.bh,
|
||||||
fzhslxbh: o.fzhsFwlb.fzhslxbh
|
fzhslxbh: o.fzhsSllb.fzhslxbh
|
||||||
},
|
},
|
||||||
fzhsKs: !o.fzhsKs ? {} : _.isString(o.fzhsKs) ? o.fzhsKs : {
|
fzhsKs: !o.fzhsKs ? {} : _.isString(o.fzhsKs) ? {
|
||||||
|
bh: o.fzhsKsObj[0].bh,
|
||||||
|
fzhslxbh: o.fzhsKsObj[0].fzhslxbh
|
||||||
|
} : {
|
||||||
bh: o.fzhsKs.bh,
|
bh: o.fzhsKs.bh,
|
||||||
fzhslxbh: o.fzhsFwlb.fzhslxbh
|
fzhslxbh: o.fzhsKs.fzhslxbh
|
||||||
},
|
},
|
||||||
fzhsOtherBmList: !o.fzhsOther ? [] : _.isString(o.fzhsOther) ? o.fzhsOther.split(",") : _.map(o.fzhsOther, o => (o.bh))
|
fzhsOtherBmList: !o.fzhsOther ? [] : _.isString(o.fzhsOther) ? _.map(o.fzhsOtherObj, k => ({
|
||||||
|
bh: k.bh, fzhslxbh: k.fzhslxbh
|
||||||
|
})) : _.map(o.fzhsOther, o => (o.bh))
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
console.log(payload, datas);
|
|
||||||
return;
|
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
API.pushUCAndSave(payload).then(({ status, errormsg }) => {
|
API.pushUCAndSave(payload).then(({ status, data, errormsg }) => {
|
||||||
this.setState({ loading: false });
|
this.setState({ loading: false });
|
||||||
if (status) {
|
if (status) {
|
||||||
message.success(getLabel(111, "操作成功!"));
|
message.success(data.errMsg);
|
||||||
this.setState({ visible: false });
|
this.setState({ visible: false });
|
||||||
setTimeout(() => window.close(), 1500);
|
setTimeout(() => window.close(), 1500);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue