| | |
| | | let record = {} |
| | | let formlist = fromJS(action.fields).toJS() |
| | | let fieldMap = new Map() |
| | | let check = action.setting.formType === 'check' |
| | | |
| | | formlist = formlist.filter(item => { |
| | | if (item.supField && item.supvalue) { // 多层表单控制 |
| | |
| | | if (!item.field || !['text', 'number', 'switch', 'select', 'link', 'linkMain', 'funcvar', 'date', 'datemonth', 'datetime', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false |
| | | |
| | | // 数据自动填充 |
| | | item.readin = item.readin !== 'false' |
| | | item.readonly = item.readonly === 'true' |
| | | let readin = item.readin !== 'false' |
| | | item.readin = item.readin !== 'false' && item.readin !== 'top' |
| | | item.readonly = check || item.readonly === 'true' |
| | | item.writein = item.writein !== 'false' |
| | | item.hidden = item.hidden === 'true' |
| | | item.fieldlength = item.fieldlength || 50 |
| | | |
| | | if (item.type === 'funcvar') { |
| | | readin = false |
| | | item.readin = false |
| | | item.hidden = true |
| | | } else if (item.type === 'number') { |
| | |
| | | |
| | | let newval = '$empty' |
| | | |
| | | if (item.readin && data && data.hasOwnProperty(item.field)) { |
| | | if (readin && data && data.hasOwnProperty(item.field)) { |
| | | newval = data[item.field] |
| | | } |
| | | if (item.type === 'linkMain') { |
| | |
| | | } |
| | | |
| | | // 下级表单控制-字段写入 |
| | | 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) |
| | |
| | | } |
| | | |
| | | resetFormList = (result) => { |
| | | let _formlist = this.state.formlist.map(item => { |
| | | let _formlist = fromJS(this.state.formlist).toJS().map(item => { |
| | | if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = [] |
| | | result[item.field].forEach(cell => { |
| | |
| | | |
| | | 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] |
| | | }) |
| | | } |
| | | |
| | | if (item.disableField && cell[item.disableField] && /^true$/ig.test(cell[item.disableField])) { |
| | | _cell.$disabled = true |
| | | } |
| | | |
| | | options.push(_cell) |
| | |
| | | } else if (item.type === 'color') { |
| | | content = (<MKColor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>) |
| | | } else if (item.type === 'checkcard') { |
| | | className = "checkcard" |
| | | className = 'checkcard' |
| | | content = (<MKCheckCard config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>) |
| | | } else if (item.type === 'switch') { |
| | | content = (<MKSwitch config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>) |
| | |
| | | } else if (item.type === 'date' || item.type === 'datemonth' || item.type === 'datetime') { |
| | | content = (<MKDatePicker config={item} onChange={(val) => this.recordChange({[item.field]: val})} />) |
| | | } else if (item.type === 'fileupload') { |
| | | className = item.readonly ? 'readonly' : '' |
| | | className += item.fileType === 'picture-card' ? ' file-upload' : '' |
| | | content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />) |
| | | } else if (item.type === 'textarea') { |
| | | content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>) |