| | |
| | | const cardTypeOptions = { |
| | | sequence: ['eleType', 'width'], |
| | | text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable'], |
| | | number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'], |
| | | picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'], |
| | | number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'], |
| | | picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'backgroundSize', 'maxWidth', 'link', 'noValue'], |
| | | video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'], |
| | | icon: ['eleType', 'icon', 'datatype', 'width'], |
| | | icon: ['eleType', 'datatype', 'width', 'tooltip'], |
| | | slider: ['eleType', 'datatype', 'width', 'color', 'maxValue', 'showInfo', 'showType', 'strokeWidth', 'strokeLinecap', 'trailColor'], |
| | | splitline: ['eleType', 'color', 'width', 'borderWidth'], |
| | | barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval', 'noValue'], |
| | |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | config: PropTypes.object, // 组件信息 |
| | | formlist: PropTypes.any, // 表单信息 |
| | | card: PropTypes.any, // 按钮信息 |
| | |
| | | item.options = [] |
| | | config.columns.forEach(col => { |
| | | let label = col.label |
| | | if (label !== col.field) { |
| | | if (label.toLowerCase() !== col.field.toLowerCase()) { |
| | | label = col.field + ' ' + col.label |
| | | } |
| | | if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) { |
| | |
| | | if (datatype === 'dynamic') { |
| | | _options.push('field') |
| | | if (eleType === 'number') { |
| | | _options.push('decimal') |
| | | _options.push('decimal', 'format') |
| | | } |
| | | } else if (eleType === 'picture' || eleType === 'video') { |
| | | _options.push('url') |
| | |
| | | if (datatype === 'dynamic') { |
| | | _options.push('field') |
| | | } else { |
| | | _options.push('tooltip') |
| | | _options.push('icon') |
| | | } |
| | | } |
| | | if (_options.includes('fixStyle') && fixStyle === 'alone') { |
| | |
| | | item.options = [] |
| | | config.columns.forEach(col => { |
| | | let label = col.label |
| | | if (label !== col.field) { |
| | | if (label.toLowerCase() !== col.field.toLowerCase()) { |
| | | label = col.field + ' ' + col.label |
| | | } |
| | | |
| | |
| | | item.initVal = posterType |
| | | } else if (item.key === 'fixStyle') { |
| | | item.initVal = fixStyle |
| | | } else if (item.key === 'color') { |
| | | if (value === 'splitline') { |
| | | item.initVal = '#EBE9E9' |
| | | } |
| | | } |
| | | |
| | | return item |
| | |
| | | showType: card.showType || 'line', |
| | | formlist: _formlist |
| | | }, () => { |
| | | if (value === 'slider') { |
| | | if (value === 'splitline') { |
| | | this.props.form.setFieldsValue({width: 24, color: '#EBE9E9'}) |
| | | } else if (value === 'slider') { |
| | | this.props.form.setFieldsValue({width: 24, color: '#1890ff'}) |
| | | } else if (value === 'qrcode') { |
| | | this.props.form.setFieldsValue({color: '#000000'}) |
| | |
| | | rules: [ |
| | | { |
| | | required: item.readonly ? false : !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | message: '请输入' + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | |
| | | rules: [ |
| | | { |
| | | required: item.readonly ? false : !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | message: '请输入' + item.label + '!' |
| | | } |
| | | ] |
| | | })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)} |
| | |
| | | initialValue: item.initVal, |
| | | rules: [{ |
| | | required: item.readonly ? false : !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | message: '请输入' + item.label + '!' |
| | | }] |
| | | })(<InputNumber min={item.min || 0} max={item.max || 10000} precision={item.precision || 0} onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | |
| | | initialValue: item.initVal || '', |
| | | rules: [{ |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | }] |
| | | })( |
| | | <Select |
| | |
| | | initialValue: item.initVal || '', |
| | | rules: [{ |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | }] |
| | | })( |
| | | <MkEditIcon /> |
| | |
| | | initialValue: item.initVal, |
| | | rules: [{ |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | }] |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.onChange(e, item.key)}} disabled={item.readonly}> |
| | |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | } |
| | | ] |
| | | })( |