From 0eb129a9beddbb86ae74d7106a8e60823206b8d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 14 十二月 2023 11:29:15 +0800 Subject: [PATCH] 2023-12-14 --- src/menu/components/form/simple-form/index.jsx | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index f267c58..b5e6fb1 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -69,7 +69,7 @@ setting: {title: '', align: 'left_right', enable: 'true'}, style: {}, fields: [], - subButton: {label: '鎻愪氦', type: 'submit', intertype: 'system', reload: 'false', sqlType: 'update', sql: '', Ot: 'notRequired', execSuccess: 'never', enable: 'true', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px', paddingTop: '5px', paddingBottom: '5px'}}, + subButton: {label: '鎻愪氦', type: 'submit', intertype: 'system', reload: 'false', sqlType: '', sql: '', Ot: 'notRequired', execSuccess: 'never', enable: 'true', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px', paddingTop: '5px', paddingBottom: '5px'}}, }] } @@ -80,6 +80,10 @@ card: _card }) } + } + + componentDidMount () { + MKEmitter.addListener('mkUpdateInter', this.mkUpdateInter) } shouldComponentUpdate (nextProps, nextState) { @@ -93,6 +97,21 @@ this.setState = () => { return } + MKEmitter.removeListener('mkUpdateInter', this.mkUpdateInter) + } + + mkUpdateInter = (inter, split) => { + const { card } = this.state + + if (card.wrap.datatype === 'public' && card.wrap.publicId === inter.uuid) { + let _card = {...card, columns: fromJS(inter.columns).toJS()} + + split.delay = split.delay + 10 + + setTimeout(() => { + this.updateComponent(_card) + }, split.delay) + } } /** @@ -104,7 +123,7 @@ card.errors = [] let idCtrl = false - if (card.wrap.datatype !== 'static') { + if (card.wrap.datatype === 'dynamic') { let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' if (supModule === 'empty') { supModule = '' @@ -118,6 +137,9 @@ } card.subcards.forEach(item => { + if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true @@ -128,16 +150,22 @@ }) }) } else { - let supModule = card.wrap.supModule ? card.wrap.supModule[card.wrap.supModule.length - 1] : '' + let supModule = '' + if (card.wrap.datatype === 'static') { + supModule = card.wrap.supModule ? card.wrap.supModule[card.wrap.supModule.length - 1] : '' + } card.$tables = getTables(card) card.subcards.forEach(item => { + if (item.subButton.intertype === 'system' && !item.subButton.sqlType) { + card.errors.push({ level: 0, detail: `${item.subButton.label} 鎸夐挳璇疯缃搷浣滅被鍨媊}) + } item.fields.forEach(m => { if (m.dataSource && /@ID@/ig.test(m.dataSource)) { idCtrl = true } - if (m.type === 'linkMain' && !supModule) { + if (m.type === 'linkMain' && !supModule && card.wrap.datatype === 'static') { card.errors.push({ level: 1, detail: `璇锋鏌ュ叧鑱斾富琛ㄢ��${m.label}鈥濇槸鍚︽湁鏁坄}) } }) @@ -497,6 +525,17 @@ } else { _card.setting.supModule = '' } + } else if (res.datatype === 'public') { + let interfaces = window.GLOB.customMenu.interfaces || [] + + let d = interfaces.filter(m => m.uuid === res.publicId && m.status === 'true')[0] + + if (d) { + _card.columns = fromJS(d.columns).toJS() + + _card.setting = { interType: 'system' } + _card.scripts = [] + } } _card.subcards[0].setting.focus = _card.wrap.focus @@ -563,8 +602,7 @@ <PasteForms config={card.subcards[0]} update={this.pasteForm} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> - {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} - {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/> : null} + {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}}/>} </div> } trigger="hover"> <ToolOutlined /> -- Gitblit v1.8.0