| | |
| | | textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | extend: ['label', 'field', 'type', 'Align', 'Width', 'colUnit', 'shift', 'quota', 'supField'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | | index: ['label', 'type', 'Align', 'Width'] |
| | |
| | | getOptions = () => { |
| | | let _options = fromJS(columnTypeOptions[this.record.type]).toJS() |
| | | |
| | | let reLabel = {} |
| | | |
| | | if (['number', 'text'].includes(this.record.type) && this.record.editable === 'true') { |
| | | _options.push('ctrlField') |
| | | if (this.record.ctrlField) { |
| | |
| | | } else { |
| | | _options.push('required', 'enter') |
| | | } |
| | | |
| | | reLabel.required = '必填' |
| | | } else if (this.record.type === 'number') { |
| | | _options.push('max', 'min', 'enter', 'clearField') |
| | | _options.push('max', 'min', 'required', 'enter', 'clearField') |
| | | |
| | | reLabel.required = '不等于0' |
| | | } |
| | | } else if (this.record.type === 'extend') { |
| | | if (this.record.colUnit === 'day') { |
| | | _options.push('dayFormat') |
| | | } else { |
| | | _options.push('hourFormat') |
| | | } |
| | | } |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | |
| | | } |
| | | } |
| | | |
| | | return _options |
| | | return {options: _options, reLabel} |
| | | } |
| | | |
| | | editColumn = (column) => { |
| | |
| | | this.record[item.key] = item.initVal |
| | | }) |
| | | |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | visible: true, |
| | | formlist: formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | if (item.key === 'formula') { |
| | | item.fields = this.props.fields.map(col => col.field) |
| | |
| | | this.record.IsSort = 'false' |
| | | } |
| | | |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | let _field = '' |
| | | if (value === 'formula') { |
| | |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | |
| | | this.record.type = values.type |
| | | |
| | | if (values.type !== _type) { |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } else if (key === 'editType') { |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | |
| | | } |
| | | |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort', 'textFormat'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | let { options, reLabel } = this.getOptions() |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | item.initVal = this.record[item.key] |
| | | item.hidden = !_options.includes(item.key) |
| | | item.hidden = !options.includes(item.key) |
| | | if (reLabel[item.key]) { |
| | | item.label = reLabel[item.key] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | |
| | | let content = null |
| | | let extra = null |
| | | let initVal = item.initVal || '' |
| | | let label = item.label |
| | | if (item.tooltip) { |
| | | if (item.toolWidth) { |
| | | label = <Tooltip placement="topLeft" overlayStyle={{maxWidth: item.toolWidth}} title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> |
| | | } else { |
| | | label = <Tooltip placement="topLeft" title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> |
| | | } |
| | | } |
| | | |
| | | if (item.type === 'text') { |
| | | rules = [ |
| | |
| | | if (item.key === 'formula') { |
| | | fields.push( |
| | | <Col span={span} key={index}> |
| | | <Form.Item className={className} extra={extra} label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | <Form.Item className={className} extra={extra} label={label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: initVal, |
| | | rules: rules |
| | |
| | | |
| | | fields.push( |
| | | <Col span={span} key={index}> |
| | | <Form.Item className={className} extra={extra} label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | <Form.Item className={className} extra={extra} label={label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: initVal, |
| | | rules: rules |