| | |
| | | let item = fieldMap.get(cell.field) |
| | | |
| | | // 下级表单控制-字段写入 |
| | | if ((['select', 'radio', 'link'].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.type === 'cascader' && item.resourceType !== '2')) && item.linkSubField) { |
| | | item.subFields = [] |
| | | item.linkSubField.forEach(m => { |
| | | let n = fieldMap.get(m) |
| | |
| | | item.options = fromJS(item.oriOptions).toJS() |
| | | } |
| | | item.linkSubField = null |
| | | } else if (item.type === 'cascader' && item.fillField) { |
| | | let n = fieldMap.get(item.fillField) |
| | | item.fillFieldId = n ? n.uuid : '' |
| | | } |
| | | |
| | | // if (item.type === 'link') { |
| | |
| | | } |
| | | |
| | | if (item.subFields && item.options.length > 0) { |
| | | let initval = item.initval |
| | | if (item.type === 'cascader' && item.separator) { |
| | | initval = initval.split(item.separator).pop() |
| | | } |
| | | // eslint-disable-next-line |
| | | let option = item.options.filter(cell => item.initval == cell.value)[0] |
| | | let option = item.options.filter(cell => initval == cell.value)[0] |
| | | |
| | | if (option) { |
| | | reFieldsVal = reFieldsVal || {} |
| | | item.subFields.forEach(n => { |
| | | reFieldsVal[n.field] = option[n.field] |
| | | }) |
| | | } |
| | | } else if (item.fillField && item.initval && item.separator && item.options.length > 0) { |
| | | let initvals = item.initval.split(item.separator) |
| | | let label = [] |
| | | initvals.forEach(m => { |
| | | // eslint-disable-next-line |
| | | let option = item.options.filter(cell => m == cell.value)[0] |
| | | if (option) { |
| | | label.push(option.label) |
| | | } |
| | | }) |
| | | |
| | | label = label.join(item.separator) |
| | | |
| | | if (label) { |
| | | reFieldsVal = reFieldsVal || {} |
| | | reFieldsVal[item.fillField] = label |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | if (item.subFields && item.options.length > 0) { |
| | | let initval = item.initval |
| | | if (item.type === 'cascader' && item.separator) { |
| | | initval = initval.split(item.separator).pop() |
| | | } |
| | | // eslint-disable-next-line |
| | | let option = item.options.filter(cell => item.initval == cell.value)[0] |
| | | let option = item.options.filter(cell => initval == cell.value)[0] |
| | | |
| | | if (option) { |
| | | reFieldsVal = reFieldsVal || {} |
| | | item.subFields.forEach(n => { |
| | | reFieldsVal[n.field] = option[n.field] |
| | | }) |
| | | } |
| | | } else if (item.fillField && item.initval && item.separator && item.options.length > 0) { |
| | | let initvals = item.initval.split(item.separator) |
| | | let label = [] |
| | | initvals.forEach(m => { |
| | | // eslint-disable-next-line |
| | | let option = item.options.filter(cell => m == cell.value)[0] |
| | | if (option) { |
| | | label.push(option.label) |
| | | } |
| | | }) |
| | | |
| | | label = label.join(item.separator) |
| | | |
| | | if (label) { |
| | | reFieldsVal = reFieldsVal || {} |
| | | reFieldsVal[item.fillField] = label |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | options = options.filter(option => { |
| | | if (option.ParentID === config.topmark) { |
| | | _options.push({ |
| | | label: option.label, |
| | | value: option.value |
| | | }) |
| | | _options.push(option) |
| | | return false |
| | | } |
| | | return true |
| | |
| | | |
| | | options = options.filter(option => { |
| | | if (option.ParentID === parent.value) { |
| | | parent.children.push({ |
| | | label: option.label, |
| | | value: option.value |
| | | }) |
| | | parent.children.push(option) |
| | | return false |
| | | } |
| | | return true |
| | |
| | | let other = {} |
| | | |
| | | let _value = val.join(config.separator) |
| | | let _option = option[option.length - 1] |
| | | |
| | | if (config.fillFieldId) { |
| | | let _label = option.map(m => m.label).join(config.separator) |
| | | other[config.fillField] = _label |
| | | MKEmitter.emit('mkFC', 'input', config.fillFieldId, _label) |
| | | if (config.subFields && _option) { |
| | | config.subFields.forEach((n, i) => { |
| | | other[n.field] = _option[n.field] |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkFC', 'input', n.uuid, _option[n.field]) |
| | | }, i * 5) |
| | | }) |
| | | } |
| | | |
| | | this.props.onChange(_value, other) |
| | |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'fillField', |
| | | label: '填充表单', |
| | | tooltip: '在切换选项时会把级联菜单的文本自动填入关联的表单中。', |
| | | initVal: card.fillField || '', |
| | | options: inputfields |
| | | }, |
| | | // { |
| | | // type: 'number', |
| | | // key: 'marginTop', |
| | |
| | | datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'splitline', 'marginTop', 'marginBottom'], |
| | | datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'], |
| | | textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom', 'enterReplace'], |
| | | cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator', 'fillField'], |
| | | cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator'], |
| | | color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'], |
| | | rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'rateCount', 'character', 'place'], |
| | | hint: ['label', 'field', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], |
| | |
| | | |
| | | if (type === 'cascader') { |
| | | if (this.record.resourceType === '0') { // 自定义资源 |
| | | shows.push('options', 'topmark') |
| | | shows.push('options', 'topmark', 'linkSubField') |
| | | } else if (this.record.resourceType === '1') { // 数据源 |
| | | shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField') |
| | | shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField', 'linkSubField') |
| | | } |
| | | reTypes.linkField = 'text' |
| | | reTooltip.linkField = '用于构建数据结构。' |
| | |
| | | let linkSubFields = this.record.linkSubField || [] |
| | | |
| | | if (type !== 'checkcard') { |
| | | if (!['select', 'radio', 'link'].includes(type)) { |
| | | if (!['select', 'radio', 'link', 'cascader'].includes(type)) { |
| | | linkSubFields = [] |
| | | } |
| | | if (type === 'radio' && this.record.linkField) { |
| | | type = 'link' |
| | | } else if (type === 'cascader') { |
| | | type = 'link' |
| | | if (this.record.resourceType === '2') { // 自定义资源 |
| | | linkSubFields = [] |
| | | } |
| | | } |
| | | content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/> |
| | | } else { |