| | |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单 |
| | | card: PropTypes.object, // 搜索条件信息 |
| | | inputSubmit: PropTypes.any // 回车提交事件 |
| | |
| | | } |
| | | |
| | | optionChange = (key, value) => { |
| | | let oriType = this.record.type |
| | | this.record[key] = value |
| | | let _fieldval = {} |
| | | |
| | |
| | | if (value === 'checkcard') { |
| | | this.record.multiple = 'false' |
| | | _fieldval.multiple = 'false' |
| | | _fieldval.ratio = 24 |
| | | } else if (oriType === 'checkcard') { |
| | | _fieldval.ratio = 6 |
| | | } |
| | | |
| | | if (this.record.options.length > 0) { |
| | |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { dict } = this.props |
| | | const { formlist } = this.state |
| | | const fields = [] |
| | | |
| | |
| | | if (item.type === 'text') { |
| | | let type = this.record.type |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.input'] + item.label + '!' } |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | if (item.key === 'field' || item.key === 'datefield') { |
| | | rules.push({ |
| | |
| | | } |
| | | } else if (item.type === 'number') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.input'] + item.label + '!' } |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | initVal = item.initVal |
| | | |
| | |
| | | } |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.select'] + item.label + '!' } |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <Select |
| | |
| | | </Select> |
| | | } else if (item.type === 'radio') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.select'] + item.label + '!' } |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.optionChange(item.key, e.target.value)}}> |
| | |
| | | </Radio.Group> |
| | | } else if (item.type === 'codemirror') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.input'] + item.label + '!' } |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | span = 24 |
| | | className = 'text-area' |
| | |
| | | if (this.record.linkField) { |
| | | type = 'link' |
| | | } |
| | | content = <DataTable dict={dict} type={type} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/> |
| | | content = <DataTable type={type} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/> |
| | | } |
| | | } else if (item.type === 'fields') { |
| | | span = 24 |
| | |
| | | { required: item.required, message: '请添加' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <FieldsTable dict={dict} onChange={this.changeField}/> |
| | | content = <FieldsTable onChange={this.changeField}/> |
| | | } else if (item.type === 'checkbox') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.select'] + item.label + '!' } |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <Checkbox.Group style={{width: '105%'}} options={item.options} onChange={(values) => this.optionChange(item.key, values)}/> |
| | |
| | | } else if (item.type === 'color') { |
| | | className = 'color-form-item' |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.select'] + item.label + '!' } |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <ColorSketch allowClear={true}/> |