| | |
| | | |
| | | records.fields.unshift(values.field) |
| | | records.labels.unshift(values.label) |
| | | records.fields = Array.from(new Set(records.fields)) |
| | | records.labels = Array.from(new Set(records.labels)) |
| | | |
| | | let _fields = [] |
| | | let _labels = [] |
| | | |
| | | records.fields = records.fields.filter(m => { |
| | | if (_fields.includes(m.toLowerCase())) return false |
| | | _fields.push(m.toLowerCase()) |
| | | return true |
| | | }) |
| | | records.labels = records.labels.filter(m => { |
| | | if (_labels.includes(m.toLowerCase())) return false |
| | | _labels.push(m.toLowerCase()) |
| | | return true |
| | | }) |
| | | |
| | | localStorage.setItem('replaceRecord', JSON.stringify(records)) |
| | | } |
| | |
| | | } |
| | | |
| | | clear = () => { |
| | | let _this = this |
| | | let that = this |
| | | confirm({ |
| | | title: '确定清除历史记录吗?', |
| | | content: '', |
| | | onOk() { |
| | | localStorage.removeItem('replaceRecord') |
| | | _this.setState({fields: [], labels: []}) |
| | | that.setState({fields: [], labels: []}) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | {getFieldDecorator('resource', { |
| | | initialValue: 'custom' |
| | | })( |
| | | <Radio.Group onChange={(e) => this.setState({resource: e.target.value})}> |
| | | <Radio.Group onChange={(e) => {this.setState({resource: e.target.value});this.props.form.setFieldsValue({reType: 'field'})}}> |
| | | <Radio value="dict">数据字典</Radio> |
| | | <Radio value="custom">自定义</Radio> |
| | | </Radio.Group> |
| | |
| | | })( |
| | | <Radio.Group onChange={(e) => this.setState({reType: e.target.value})}> |
| | | <Radio value="field">字段 <SwapRightOutlined /> 名称</Radio> |
| | | <Radio value="name">原字段 <SwapRightOutlined /> 新字段</Radio> |
| | | <Radio disabled={resource === 'dict'} value="name">原字段 <SwapRightOutlined /> 新字段</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |