| | |
| | | |
| | | class ActionForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | type: PropTypes.any, // type为"card"时,只可选单行或不选行 |
| | | setting: PropTypes.object, // 页面设置 |
| | | formlist: PropTypes.any, // 表单信息 |
| | |
| | | record = {} |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { type, dict } = this.props |
| | | const { type } = this.props |
| | | |
| | | let requireOptions = [ |
| | | { value: 'notRequired', text: dict['header.form.notRequired'] }, |
| | | { value: 'requiredSgl', text: dict['header.form.requiredSgl'] }, |
| | | { value: 'required', text: dict['header.form.required'] }, |
| | | { value: 'requiredOnce', text: dict['header.form.requiredOnce'] } |
| | | { value: 'notRequired', text: '不选择行' }, |
| | | { value: 'requiredSgl', text: '选择单行' }, |
| | | { value: 'required', text: '选择多行' }, |
| | | { value: 'requiredOnce', text: '多行拼接' } |
| | | ] |
| | | |
| | | if (type === 'card') { |
| | |
| | | _fieldval.intertype = 'system' |
| | | _fieldval.Ot = 'notRequired' |
| | | |
| | | _fieldval.label = this.props.dict['model.form.excelIn'] |
| | | _fieldval.label = '导入Excel' |
| | | _fieldval.class = 'dgreen' |
| | | this.record.Ot = 'notRequired' |
| | | this.record.label = this.props.dict['model.form.excelIn'] |
| | | this.record.label = '导入Excel' |
| | | this.record.class = 'dgreen' |
| | | |
| | | |
| | | } else if (value === 'excelOut') { |
| | | _fieldval.intertype = 'system' |
| | | _fieldval.label = this.props.dict['model.form.excelOut'] |
| | | _fieldval.label = '导出Excel' |
| | | _fieldval.class = 'dgreen' |
| | | _fieldval.execSuccess = 'never' |
| | | this.record.Ot = 'notRequired' |
| | | this.record.label = this.props.dict['model.form.excelOut'] |
| | | this.record.label = '导出Excel' |
| | | this.record.class = 'dgreen' |
| | | this.record.execSuccess = 'never' |
| | | |
| | |
| | | |
| | | } |
| | | if (value === 'excelIn') { |
| | | _fieldval.label = this.props.dict['model.form.excelIn'] |
| | | _fieldval.label = '导入Excel' |
| | | _fieldval.class = 'dgreen' |
| | | } else if (value === 'excelOut') { |
| | | _fieldval.label = this.props.dict['model.form.excelOut'] |
| | | _fieldval.label = '导出Excel' |
| | | _fieldval.class = 'dgreen' |
| | | _fieldval.control = '' |
| | | this.record.control = '' |
| | |
| | | } |
| | | |
| | | getFields() { |
| | | const { dict } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | |
| | |
| | | } |
| | | if (item.type === 'text') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.input'] + item.label + '!' } |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | |
| | | if (item.key === 'innerFunc') { |
| | |
| | | content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} /> |
| | | } else if (item.type === 'number') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.input'] + item.label + '!' } |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <InputNumber min={item.min} max={item.max} precision={item.precision} onPressEnter={this.handleSubmit}/> |
| | | } else if (item.type === 'select') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.select'] + item.label + '!' } |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | if (item.extendName) { |
| | |
| | | } |
| | | } 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 onChange={(e) => {this.optionChange(item.key, e.target.value)}}> |
| | |
| | | </Radio.Group> |
| | | } 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> |
| | |
| | | } else if (item.type === 'cascader') { |
| | | initVal = item.initVal || [] |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.select'] + item.label + '!' } |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <Cascader options={item.options || []} expandTrigger="hover" placeholder=""/> |
| | | } else if (item.type === 'icon') { |
| | | rules = [ |
| | | { required: item.required, message: dict['form.required.select'] + item.label + '!' } |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <MkEditIcon options={['edit', 'hint', 'direction', 'normal', 'data']} allowClear/> |
| | |
| | | span = 24 |
| | | className = 'textarea' |
| | | rules = [ |
| | | { required: item.readonly ? false : item.required, message: dict['form.required.input'] + item.label + '!' } |
| | | { required: item.readonly ? false : item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <TextArea rows={2} readOnly={item.readonly}/> |