From 2a3629979d1bc6d0a6c90e481ac93eabd2bfefd1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 01 六月 2023 10:45:21 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/tabviews/custom/components/table/base-table/index.jsx | 27 package-lock.json | 51 src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx | 31 src/views/login/loginform.jsx | 7 src/menu/components/chart/antv-G6/index.jsx | 6 src/menu/components/table/edit-table/columns/tableIn/index.jsx | 43 src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx | 138 -- src/views/mobdesign/menuform/index.jsx | 5 src/views/pcdesign/menuform/index.jsx | 5 src/tabviews/custom/components/chart/antv-G6/index.jsx | 6 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 2 src/menu/components/chart/antv-X6/index.scss | 65 src/menu/components/chart/antv-X6/index.jsx | 1753 ++++++++++------------------------- src/views/menudesign/homeform/index.jsx | 5 src/views/menudesign/menuform/index.jsx | 5 src/tabviews/custom/popview/index.jsx | 24 src/views/mobdesign/popview/menuform/index.jsx | 5 src/tabviews/custom/components/table/edit-table/index.jsx | 58 src/views/tabledesign/index.jsx | 7 src/views/tabledesign/menuform/index.jsx | 2 src/tabviews/basetable/index.jsx | 4 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx | 1 src/api/index.js | 2 src/tabviews/custom/components/share/normalTable/index.jsx | 2 src/menu/menushell/card.jsx | 12 src/components/header/loginform.jsx | 4 src/views/mobdesign/index.jsx | 7 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 2 src/views/menudesign/index.jsx | 7 src/menu/modulesource/option.jsx | 2 src/views/menudesign/popview/menuform/index.jsx | 5 src/tabviews/custom/components/card/cardcellList/index.jsx | 4 src/menu/components/chart/antv-G6/index.scss | 19 src/menu/components/card/cardcellcomponent/index.jsx | 18 src/views/pcdesign/index.jsx | 7 src/tabviews/custom/components/table/normal-table/index.jsx | 27 src/views/login/logincloudform.jsx | 2 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 16 src/tabviews/custom/components/table/edit-table/normalTable/index.scss | 8 src/tabviews/zshare/mutilform/index.jsx | 14 src/menu/components/card/cardcellcomponent/formconfig.jsx | 3 src/tabviews/custom/index.jsx | 24 src/menu/components/table/base-table/columns/index.jsx | 138 +- package.json | 11 src/menu/components/table/normal-table/columns/index.jsx | 138 +- src/menu/components/table/edit-table/columns/index.jsx | 144 +- 46 files changed, 1,038 insertions(+), 1,828 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef69c52..9838f54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -624,9 +624,9 @@ } }, "@antv/x6": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/@antv/x6/-/x6-2.10.1.tgz", - "integrity": "sha512-38Fi9Qgnp+ylTrnRnhrGsc2cxsDosULbN6toVs9GjVpOguzq3oxRUblzO6dcnJhbzXfZxIcB/IuQt3pYpXJBKA==", + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/@antv/x6/-/x6-2.11.1.tgz", + "integrity": "sha512-DwyuT/zuTEhwsnKwCj67cadwLeEbB5jfdCxrkTnEm6pg0+vT3FinbF71IK7SHoY8d4HOHl+sJt7ikJfr61JqLw==", "requires": { "@antv/x6-common": "^2.0.12", "@antv/x6-geometry": "^2.0.5", @@ -646,6 +646,49 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@antv/x6-geometry/-/x6-geometry-2.0.5.tgz", "integrity": "sha512-MId6riEQkxphBpVeTcL4ZNXL4lScyvDEPLyIafvWMcWNTGK0jgkK7N20XSzqt8ltJb0mGUso5s56mrk8ysHu2A==" + }, + "@antv/x6-plugin-clipboard": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-clipboard/-/x6-plugin-clipboard-2.1.6.tgz", + "integrity": "sha512-roZPLnZx6PK8MBvee0QMo90fz/TXeF0WNe4EGin2NBq5M1I5XTWrYvA6N2XVIiWAAI67gjQeEE8TpkL7f8QdqA==" + }, + "@antv/x6-plugin-dnd": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-dnd/-/x6-plugin-dnd-2.0.5.tgz", + "integrity": "sha512-g8GGJS2XmM8C59juOBiFqaR/f8i8y8tqw9sJNwta7s1Phh3hwDd7o4kk36Kk5eTKkfZfnjEyWHMOqp/h+EDibQ==" + }, + "@antv/x6-plugin-history": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-history/-/x6-plugin-history-2.2.3.tgz", + "integrity": "sha512-yiv5e7CQKm1HrJe7je4iWjkzDzU+I0WsyL8En2j0UwXJrUNaKYyv4BkRg2tvyi52hydxidMgi3tNnNQHEZwoMg==" + }, + "@antv/x6-plugin-keyboard": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-keyboard/-/x6-plugin-keyboard-2.2.1.tgz", + "integrity": "sha512-sqfN0h4txVO211uIeKBd3zQ/IN2zPzDThWNTEhRx7Lecg1fO7uRXWBbOA48j3EgpRFXVexdSzIEVJEx+IWUdYw==", + "requires": { + "mousetrap": "^1.6.5" + } + }, + "@antv/x6-plugin-selection": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-selection/-/x6-plugin-selection-2.1.7.tgz", + "integrity": "sha512-ODfYLNwKSaLgIYMYfMW4dYQ9KKFOVBEdH0BzvyG8mfRol+JtZuyrm4BRbAvMryQKHrSxs4JCYXTFd2F7ZTuxLQ==" + }, + "@antv/x6-plugin-snapline": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-snapline/-/x6-plugin-snapline-2.1.7.tgz", + "integrity": "sha512-AsysoCb9vES0U2USNhEpYuO/W8I0aYfkhlbee5Kt4NYiMfQfZKQyqW/YjDVaS2pm38C1NKu1LdPVk/BBr4CasA==" + }, + "@antv/x6-plugin-stencil": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-stencil/-/x6-plugin-stencil-2.0.3.tgz", + "integrity": "sha512-pQkTIbMCezTqo38fofuFGnI30Rk0j5gHc/+Ndml1RHVEV0p8i1HGRAR5we7SVTcT56AHlP46H+oRFReQmVgvKA==" + }, + "@antv/x6-plugin-transform": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@antv/x6-plugin-transform/-/x6-plugin-transform-2.1.7.tgz", + "integrity": "sha512-idzBr8/Bcw8zHQUSNS0Y8VSNMigCWiUuiwqO572Ac/P2tMfP6Ot2SahEYHGUOD2NEMPr95q4JMZc+Evvt4JFTw==" }, "@antv/x6-react-components": { "version": "1.1.15", @@ -11290,7 +11333,7 @@ "insert-css": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/insert-css/-/insert-css-2.0.0.tgz", - "integrity": "sha1-610Ql7dUL0x56jBg067gfQU4gPQ=" + "integrity": "sha512-xGq5ISgcUP5cvGkS2MMFLtPDBtrtQPSFfC6gA6U8wHKqfjTIMZLZNxOItQnoSjdOzlXOLU/yD32RKC4SvjNbtA==" }, "internal-ip": { "version": "4.3.0", diff --git a/package.json b/package.json index c34f77a..7e417d1 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,15 @@ "@antv/g2": "^4.1.34", "@antv/g6": "^4.6.4", "@antv/util": "^2.0.17", - "@antv/x6": "^2.10.1", + "@antv/x6": "^2.11.1", + "@antv/x6-plugin-clipboard": "^2.1.6", + "@antv/x6-plugin-dnd": "^2.0.5", + "@antv/x6-plugin-history": "^2.2.3", + "@antv/x6-plugin-keyboard": "^2.2.1", + "@antv/x6-plugin-selection": "^2.1.7", + "@antv/x6-plugin-snapline": "^2.1.7", + "@antv/x6-plugin-stencil": "^2.0.3", + "@antv/x6-plugin-transform": "^2.1.7", "@antv/xflow": "^1.0.50", "@babel/core": "7.5.5", "@svgr/webpack": "4.3.2", @@ -55,6 +63,7 @@ "identity-obj-proxy": "3.0.0", "immutability-helper": "^3.0.1", "immutable": "^4.0.0-rc.12", + "insert-css": "^2.0.0", "is-wsl": "^1.1.0", "jest": "24.8.0", "jest-environment-jsdom-fourteen": "0.1.0", diff --git a/src/api/index.js b/src/api/index.js index 4f1467b..814b0dd 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -48,7 +48,7 @@ axios.interceptors.response.use((response) => { if (response.data.ErrCode === 'LoginError') { - if (window.debugger === true) { + if (window.debugger === true || window.GLOB.saving) { response.data.ErrCode = 'E' return Promise.resolve(response.data) } else if (!sessionStorage.getItem('loginError')) { diff --git a/src/components/header/loginform.jsx b/src/components/header/loginform.jsx index 45a57c0..b20fc13 100644 --- a/src/components/header/loginform.jsx +++ b/src/components/header/loginform.jsx @@ -58,6 +58,10 @@ if (oripassword && values.password === '*********') { values.password = oripassword } + + values.username = values.username.replace(/\t*|\v*|\s*/g, '') + values.password = values.password.replace(/\t*|\v*|\s*/g, '') + resolve(values) } else { reject(err) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index b0620bb..10007af 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -182,7 +182,7 @@ _options.push('linkurl') } } else if (this.record.linkType === 'other') { - _options.push('linkurl', 'joint') + _options.push('linkurl', 'joint', 'open') } else { _options.push('linkurl') } diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 603aeaf..76dc518 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -603,6 +603,7 @@ key: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', + tooltip: ['pc', 'mob'].includes(appType) ? '褰撻摼鎺ョ被鍨嬩负鈥滃叾浠栤�濓紝涓旈摼鎺ュ湴鍧�浠menuid@寮�澶存椂锛屽叾鍚庡唴瀹瑰皢琚涓鸿彍鍗旾D銆�' : '', required: true, options: [] }, @@ -611,7 +612,7 @@ key: 'open', label: '鎵撳紑鏂瑰紡', initVal: card.open || 'blank', - tooltip: '鑿滃崟鎵撳紑鏂瑰紡銆�', + tooltip: '鑿滃崟鎵撳紑鏂瑰紡锛岄摼鎺ユ棤鏁堛��', required: true, forbid: !['pc', 'mob'].includes(appType), options: [ diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 8e7bc2a..4d09c7e 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -180,12 +180,6 @@ getStyle = (style) => { const { card, elements } = this.state - // if (card.eleType === 'button') { - // if ((style.paddingLeft || style.paddingRight) && !style.width) { - // style.width = 'auto' - // } - // } - let _card = this.resetCardStyle(card, style) let _elements = elements.map(cell => { @@ -443,17 +437,7 @@ if (cell.uuid === res.uuid) { res.eleType = cell.eleType || null res.style = cell.style || null - // res.modal = cell.modal || null - // res.config = cell.config || null res.wrapStyle = cell.wrapStyle || null - // res = {...cell, ...res} - - // if (!res.control) { - // delete res.controlField - // delete res.controlVal - // } - - // delete res.focus if (res.OpenType === 'form') { if (cell.OpenType !== 'form') { @@ -799,7 +783,7 @@ destroyOnClose > <ActionForm - type={cards.type === 'balcony' ? '' : 'card'} + type={cards.type === 'balcony' || cardCell.$cardType === 'extendCard' ? '' : 'card'} card={card} formlist={this.state.formlist} inputSubmit={this.handleActionSubmit} diff --git a/src/menu/components/chart/antv-G6/index.jsx b/src/menu/components/chart/antv-G6/index.jsx index 985a6f5..15eb93f 100644 --- a/src/menu/components/chart/antv-G6/index.jsx +++ b/src/menu/components/chart/antv-G6/index.jsx @@ -1137,7 +1137,7 @@ const { card } = this.state if (card.plot.subtype === 'mindmap') { - this.ponitrender() + this.mindrender() } else if (card.plot.subtype === 'indentTree') { this.indentrender() } else if (card.plot.subtype === 'kapmap') { @@ -1270,9 +1270,9 @@ } /** - * @description 鏁g偣鍥� + * @description 鎬濈淮瀵煎浘 */ - ponitrender = () => { + mindrender = () => { const { card } = this.state const plot = card.plot const data = this.getdata() diff --git a/src/menu/components/chart/antv-G6/index.scss b/src/menu/components/chart/antv-G6/index.scss index 5d8ba6f..d395eaf 100644 --- a/src/menu/components/chart/antv-G6/index.scss +++ b/src/menu/components/chart/antv-G6/index.scss @@ -42,25 +42,6 @@ color: rgba(0, 0, 0, 0.85); background: rgba(255, 255, 255, 0.55); } - - .model-menu-action-list { - position: absolute; - right: 0px; - top: 30px; - z-index: 4; - font-size: 16px; - - .ant-row .anticon-plus { - float: right; - } - - .page-card { - float: right; - } - } - .normal-header + .canvas + .model-menu-action-list { - top: 45px; - } } .menu-scatter-chart-edit-box:hover { z-index: 1; diff --git a/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx index 9eed12a..1f0a073 100644 --- a/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx +++ b/src/menu/components/chart/antv-X6/chartcompile/formconfig.jsx @@ -203,130 +203,18 @@ type: 'select', field: 'subtype', label: '绫诲瀷', - initval: card.subtype || 'mindmap', + initval: card.subtype || 'xflow', required: true, options: [{ - value: 'mindmap', - label: '鎬濈淮瀵煎浘' + value: 'xflow', + label: '娴佺▼鍥�' }, { value: 'indentTree', - label: '缂╄繘鏂囦欢鏍�' + label: '娉抽亾鍥�' }, { value: 'kapmap', - label: '鐭ヨ瘑鍥捐氨鏍�' - }], - controlFields: [ - {field: 'dirField', values: ['mindmap']}, - {field: 'nodeColor', values: ['mindmap']}, - // {field: 'collapsed', values: ['indentTree', 'kapmap']}, - ] - }, - { - type: 'radio', - field: 'rootType', - label: '鏍硅妭鐐瑰彇鍊�', - initval: card.rootType || 'fixed', - tooltip: '閫夋嫨涓婄骇鏃讹紝璇峰~鍐欐牴鑺傜偣鐨勬枃鏈拰鍊肩殑瀛楁鍚�', - required: true, - options: [{ - value: 'fixed', - label: '鍥哄畾鍊�' - }, { - value: 'supvalue', - label: '涓婄骇缁勪欢' - }, { - value: 'line', - label: '琛�' - }], - controlFields: [ - {field: 'rootLabel', values: ['fixed', 'supvalue']}, - {field: 'rootValue', values: ['fixed', 'supvalue']}, - {field: 'mark', values: ['line']}, - ] - }, - { - type: 'text', - field: 'rootValue', - label: '鏍硅妭鐐瑰��', - initval: card.rootValue || '', - required: true - }, - { - type: 'text', - field: 'rootLabel', - label: '鏍硅妭鐐规枃鏈�', - initval: card.rootLabel || '', - required: true - }, - { - type: 'select', - field: 'valueField', - label: '鍊煎瓧娈�', - initval: card.valueField || '', - required: true, - options: columns - }, - { - type: 'select', - field: 'labelField', - label: '鏂囨湰瀛楁', - initval: card.labelField || '', - required: true, - options: columns - }, - { - type: 'select', - field: 'parentField', - label: '涓婄骇瀛楁', - initval: card.parentField || '', - required: true, - options: columns - }, - { - type: 'text', - field: 'mark', - label: '椤剁骇鏍囪瘑', - initval: card.mark || '', - tooltip: '涓婄骇瀛楁鍊间笌椤剁骇鏍囪瘑鐩稿悓鏃讹紝瑙嗕负鏍硅妭鐐广��', - required: true - }, - { - type: 'select', - field: 'dirField', - label: '鏂瑰悜鎺у埗', - initval: card.dirField || '', - required: false, - options: columns, - controlFields: [ - {field: 'dirSign', notNull: true}, - {field: 'leftColor', notNull: true}, - ] - }, - { - type: 'text', - field: 'dirSign', - label: '宸﹀悜鏍囪', - initval: card.dirSign || '', - tooltip: '褰撹妭鐐瑰�间笌鏍囪鐩稿悓鏃惰妭鐐逛俊鎭綅浜庤妭鐐瑰乏渚э紝澶氫釜鍊艰鐢ㄩ�楀彿鍒嗛殧銆�', - required: false - }, - { - type: 'color', - field: 'nodeColor', - label: '鑺傜偣棰滆壊', - initval: card.nodeColor || '#1890ff', - tooltip: '鍙充晶鑺傜偣鐨勬爣璁伴鑹层��', - colorType: 'hex', - required: false - }, - { - type: 'color', - field: 'leftColor', - label: '宸﹁妭鐐归鑹�', - initval: card.leftColor || '#26C281', - tooltip: '宸︿晶鑺傜偣鐨勬爣璁伴鑹层��', - colorType: 'hex', - required: false + label: '缁勭粐缁撴瀯鍥�' + }] }, { type: 'radio', @@ -339,18 +227,6 @@ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, ], - }, - { - type: 'radio', - field: 'collapsed', - label: '鑺傜偣鍚堝苟', - initval: card.collapsed || 'false', - tooltip: '涓�绾ц妭鐐规槸鍚﹀悎骞躲��', - required: false, - options: [ - {value: 'false', label: '鍚�'}, - {value: 'true', label: '鏄�'}, - ], - }, + } ] } diff --git a/src/menu/components/chart/antv-X6/index.jsx b/src/menu/components/chart/antv-X6/index.jsx index 985a6f5..885210e 100644 --- a/src/menu/components/chart/antv-X6/index.jsx +++ b/src/menu/components/chart/antv-X6/index.jsx @@ -1,947 +1,29 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Popover, message } from 'antd' +import { Popover } from 'antd' import { ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' -import G6 from '@antv/g6' +import { Graph, Shape } from '@antv/x6' +import { Stencil } from '@antv/x6-plugin-stencil' +import { Transform } from '@antv/x6-plugin-transform' +import { Selection } from '@antv/x6-plugin-selection' +import { Snapline } from '@antv/x6-plugin-snapline' +import { Keyboard } from '@antv/x6-plugin-keyboard' +import { Clipboard } from '@antv/x6-plugin-clipboard' +import { History } from '@antv/x6-plugin-history' import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' -import { resetStyle, getTables, getHeight, checkComponent } from '@/utils/utils-custom.js' +import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js' import './index.scss' - -const { Util } = G6 const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) -const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) -const MindData = [ - 'Modeling Methods', - [ - 'Classification', - ['Logistic regression', 'Linear discriminant analysis', 'Rules', 'Decision trees', 'Naive Bayes', 'K nearest neighbor', 'Probabilistic neural network', 'Support vector machine'] - ], - [ - 'Consensus', - [ - 'Models diversity', - ['Different initializations', 'Different parameter choices', 'Different architectures', 'Different modeling methods', 'Different training sets', 'Different feature sets'] - ], - [ - 'Methods', - ['Classifier selection', 'Classifier fusion'] - ], - [ - 'Common', - ['Bagging', 'Boosting', 'AdaBoost'] - ] - ], - [ - 'Regression', - ['Multiple linear regression', 'Partial least squares', 'Multi-layer feedforward neural network', 'General regression neural network', 'Support vector regression'] - ] -] - -const styles = { - blue: '#1890ff', - red: '#f5222d', - orange_red: '#fa541c', - orange: '#fa8c16', - orange_yellow: '#faad14', - yellow: '#fadb14', - yellow_green: '#a0d911', - green: '#52c41a', - cyan: '#13c2c2', - blue_purple: '#2f54eb', - purple: '#722ed1', - magenta: '#eb2f96', - grass_green: '#aeb303', - deep_red: '#c32539', - deep_blue: '#1d3661' -} - -let systemColor = '#1890ff' -if (window.GLOB.style) { - let type = window.GLOB.style.replace(/bg_black_style_|bg_white_style_/, '') - systemColor = styles[type] || '#1890ff' -} -const COLORS = ['#5B8FF9', '#F6BD16', '#5AD8A6', '#945FB9', '#E86452', '#6DC8EC', '#FF99C3', '#1E9493', '#FF9845', '#5D7092'] - -// 鎬濈淮瀵煎浘 -G6.registerNode( - 'dice-mind-map-root', { - jsx: (cfg) => { - const width = Util.getTextSize(cfg.label, 16)[0] + 24 - - return ` - <group> - <rect style={{width: ${width}, height: 42, stroke: ${systemColor}, radius: 4}} keyshape> - <text style={{ fontSize: 16, marginLeft: 6, marginTop: 12 }}>${cfg.label}</text> - </rect> - </group> - ` - }, - getAnchorPoints() { - return [ - [0, 0.5], - [1, 0.5] - ] - } - }, - 'single-node', -) - -G6.registerNode( - 'dice-mind-map-leaf', { - jsx: (cfg) => { - const width = Util.getTextSize(cfg.label, 12)[0] + 24 - - return ` - <group> - <rect style={{width: ${width}, height: 26, fill: 'transparent', cursor: pointer }}> - <text style={{ fontSize: 12, fill: ${cfg.selected ? systemColor : '#000000'}, marginLeft: 12, marginTop: 6, cursor: pointer }}>${cfg.label}</text> - </rect> - <rect style={{ fill: ${cfg.color}, width: ${width}, height: 2, x: 0, y: 32, cursor: pointer }} /> - </group> - ` - }, - getAnchorPoints() { - return [ - [0, 0.965], - [1, 0.965] - ] - } - }, - 'single-node', -) -G6.registerBehavior('dice-mindmap', { - getEvents() { - return { - 'node:click': 'editNode', - 'canvas:click': 'onCanvasClick' - } - }, - editNode(evt) { - const item = evt.item - const model = item.get('model') - - this.graph.getNodes().forEach(node => { - let _model = node.get('model') - if (_model.selected) { - _model.selected = false - this.graph.updateItem(node, _model, false) - } - }) - - model.selected = true - this.graph.updateItem(item, model, false) - }, - onCanvasClick(e) { - this.graph.getNodes().forEach(node => { - let _model = node.get('model') - if (_model.selected) { - _model.selected = false - this.graph.updateItem(node, _model, false) - } - }) - } -}) -G6.registerBehavior('scroll-canvas', { - getEvents: function getEvents() { - return { - wheel: 'onWheel' - } - }, - onWheel: function onWheel(ev) { - const { graph } = this - if (!graph) { - return - } - if (ev.ctrlKey) { - const canvas = graph.get('canvas') - const point = canvas.getPointByClient(ev.clientX, ev.clientY) - let ratio = graph.getZoom() - if (ev.wheelDelta > 0) { - ratio += ratio * 0.05 - } else { - ratio *= ratio * 0.05 - } - graph.zoomTo(ratio, { - x: point.x, - y: point.y - }) - } else { - const x = ev.deltaX || ev.movementX - const y = ev.deltaY || ev.movementY || (-ev.wheelDelta * 125) / 3 - graph.translate(-x, -y) - } - ev.preventDefault() - } -}) - -// 缂╄繘鏂囦欢鏍� -G6.registerNode('indentedRoot', { - draw(model, group) { - const keyShape = group.addShape('rect', { - attrs: { - x: -46, - y: -16, - width: 92, - height: 32, - fill: systemColor, - radius: 2, - stroke: '#5B8FF9', - lineWidth: 0 - }, - name: 'key-shape' - }) - - const text = group.addShape('text', { - attrs: { - text: model.label || 'root', - fill: "#fff", - fontSize: 12, - x: 0, - y: 0, - textAlign: 'center', - textBaseline: 'middle' - }, - name: 'root-text-shape' - }) - const textBBox = text.getBBox() - const width = textBBox.width + 24 - const height = textBBox.height + 12 - keyShape.attr({ - x: -width / 2, - y: -height / 2, - width, - height - }) - - return keyShape - }, - getAnchorPoints() { - return [ - [0.5, 1] - ] - }, - update: undefined -}) - -G6.registerNode('indentedNode', { - addChildCount(group, tag, props) { - const { collapsed, branchColor, count } = props - let clickCircleY = 10 - // 瀛愮被鏁伴噺 icon锛岀粯鍒跺渾鐐瑰湪鑺傜偣姝d笅鏂� - if (tag) { - const childCountGroup = group.addGroup({ - name: 'child-count-group' - }) - childCountGroup.setMatrix([1, 0, 0, 0, 1, 0, 0, clickCircleY, 1]) - const countBackWidth = collapsed ? 26 : 12 - childCountGroup.addShape('rect', { - attrs: { - width: countBackWidth, - height: 12, - radius: 6, - stroke: branchColor, - lineWidth: 2, - fill: collapsed ? branchColor : '#fff', - x: -countBackWidth / 2, - y: -6, - cursor: 'pointer', - }, - name: 'child-count-rect-shape' - }) - const childCountText = childCountGroup.addShape('text', { - attrs: { - text: count, - fill: '#fff', - x: 0, - y: 0, - fontSize: 10, - textAlign: 'center', - textBaseline: 'middle', - cursor: 'pointer', - }, - name: 'child-count-text-shape' - }) - const childHoverIcon = childCountGroup.addShape('path', { - attrs: { - stroke: '#fff', - lineWidth: 1, - cursor: 'pointer', - path: [['M', -3, 2], ['L', 0, -2], ['L', 3, 2]] - }, - name: 'child-count-expand-icon', - capture: false - }) - childHoverIcon.hide() - - // 杩炴帴 count 鐨勭嚎娈� - const countLink = group.addShape('path', { - attrs: { - path: [['M', 0, 0], ['L', 0, 11]], - stroke: branchColor, - lineWidth: 2, - }, - name: 'count-link' - }) - countLink.toBack() - - if (collapsed) { - childCountGroup.show() - childCountText.show() - countLink.show() - } - else { - childCountGroup.hide() - childCountText.hide() - countLink.hide() - } - - clickCircleY += 16 - } - }, - addBottomLine(group, props) { - const { x, width, stroke, lineWidth } = props - return group.addShape('path', { - attrs: { - path: [ - ['M', x - 1, 0], - ['L', width, 0], - ], - stroke, - lineWidth, - }, - name: 'node-path-shape' - }) - }, - addName(group, props) { - const { label, x = 0, y, fill } = props - return group.addShape('text', { - attrs: { - text: label, - x, - y, - textAlign: 'start', - textBaseline: 'top', - fill, - fontSize: 14, - fontFamily: 'PingFangSC-Regular', - cursor: 'pointer', - }, - name: 'not-root-text-shape' - }) - }, - draw(model, group) { - const { collapsed, depth, label, children, selected } = model - // 鏄惁涓烘牴鑺傜偣 - const rootNode = depth === 0 - // 瀛愯妭鐐规暟閲� - const childCount = children ? children.length : 0 - - let width = 0 - const height = 24 - const x = 0 - const y = -height / 2 - const borderRadius = 4 - // 鍚嶇О鏂囨湰 - const text = this.addName(group, { label, x, y }) - - let textWidth = text.getBBox().width - width = textWidth + 20 - - const keyShapeAttrs = { - x, - y, - width, - height, - radius: borderRadius, - fill: undefined, - stroke: undefined, - } - - const keyShape = group.addShape('rect', { - attrs: keyShapeAttrs, - name: 'root-key-shape-rect-shape' - }) - - // 搴曢儴妯嚎 - const bottomLine = this.addBottomLine(group, { - stroke: model.branchColor || '#AAB7C4', - lineWidth: 3, - x, - width - }) - - let nameColor = 'rgba(0, 0, 0, 0.85)' - - if (selected) { - nameColor = systemColor - } - - // 鍚嶇О - text.attr({ - y: y - 12, - fill: nameColor - }) - text.toFront() - textWidth = text.getBBox().width - - if (bottomLine) bottomLine.toFront() - - this.addChildCount(group, childCount && !rootNode, { - collapsed, - branchColor: model.branchColor, - count: childCount ? `${childCount}` : undefined - }) - - const bbox = group.getBBox() - const backContainer = group.addShape('path', { - attrs: { - path: childCount ? [ - ['M', bbox.minX, bbox.minY], - ['L', bbox.maxX, bbox.minY], - ['L', bbox.maxX, bbox.maxY], - ['L', bbox.minX + 20, bbox.maxY], - ['L', bbox.minX + 20, bbox.maxY + 20], - ['L', bbox.minX, bbox.maxY + 20], - ['Z'] - ] : [ - ['M', bbox.minX, bbox.minY], - ['L', bbox.maxX, bbox.minY], - ['L', bbox.maxX, bbox.maxY], - ['L', bbox.minX, bbox.maxY], - ['Z'] - ], - fill: '#fff', - opacity: 0 - } - }) - backContainer.toBack() - return keyShape - } -}) - -G6.registerEdge('indentedEdge', { - afterDraw: (cfg, group) => { - const sourceNode = cfg.sourceNode && cfg.sourceNode.getModel() - const targetNode = cfg.targetNode && cfg.targetNode.getModel() - const color = sourceNode.branchColor || targetNode.branchColor || cfg.color || '#000' - - const keyShape = group.get('children')[0] - keyShape.attr({ - stroke: color, - lineWidth: 3 // branchThick - }) - group.toBack() - }, - getControlPoints: (cfg) => { - const startPoint = cfg.startPoint - const endPoint = cfg.endPoint - return [ - startPoint, - { - x: startPoint.x, - y: endPoint.y, - }, - endPoint - ] - }, - update: undefined -}, 'polyline') - -G6.registerBehavior('wheel-scroll', { - getDefaultCfg() { - return { - direction: 'y', - zoomKey: 'ctrl', - sensitivity: 3, - scalableRange: -64 - } - }, - getEvents() { - return { - wheel: 'onWheel' - } - }, - onWheel(ev) { - const graph = this.graph - let keyDown = ev[`${this.zoomKey}Key`] - if (this.zoomKey === 'control') keyDown = ev.ctrlKey - if (keyDown) { - const sensitivity = this.get('sensitivity') - const canvas = graph.get('canvas') - const point = canvas.getPointByClient(ev.clientX, ev.clientY) - let ratio = graph.getZoom() - if (ev.wheelDelta > 0) { - ratio *= (1 + 0.01 * sensitivity) - } else { - ratio *= (1 - 0.01 * sensitivity) - } - graph.zoomTo(ratio, { - x: point.x, - y: point.y - }) - graph.emit('wheelzoom', ev) - } else { - let dx = ev.deltaX || ev.movementX - let dy = ev.deltaY || ev.movementY - if (!dy && navigator.userAgent.indexOf('Firefox') > -1) dy = (-ev.wheelDelta * 125) / 3 - - const width = this.graph.get('width') - const height = this.graph.get('height') - const graphCanvasBBox = this.graph.get('group').getCanvasBBox() - - let expandWidth = this.scalableRange - let expandHeight = this.scalableRange - // 鑻� scalableRange 鏄� 0~1 鐨勫皬鏁帮紝鍒欎綔涓烘瘮渚嬭�冭檻 - if (expandWidth < 1 && expandWidth > -1) { - expandWidth = width * expandWidth - expandHeight = height * expandHeight - } - - const { minX, maxX, minY, maxY } = graphCanvasBBox - - if (dx > 0) { - if (maxX < -expandWidth) { - dx = 0 - } else if (maxX - dx < -expandWidth) { - dx = maxX + expandWidth - } - } else if (dx < 0) { - if (minX > width + expandWidth) { - dx = 0 - } else if (minX - dx > width + expandWidth) { - dx = minX - (width + expandWidth) - } - } - - if (dy > 0) { - if (maxY < -expandHeight) { - dy = 0 - } else if (maxY - dy < -expandHeight) { - dy = maxY + expandHeight - } - } else if (dy < 0) { - if (minY > height + expandHeight) { - dy = 0 - } else if (minY - dy > height + expandHeight) { - dy = minY - (height + expandHeight) - } - } - - if (this.get('direction') === 'x') { - dy = 0 - } else if (this.get('direction') === 'y') { - dx = 0 - } - - graph.translate(-dx, -dy) - } - ev.preventDefault() - } -}) -G6.registerBehavior('hover-node', { - getEvents() { - return { - 'node:mouseover': 'onNodeMouseOver', - 'node:mouseleave': 'onNodeMouseLeave', - 'node:mouseenter': 'onNodeMouseEnter' - } - }, - onNodeMouseEnter(ev) { - const { item } = ev - if (!item || item.get('destroyed')) return - item.toFront() - const model = item.getModel() - const { collapsed, depth } = model - const rootNode = depth === 0 || model.isRoot - const group = item.getContainer() - - if (rootNode) return - - // 鎺у埗瀛愯妭鐐逛釜鏁版爣璁� - if (!collapsed) { - const childCountGroup = group.find(e => e.get('name') === 'child-count-group') - if (childCountGroup) { - childCountGroup.show() - } - } - }, - onNodeMouseOver(ev) { - const shape = ev.target - - // tooltip鏄剧ず銆侀殣钘� - this.graph.emit('tooltip: show', ev) - - // expand 鐘舵�佷笅锛岃嫢 hover 鍒板瓙鑺傜偣涓暟鏍囪锛屽~鍏呰儗鏅�+鏄剧ず鏀惰捣 icon - const { item } = ev - const group = item.getContainer() - const model = item.getModel() - if (!model.collapsed) { - const childCountGroup = group.find(e => e.get('name') === 'child-count-group') - if (childCountGroup) { - childCountGroup.show() - const back = childCountGroup.find(e => e.get('name') === 'child-count-rect-shape') - const expandIcon = childCountGroup.find(e => e.get('name') === 'child-count-expand-icon') - const rootNode = model.depth === 0 || model.isRoot - const branchColor = rootNode ? '#576286' : model.branchColor - if (shape.get('parent').get('name') === 'child-count-group') { - if (back) { - back.attr('fill', branchColor || '#fff') - } - if (expandIcon) { - expandIcon.show() - } - } else { - if (back) { - back.attr('fill', '#fff') - } - if (expandIcon) { - expandIcon.hide() - } - } - } - } - }, - onNodeMouseLeave(ev) { - const { item } = ev - const model = item.getModel() - const group = item.getContainer() - const { collapsed } = model - - if (!collapsed) { - const childCountGroup = group.find(e => e.get('name') === 'child-count-group') - if (childCountGroup) { - childCountGroup.hide() - } - - const iconsLinkPath = group.find(e => e.get('name') === 'icons-link-path') - if (iconsLinkPath) { - iconsLinkPath.hide() - } - } - - this.graph.emit('tooltip: hide', ev) - } -}) -G6.registerBehavior('click-node', { - getEvents() { - return { - 'node:click': 'onNodeClick', - 'canvas:click': 'onCanvasClick' - } - }, - onNodeClick(e) { - const { item, target } = e - const shape = target - const shapeName = shape.cfg.name - let model = item.getModel() - - // 鐐瑰嚮鏀惰捣/灞曞紑 icon - if (shapeName === 'child-count-rect-shape' || shapeName === 'child-count-text-shape') { - const updatedCollapsed = !model.collapsed - this.graph.updateItem(item, { collapsed: updatedCollapsed }) - this.graph.layout() - return - } - - // 閫変腑鑺傜偣 - this.graph.getNodes().forEach(node => { - let _model = node.get('model') - if (_model.selected) { - _model.selected = false - this.graph.updateItem(node, _model, false) - } - }) - - model.selected = true - this.graph.updateItem(item, model, false) - - return - }, - onCanvasClick(e) { - this.graph.getNodes().forEach(node => { - let _model = node.get('model') - if (_model.selected) { - _model.selected = false - this.graph.updateItem(node, _model, false) - } - }) - } -}) -const dataIndTransform = (data) => { - const changeData = (d) => { - let data = { ...d } - - data.type = data.isRoot ? 'indentedRoot' : 'indentedNode' - - if (d.children) { - data.children = d.children.map((child) => changeData(child)) - } - // 缁欏畾 branchColor 鍜� 0-2 灞傝妭鐐� depth - if (data.children && data.children.length) { - data.depth = 0 - data.children.forEach((subtree, i) => { - subtree.branchColor = COLORS[i % COLORS.length] - // dfs - let currentDepth = 1 - subtree.depth = currentDepth - Util.traverseTree(subtree, child => { - child.branchColor = COLORS[i % COLORS.length] - - if (!child.depth) { - child.depth = currentDepth + 1 - } - else currentDepth = subtree.depth - if (child.children) { - child.children.forEach(subChild => { - subChild.depth = child.depth + 1 - }) - } - - if (!data.isRoot) { - child.collapsed = data.collapsed || false - } - return true - }) - }) - } - - return data - } - return changeData(data) -} - -// 鐭ヨ瘑鍥捐氨鏍� -G6.registerNode('treeNode', { - draw: (cfg, group) => { - const { label, selected, children, isRoot } = cfg - const rootNode = !!isRoot - const hasChildren = children && children.length !== 0 - - let width = 0 - const height = 28 - const x = 0 - const y = -height / 2 - - // 鍚嶇О鏂囨湰 - const text = group.addShape('text', { - attrs: { - text: label, - x: x * 2, - y, - textAlign: 'left', - textBaseline: 'top', - fontFamily: 'PingFangSC-Regular', - }, - cursor: 'pointer', - name: 'name-text-shape', - }) - const textWidth = text.getBBox().width - width = textWidth + 20 - - width = width < 60 ? 60 : width - - if (!rootNode && hasChildren) { - width += 22 - } - - const keyShapeAttrs = { - x, - y, - width, - height, - radius: 4 - } - - const keyShape = group.addShape('rect', { - attrs: keyShapeAttrs, - name: 'root-key-shape-rect-shape' - }) - - if (!rootNode) { - // 搴曢儴妯嚎 - group.addShape('path', { - attrs: { - path: [ - ['M', x - 1, 0], - ['L', width, 0], - ], - stroke: '#AAB7C4', - lineWidth: 1, - }, - name: 'node-path-shape' - }) - } - - const mainX = x - 10 - const mainY = -height + 15 - - if (rootNode) { - group.addShape('rect', { - attrs: { - x: mainX, - y: mainY, - width: width + 12, - height, - radius: 14, - fill: systemColor, - cursor: 'pointer', - }, - name: 'main-shape' - }) - } - - let nameColor = 'rgba(0, 0, 0, 0.85)' - if (selected) { - nameColor = systemColor - } - - // 鍚嶇О - if (rootNode) { - group.addShape('text', { - attrs: { - text: label, - x: mainX + 18, - y: 1, - textAlign: 'left', - textBaseline: 'middle', - fill: '#ffffff', - fontSize: 12, - fontFamily: 'PingFangSC-Regular', - cursor: 'pointer', - }, - name: 'root-text-shape' - }) - } else { - group.addShape('text', { - attrs: { - text: label, - x: mainX + 6, - y: y - 5, - textAlign: 'start', - textBaseline: 'top', - fill: nameColor, - fontSize: 12, - fontFamily: 'PingFangSC-Regular', - cursor: 'pointer', - }, - name: 'not-root-text-shape' - }) - } - - // 瀛愮被鏁伴噺 - if (hasChildren && !rootNode) { - const childCountHeight = 12 - const childCountX = width - 22 - const childCountY = -childCountHeight / 2 - - group.addShape('rect', { - attrs: { - width: 22, - height: 12, - stroke: systemColor, - fill: '#fff', - x: childCountX, - y: childCountY, - radius: 6, - cursor: 'pointer', - }, - name: 'child-count-rect-shape', - }) - group.addShape('text', { - attrs: { - text: `${children.length}`, - fill: 'rgba(0, 0, 0, .65)', - x: childCountX + 11, - y: childCountY + 12, - fontSize: 10, - width: 22, - textAlign: 'center', - cursor: 'pointer', - }, - name: 'child-count-text-shape' - }) - } - - return keyShape - } -}) - -G6.registerEdge('smooth', { - draw(cfg, group) { - const { startPoint, endPoint } = cfg - const hgap = Math.abs(endPoint.x - startPoint.x) - - const path = [ - ['M', startPoint.x, startPoint.y], - [ - 'C', - startPoint.x + hgap / 4, - startPoint.y, - endPoint.x - hgap / 2, - endPoint.y, - endPoint.x, - endPoint.y, - ], - ] - - const shape = group.addShape('path', { - attrs: { - stroke: '#AAB7C4', - path, - }, - name: 'smooth-path-shape', - }) - return shape - }, -}) - -G6.registerBehavior('click-item', { - getEvents() { - return { - 'node:click': 'onNodeClick', - 'canvas:click': 'onCanvasClick' - } - }, - onNodeClick(e) { - const { item } = e - let model = item.getModel() - - if (model.children) return - // 閫変腑鑺傜偣 - this.graph.getNodes().forEach(node => { - let _model = node.get('model') - if (_model.selected) { - _model.selected = false - this.graph.updateItem(node, _model, false) - } - }) - - model.selected = true - this.graph.updateItem(item, model, false) - - return - }, - onCanvasClick(e) { - this.graph.getNodes().forEach(node => { - let _model = node.get('model') - if (_model.selected) { - _model.selected = false - this.graph.updateItem(node, _model, false) - } - }) - } -}) - -class antvG6Chart extends Component { +class antvX6Chart extends Component { static propTpyes = { card: PropTypes.object, updateConfig: PropTypes.func, @@ -986,32 +68,12 @@ plot: _plot, } - if (card.config) { - let config = fromJS(card.config).toJS() - - _card.plot = config.plot - _card.plot.name = card.name - _card.style = config.style - _card.headerStyle = config.headerStyle - - _card.setting = config.setting - _card.columns = config.columns - _card.scripts = config.scripts - } - this.updateComponent(_card) } else { this.setState({ card: fromJS(card).toJS() }) } - } - - componentDidMount () { - MKEmitter.addListener('tabsChange', this.handleTabsChange) - setTimeout(() => { - this.viewrender() - }, 1000) } shouldComponentUpdate (nextProps, nextState) { @@ -1025,311 +87,531 @@ this.setState = () => { return } - MKEmitter.removeListener('tabsChange', this.handleTabsChange) } - handleTabsChange = (parentId) => { - const { card } = this.state - - if (parentId.indexOf(card.uuid) > -1 || parentId === 'all') { - let _element = document.getElementById(card.uuid + 'canvas') - if (_element) { - _element.innerHTML = '' - } - - this.$timer && clearTimeout(this.$timer) - this.$timer = setTimeout(this.viewrender, 100) - } - } - - getdata = () => { - const { card } = this.state - - const setData = (list) => { - let item = { - label: list[0], - id: list[0], - children: [] - } - if (!list[1]) { - delete item.children - - return item - } else if (!Array.isArray(list[1])) { - return list.map(m => ({label: m, id: m})) - } - - for (let i = 1; i < list.length; i++) { - let cell = setData(list[i]) - - if (Array.isArray(cell)) { - item.children.push(...cell) - } else { - item.children.push(cell) - } - } - - return item - } - - let data = setData(MindData) - - if (card.plot.subtype === 'mindmap') { - if (card.plot.dirField) { - data.children[0].direction = 'left' - data.children[2].direction = 'left' - } - - data.children.forEach(item => { - if (item.direction === 'left') { - item.color = card.plot.leftColor || '#26C281' - } else { - item.direction = 'right' - item.color = card.plot.nodeColor || '#1890ff' - } - }) - - data.collapsed = false - data.type = 'dice-mind-map-root' - - const collapse = (item) => { - if (!item.children) return - - item.children.forEach(cell => { - cell.collapsed = card.plot.collapsed === 'true' - cell.direction = cell.direction || 'right' - cell.type = 'dice-mind-map-leaf' - cell.color = cell.color || item.color - collapse(cell) - }) - } - - collapse(data) - } else if (card.plot.subtype === 'indentTree') { - data.isRoot = true - data.collapsed = false - - data.children.forEach(item => { - item.collapsed = card.plot.collapsed === 'true' - }) - } else if (card.plot.subtype === 'kapmap') { - data.isRoot = true - data.collapsed = false - - if (card.plot.collapsed === 'true') { - const collapse = (item) => { - if (!item.children) return - - item.children.forEach(cell => { - cell.collapsed = true - collapse(cell) - }) - } - - collapse(data) - } - } - - return data + componentDidMount () { + setTimeout(() => { + this.viewrender() + }, 1000) } viewrender = () => { - const { card } = this.state + // const { card } = this.state - if (card.plot.subtype === 'mindmap') { - this.ponitrender() - } else if (card.plot.subtype === 'indentTree') { - this.indentrender() - } else if (card.plot.subtype === 'kapmap') { + // if (card.plot.subtype === 'mindmap') { + // this.ponitrender() + // } else if (card.plot.subtype === 'indentTree') { + // this.indentrender() + // } else if (card.plot.subtype === 'kapmap') { this.kapmaprender() - } + // } } kapmaprender = () => { const { card } = this.state - const plot = card.plot - const data = this.getdata() - const height = getHeight(plot.height) - const graph = new G6.TreeGraph({ - container: card.uuid + 'canvas', - width: this.wrap.scrollWidth - 30, - height: height, - modes: { - default: [ - { - type: 'collapse-expand', + preWork() + + // #region 鍒濆鍖栫敾甯� + const graph = new Graph({ + container: document.getElementById(card.uuid + 'container'), + grid: true, + mousewheel: { + enabled: true, + zoomAtMousePosition: true, + modifiers: 'ctrl', + minScale: 0.5, + maxScale: 3, + }, + connecting: { + router: 'manhattan', + connector: { + name: 'rounded', + args: { + radius: 8, }, - 'drag-canvas', - 'zoom-canvas', - 'click-item' - ], + }, + anchor: 'center', + connectionPoint: 'anchor', + allowBlank: false, + snap: { + radius: 20, + }, + createEdge() { + return new Shape.Edge({ + attrs: { + line: { + stroke: '#A2B1C3', + strokeWidth: 2, + targetMarker: { + name: 'block', + width: 12, + height: 8, + }, + }, + }, + zIndex: 0, + }) + }, + validateConnection({ targetMagnet }) { + return !!targetMagnet + }, }, - defaultNode: { - type: 'treeNode', - anchorPoints: [ - [0, 0.5], - [1, 0.5], - ], + highlighting: { + magnetAdsorbed: { + name: 'stroke', + args: { + attrs: { + fill: '#5F95FF', + stroke: '#5F95FF', + }, + }, + }, }, - defaultEdge: { - type: 'smooth', + }) + // #endregion + + // #region 浣跨敤鎻掍欢 + graph + .use( + new Transform({ + resizing: true, + rotating: true, + }), + ) + .use( + new Selection({ + rubberband: true, + showNodeSelectionBox: true, + }), + ) + .use(new Snapline()) + .use(new Keyboard()) + .use(new Clipboard()) + .use(new History()) + // #endregion + + // #region 鍒濆鍖� stencil + const stencil = new Stencil({ + title: '娴佺▼鍥�', + target: graph, + stencilGraphWidth: 200, + stencilGraphHeight: 180, + collapsable: true, + groups: [ + { + title: '鍩虹娴佺▼鍥�', + name: 'group1', + }, + { + title: '绯荤粺璁捐鍥�', + name: 'group2', + graphHeight: 250, + layoutOptions: { + rowHeight: 70, + }, + }, + ], + layoutOptions: { + columns: 2, + columnWidth: 80, + rowHeight: 55, }, - layout: { - type: 'compactBox', - direction: 'LR', - getId: function getId(d) { - return d.id - }, - getHeight: function getHeight() { - return 16 - }, - getWidth: function getWidth(d) { - const labelWidth = G6.Util.getTextSize(d.label, 12)[0] - const width = 60 + labelWidth - return width - }, - getVGap: function getVGap() { - return 15 - }, - getHGap: function getHGap() { - return 30 - } + }) + document.getElementById('stencil').appendChild(stencil.container) + // #endregion + + // #region 蹇嵎閿笌浜嬩欢 + graph.bindKey(['meta+c', 'ctrl+c'], () => { + const cells = graph.getSelectedCells() + if (cells.length) { + graph.copy(cells) + } + return false + }) + graph.bindKey(['meta+x', 'ctrl+x'], () => { + const cells = graph.getSelectedCells() + if (cells.length) { + graph.cut(cells) + } + return false + }) + graph.bindKey(['meta+v', 'ctrl+v'], () => { + if (!graph.isClipboardEmpty()) { + const cells = graph.paste({ offset: 32 }) + graph.cleanSelection() + graph.select(cells) + } + return false + }) + + // undo redo + graph.bindKey(['meta+z', 'ctrl+z'], () => { + if (graph.canUndo()) { + graph.undo() + } + return false + }) + graph.bindKey(['meta+shift+z', 'ctrl+shift+z'], () => { + if (graph.canRedo()) { + graph.redo() + } + return false + }) + + // select all + graph.bindKey(['meta+a', 'ctrl+a'], () => { + const nodes = graph.getNodes() + if (nodes) { + graph.select(nodes) } }) - graph.data(data) - graph.render() - graph.fitView() + // delete + graph.bindKey('backspace', () => { + const cells = graph.getSelectedCells() + if (cells.length) { + graph.removeCells(cells) + } + }) - if (plot.collapsed === 'true') { - graph.zoomTo(1, { x: 0, y: height / 2 }) + // zoom + graph.bindKey(['ctrl+1', 'meta+1'], () => { + const zoom = graph.zoom() + if (zoom < 1.5) { + graph.zoom(0.1) + } + }) + graph.bindKey(['ctrl+2', 'meta+2'], () => { + const zoom = graph.zoom() + if (zoom > 0.5) { + graph.zoom(-0.1) + } + }) + + // 鎺у埗杩炴帴妗╂樉绀�/闅愯棌 + const showPorts = (ports, show) => { + for (let i = 0, len = ports.length; i < len; i += 1) { + ports[i].style.visibility = show ? 'visible' : 'hidden' + } } - } + graph.on('node:mouseenter', () => { + const container = document.getElementById(card.uuid + 'container') + const ports = container.querySelectorAll('.x6-port-body') + showPorts(ports, true) + }) + graph.on('node:mouseleave', () => { + const container = document.getElementById(card.uuid + 'container') + const ports = container.querySelectorAll('.x6-port-body') + showPorts(ports, false) + }) + // #endregion - indentrender = () => { - const { card } = this.state - const plot = card.plot - const data = this.getdata() - - const tree = new G6.TreeGraph({ - container: card.uuid + 'canvas', - width: this.wrap.scrollWidth - 30, - height: getHeight(plot.height), - layout: { - type: 'indented', - direction: 'LR', - isHorizontal: true, - indent: 40, - getHeight: (d) => { - if (d.isRoot) { - return 30 - } - if (d.collapsed && d.children && d.children.length) { - return 36 - } - return 22 + // #region 鍒濆鍖栧浘褰� + const ports = { + groups: { + top: { + position: 'top', + attrs: { + circle: { + r: 4, + magnet: true, + stroke: '#5F95FF', + strokeWidth: 1, + fill: '#fff', + style: { + visibility: 'hidden', + }, + }, + }, }, - getVGap: () => { - return 10 + right: { + position: 'right', + attrs: { + circle: { + r: 4, + magnet: true, + stroke: '#5F95FF', + strokeWidth: 1, + fill: '#fff', + style: { + visibility: 'hidden', + }, + }, + }, + }, + bottom: { + position: 'bottom', + attrs: { + circle: { + r: 4, + magnet: true, + stroke: '#5F95FF', + strokeWidth: 1, + fill: '#fff', + style: { + visibility: 'hidden', + }, + }, + }, + }, + left: { + position: 'left', + attrs: { + circle: { + r: 4, + magnet: true, + stroke: '#5F95FF', + strokeWidth: 1, + fill: '#fff', + style: { + visibility: 'hidden', + }, + }, + }, }, }, - defaultEdge: { - type: 'indentedEdge', - style: { - lineWidth: 2, - radius: 16 - } - }, - minZoom: 0.5, - modes: { - default: [ - 'drag-canvas', - 'wheel-scroll', - 'hover-node', - 'click-node' - ] - } - }) - - tree.on('afterrender', e => { - tree.getEdges().forEach(edge => { - const targetNode = edge.getTarget().getModel() - const color = targetNode.branchColor - tree.updateItem(edge, { color }) - }) - setTimeout(() => { - tree.moveTo(32, 32) - tree.zoomTo(0.7) - }, 16) - }) - - tree.data(dataIndTransform(data)) - - tree.render() - } - - /** - * @description 鏁g偣鍥� - */ - ponitrender = () => { - const { card } = this.state - const plot = card.plot - const data = this.getdata() - const width = this.wrap.scrollWidth - 30 - const height = getHeight(plot.height) - let modes = ['drag-canvas', 'zoom-canvas', 'dice-mindmap'] - - if (plot.collapsed === 'true') { - modes = [{ type: 'collapse-expand' },'drag-canvas', 'zoom-canvas', 'dice-mindmap'] + items: [ + { + group: 'top', + }, + { + group: 'right', + }, + { + group: 'bottom', + }, + { + group: 'left', + }, + ], } - const tree = new G6.TreeGraph({ - container: card.uuid + 'canvas', - width: width, - height: height, - fitView: true, - layout: { - type: 'mindmap', - direction: 'H', - getHeight: () => { - return 16 + Graph.registerNode( + 'custom-rect', + { + inherit: 'rect', + width: 66, + height: 36, + attrs: { + body: { + strokeWidth: 1, + stroke: '#5F95FF', + fill: '#EFF4FF', + }, + text: { + fontSize: 12, + fill: '#262626', + }, }, - getWidth: (node) => { - return node.level === 0 ? - Util.getTextSize(node.label, 16)[0] + 12 : - Util.getTextSize(node.label, 12)[0] - }, - getVGap: () => { - return 10 - }, - getHGap: () => { - return 60 - }, - getSide: (node) => { - return node.data.direction - } + ports: { ...ports }, }, - defaultEdge: { - type: 'cubic-horizontal', - style: { - lineWidth: 2 - } + true, + ) + + Graph.registerNode( + 'custom-polygon', + { + inherit: 'polygon', + width: 66, + height: 36, + attrs: { + body: { + strokeWidth: 1, + stroke: '#5F95FF', + fill: '#EFF4FF', + }, + text: { + fontSize: 12, + fill: '#262626', + }, + }, + ports: { + ...ports, + items: [ + { + group: 'top', + }, + { + group: 'bottom', + }, + ], + }, }, - minZoom: 0.5, - modes: { - default: modes - } + true, + ) + + Graph.registerNode( + 'custom-circle', + { + inherit: 'circle', + width: 45, + height: 45, + attrs: { + body: { + strokeWidth: 1, + stroke: '#5F95FF', + fill: '#EFF4FF', + }, + text: { + fontSize: 12, + fill: '#262626', + }, + }, + ports: { ...ports }, + }, + true, + ) + + Graph.registerNode( + 'custom-image', + { + inherit: 'rect', + width: 52, + height: 52, + markup: [ + { + tagName: 'rect', + selector: 'body', + }, + { + tagName: 'image', + }, + { + tagName: 'text', + selector: 'label', + }, + ], + attrs: { + body: { + stroke: '#5F95FF', + fill: '#5F95FF', + }, + image: { + width: 26, + height: 26, + refX: 13, + refY: 16, + }, + label: { + refX: 3, + refY: 2, + textAnchor: 'left', + textVerticalAnchor: 'top', + fontSize: 12, + fill: '#fff', + }, + }, + ports: { ...ports }, + }, + true, + ) + + const r1 = graph.createNode({ + shape: 'custom-rect', + label: '寮�濮�', + attrs: { + body: { + rx: 20, + ry: 26, + }, + }, }) + const r2 = graph.createNode({ + shape: 'custom-rect', + label: '杩囩▼', + }) + const r3 = graph.createNode({ + shape: 'custom-rect', + attrs: { + body: { + rx: 6, + ry: 6, + }, + }, + label: '鍙�夎繃绋�', + }) + const r4 = graph.createNode({ + shape: 'custom-polygon', + attrs: { + body: { + refPoints: '0,10 10,0 20,10 10,20', + }, + }, + label: '鍐崇瓥', + }) + const r5 = graph.createNode({ + shape: 'custom-polygon', + attrs: { + body: { + refPoints: '10,0 40,0 30,20 0,20', + }, + }, + label: '鏁版嵁', + }) + const r6 = graph.createNode({ + shape: 'custom-circle', + label: '杩炴帴', + }) + stencil.load([r1, r2, r3, r4, r5, r6], 'group1') - tree.data(data) - - tree.render() + const imageShapes = [ + { + label: 'Client', + image: + 'https://gw.alipayobjects.com/zos/bmw-prod/687b6cb9-4b97-42a6-96d0-34b3099133ac.svg', + }, + { + label: 'Http', + image: + 'https://gw.alipayobjects.com/zos/bmw-prod/dc1ced06-417d-466f-927b-b4a4d3265791.svg', + }, + { + label: 'Api', + image: + 'https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg', + }, + { + label: 'Sql', + image: + 'https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg', + }, + { + label: 'Clound', + image: + 'https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg', + }, + { + label: 'Mq', + image: + 'https://gw.alipayobjects.com/zos/bmw-prod/2010ac9f-40e7-49d4-8c4a-4fcf2f83033b.svg', + }, + ] + const imageNodes = imageShapes.map((item) => + graph.createNode({ + shape: 'custom-image', + label: item.label, + attrs: { + image: { + 'xlink:href': item.image, + }, + }, + }), + ) + stencil.load(imageNodes, 'group2') + // #endregion - if (plot.collapsed === 'true' && plot.dirField) { - tree.zoomTo(1, { x: width / 2, y: height / 2 }) - } else if (plot.collapsed === 'true') { - tree.zoomTo(1, { x: 0, y: height / 2 }) + function preWork() { + // 杩欓噷鍗忓姪婕旂ず鐨勪唬鐮侊紝鍦ㄥ疄闄呴」鐩腑鏍规嵁瀹為檯鎯呭喌杩涜璋冩暣 + const container = document.getElementById(card.uuid + 'canvas') + const stencilContainer = document.createElement('div') + stencilContainer.id = 'stencil' + stencilContainer.classList.add('mk-stencil') + const graphContainer = document.createElement('div') + graphContainer.id = card.uuid + 'container' + graphContainer.classList.add('mk-container') + container.appendChild(stencilContainer) + container.appendChild(graphContainer) } } @@ -1354,19 +636,6 @@ if (card.errors.length === 0) { card.$tables = getTables(card) - } - - if (!card.plot.valueField) { - card.errors.push({ level: 0, detail: '鍥捐〃淇℃伅灏氭湭璁剧疆锛�'}) - } else { - let columns = card.columns.map(c => c.field) - if (!columns.includes(card.plot.valueField)) { - card.errors.push({ level: 0, detail: '鍊煎瓧娈靛湪瀛楁闆嗕腑涓嶅瓨鍦�'}) - } else if (!columns.includes(card.plot.labelField)) { - card.errors.push({ level: 0, detail: '鏂囨湰瀛楁鍦ㄥ瓧娈甸泦涓笉瀛樺湪'}) - } else if (!columns.includes(card.plot.parentField)) { - card.errors.push({ level: 0, detail: '涓婄骇瀛楁鍦ㄥ瓧娈甸泦涓笉瀛樺湪'}) - } } this.setState({ @@ -1410,7 +679,6 @@ <ChartCompileForm config={card} plotchange={this.updateComponent}/> <CopyComponent type="antvG6" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)}/> <SettingComponent config={card} updateConfig={this.updateComponent}/> </div> @@ -1418,18 +686,11 @@ <ToolOutlined/> </Popover> <NormalHeader config={card} updateComponent={this.updateComponent}/> - <div className="canvas" style={{minHeight: card.plot.height}} id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> + <div className="canvas" style={{width: '100%', minHeight: card.plot.height, height: card.plot.height}} id={card.uuid + 'canvas'}> + </div> <div className="component-name"> <div className="center"> - <div className="title" onDoubleClick={() => { - let oInput = document.createElement('input') - oInput.value = 'anchor' + card.uuid - document.body.appendChild(oInput) - oInput.select() - document.execCommand('Copy') - document.body.removeChild(oInput) - message.success('澶嶅埗鎴愬姛銆�') - }}>{card.name}</div> + <div className="title">{card.name}</div> <div className="content"> {card.errors && card.errors.map((err, index) => { if (err.level === 0) { @@ -1446,4 +707,4 @@ } } -export default antvG6Chart \ No newline at end of file +export default antvX6Chart \ No newline at end of file diff --git a/src/menu/components/chart/antv-X6/index.scss b/src/menu/components/chart/antv-X6/index.scss index 5d8ba6f..afcc501 100644 --- a/src/menu/components/chart/antv-X6/index.scss +++ b/src/menu/components/chart/antv-X6/index.scss @@ -8,8 +8,52 @@ .canvas { margin: 0px; - padding: 15px; letter-spacing: 0px; + display: flex; + + .mk-stencil { + width: 180px; + height: 100%; + position: relative; + z-index: 2; + border-right: 1px solid #dfe3e8; + } + .mk-container { + width: calc(100% - 180px); + height: 100%; + } + .x6-widget-stencil { + background-color: #fff; + } + .x6-widget-stencil-title { + background-color: #fff; + } + .x6-widget-stencil-group-title { + background-color: #fff !important; + } + .x6-widget-transform { + margin: -1px 0 0 -1px; + padding: 0px; + border: 1px solid #239edd; + } + .x6-widget-transform > div { + border: 1px solid #239edd; + } + .x6-widget-transform > div:hover { + background-color: #3dafe4; + } + .x6-widget-transform-active-handle { + background-color: #3dafe4; + } + .x6-widget-transform-resize { + border-radius: 0; + } + .x6-widget-selection-inner { + border: 1px solid #239edd; + } + .x6-widget-selection-box { + opacity: 0; + } } .chart-header { @@ -41,25 +85,6 @@ cursor: pointer; color: rgba(0, 0, 0, 0.85); background: rgba(255, 255, 255, 0.55); - } - - .model-menu-action-list { - position: absolute; - right: 0px; - top: 30px; - z-index: 4; - font-size: 16px; - - .ant-row .anticon-plus { - float: right; - } - - .page-card { - float: right; - } - } - .normal-header + .canvas + .model-menu-action-list { - top: 45px; } } .menu-scatter-chart-edit-box:hover { diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index c6b6e95..37e38f0 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -51,68 +51,40 @@ } render() { - const { connectDragSource, connectDropTarget, moveCol, addElement, dropCol, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props + const { connectDragSource, connectDropTarget, moveCol, componentId, addElement, dropCol, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props - if (index !== undefined && column) { - let style = {cursor: 'move', textAlign: align} - if (column.Width) { - style.width = column.Width - style.minWidth = column.Width - } + if (!column) return ( + <th {...restProps}>{children}</th> + ) - if (window.GLOB.columnId === column.uuid) { - style.color = '#1890ff' - } - - return connectDragSource( - connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> - {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} - <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> - {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} - {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} - <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } - </div> - } trigger="hover"> - {children} - </Popover> - </th>), - ) - } else if (column) { - let style = {textAlign: align} - if (column.Width) { - style.width = column.Width - style.minWidth = column.Width - } - - if (window.GLOB.columnId === column.uuid) { - style.color = '#1890ff' - } - - return ( - <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> - {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} - <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> - {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} - <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } - </div> - } trigger="hover"> - {children} - </Popover> - </th> - ) - } else { - return (<th {...restProps}>{children}</th>) + let style = {cursor: 'move', textAlign: align} + if (column.Width) { + style.width = column.Width + style.minWidth = column.Width } + + if (window.GLOB.columnId === column.uuid) { + style.color = '#1890ff' + } + + return connectDragSource( + connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> + {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} + {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} + {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} + <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> + {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} + {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} + <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> + {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + </div> + } trigger="hover"> + {children} + </Popover> + </th>), + ) } } @@ -127,17 +99,28 @@ const ColTarget = { drop(props, monitor) { const item = monitor.getItem() - const dragIndex = item.index - const hoverIndex = props.index + let dragIndex = item.index + let hoverIndex = props.index if (item.$init) { - props.dropCol(item, hoverIndex) + if (/sub_/.test(hoverIndex)) { + message.warning('鍚堝苟鍒楀瓙鍏冪礌鏆備笉鏀寔鎷栨嫿娣诲姞銆�') + } else { + props.dropCol(item, hoverIndex.replace(new RegExp(props.componentId + '@', 'ig'), '')) + } return } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { return + } else { + let reg = new RegExp(props.componentId + '@', 'ig') + if (reg.test(dragIndex)) { + props.moveCol(dragIndex.replace(reg, ''), hoverIndex.replace(reg, '')) + } else { + message.warning('鎷栧姩鍏冪礌涓嶅湪褰撳墠缁勪欢涓��') + return + } } - props.moveCol(dragIndex, hoverIndex) monitor.getItem().index = hoverIndex }, } @@ -304,12 +287,32 @@ moveCol = (dragIndex, hoverIndex) => { let _columns = fromJS(this.state.columns).toJS() - _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) + if (/^sub_/.test(dragIndex) || /^sub_/.test(hoverIndex)) { + let sign1 = dragIndex.split('_') + let sign2 = hoverIndex.split('_') + if (sign1[1] !== sign2[1]) { + message.warning('鎷栧姩鍏冪礌涓嶅湪鍚屼竴涓悎骞跺垪涓��') + return + } + this.loopMoveCol(_columns, sign1[1], sign1[2], sign2[2]) + } else { + _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) + } this.setState({ columns: _columns }, () => { this.props.updatecolumn({...this.props.config, cols: _columns}) + }) + } + + loopMoveCol = (columns, colId, dragIndex, hoverIndex) => { + columns.forEach(column => { + if (column.type === 'colspan' && column.uuid === colId) { + column.subcols.splice(hoverIndex, 0, ...column.subcols.splice(dragIndex, 1)) + } else if (column.type === 'colspan') { + this.loopMoveCol(column.subcols, colId, dragIndex, hoverIndex) + } }) } @@ -554,7 +557,7 @@ document.body.removeChild(oInput) } - handlecolumns = (columns, fields, config, isSub) => { + handlecolumns = (columns, fields, config, pId) => { return columns.map((col, index) => { return { title: col.label, @@ -568,8 +571,9 @@ upComponent: this.updateCol }), onHeaderCell: () => ({ - index: isSub ? undefined : index, + index: pId ? config.uuid + '@sub_' + pId + '_' + index : config.uuid + '@' + index, column: col, + componentId: config.uuid, fields: fields, align: col.Align, moveCol: this.moveCol, @@ -581,7 +585,7 @@ changeStyle: this.changeStyle, deleteCol: this.deleteCol, }), - children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, + children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, col.uuid) : null, } }) } diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index 51b977c..ba13cb7 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -52,71 +52,40 @@ } render() { - const { connectDragSource, connectDropTarget, moveCol, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props + const { connectDragSource, connectDropTarget, moveCol, componentId, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props if (!column) return ( - <th {...restProps} index={index}> - {children} - </th> + <th {...restProps}>{children}</th> ) - if (index !== undefined) { - let style = {cursor: 'move', textAlign: align} - if (column.Width) { - style.width = column.Width - style.minWidth = column.Width - } - - if (window.GLOB.columnId === column.uuid) { - style.color = '#1890ff' - } - - return connectDragSource( - connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> - {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} - <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> - {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} - {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} - <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } - </div> - } trigger="hover"> - {children} - </Popover> - </th>), - ) - } else if (column) { - let style = {textAlign: align} - if (column.Width) { - style.width = column.Width - style.minWidth = column.Width - } - if (window.GLOB.columnId === column.uuid) { - style.color = '#1890ff' - } - - return ( - <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> - {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} - <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> - {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} - <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } - </div> - } trigger="hover"> - {children} - </Popover> - </th> - ) + let style = {cursor: 'move', textAlign: align} + if (column.Width) { + style.width = column.Width + style.minWidth = column.Width } + + if (window.GLOB.columnId === column.uuid) { + style.color = '#1890ff' + } + + return connectDragSource( + connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> + {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} + {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} + {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} + <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> + {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} + {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} + <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> + {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + </div> + } trigger="hover"> + {children} + </Popover> + </th>), + ) } } @@ -131,17 +100,28 @@ const ColTarget = { drop(props, monitor) { const item = monitor.getItem() - const dragIndex = item.index - const hoverIndex = props.index + let dragIndex = item.index + let hoverIndex = props.index if (item.$init) { - props.dropCol(item, hoverIndex) + if (/sub_/.test(hoverIndex)) { + message.warning('鍚堝苟鍒楀瓙鍏冪礌鏆備笉鏀寔鎷栨嫿娣诲姞銆�') + } else { + props.dropCol(item, hoverIndex.replace(new RegExp(props.componentId + '@', 'ig'), '')) + } return } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { return + } else { + let reg = new RegExp(props.componentId + '@', 'ig') + if (reg.test(dragIndex)) { + props.moveCol(dragIndex.replace(reg, ''), hoverIndex.replace(reg, '')) + } else { + message.warning('鎷栧姩鍏冪礌涓嶅湪褰撳墠缁勪欢涓��') + return + } } - - props.moveCol(dragIndex, hoverIndex) + monitor.getItem().index = hoverIndex }, } @@ -281,12 +261,32 @@ moveCol = (dragIndex, hoverIndex) => { let _columns = fromJS(this.state.columns).toJS() - _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) + if (/^sub_/.test(dragIndex) || /^sub_/.test(hoverIndex)) { + let sign1 = dragIndex.split('_') + let sign2 = hoverIndex.split('_') + if (sign1[1] !== sign2[1]) { + message.warning('鎷栧姩鍏冪礌涓嶅湪鍚屼竴涓悎骞跺垪涓��') + return + } + this.loopMoveCol(_columns, sign1[1], sign1[2], sign2[2]) + } else { + _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) + } this.setState({ columns: _columns }, () => { this.props.updatecolumn({...this.props.config, cols: _columns}) + }) + } + + loopMoveCol = (columns, colId, dragIndex, hoverIndex) => { + columns.forEach(column => { + if (column.type === 'colspan' && column.uuid === colId) { + column.subcols.splice(hoverIndex, 0, ...column.subcols.splice(dragIndex, 1)) + } else if (column.type === 'colspan') { + this.loopMoveCol(column.subcols, colId, dragIndex, hoverIndex) + } }) } @@ -624,7 +624,7 @@ MKEmitter.removeListener('submitStyle', this.getStyle) } - handlecolumns = (columns, fields, config, isSub) => { + handlecolumns = (columns, fields, config, pId) => { return columns.map((col, index) => { let title = col.label if (col.editable === 'true') { @@ -643,8 +643,9 @@ upComponent: this.updateCol }), onHeaderCell: () => ({ - index: isSub ? undefined : index, + index: pId ? config.uuid + '@sub_' + pId + '_' + index : config.uuid + '@' + index, column: col, + componentId: config.uuid, fields: fields, align: col.Align, moveCol: this.moveCol, @@ -656,7 +657,7 @@ changeStyle: this.changeStyle, deleteCol: this.deleteCol, }), - children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, + children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, col.uuid) : null, } }) } @@ -728,10 +729,7 @@ destroyOnClose > <TableVerify - card={config.submit} - setting={config.setting} - cols={config.cols} - columns={config.columns} + config={config} wrappedComponentRef={(inst) => this.verifyRef = inst} /> </Modal> diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx index 4bdb8d8..6627ad6 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx @@ -1,13 +1,14 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, InputNumber, Radio, Typography } from 'antd' -import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' +import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, Cascader, Tooltip, InputNumber, Radio, Typography } from 'antd' +import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' +import MenuUtils from '@/utils/utils-custom.js' import UniqueForm from './uniqueform' import CustomScript from './customscript' import asyncComponent from '@/utils/asyncComponent' @@ -28,6 +29,7 @@ state = { verify: {}, fields: [], + modules: [], fieldLabel: {}, systemScripts: [], activeKey: 'basemsg', @@ -175,27 +177,32 @@ } UNSAFE_componentWillMount() { - const { columns, card, setting } = this.props - let _verify = fromJS(card).toJS() + const { columns, submit, setting, uuid } = this.props.config + let _verify = fromJS(submit).toJS() _verify.sheet = _verify.sheet || setting.tableName let fieldLabel = {} - // let _columns = [] - // let _fields = {} columns.forEach(col => { fieldLabel[col.field] = col.label - // _fields[col.field] = col }) - // cols.forEach(col => { - // if (!col.field || col.type === 'index' || !_fields[col.field]) return - - // _columns.push(_fields[col.field]) - // }) + + let supId = '' + if (setting && setting.supModule) { + let pid = setting.supModule[setting.supModule.length - 1] + if (pid && pid !== 'empty') { + supId = pid + } else { + supId = '' + } + } + + let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, uuid, supId) this.setState({ fields: fromJS(columns).toJS().filter(item => item.field !== setting.primaryKey), fieldLabel, + modules: modules, verify: _verify }, () => { this.resetUniqueColumns() @@ -491,7 +498,7 @@ } render() { - const { verify, scriptsColumns, uniqueColumns, activeKey, fields } = this.state + const { verify, scriptsColumns, uniqueColumns, activeKey, fields, modules } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -562,6 +569,16 @@ </Radio.Group> </Form.Item> </Col> : null} + <Col span={8}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滀笂绾э紙琛岋級鈥濄��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍒锋柊缁勪欢 + </Tooltip> + }> + <Cascader options={modules} value={verify.syncComponent || []} expandTrigger="hover" allowClear placeholder="" onChange={(val) => this.onOptionChange(val, 'syncComponent')}/> + </Form.Item> + </Col> </Row> </Form> </TabPane> diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 47ea9a5..1713c3c 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -52,68 +52,40 @@ } render() { - const { connectDragSource, connectDropTarget, moveCol, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props + const { connectDragSource, connectDropTarget, moveCol, componentId, dropCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props - if (index !== undefined && column) { - let style = {cursor: 'move', textAlign: align} - if (column.Width) { - style.width = column.Width - style.minWidth = column.Width - } + if (!column) return ( + <th {...restProps}>{children}</th> + ) - if (window.GLOB.columnId === column.uuid) { - style.color = '#1890ff' - } - - return connectDragSource( - connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> - {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} - <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> - {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} - {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} - <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } - </div> - } trigger="hover"> - {children} - </Popover> - </th>), - ) - } else if (column) { - let style = {textAlign: align} - if (column.Width) { - style.width = column.Width - style.minWidth = column.Width - } - - if (window.GLOB.columnId === column.uuid) { - style.color = '#1890ff' - } - - return ( - <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> - {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} - {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} - <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> - {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} - <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } - </div> - } trigger="hover"> - {children} - </Popover> - </th> - ) - } else { - return (<th {...restProps}>{children}</th>) + let style = {cursor: 'move', textAlign: align} + if (column.Width) { + style.width = column.Width + style.minWidth = column.Width } + + if (window.GLOB.columnId === column.uuid) { + style.color = '#1890ff' + } + + return connectDragSource( + connectDropTarget(<th {...restProps} index={index} style={style} onDoubleClick={() => this.props.editColumn(column)}> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> + {column.type === 'colspan' ? <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={() => this.props.addElement(column)} /> : null} + {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null} + {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null} + <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> + {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} + {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} + <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> + {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + </div> + } trigger="hover"> + {children} + </Popover> + </th>), + ) } } @@ -128,17 +100,28 @@ const ColTarget = { drop(props, monitor) { const item = monitor.getItem() - const dragIndex = item.index - const hoverIndex = props.index + let dragIndex = item.index + let hoverIndex = props.index if (item.$init) { - props.dropCol(item, hoverIndex) + if (/sub_/.test(hoverIndex)) { + message.warning('鍚堝苟鍒楀瓙鍏冪礌鏆備笉鏀寔鎷栨嫿娣诲姞銆�') + } else { + props.dropCol(item, hoverIndex.replace(new RegExp(props.componentId + '@', 'ig'), '')) + } return } else if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { return + } else { + let reg = new RegExp(props.componentId + '@', 'ig') + if (reg.test(dragIndex)) { + props.moveCol(dragIndex.replace(reg, ''), hoverIndex.replace(reg, '')) + } else { + message.warning('鎷栧姩鍏冪礌涓嶅湪褰撳墠缁勪欢涓��') + return + } } - props.moveCol(dragIndex, hoverIndex) monitor.getItem().index = hoverIndex }, } @@ -278,12 +261,32 @@ moveCol = (dragIndex, hoverIndex) => { let _columns = fromJS(this.state.columns).toJS() - _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) + if (/^sub_/.test(dragIndex) || /^sub_/.test(hoverIndex)) { + let sign1 = dragIndex.split('_') + let sign2 = hoverIndex.split('_') + if (sign1[1] !== sign2[1]) { + message.warning('鎷栧姩鍏冪礌涓嶅湪鍚屼竴涓悎骞跺垪涓��') + return + } + this.loopMoveCol(_columns, sign1[1], sign1[2], sign2[2]) + } else { + _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) + } this.setState({ columns: _columns }, () => { this.props.updatecolumn({...this.props.config, cols: _columns}) + }) + } + + loopMoveCol = (columns, colId, dragIndex, hoverIndex) => { + columns.forEach(column => { + if (column.type === 'colspan' && column.uuid === colId) { + column.subcols.splice(hoverIndex, 0, ...column.subcols.splice(dragIndex, 1)) + } else if (column.type === 'colspan') { + this.loopMoveCol(column.subcols, colId, dragIndex, hoverIndex) + } }) } @@ -507,7 +510,7 @@ document.body.removeChild(oInput) } - handlecolumns = (columns, fields, config, isSub) => { + handlecolumns = (columns, fields, config, pId) => { return columns.map((col, index) => { return { title: col.label, @@ -521,8 +524,9 @@ upComponent: this.updateCol }), onHeaderCell: () => ({ - index: isSub ? undefined : index, + index: pId ? config.uuid + '@sub_' + pId + '_' + index : config.uuid + '@' + index, column: col, + componentId: config.uuid, fields: fields, align: col.Align, moveCol: this.moveCol, @@ -534,7 +538,7 @@ changeStyle: this.changeStyle, deleteCol: this.deleteCol, }), - children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, + children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, col.uuid) : null, } }) } diff --git a/src/menu/menushell/card.jsx b/src/menu/menushell/card.jsx index 467795d..1719f71 100644 --- a/src/menu/menushell/card.jsx +++ b/src/menu/menushell/card.jsx @@ -32,6 +32,7 @@ const Account = asyncComponent(() => import('@/menu/components/module/account')) const Iframe = asyncComponent(() => import('@/menu/components/iframe')) const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) +const AntvX6 = asyncComponent(() => import('@/menu/components/chart/antv-X6')) const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { const originalIndex = findCard(id).index @@ -123,12 +124,23 @@ return (<Iframe card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'antvG6') { return (<AntvG6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'antvX6') { + return (<AntvX6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'module' && card.subtype === 'voucher') { return (<Voucher card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } else if (card.type === 'module' && card.subtype === 'account') { return (<Account card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) } } + + // if (card.type === 'antvX6') { // 娴嬭瘯 + // return ( + // <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} style={style}> + // <AntvX6 card={card} updateConfig={updateConfig} deletecomponent={delCard}/> + // </div> + // ) + // } + return ( <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} ref={node => drag(drop(node))} style={style}> {getCardComponent()} diff --git a/src/menu/modulesource/option.jsx b/src/menu/modulesource/option.jsx index e79babd..50d70b5 100644 --- a/src/menu/modulesource/option.jsx +++ b/src/menu/modulesource/option.jsx @@ -1,7 +1,6 @@ import bar from '@/assets/mobimg/bar.png' import bar1 from '@/assets/mobimg/bar1.png' import line from '@/assets/mobimg/line.png' -// import line1 from '@/assets/mobimg/line1.png' import tabs from '@/assets/mobimg/tabs.png' import group from '@/assets/mobimg/group.png' import card1 from '@/assets/mobimg/card1.png' @@ -53,7 +52,6 @@ { type: 'menu', url: timeline, component: 'timeline', subtype: 'timeline', title: '鏃堕棿杞�', width: 12 }, { type: 'menu', url: tree, component: 'tree', subtype: 'normaltree', title: '鏍戝舰鍒楄〃', width: 12, forbid: ['billPrint'] }, { type: 'menu', url: line, component: 'line', subtype: 'line', title: '鎶樼嚎鍥�', width: 24 }, - // { type: 'menu', url: line1, component: 'line', subtype: 'line1', title: '闃舵鎶樼嚎鍥�', width: 24 }, { type: 'menu', url: bar, component: 'bar', subtype: 'bar', title: '鏌辩姸鍥�', width: 24 }, { type: 'menu', url: bar1, component: 'bar', subtype: 'bar1', title: '鏉″舰鍥�', width: 24 }, { type: 'menu', url: Pie, component: 'pie', subtype: 'pie', title: '楗煎浘', width: 12 }, diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 816de31..c479441 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -348,7 +348,7 @@ cell.$MenuID = this.props.MenuID cell.$view = 'popview' - if (cell.syncComponentId === item.setting.supModule) { + if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -414,7 +414,7 @@ cell.$view = 'popview' cell.$toolbtn = true - if (cell.syncComponentId === item.setting.supModule) { + if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 27033aa..030841b 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -100,7 +100,7 @@ node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) } - if (!card.link) return + if (!card.link || (card.linkType === 'qywx' || card.linkType === 'linkmenu')) return e.stopPropagation() let url = '' @@ -131,7 +131,7 @@ } window.open(_url) return - } else if (card.linkType === 'qywx' || card.linkType === 'linkmenu') { + } else if (card.linkType === 'other' && /^@menuid@/ig.test(url)) { return } diff --git a/src/tabviews/custom/components/chart/antv-G6/index.jsx b/src/tabviews/custom/components/chart/antv-G6/index.jsx index ac96d6b..8406f8d 100644 --- a/src/tabviews/custom/components/chart/antv-G6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-G6/index.jsx @@ -1293,7 +1293,7 @@ this.setState({empty: false}) if (plot.subtype === 'mindmap') { - this.ponitrender() + this.mindrender() } else if (plot.subtype === 'indentTree') { this.indentrender() } else if (plot.subtype === 'kapmap') { @@ -1424,9 +1424,9 @@ } /** - * @description 鏁g偣鍥� + * @description 鎬濈淮瀵煎浘 */ - ponitrender = () => { + mindrender = () => { const { config, plot, chartId } = this.state const data = this.getdata() const width = this.wrap.scrollWidth - 30 diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 4922254..83b7612 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -6,13 +6,13 @@ import asyncComponent from '@/utils/asyncComponent' import { getMark } from '@/utils/utils.js' -import MkIcon from '@/components/mk-icon' import MKEmitter from '@/utils/events.js' import Encrypts from '@/components/encrypts' import './index.scss' const { Paragraph } = Typography const Video = asyncComponent(() => import('@/components/video')) +const MkIcon = asyncComponent(() => import('@/components/mk-icon')) const MkPicture = asyncComponent(() => import('@/components/mkPicture')) const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) const PicRadio = { diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index 80579fb..fec59dd 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -396,26 +396,13 @@ * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ refreshbysearch = (searches) => { - const { setting } = this.state - - if (setting.onload === 'false') { - this.setState({ - pageIndex: 1, - search: searches, - setting: {...setting, onload: 'true'} - }, () => { - this.loadmaindata() - this.getStatFieldsValue() - }) - } else { - this.setState({ - pageIndex: 1, - search: searches - }, () => { - this.loadmaindata(true, 'true') - this.getStatFieldsValue() - }) - } + this.setState({ + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata(true, 'true') + this.getStatFieldsValue() + }) } /** diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 96dfbb6..b2d83f8 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -37,7 +37,7 @@ pageIndex: 1, // 椤电爜 pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + search: '' // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� } /** @@ -331,25 +331,21 @@ }) } - try { - data = data.map(item => { - if (item.$$uuid === _data.$$uuid) { - _data.key = item.key - _data.$Index = item.$Index - return _data - } else { - return item - } - }) - selectedData = selectedData.map(item => { - if (_data.$$uuid === item.$$uuid) { - return _data - } + data = data.map(item => { + if (item.$$uuid === _data.$$uuid) { + _data.key = item.key + _data.$Index = item.$Index + return _data + } else { return item - }) - } catch (e) { - console.warn('鏁版嵁鏌ヨ閿欒') - } + } + }) + selectedData = selectedData.map(item => { + if (_data.$$uuid === item.$$uuid) { + return _data + } + return item + }) MKEmitter.emit('transferData', config.uuid, _data, 'line') MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) @@ -376,24 +372,12 @@ * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ refreshbysearch = (searches) => { - const { setting } = this.state - - if (setting.onload === 'false') { - this.setState({ - pageIndex: 1, - search: searches, - setting: {...setting, onload: 'true'} - }, () => { - this.loadmaindata() - }) - } else { - this.setState({ - pageIndex: 1, - search: searches - }, () => { - this.loadmaindata(true, 'true') - }) - } + this.setState({ + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata(true, 'true') + }) } /** diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 2b09bfb..47fb9f2 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -8,15 +8,13 @@ import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' import Utils, { getEditTableSql, getMark } from '@/utils/utils.js' -import MkIcon from '@/components/mk-icon' import MKEmitter from '@/utils/events.js' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' import CusSwitch from './cusSwitch' import Encrypts from '@/components/encrypts' import './index.scss' const { Paragraph } = Typography +const MkIcon = asyncComponent(() => import('@/components/mk-icon')) const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) class BodyRow extends React.Component { @@ -910,7 +908,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, edData: [], selectedRowKeys: [], // 琛ㄦ牸涓�変腑琛� tableId: '', // 琛ㄦ牸ID @@ -1686,7 +1683,7 @@ this.setState({edData: _data}) } - MKEmitter.emit('reloadData', this.props.MenuID, item.$$uuid, item) + MKEmitter.emit('reloadData', this.props.MenuID, item.$$uuid) } execSuccess = (res) => { @@ -1695,12 +1692,12 @@ if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 notification.success({ top: 92, - message: res.ErrMesg || this.state.dict['main.action.confirm.success'], + message: res.ErrMesg || '鎵ц鎴愬姛', duration: submit.stime ? submit.stime : 2 }) } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 Modal.success({ - title: res.ErrMesg || this.state.dict['main.action.confirm.success'] + title: res.ErrMesg || '鎵ц鎴愬姛' }) } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず @@ -1717,6 +1714,8 @@ if (submit.execSuccess !== 'never') { MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) } + + submit.syncComponentId && MKEmitter.emit('reloadData', submit.syncComponentId) } execError = (res) => { @@ -1888,8 +1887,6 @@ } } - let _footer = '' - let height = setting.height || false if (height && height <= 100) { height = height + 'vh' @@ -1922,7 +1919,6 @@ onChange={this.changeTable} pagination={_pagination} /> - {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null} {_data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-footer-table" type="link">鎻愪氦</Button> : null} </div> </> diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss index 84cb88f..eea792f 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss @@ -7,14 +7,6 @@ --mk-table-font-size: 14px; --mk-table-font-weight: normal; - .normal-table-footer { - padding: 10px 0px; - color: rgba(0, 0, 0, 0.65); - } - .normal-table-footer.pagination { - position: absolute; - bottom: 10px; - } >.ant-table-wrapper { position: relative; z-index: 1; diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 5788718..b882510 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -475,26 +475,13 @@ * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ refreshbysearch = (searches) => { - const { setting } = this.state - - if (setting.onload === 'false') { - this.setState({ - pageIndex: 1, - search: searches, - setting: {...setting, onload: 'true'} - }, () => { - this.loadmaindata() - this.getStatFieldsValue() - }) - } else { - this.setState({ - pageIndex: 1, - search: searches - }, () => { - this.loadmaindata(true, 'true') - this.getStatFieldsValue() - }) - } + this.setState({ + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata(true, 'true') + this.getStatFieldsValue() + }) } /** diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index f10ec65..42725b3 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -153,7 +153,7 @@ // 鏁版嵁缂撳瓨璁剧疆 if (config.cacheUseful === 'true') { - if (!['day', 'hour'].includes(config.timeUnit)) { + if (!['day', 'hour', 'minute'].includes(config.timeUnit)) { config.timeUnit = 'day' } config.cacheTime = config.cacheTime || 1 @@ -501,7 +501,7 @@ cell.$toolbtn = true - if (!mutil && cell.syncComponentId === item.setting.supModule) { + if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -554,7 +554,7 @@ cell = this.resetButton(item, cell, popview) - if (cell.syncComponentId === item.setting.supModule) { + if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -594,6 +594,14 @@ if (item.subtype === 'editable') { item.submit.logLabel = item.$menuname + '-鎻愪氦' item.submit.$menuId = item.uuid + item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : '' + + if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) { + item.submit.syncComponentId = '' + if (item.submit.execSuccess === 'grid') { + item.submit.execSuccess = 'mainline' + } + } } } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { item.subcards && item.subcards.forEach(card => { @@ -610,7 +618,7 @@ cell = this.resetButton(item, cell, popview) - if (!mutil && cell.syncComponentId === item.setting.supModule) { + if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -635,7 +643,7 @@ cell = this.resetButton(item, cell, popview) - if (!mutil && cell.syncComponentId === item.setting.supModule) { + if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -666,7 +674,7 @@ cell = this.resetButton(item, cell, popview) - if (cell.syncComponentId === item.wrap.supModule) { + if (cell.syncComponentId && cell.syncComponentId === item.wrap.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -696,9 +704,9 @@ group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' } - group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : '' + group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' - if (group.subButton.syncComponentId === item.setting.supModule) { + if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { group.subButton.syncComponentId = '' if (group.subButton.execSuccess === 'grid') { group.subButton.execSuccess = 'mainline' diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 6dccc71..aba165f 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -97,7 +97,7 @@ // 鏁版嵁缂撳瓨璁剧疆 if (config.cacheUseful === 'true') { - if (!['day', 'hour'].includes(config.timeUnit)) { + if (!['day', 'hour', 'minute'].includes(config.timeUnit)) { config.timeUnit = 'day' } config.cacheTime = config.cacheTime || 1 @@ -323,7 +323,7 @@ cell = this.resetButton(item, cell, Tab) cell.$toolbtn = true - if (!mutil && cell.syncComponentId === item.setting.supModule) { + if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -372,7 +372,7 @@ cell = this.resetButton(item, cell, Tab) - if (cell.syncComponentId === item.setting.supModule) { + if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -407,6 +407,14 @@ if (item.subtype === 'editable') { item.submit.logLabel = item.$menuname + '-鎻愪氦' item.submit.$menuId = item.uuid + item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : '' + + if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) { + item.submit.syncComponentId = '' + if (item.submit.execSuccess === 'grid') { + item.submit.execSuccess = 'mainline' + } + } } } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { item.subcards && item.subcards.forEach(card => { @@ -423,7 +431,7 @@ cell = this.resetButton(item, cell, Tab) - if (!mutil && cell.syncComponentId === item.setting.supModule) { + if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -444,7 +452,7 @@ cell = this.resetButton(item, cell, Tab) - if (!mutil && cell.syncComponentId === item.setting.supModule) { + if (!mutil && cell.syncComponentId && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -471,7 +479,7 @@ cell = this.resetButton(item, cell, Tab) - if (cell.syncComponentId === item.wrap.supModule) { + if (cell.syncComponentId && cell.syncComponentId === item.wrap.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' @@ -496,9 +504,9 @@ group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' } - group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : '' + group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' - if (group.subButton.syncComponentId === item.setting.supModule) { + if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { group.subButton.syncComponentId = '' if (group.subButton.execSuccess === 'grid') { group.subButton.execSuccess = 'mainline' diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 88e321e..067bfd2 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -546,9 +546,17 @@ if (unload) return if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) { - setTimeout(() => { - MKEmitter.emit('mkFC', 'focus', fieldMap.get(action.setting.focus).uuid) - }, 500) + let focusItem = fieldMap.get(action.setting.focus) + + if (focusItem.type === 'text' || focusItem.type === 'number') { + setTimeout(() => { + MKEmitter.emit('mkFC', 'focus', focusItem.uuid) + }, 50) + } else { + setTimeout(() => { + MKEmitter.emit('mkFC', 'focus', focusItem.uuid) + }, 500) + } } if (deForms.length > 0) { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx index 2895d40..837dd40 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx @@ -105,6 +105,7 @@ } values.uuid = editItem ? editItem.uuid : '' + values.position = values.position || (editItem ? editItem.position : 'front') if (type === 'fullscreen' && editItem) { values.status = editItem.status || 'true' diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 85fbe84..fd9b58f 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -498,7 +498,7 @@ }) if (reset) { - message.warn('鏁板�肩被鍨嬪潎涓哄繀濉��') + message.warning('鏁板�肩被鍨嬪潎涓哄繀濉��') } this.setState({verify: {...verify, columns}}, () => { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx index cadda16..bf43e2c 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx @@ -114,8 +114,7 @@ }) this.props.form.setFieldsValue({ - sql: record.sql, - // position: record.position || 'back' + sql: record.sql }) } @@ -271,43 +270,25 @@ <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts"> <Row gutter={24}> <Col span={8}> - <Form.Item label={'琛ㄥ悕'} style={{whiteSpace: 'nowrap', margin: 0}}> + <Form.Item label="琛ㄥ悕" style={{whiteSpace: 'nowrap', margin: 0}}> {sheet} </Form.Item> </Col> <Col span={10}> - <Form.Item label={'鎶ラ敊瀛楁'} style={{margin: 0, whiteSpace: 'nowrap'}}> + <Form.Item label="鎶ラ敊瀛楁" style={{margin: 0, whiteSpace: 'nowrap'}}> ErrorCode锛堝鍔犲悗缂�NT琛ㄧず鏁版嵁涓嶅洖婊氾紝濡侲NT銆丯NT銆丗NT銆丯MNT锛�, retmsg </Form.Item> </Col> <Col span={24} className="sqlfield"> - <Form.Item label={'鍙敤瀛楁'}> + <Form.Item label="鍙敤瀛楁"> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip> {usefulfields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎼滅储鏉′欢锛岃鎸夌収@xxx@鏍煎紡浣跨敤銆�'}>, {usefulfields}</Tooltip> : null} {linefields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'琛ㄥ崟鍙婅鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}>, {linefields}</Tooltip> : null} </Form.Item> </Col> - {/* <Col span={8} style={{whiteSpace: 'nowrap'}}> - <Form.Item style={{marginBottom: 0}} label={ - <Tooltip placement="bottomLeft" title={'鑷畾涔夎剼鏈笌榛樿sql浣嶇疆鍏崇郴銆�'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鎵ц浣嶇疆 - </Tooltip> - }> - {getFieldDecorator('position', { - initialValue: 'front' - })( - <Radio.Group> - <Radio value="init">鍒濆鍖�</Radio> - <Radio value="front">sql鍓�</Radio> - <Radio value="back">sql鍚�</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> */} <Col span={8}> - <Form.Item style={{marginBottom: 0}} label={'蹇嵎娣诲姞'}> + <Form.Item style={{marginBottom: 0}} label="蹇嵎娣诲姞"> <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} @@ -337,7 +318,7 @@ </Button> </Col> <Col span={24} className="sql"> - <Form.Item label={'sql'}> + <Form.Item label="sql"> {getFieldDecorator('sql', { initialValue: '', rules: [ diff --git a/src/views/login/logincloudform.jsx b/src/views/login/logincloudform.jsx index a8c70fc..c87cf3f 100644 --- a/src/views/login/logincloudform.jsx +++ b/src/views/login/logincloudform.jsx @@ -20,6 +20,8 @@ return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { + values.cloudusername = values.cloudusername.replace(/\t*|\v*|\s*/g, '') + values.cloudpassword = values.cloudpassword.replace(/\t*|\v*|\s*/g, '') resolve(values) } else { reject(err) diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index da71b58..eda2530 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -139,6 +139,13 @@ return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { + if (activeKey === 'uname_pwd') { + values.username = values.username.replace(/\t*|\v*|\s*/g, '') + values.password = values.password.replace(/\t*|\v*|\s*/g, '') + } else if (activeKey === 'sms_vcode') { + values.phone = values.phone.replace(/\t*|\v*|\s*/g, '') + values.vercode = values.vercode.replace(/\t*|\v*|\s*/g, '') + } resolve({type: activeKey, ...values}) } else { reject(err) diff --git a/src/views/menudesign/homeform/index.jsx b/src/views/menudesign/homeform/index.jsx index 1fc96b3..4454c32 100644 --- a/src/views/menudesign/homeform/index.jsx +++ b/src/views/menudesign/homeform/index.jsx @@ -171,9 +171,10 @@ {getFieldDecorator('timeUnit', { initialValue: config.timeUnit || 'day' })( - <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> <Radio value="day">澶�</Radio> <Radio value="hour">灏忔椂</Radio> + <Radio value="minute">鍒嗛挓</Radio> </Radio.Group> )} </Form.Item> @@ -189,7 +190,7 @@ } ] })( - <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> + <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> )} </Form.Item> </Col> : null} diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index f5bc9e6..ee08265 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -854,6 +854,8 @@ menuloading: true }) + window.GLOB.saving = true + setTimeout(() => { let _pass = this.verifyConfig(config) @@ -1017,6 +1019,8 @@ menuloading: false }) + window.GLOB.saving = false + if (!res) return if (res.status) { @@ -1041,6 +1045,9 @@ this.setState({ menuloading: false }) + + window.GLOB.saving = false + if (!error) { notification.warning({ top: 92, diff --git a/src/views/menudesign/menuform/index.jsx b/src/views/menudesign/menuform/index.jsx index 0f4433b..f746df1 100644 --- a/src/views/menudesign/menuform/index.jsx +++ b/src/views/menudesign/menuform/index.jsx @@ -363,9 +363,10 @@ {getFieldDecorator('timeUnit', { initialValue: config.timeUnit || 'day' })( - <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> <Radio value="day">澶�</Radio> <Radio value="hour">灏忔椂</Radio> + <Radio value="minute">鍒嗛挓</Radio> </Radio.Group> )} </Form.Item> @@ -381,7 +382,7 @@ } ] })( - <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> + <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> )} </Form.Item> </Col> : null} diff --git a/src/views/menudesign/popview/menuform/index.jsx b/src/views/menudesign/popview/menuform/index.jsx index d2899a2..e84a5af 100644 --- a/src/views/menudesign/popview/menuform/index.jsx +++ b/src/views/menudesign/popview/menuform/index.jsx @@ -86,9 +86,10 @@ {getFieldDecorator('timeUnit', { initialValue: config.timeUnit || 'day' })( - <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> <Radio value="day">澶�</Radio> <Radio value="hour">灏忔椂</Radio> + <Radio value="minute">鍒嗛挓</Radio> </Radio.Group> )} </Form.Item> @@ -104,7 +105,7 @@ } ] })( - <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> + <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> )} </Form.Item> </Col> : null} diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index fd1711e..e77f6ba 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -1430,6 +1430,8 @@ menuloading: true }) + window.GLOB.saving = true + setTimeout(() => { let _pass = this.verifyConfig(config) @@ -1687,6 +1689,8 @@ menuloading: false }) + window.GLOB.saving = false + if (!res) return if (res.status) { @@ -1721,6 +1725,9 @@ this.setState({ menuloading: false }) + + window.GLOB.saving = false + if (!error) { notification.warning({ top: 92, diff --git a/src/views/mobdesign/menuform/index.jsx b/src/views/mobdesign/menuform/index.jsx index 8a6b1b7..b6371cf 100644 --- a/src/views/mobdesign/menuform/index.jsx +++ b/src/views/mobdesign/menuform/index.jsx @@ -168,9 +168,10 @@ {getFieldDecorator('timeUnit', { initialValue: config.timeUnit || 'day' })( - <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> <Radio value="day">澶�</Radio> <Radio value="hour">灏忔椂</Radio> + <Radio value="minute">鍒嗛挓</Radio> </Radio.Group> )} </Form.Item> @@ -186,7 +187,7 @@ } ] })( - <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> + <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> )} </Form.Item> </Col> : null} diff --git a/src/views/mobdesign/popview/menuform/index.jsx b/src/views/mobdesign/popview/menuform/index.jsx index d2899a2..e84a5af 100644 --- a/src/views/mobdesign/popview/menuform/index.jsx +++ b/src/views/mobdesign/popview/menuform/index.jsx @@ -86,9 +86,10 @@ {getFieldDecorator('timeUnit', { initialValue: config.timeUnit || 'day' })( - <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> <Radio value="day">澶�</Radio> <Radio value="hour">灏忔椂</Radio> + <Radio value="minute">鍒嗛挓</Radio> </Radio.Group> )} </Form.Item> @@ -104,7 +105,7 @@ } ] })( - <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> + <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> )} </Form.Item> </Col> : null} diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 38beaf3..b35a51b 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -1169,6 +1169,8 @@ menuloading: true }) + window.GLOB.saving = true + setTimeout(() => { let _pass = this.verifyConfig(config) @@ -1408,6 +1410,8 @@ menuloading: false }) + window.GLOB.saving = false + if (!res) return if (res.status) { @@ -1442,6 +1446,9 @@ this.setState({ menuloading: false }) + + window.GLOB.saving = false + if (!error) { notification.warning({ top: 92, diff --git a/src/views/pcdesign/menuform/index.jsx b/src/views/pcdesign/menuform/index.jsx index 7bc9112..8c6262b 100644 --- a/src/views/pcdesign/menuform/index.jsx +++ b/src/views/pcdesign/menuform/index.jsx @@ -187,9 +187,10 @@ {getFieldDecorator('timeUnit', { initialValue: config.timeUnit || 'day' })( - <Radio.Group onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> + <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => {this.selectChange('timeUnit', e.target.value)}}> <Radio value="day">澶�</Radio> <Radio value="hour">灏忔椂</Radio> + <Radio value="minute">鍒嗛挓</Radio> </Radio.Group> )} </Form.Item> @@ -205,7 +206,7 @@ } ] })( - <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> + <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> )} </Form.Item> </Col> : null} diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 507484b..4b40f09 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -566,6 +566,8 @@ menuloading: true }) + window.GLOB.saving = true + setTimeout(() => { let _pass = this.verifyConfig(config) @@ -668,6 +670,8 @@ menuloading: false }) + window.GLOB.saving = false + if (!res) return if (res.status) { @@ -692,6 +696,9 @@ this.setState({ menuloading: false }) + + window.GLOB.saving = false + if (!error) { notification.warning({ top: 92, diff --git a/src/views/tabledesign/menuform/index.jsx b/src/views/tabledesign/menuform/index.jsx index 0d1dcea..fe0a8e6 100644 --- a/src/views/tabledesign/menuform/index.jsx +++ b/src/views/tabledesign/menuform/index.jsx @@ -194,8 +194,6 @@ }) } else if (key === 'parentId') { this.props.updateConfig({...config, parentId: value}) - } else if (key === 'timeUnit') { - this.props.updateConfig({...config, timeUnit: value}) } else if (key === 'OpenType') { this.props.updateConfig({...config, OpenType: value}) } else if (key === 'hidden') { -- Gitblit v1.8.0