From d1d9dc29318cb2a9a466246adff7b78fe36cf623 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 11 三月 2023 17:51:29 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/form/step-form/index.jsx | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 105 insertions(+), 2 deletions(-) diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index 32bc1f9..3f37ddf 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -132,6 +132,7 @@ card.width = card.wrap.width card.name = card.wrap.name card.errors = [] + let idCtrl = false if (card.wrap.datatype !== 'static') { let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' @@ -158,6 +159,9 @@ card.subcards.forEach(item => { item.fields.forEach(m => { + if (m.dataSource && /@ID@/ig.test(m.dataSource)) { + idCtrl = true + } if (m.type === 'linkMain' && !supModule) { card.errors.push({ level: 1, detail: `璇锋鏌ュ垎缁勨��${item.setting.title}鈥濅腑鍏宠仈涓昏〃鈥�${m.label}鈥濇槸鍚︽湁鏁坄}) } @@ -170,12 +174,17 @@ card.subcards.forEach(item => { item.fields.forEach(m => { + if (m.dataSource && /@ID@/ig.test(m.dataSource)) { + idCtrl = true + } if (m.type === 'linkMain' && !supModule) { card.errors.push({ level: 1, detail: `璇锋鏌ュ垎缁勨��${item.setting.title}鈥濅腑鍏宠仈涓昏〃鈥�${m.label}鈥濇槸鍚︽湁鏁坄}) } }) }) } + + card.idCtrl = idCtrl this.setState({ card: card @@ -563,7 +572,7 @@ let param = { func: 's_debug_sql', exec_type: 'y', - LText: `declare @mk_organization nvarchar(512) + LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) ${res.dataSource}` } @@ -688,6 +697,98 @@ this.updateComponent(_card) } + clearGroup = () => { + let group = fromJS(this.state.group).toJS() + let card = fromJS(this.state.card).toJS() + let _this = this + + group.fields = [] + + card.subcards = card.subcards.map(item => { + if (item.uuid === group.uuid) { + return group + } + return item + }) + + confirm({ + content: `纭畾娓呯┖琛ㄥ崟鍚楋紵`, + onOk() { + _this.setState({group}) + _this.updateComponent(card) + }, + onCancel() {} + }) + } + + parseForm = (g, res) => { + let _group = fromJS(g).toJS() + let _confirm = false + + if (res.copyType === 'form') { + let fieldrepet = false // 瀛楁閲嶅 + res.uuid = Utils.getuuid() + + _group.fields.forEach(item => { + if (res.field && item.field && item.field.toLowerCase() === res.field.toLowerCase()) { + fieldrepet = true + } + }) + + if (fieldrepet) { + notification.warning({ + top: 92, + message: '瀛楁宸插瓨鍦紒', + duration: 10 + }) + return + } + _group.fields.push(res) + } else { + if (_group.fields.length > 0) { + _confirm = true + } + + _group.fields = res.fields.map(item => { + item.uuid = Utils.getuuid() + return item + }) + } + + if (_confirm) { + let that = this + confirm({ + title: '纭畾鏇挎崲琛ㄥ崟鍚楋紵', + content: '鍘熻〃鍗曞皢鍒犻櫎銆�', + onOk() { + that.updateForms(_group) + }, + onCancel() {} + }) + } else { + this.updateForms(_group) + } + } + + updateForms = (_group) => { + const { group } = this.state + let card = fromJS(this.state.card).toJS() + + card.subcards = card.subcards.map(item => { + if (item.uuid === _group.uuid) { + return _group + } + return item + }) + + if (_group.uuid === group.uuid) { + this.setState({group: _group}) + this.updateComponent(card) + } else { + this.updateComponent(card) + } + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -734,12 +835,14 @@ selectId={group ? group.uuid : ''} handleList={this.changecards} handleGroup={this.changeGroup} + handleForm={this.parseForm} closeGroup={this.closeGroup} selectGroup={this.selectGroup} /> - {group ? <div className="form-area"> + {group ? <div className={`form-area mk-${card.wrap.formStyle || ''}`}> <PlusOutlined className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm}/> <FieldsComponent config={group} type="form" plusFields={this.plusFields} /> + <span style={{color: 'red', marginLeft: '30px', cursor: 'pointer'}} onClick={this.clearGroup}>娓呯┖</span> <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(1)}>1鍒�</Button> : null} {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2鍒�</Button> : null} -- Gitblit v1.8.0