/* * Author: 黎永顺 * name: 新增数据采集项 * Description: */ import React, { Component } from "react"; import { WeaBrowser, WeaFormItem } from "ecCom"; import { getDomkes, getSearchs } from "../../util"; import "./index.less"; class AddItems extends Component { componentDidMount() { const { editId, condition, form } = this.props; if (!_.isEmpty(editId)) { getDomkes(condition).map(item => { if (item === "employeeId") { form.updateFields({ [item]: { value: editId[item], valueSpan: editId["username"], valueObj: [{ id: editId[item], name: editId["username"] }] } }); } else if (item === "taxAgentId") { form.updateFields({ [item]: editId[item].toString() }); } else { form.updateFields({ [item]: editId[item] || "" }); } }); } } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.editId !== this.props.editId && !_.isEmpty(nextProps.editId)) { getDomkes(nextProps.condition).map(item => { if (item === "employeeId") { nextProps.form.updateFields({ [item]: { value: nextProps.editId[item], valueSpan: nextProps.editId["username"], valueObj: [{ id: nextProps.editId[item], name: nextProps.editId["username"] }] } }); } else if (item === "taxAgentId") { nextProps.form.updateFields({ [item]: nextProps.editId[item].toString() }); } else { nextProps.form.updateFields({ [item]: nextProps.editId[item] || "" }); } }); } } render() { const { form, condition = [] } = this.props; return (
{getSearchs(form, condition, 2, false)} 若此员工数据已存在在同期列表中,则当前数据保存后会覆盖列表数据
); } } export default AddItems; export const Browser = payload => { const { label, onChange, viewAttr = 3, value, valueSpan, type = 1, isSingle = true } = payload; return ( onChange({ ids, names })}/> ); }; export const Tips = payload => { const { children } = payload; return (
小提示
{children}
); };