From c62724a2cdbafa3c660538955acbedafa5a01871 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 01 六月 2024 15:25:21 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/templates/modalconfig/index.jsx | 127 ++--------------------------------------- 1 files changed, 8 insertions(+), 119 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 3f2571f..cabfc7d 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -14,7 +14,6 @@ import asyncComponent from '@/utils/asyncComponent' import { BaseConfig, SearchItems } from './source' import { updateForm } from '@/utils/utils-update.js' -import MKEmitter from '@/utils/events.js' import './index.scss' const { Panel } = Collapse @@ -124,7 +123,7 @@ componentDidMount() { window.GLOB.formId = '' - MKEmitter.addListener('submitStyle', this.getStyle) + document.onkeydown = (event) => { let e = event || window.event let keyCode = e.keyCode || e.which || e.charCode @@ -157,7 +156,6 @@ * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ componentWillUnmount () { - MKEmitter.removeListener('submitStyle', this.getStyle) this.setState = () => { return } @@ -184,24 +182,6 @@ } this.props.handleView(param) - } - - getStyle = (comIds, style) => { - const { config } = this.state - - if (comIds[0] !== 'form') return - - let Index = config.fields.findIndex(n => n.uuid === comIds[1]) - - if (Index === -1) return - - let _config = fromJS(config).toJS() - - _config.fields[Index].style = style - - this.setState({ - config: _config - }) } /** @@ -236,112 +216,21 @@ handleForm = (_card) => { const { menu, tabConfig, subTabConfig } = this.props const { config } = this.state + let card = fromJS(_card).toJS() - let _inputfields = [] - let _tabfields = [] - let _linkableFields = [] - let _linksupFields = [] - let standardform = null - let index = null - - config.fields.forEach((item, i) => { - if (card.uuid === item.uuid) { - index = i - } - - if (!item.field || card.field === item.field) return - - if (['text', 'number', 'textarea', 'color'].includes(item.type)) { - _inputfields.push({ - field: item.field, - label: item.label - }) - } - if (item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) { - _tabfields.push({ - field: item.field, - label: item.label - }) - } - - if (['switch', 'check', 'popSelect'].includes(item.type)) { - _linksupFields.push({ - field: item.field, - label: item.label - }) - } - - if (!['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) return - - _linksupFields.push({ - field: item.field, - label: item.label - }) - - if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) return - - _linkableFields.push({ - field: item.field, - label: item.label + '-琛ㄥ崟' - }) - }) - - if (index !== null) { - if (index === 0) { - standardform = config.fields[index + 1] || null - } else { - standardform = config.fields[index - 1] || null - } - } - - let _fields = _linkableFields.map(cell => cell.field) + let columns = [] if (subTabConfig) { - subTabConfig.columns.forEach(col => { - if (col.field && !_fields.includes(col.field)) { - _linkableFields.push({ - field: col.field, - label: col.label + '-鏄剧ず鍒�' - }) - } - }) + columns = subTabConfig.columns } else if (tabConfig) { - tabConfig.columns.forEach(col => { - if (col.field && !_fields.includes(col.field)) { - _linkableFields.push({ - field: col.field, - label: col.label + '-鏄剧ず鍒�' - }) - } - }) + columns = tabConfig.columns } else if (menu.LongParam) { - menu.LongParam.columns.forEach(col => { - if (col.field && !_fields.includes(col.field)) { - _linkableFields.push({ - field: col.field, - label: col.label + '-鏄剧ず鍒�' - }) - } - }) - } - - if (card.linkSubField && card.linkSubField.length > 0) { - let fields = _inputfields.map(item => item.field) - card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) - } - - if (!card.span && standardform && standardform.span) { - card.span = standardform.span - card.labelwidth = standardform.labelwidth - } else if (!card.span) { - card.span = 12 - card.labelwidth = 33.3 + columns = menu.LongParam.columns } this.setState({ - standardform, visible: true, card: card, - formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields) + formlist: getModalForm(card, config.fields, columns) }) } @@ -772,7 +661,7 @@ card={this.state.card} formlist={this.state.formlist} inputSubmit={this.handleSubmit} - standardform={this.state.standardform} + fields={config.fields} wrappedComponentRef={(inst) => this.formRef = inst} /> </Modal> -- Gitblit v1.8.0