| | |
| | | } |
| | | |
| | | if (item.type === 'text') { |
| | | if (typeof(item.initval) === 'number') { |
| | | item.initval = item.initval + '' |
| | | } |
| | | let _rules = [{ |
| | | pattern: /^[^']*$/ig, |
| | | message: formRule.input.quotemsg |
| | |
| | | _rules.push({ |
| | | pattern: /^[a-zA-Z0-9]*$/ig, |
| | | message: formRule.input.letternummsg |
| | | }) |
| | | } else if (item.regular === 'phone') { |
| | | _rules.push({ |
| | | pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ig, |
| | | message: '请正确输入手机号' |
| | | }) |
| | | } else if (item.regular === 'funcname') { |
| | | _rules.push({ |
| | |
| | | } |
| | | |
| | | // 下级表单控制-字段写入 |
| | | if ((['select', 'radio'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true')) && item.linkSubField) { |
| | | if ((['select', 'radio', 'link'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true')) && item.linkSubField) { |
| | | item.subFields = [] |
| | | item.linkSubField.forEach(m => { |
| | | let n = fieldMap.get(m) |
| | |
| | | |
| | | if (item.type === 'link') { |
| | | _cell.ParentID = cell[item.linkField] === undefined ? '' : cell[item.linkField] |
| | | } else if (item.subFields) { |
| | | } |
| | | if (item.subFields) { |
| | | item.subFields.forEach(m => { |
| | | _cell[m.field] = (cell[m.field] || cell[m.field] === 0) ? cell[m.field] : '' |
| | | _cell[m.field] = cell[m.field] === undefined ? '' : cell[m.field] |
| | | }) |
| | | } |
| | | |
| | |
| | | let label = item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}><Icon type="question-circle" />{item.label}</Tooltip> : item.label |
| | | |
| | | if (item.type === 'text' || item.type === 'linkMain') { |
| | | content = (<MKInput config={item} onChange={(val) => this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit} />) |
| | | content = (<MKInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit} />) |
| | | } else if (item.type === 'number') { |
| | | content = (<MKNumberInput config={item} onChange={(val) => this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit} />) |
| | | content = (<MKNumberInput config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit} />) |
| | | } else if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { |
| | | content = (<MKSelect config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)} onSubmit={this.props.inputSubmit} />) |
| | | } else if (item.type === 'color') { |
| | |
| | | } else if (item.type === 'fileupload') { |
| | | content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />) |
| | | } else if (item.type === 'textarea') { |
| | | content = (<MKTextArea config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>) |
| | | content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>) |
| | | } else if (item.type === 'brafteditor') { |
| | | content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>) |
| | | label = item.hidelabel !== 'true' ? label : '' |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Form className={'main-form-field ' + _align} id="main-form-box"> |
| | | <Form className={'main-form-field ' + _align}> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |