| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Tooltip, Icon, Cascader } from 'antd' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Tooltip, Icon, Cascader, Input } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MKEInput from './mkInput' |
| | | import MKNumberInput from './mkNumberInput' |
| | | import MKSelect from './mkSelect' |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | |
| | | const MKRadio = asyncComponent(() => import('./mkRadio')) |
| | | const StyleInput = asyncComponent(() => import('./styleInput')) |
| | |
| | | } |
| | | |
| | | item.hidden = false |
| | | |
| | | if (item.forbid) { |
| | | item.hidden = true |
| | | } |
| | | if (item.options) { |
| | | item.oriOptions = fromJS(item.options).toJS() |
| | | } |
| | | |
| | | if (item.type === 'text') { |
| | | let _rules = [{ |
| | |
| | | }) |
| | | |
| | | formlist = formlist.map(cell => { |
| | | return fieldMap.get(cell.field) || cell |
| | | let item = fieldMap.get(cell.field) |
| | | |
| | | if (item.linkField) { |
| | | let supInitVal = fieldMap.get(item.linkField).initval || '' |
| | | |
| | | item.options = item.oriOptions.filter(option => option.ParentID === supInitVal) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.record = record |
| | |
| | | const fields = [] |
| | | |
| | | formlist.forEach((item, index) => { |
| | | if (item.hidden) return |
| | | if (item.hidden || item.forbid) return |
| | | |
| | | let content = null |
| | | let label = item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}><Icon type="question-circle" />{item.label}</Tooltip> : item.label |
| | |
| | | content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />) |
| | | } else if (item.type === 'cascader') { |
| | | content = (<Cascader options={item.options} expandTrigger="hover" placeholder="" />) |
| | | } else if (item.type === 'textarea') { |
| | | content = (<TextArea rows={item.rows || 2} placeholder=""/>) |
| | | } |
| | | |
| | | if (!content) return |