From 47b60c427d8b72e250b551ec857c0631b5857224 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 15 四月 2021 19:42:35 +0800 Subject: [PATCH] 2021-04-15 --- src/menu/components/table/normal-table/columns/editColumn/index.jsx | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 43c63ac..ed9a99f 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -103,13 +103,34 @@ } }) } else if (key === 'field') { - this.props.form.setFieldsValue({label: option.props.children}) - if (this.state.type === 'number') { + let values = {label: option.props.children} + if (/Decimal|int/ig.test(option.props.datatype)) { let decimal = 0 if (/Decimal/ig.test(option.props.datatype)) { decimal = +option.props.datatype.replace(/Decimal\(18,/ig, '').replace(')', '') } - this.props.form.setFieldsValue({decimal}) + values.type = 'number' + values.decimal = decimal + } else if (/nvarchar/ig.test(option.props.datatype)) { + values.type = 'text' + } + + if (values.type !== this.state.type) { + values.perspective = '' + let _options = fromJS(columnTypeOptions[values.type]).toJS() + + this.setState({ + type: values.type, + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + + return item + }) + }, () => { + this.props.form.setFieldsValue(values) + }) + } else { + this.props.form.setFieldsValue(values) } } else if (key === 'format' && value === 'percent') { this.props.form.setFieldsValue({postfix: '%'}) -- Gitblit v1.8.0