From 78a727a5acfb9aac5094307f13e8c4dfa1f792cb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 13 四月 2025 00:27:22 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/views/tabledesign/index.jsx | 2 src/menu/delExtraDb/index.jsx | 281 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/views/pcdesign/index.jsx | 2 src/assets/css/design.scss | 3 src/menu/components/share/pasteforms/index.jsx | 6 + src/views/mobdesign/index.jsx | 2 src/views/menudesign/index.jsx | 2 src/menu/delExtraDb/index.scss | 0 8 files changed, 298 insertions(+), 0 deletions(-) diff --git a/src/assets/css/design.scss b/src/assets/css/design.scss index 1c2be11..db7db9a 100644 --- a/src/assets/css/design.scss +++ b/src/assets/css/design.scss @@ -171,6 +171,9 @@ .anticon { display: none; } + span { + margin-left: 0px!important; + } } button:hover { color: #26C281; diff --git a/src/menu/components/share/pasteforms/index.jsx b/src/menu/components/share/pasteforms/index.jsx index 180304b..c096113 100644 --- a/src/menu/components/share/pasteforms/index.jsx +++ b/src/menu/components/share/pasteforms/index.jsx @@ -87,6 +87,7 @@ let forms = fromJS(config.fields).toJS() let fields = fromJS(result.fields).toJS() let repeats = [] + let lastId = '' forms = forms.map(item => { if (!item.field) return item @@ -94,11 +95,16 @@ let cell = fields.filter(m => m.field && m.field.toLowerCase() === item.field.toLowerCase())[0] if (cell) { repeats.push(cell.field) + lastId = cell.uuid return cell } return item }) + + if (lastId) { + window.GLOB.formId = lastId + } fields = fields.filter(m => !m.field || !repeats.includes(m.field)) diff --git a/src/menu/delExtraDb/index.jsx b/src/menu/delExtraDb/index.jsx new file mode 100644 index 0000000..5f7c0e6 --- /dev/null +++ b/src/menu/delExtraDb/index.jsx @@ -0,0 +1,281 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { fromJS } from 'immutable' +import { Modal, Button, notification } from 'antd' + +// import './index.scss' + +const { confirm } = Modal + +class DelExtraDb extends Component { + static propTpyes = { + config: PropTypes.object, + updateConfig: PropTypes.func + } + + trigger = () => { + const that = this + confirm({ + title: '纭畾瑕佹竻闄ゅ搴撳悧锛�', + content: '閰嶇疆涓殑@db@灏嗚娓呴櫎', + okText: '纭畾', + cancelText: '鍙栨秷', + onOk() { + that.exec() + }, + onCancel() {} + }) + } + + checkBtn = (cell) => { + if (cell.modal && cell.modal.fields && cell.modal.fields.length) { + cell.modal.fields = cell.modal.fields.map(n => { + if (n.dataSource) { + n.dataSource = n.dataSource.replace(/@db@/ig, '') + } + return n + }) + } + if (cell.sql) { + cell.sql = cell.sql.replace(/@db@/ig, '') + } + if (cell.cbTable) { + cell.cbTable = cell.cbTable.replace(/@db@/ig, '') + } + if (cell.sheet) { + cell.sheet = cell.sheet.replace(/@db@/ig, '') + } + if (cell.verify) { + if (cell.verify.scripts) { + cell.verify.scripts = cell.verify.scripts.map(n => { + if (n.sql) { + n.sql = n.sql.replace(/@db@/ig, '') + } + return n + }) + } + if (cell.verify.cbScripts) { + cell.verify.cbScripts = cell.verify.cbScripts.map(n => { + if (n.sql) { + n.sql = n.sql.replace(/@db@/ig, '') + } + return n + }) + } + if (cell.verify.customverifys) { + cell.verify.customverifys = cell.verify.customverifys.map(n => { + if (n.sql) { + n.sql = n.sql.replace(/@db@/ig, '') + } + return n + }) + } + } + } + + exec = () => { + let config = fromJS(this.props.config).toJS() + + let _replace = (components) => { + return components.map(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + tab.components = _replace(tab.components) + }) + return item + } else if (item.type === 'group') { + item.components = _replace(item.components) + return item + } + + if (item.setting) { + if (item.setting.tableName) { + item.setting.tableName = item.setting.tableName.replace(/@db@/ig, '') + } + if (item.setting.dataresource) { + item.setting.dataresource = item.setting.dataresource.replace(/@db@/ig, '') + } + if (item.scripts) { + item.scripts = item.scripts.map(cell => { + cell.sql = cell.sql.replace(/@db@/ig, '') + return cell + }) + } + } + + if (item.search) { + if (Array.isArray(item.search)) { + item.search = item.search.map(col => { + if (col.dataSource) { + col.dataSource = col.dataSource.replace(/@db@/ig, '') + } + return col + }) + } else if (item.search.fields) { + item.search.fields = item.search.fields.map(col => { + if (col.dataSource) { + col.dataSource = col.dataSource.replace(/@db@/ig, '') + } + return col + }) + if (item.search.groups) { + item.search.groups = item.search.groups.map(group => { + if (group.fields) { + group.fields = group.fields.map(col => { + if (col.dataSource) { + col.dataSource = col.dataSource.replace(/@db@/ig, '') + } + return col + }) + } + return group + }) + } + } + } + + if (item.action) { + item.action.forEach(m => { + this.checkBtn(m) + + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } + }) + } + + if (item.subcards) { + item.subcards.forEach(card => { + if (card.subButton) { + this.checkBtn(card.subButton) + } + if (card.elements) { // 鍗$墖 + card.elements = card.elements.map(m => { + if (m.eleType !== 'button') return m + + this.checkBtn(m) + + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } + return m + }) + } + + if (card.backElements) { // 鍗$墖 + card.backElements = card.backElements.map(m => { + if (m.eleType !== 'button') return m + + this.checkBtn(m) + + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } + return m + }) + } + + if (card.fields) { // 琛ㄥ崟 + card.fields = card.fields.map(m => { + if (m.dataSource) { + m.dataSource = m.dataSource.replace(/@db@/ig, '') + } + return m + }) + } + }) + } + + if (item.elements) { + item.elements = item.elements.map(m => { + if (m.eleType !== 'button') return m + + this.checkBtn(m) + + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } + return m + }) + } + + if (item.cols) { + let _update = (cols) => { + return cols.map(col => { + if (col.type === 'custom' && col.elements) { + col.elements = col.elements.map(m => { + if (m.eleType !== 'button') return m + + this.checkBtn(m) + + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } + + return m + }) + } else if (col.type === 'colspan') { + col.subcols = _update(col.subcols) + } + + return col + }) + } + + item.cols = _update(item.cols) + } + + if (item.subtype === 'editable' && item.submit) { + if (item.submit.sheet) { + item.submit.sheet = item.submit.sheet.replace(/@db@/ig, '') + } + if (item.submit.scripts) { + item.submit.scripts = item.submit.scripts.map(n => { + if (n.sql) { + n.sql = n.sql.replace(/@db@/ig, '') + } + return n + }) + } + } + + return item + }) + } + + config.components = _replace(config.components) + + config.interfaces && config.interfaces.forEach(item => { + if (item.setting) { + if (item.setting.tableName) { + item.setting.tableName = item.setting.tableName.replace(/@db@/ig, '') + } + if (item.setting.dataresource) { + item.setting.dataresource = item.setting.dataresource.replace(/@db@/ig, '') + } + if (item.scripts) { + item.scripts = item.scripts.map(cell => { + cell.sql = cell.sql.replace(/@db@/ig, '') + return cell + }) + } + } + }) + + notification.success({ + top: 92, + message: '澶栧簱宸叉竻闄ゃ��', + duration: 3 + }) + this.props.updateConfig(config) + } + + render() { + // <HddOutlined /> + return ( + <Button className="mk-border-yellow" icon="hdd" onClick={this.trigger}>娓呴櫎澶栧簱</Button> + ) + } +} + +export default DelExtraDb \ No newline at end of file diff --git a/src/menu/delExtraDb/index.scss b/src/menu/delExtraDb/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/menu/delExtraDb/index.scss diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 1904f57..81247eb 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -35,6 +35,7 @@ const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const DelExtraDb = asyncComponent(() => import('@/menu/delExtraDb')) const LowerField = asyncComponent(() => import('@/menu/lowerField')) const Debug = asyncComponent(() => import('@/menu/debug')) const NormalCss = asyncComponent(() => import('@/menu/normalCss')) @@ -1367,6 +1368,7 @@ {config ? <Dropdown placement="bottomCenter" overlay={<div className="mk-opeartion-dropdown-wrap"> <ReplaceField config={config} updateConfig={this.resetConfig}/> <LowerField config={config} updateConfig={this.resetConfig}/> + <DelExtraDb config={config} updateConfig={this.resetConfig}/> <PictureController/> <Button onClick={() => window.open('#/ai')}>DeepSeek</Button> </div>} trigger={['hover']}> diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 9e9d219..59c5caf 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -34,6 +34,7 @@ const TableNodes = asyncComponent(() => import('@/menu/tablenodes')) const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const DelExtraDb = asyncComponent(() => import('@/menu/delExtraDb')) const LowerField = asyncComponent(() => import('@/menu/lowerField')) const NormalCss = asyncComponent(() => import('@/menu/normalCss')) const NormalCopy = asyncComponent(() => import('@/menu/normalCopy')) @@ -2314,6 +2315,7 @@ <Button className="mk-border-purple" disabled={MenuId === appLoginId} data-title="褰撳墠鑿滃崟涓哄簲鐢ㄧ櫥褰曢〉" onClick={this.setLoginView}><LoginOutlined /> 璁句负鐧诲綍椤�</Button> <ReplaceField config={config} updateConfig={this.resetConfig}/> <LowerField config={config} updateConfig={this.resetConfig}/> + <DelExtraDb config={config} updateConfig={this.resetConfig}/> <Transfer MenuID={MenuId} /> {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} <Button type="default" onClick={this.closeView}>鍏抽棴</Button> diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 497620c..259eeb2 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -39,6 +39,7 @@ const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const DelExtraDb = asyncComponent(() => import('@/menu/delExtraDb')) const LowerField = asyncComponent(() => import('@/menu/lowerField')) const NormalCss = asyncComponent(() => import('@/menu/normalCss')) const NormalCopy = asyncComponent(() => import('@/menu/normalCopy')) @@ -1939,6 +1940,7 @@ <Button className="mk-border-purple" disabled={MenuId === appLoginId} data-title="褰撳墠鑿滃崟涓哄簲鐢ㄧ櫥褰曢〉" onClick={this.setLoginView}><LoginOutlined/> 璁句负鐧诲綍椤�</Button> <ReplaceField config={config} updateConfig={this.resetConfig}/> <LowerField config={config} updateConfig={this.resetConfig}/> + <DelExtraDb config={config} updateConfig={this.resetConfig}/> <Transfer MenuID={MenuId} /> {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} <Button type="default" onClick={this.closeView}>鍏抽棴</Button> diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 2593829..f662bfa 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -33,6 +33,7 @@ const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const DelExtraDb = asyncComponent(() => import('@/menu/delExtraDb')) const LowerField = asyncComponent(() => import('@/menu/lowerField')) const Debug = asyncComponent(() => import('@/menu/debug')) const Versions = asyncComponent(() => import('@/menu/versions')) @@ -1095,6 +1096,7 @@ {config ? <Dropdown placement="bottomCenter" overlay={<div className="mk-opeartion-dropdown-wrap"> <ReplaceField config={config} updateConfig={this.resetConfig}/> <LowerField config={config} updateConfig={this.resetConfig}/> + <DelExtraDb config={config} updateConfig={this.resetConfig}/> <Button onClick={() => window.open('#/ai')}>DeepSeek</Button> </div>} trigger={['hover']}> <div className="mk-button-more">鏇村<DownOutlined/></div> -- Gitblit v1.8.0