| | |
| | | const { TextArea } = Input |
| | | |
| | | const MKRadio = asyncComponent(() => import('./mkRadio')) |
| | | const MKTable = asyncComponent(() => import('./mkTable')) |
| | | const MKCheckbox = asyncComponent(() => import('./mkCheckbox')) |
| | | const StyleInput = asyncComponent(() => import('./styleInput')) |
| | | const MKFileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload')) |
| | | const MKColor = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkColor')) |
| | | const MkIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent')) |
| | | |
| | | class ModalForm extends Component { |
| | |
| | | validator: (rule, value, callback) => this.handleConfirmPassword(rule, value, callback, item) |
| | | }] |
| | | } else if (item.type === 'textarea') { |
| | | let _rules = [ |
| | | item.rules = [ |
| | | { |
| | | required: item.required, |
| | | message: item.label + '不可为空!' |
| | | } |
| | | ] |
| | | item.rules = _rules |
| | | } else if (item.type === 'table') { |
| | | item.rules = [ |
| | | { |
| | | required: item.required, |
| | | message: '请添加' + item.label + '!' |
| | | } |
| | | ] |
| | | } else { |
| | | item.rules = [ |
| | | { |
| | |
| | | if (vals.length === new Set(vals).size) { |
| | | cell.hidden = true |
| | | } |
| | | } else if (item.notNull) { |
| | | cell.hidden = !supItem.initval || JSON.stringify(supItem.initval) === '[]' |
| | | } else if (!item.values.includes(supItem.initval)) { |
| | | cell.hidden = true |
| | | } |
| | |
| | | } else { |
| | | m.hidden = true |
| | | } |
| | | } else if (cell.notNull) { |
| | | m.hidden = !val || JSON.stringify(val) === '[]' |
| | | } else { |
| | | m.hidden = !cell.values.includes(val) |
| | | } |
| | |
| | | |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(cell => { |
| | | if (cell.field) { |
| | | return map.get(cell.field) |
| | | if (!cell.field) return cell |
| | | |
| | | let item = map.get(cell.field) |
| | | |
| | | if (item && item.linkField) { |
| | | let supInitVal = this.record[item.linkField] || '' |
| | | |
| | | item.options = item.oriOptions.filter(option => option.ParentID === supInitVal) |
| | | } |
| | | return cell |
| | | |
| | | return item || cell |
| | | }) |
| | | }) |
| | | } |
| | |
| | | } else if (item.type === 'fileupload') { |
| | | content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />) |
| | | } else if (item.type === 'cascader') { |
| | | content = (<Cascader allowClear={!!item.allowClear} options={item.options} expandTrigger="hover" placeholder="" />) |
| | | content = (<Cascader allowClear={!!item.allowClear} onChange={(val) => this.recordChange({[item.field]: val}, item)} options={item.options} expandTrigger="hover" placeholder="" />) |
| | | } else if (item.type === 'textarea') { |
| | | content = (<TextArea rows={item.rows || 2} placeholder=""/>) |
| | | } else if (item.type === 'mkicon') { |
| | | content = (<MkIcon allowClear={item.allowClear}/>) |
| | | content = (<MkEditIcon allowClear={item.allowClear}/>) |
| | | } else if (item.type === 'source') { |
| | | content = (<SourceComponent type="" placement="right"/>) |
| | | } else if (item.type === 'table') { |
| | | content = (<MKTable columns={item.columns || []}/>) |
| | | } |
| | | |
| | | if (!content) return |