From 92664ef80a97a63fde223b14097ccda3ae6ff183 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 四月 2025 14:31:57 +0800 Subject: [PATCH] Merge branch 'positec' into dms --- src/views/tabledesign/index.jsx | 219 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 195 insertions(+), 24 deletions(-) diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 61f2b2d..235d3e2 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -4,15 +4,15 @@ import { is, fromJS } from 'immutable' import moment from 'moment' import HTML5Backend from 'react-dnd-html5-backend' -import { notification, Modal, Collapse, Card, Switch, Button, Typography } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons' +import { notification, Modal, Collapse, Card, Switch, Button, Typography, message, Dropdown } from 'antd' +import { DoubleLeftOutlined, DoubleRightOutlined, CopyOutlined, DownOutlined } from '@ant-design/icons' import md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' import { langs } from '@/store/options' import MKEmitter from '@/utils/events.js' -import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' +import { getTables, getFuncsAndInters, getOutMessage, getLangTrans, getAllSqls } from '@/utils/utils-custom.js' import SourceElement from '@/templates/zshare/dragsource' import asyncComponent from '@/utils/asyncComponent' import Source from './source' @@ -33,10 +33,14 @@ 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 LowerText = asyncComponent(() => import('@/menu/lowerText')) const Debug = asyncComponent(() => import('@/menu/debug')) const Versions = asyncComponent(() => import('@/menu/versions')) const Transfer = asyncComponent(() => import('@/menu/transfer')) const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) +const NormalCopy = asyncComponent(() => import('@/menu/normalCopy')) const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) const ModalController = asyncComponent(() => import('@/menu/modalconfig/controller')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) @@ -540,6 +544,8 @@ } else if (this.checklog()) { if (sessionStorage.getItem('langList') && !config.trans) { + } else if (config.enabled && !config.allSqls) { + } else { notification.success({ top: 92, @@ -564,6 +570,52 @@ } else if (!config.enabled && config.force && _pass) { config.enabled = true delete config.force + } + + let long_data = '' + if (config.enabled) { + let sqls = getAllSqls(config) + let _t = moment().format('YYYYMMDDHHmmss') + let getguid = () => { + let uuid = '' + for (let i = 0; i < 18; i++) { + uuid += String.fromCharCode(Math.floor(Math.random() * 26) + 65) + } + uuid = uuid.replace(/minke/ig, 'MNKIE') + return uuid + } + + long_data = [] + // let oriIds = {} + // if (config.allSqls) { + // config.allSqls.forEach(item => { + // if (!item.md5) return + // oriIds[item.uuid + item.md5] = item.v_id + // }) + // } + + config.allSqls = sqls.map(item => { + let v_id = _t + getguid() + + // if (oriIds[item.uuid + item.md5]) { + // v_id = oriIds[item.uuid + item.md5] + // } + + long_data.push(`${md5(window.GLOB.appkey + v_id)},${item.uuid},${v_id},${window.btoa(window.encodeURIComponent(item.LText))},${config.sqlperm === 'false' ? '' : item.roleId || ''}`) + + return { + uuid: item.uuid, + v_id: v_id, + type: item.type, + reps: item.reps, + // md5: item.md5 || '', + luser: item.luser === true + } + }) + + long_data = long_data.join(';') + } else { + delete config.allSqls } let tbs = [] @@ -600,6 +652,7 @@ } let interfaces = getFuncsAndInters(config) + let msg = getOutMessage(config) let urlFields = config.urlFields ? config.urlFields.join(',') : '' let langSql = getLangTrans(config) @@ -613,10 +666,9 @@ EasyCode: config.easyCode || '', Template: 'BaseTable', MenuName: config.MenuName || '', - PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), + PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, msg, backend: 'level1', enabled: config.enabled, urlFields}), open_edition: config.open_edition, - // LText: '', - // LTexttb: '', + long_data: long_data, debug_md5: key, debug_url: url, debug_list: window.btoa(tbs), @@ -686,18 +738,11 @@ }, 300 + (+sessionStorage.getItem('mkDelay'))) } - netError = (error) => { + netError = () => { this.setState({ menuloading: false }) - if (!error) { - notification.warning({ - top: 92, - message: '淇濆瓨澶辫触锛岃妫�鏌ョ綉缁滄槸鍚︽甯搞��', - duration: 5 - }) - } MKEmitter.emit('completeSave') } @@ -848,6 +893,129 @@ return is(fromJS(oriConfig), fromJS(config)) } + copyMenu = () => { + const { config } = this.state + + if (!config.enabled) { + notification.warning({ + top: 92, + message: '鑿滃崟鏈惎鐢紝涓嶅彲澶嶅埗銆�', + duration: 5 + }) + } else { + let msg = { copyType: 'components', type: 'admin', interfaces: [] } + + msg.components = fromJS(config.components).toJS() + msg.components.forEach((item, i) => { + if (item.type === 'tabs') { + item.name = '鏍囩缁�' + i + item.width = 24 + item.subtype = 'tabs' + item.setting = {autoSwitch: 'false', blacklist: [], name: item.name, position: 'top', supModule: [], tabStyle: 'line', width: 24} + + item.subtabs.forEach(tab => { + tab.components[0].subtype = 'normaltable' + tab.components[0].width = 24 + tab.components[0].wrap.width = 24 + tab.components[0].wrap.name = tab.components[0].name + + tab.components[0].action.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + tab.components[0].cols = tab.components[0].cols.filter(col => !(col.field && col.Hide === 'true')) + tab.components[0].cols.forEach(col => { + if (col.type !== 'custom') return + col.elements.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + }) + }) + } else { + item.subtype = 'normaltable' + item.width = 24 + item.wrap.width = 24 + item.wrap.name = item.name + item.action.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + item.cols = item.cols.filter(col => !(col.field && col.Hide === 'true')) + item.cols.forEach(col => { + if (col.type !== 'custom') return + col.elements.forEach(btn => { + if (btn.OpenType === 'popview' && btn.config) { + btn.config.Template = 'CustomPage' + if (btn.config.components[0]) { + btn.config.components[0].subtype = 'normaltable' + } + } + }) + }) + } + }) + + if (msg.components[0].search && msg.components[0].search.length > 0) { + let cell = { + uuid: Utils.getuuid(), + type: 'search', + width: 24, + subtype: 'mainsearch', + name: '鎼滅储', + search: msg.components[0].search, + style: {borderBottomColor: '#f0f0f0', borderBottomWidth: '1px'}, + wrap: {float: 'left', blacklist: [], name: '鎼滅储', width: 24} + } + + cell.wrap.advanceType = msg.components[0].wrap.advanceType || 'modal' + cell.wrap.advanceWidth = msg.components[0].wrap.advanceWidth || 1000 + cell.wrap.searchLwidth = msg.components[0].wrap.searchLwidth || 33.3 + cell.wrap.searchRatio = msg.components[0].wrap.searchRatio || 6 + cell.wrap.resetContrl = msg.components[0].wrap.resetContrl || 'init' + cell.wrap.show = msg.components[0].wrap.show || 'true' + + if (cell.wrap.advanceType === 'drawer') { + cell.wrap.drawerPlacement = msg.components[0].wrap.drawerPlacement || 'left' + } + + msg.components[0].search = [] + msg.components[0].setting.useMSearch = 'true' + + msg.components.unshift(cell) + msg.components[0].$tables = getTables(msg.components[0]) + msg.components[1].$tables = getTables(msg.components[1]) + } + + try { + msg = window.btoa(window.encodeURIComponent(JSON.stringify(msg))) + } catch (e) { + console.warn('Stringify Failure') + msg = '' + } + + let oInput = document.createElement('input') + oInput.value = msg + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + message.success('澶嶅埗鎴愬姛銆�') + } + } + updateLogConfig = (config) => { config.fstMenuId = this.state.config.fstMenuId || config.fstMenuId || '' config.parentId = this.state.config.parentId || config.parentId || '' @@ -895,7 +1063,9 @@ /> {/* 琛ㄥ悕娣诲姞 */} <TableComponent config={config} updatetable={this.updateConfig}/> - <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> + <Paragraph style={{padding: '15px 0px 0px 32px'}} copyable={{ text: MenuId }}>鑿滃崟ID锛�</Paragraph> + <Paragraph style={{padding: '0px 0px 0px 18px'}}>澶嶅埗鑿滃崟涓嬫墍鏈夌粍浠讹細<CopyOutlined onClick={this.copyMenu} style={{cursor: 'pointer', color: '#1890ff'}} /></Paragraph> + <NormalCopy /> </> : null} </Panel> <Panel header="鎼滅储" key="search"> @@ -918,22 +1088,23 @@ <div className={'menu-view' + (menuloading ? ' saving' : '')}> <Card bordered={false} extra={ <div className="mk-opeartion-list"> - {/* <Dropdown overlay={ - <div className="mk-button-dropdown-wrap"> - <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> - </div> - } trigger={['click']} placement="bottomCenter"> - <Button className="mk-button-more">鏇村<DownOutlined/></Button> - </Dropdown> */} {config ? <Debug config={config}/> : null} {config ? <Transfer config={config}/> : null} {config ? <Unattended config={config} updateConfig={this.updateConfig}/> : null} {config ? <Versions MenuId={MenuId} Template="BaseTable" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} <TableNodes config={config} /> - <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> <PasteBaseTable type="page" insert={this.insert}/> + {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}/> + <LowerText /> + <Button onClick={() => window.open('#/ai')}>DeepSeek</Button> + </div>} trigger={['hover']}> + <div className="mk-button-more">鏇村<DownOutlined/></div> + </Dropdown> : null} {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} - <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> + <Button type="primary" id="save-config" disabled={!config} onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> <Button type="default" disabled={menuloading} onClick={this.closeView}>鍏抽棴</Button> </div> } style={{ width: '100%' }}> -- Gitblit v1.8.0