From 34f78e1203a839592ca6764f88f1632088e07d2a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 10 二月 2020 13:41:43 +0800 Subject: [PATCH] 2020-02-10 --- src/templates/ushare/editable/index.jsx | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/templates/ushare/editable/index.jsx b/src/templates/ushare/editable/index.jsx index a3064ca..085aab2 100644 --- a/src/templates/ushare/editable/index.jsx +++ b/src/templates/ushare/editable/index.jsx @@ -44,12 +44,13 @@ this.form = form const { children, dataIndex, record } = this.props const { editing } = this.state + return editing ? ( <Form.Item style={{ margin: 0 }}> {form.getFieldDecorator(dataIndex, { rules: [ { - required: true, + required: dataIndex === 'Value' || dataIndex === 'Text', message: 'NOT NULL.', }, ], @@ -150,7 +151,8 @@ columns: columns, dataSource: props.data, count: props.data.length, - type: props.type + type: props.type, + linkSubFields: props.linkSubFields } } @@ -187,8 +189,17 @@ } resetColumn = (type, linkSubFields) => { + let dataSource = JSON.parse(JSON.stringify(this.state.dataSource)) let _width = '40%' let fields = [] + + if (type === 'select' && linkSubFields.length > this.state.linkSubFields) { + let addcol = linkSubFields[linkSubFields.length - 1] + dataSource = dataSource.map(data => { + data[addcol.field] = data.Text + return data + }) + } if (type === 'link') { _width = '27%' @@ -242,6 +253,7 @@ this.setState({ columns: columns, + dataSource: dataSource, type: type }) } -- Gitblit v1.8.0