From 6b680ace26dc95031a1b7a3e33f8785c112f787d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 20 四月 2020 18:32:01 +0800 Subject: [PATCH] 2020-04-20 --- src/templates/comtableconfig/actionform/index.jsx | 12 package-lock.json | 245 +++++++++++++ src/templates/zshare/formconfig.jsx | 14 src/templates/comtableconfig/index.jsx | 172 +-------- src/templates/subtableconfig/index.jsx | 191 ++------- src/templates/subtableconfig/index.scss | 29 - src/templates/zshare/tabform/index.jsx | 33 + src/templates/zshare/editcomponent/index.jsx | 226 ++++++++++++ src/templates/comtableconfig/index.scss | 11 src/tabviews/zshare/actionList/index.jsx | 22 + src/tabviews/subtable/index.jsx | 31 + src/templates/zshare/editcomponent/index.scss | 5 package.json | 2 src/tabviews/commontable/index.jsx | 3 src/utils/utils.js | 28 src/templates/subtableconfig/actionform/index.jsx | 12 16 files changed, 685 insertions(+), 351 deletions(-) diff --git a/package-lock.json b/package-lock.json index 00e5160..de3c4c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,203 @@ "babel-runtime": "6.26.0" } }, + "@antv/adjust": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@antv/adjust/-/adjust-0.2.2.tgz", + "integrity": "sha512-b5cABT0WWgKU8pfhW2ssID4FBXDBnHPuxU/HAV3nOMq1lso2BI2/r1hHnrVMZId5Dntb7YrVTOsokiD9DFZ2+w==", + "requires": { + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/attr": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@antv/attr/-/attr-0.3.2.tgz", + "integrity": "sha512-31PfcVKeQdPBmr/QD+IC0NB/FbdtVKOXBCNMepFc5/dEs7jphmgG1V4tfAJmcXIHubCTHOjpscTrDIvoKSGvMQ==", + "requires": { + "@antv/color-util": "2.0.4", + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/color-util": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@antv/color-util/-/color-util-2.0.4.tgz", + "integrity": "sha512-CM9bIuykFTKPKbp8iDv2hHfY9QoaAOAyqFKWoV7ux1ZlFOA3KfRwcBDJtk0WlMdhzuZyhMGq0sBlxHCs9YBsVQ==", + "requires": { + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/component": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@antv/component/-/component-0.5.6.tgz", + "integrity": "sha512-xT9s+gS6b8P+t/tc1ulOBxNe2nveQ0hHQWB5jyCXnpS57B9GINgwjDv0uI280PScIQCa8rkn1eRZYzV1OMeb2w==", + "requires": { + "@antv/dom-util": "2.0.2", + "@antv/g-base": "0.4.4", + "@antv/matrix-util": "2.0.7", + "@antv/path-util": "2.0.7", + "@antv/scale": "0.3.1", + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/coord": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@antv/coord/-/coord-0.2.7.tgz", + "integrity": "sha512-0xfUYANsmvvvjmCm0ZuT2Bw1448Mm5EbizeBKJlPIlaV4Cf3Fz+ZdDVnRdhcVs7psSromRX+LqrjkxvT3GikLQ==", + "requires": { + "@antv/matrix-util": "2.0.7", + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/dom-util": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@antv/dom-util/-/dom-util-2.0.2.tgz", + "integrity": "sha512-i/rh385casRd6OA4rbpbA2jyiwY/w7PtkA+74mH43PiBzOcLpDg1jEWR9dMO0tIqUzHQWWqKNNjmXVubl4GS6g==", + "requires": { + "tslib": "1.10.0" + } + }, + "@antv/event-emitter": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@antv/event-emitter/-/event-emitter-0.1.2.tgz", + "integrity": "sha512-6C6NJOdoNVptCr5y9BVOhKkCgW7LFs/SpcRyAExUeSjAm0zJqcqNkSIRGsXYhj4PJI+CZICHzGwwiSnIsE68Ug==" + }, + "@antv/g-base": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@antv/g-base/-/g-base-0.4.4.tgz", + "integrity": "sha512-P5qptpFy4QiEiQsESNVxvLJsfJJkTuJyfgchP4tUv/g3Ir6xn3Hj8mFbyjesOJ4/wWyhABYTpekK0HNWr1WiXA==", + "requires": { + "@antv/event-emitter": "0.1.2", + "@antv/g-math": "0.1.3", + "@antv/matrix-util": "2.0.7", + "@antv/path-util": "2.0.7", + "@antv/util": "2.0.8", + "@types/d3-timer": "1.0.9", + "d3-ease": "1.0.6", + "d3-interpolate": "1.4.0", + "d3-timer": "1.0.10" + } + }, + "@antv/g-canvas": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/@antv/g-canvas/-/g-canvas-0.4.8.tgz", + "integrity": "sha512-OR9n+w4sCEnTgscjEr5mk2Y48JEKfdetZiX/2rRnJXdETH3oqoogHTmrQkT5AqS2vKNdi6xErXIO/Wg2fQs1aA==", + "requires": { + "@antv/g-base": "0.4.4", + "@antv/g-math": "0.1.3", + "@antv/path-util": "2.0.7", + "@antv/util": "2.0.8", + "gl-matrix": "3.3.0" + } + }, + "@antv/g-math": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@antv/g-math/-/g-math-0.1.3.tgz", + "integrity": "sha512-m4jF1Xm9bSTDLU35u3bSW9UcqJJVxU+E+bKtJgNfXUiDwHILYJey825+ApsZ8yjU7SD1kDP6GH6NTGzmChszEQ==", + "requires": { + "@antv/util": "2.0.8", + "gl-matrix": "3.3.0" + } + }, + "@antv/g-svg": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@antv/g-svg/-/g-svg-0.4.4.tgz", + "integrity": "sha512-oHhfT3OhckGpBNlLM+FY5l6ysA044pqJ3CQ/NNqS269PwAXqswu7GbIIDmiy6lUURtaAVgyYxbAddoCnCvZ1Kg==", + "requires": { + "@antv/g-base": "0.4.4", + "@antv/g-math": "0.1.3", + "@antv/util": "2.0.8", + "detect-browser": "4.8.0" + } + }, + "@antv/g2": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/@antv/g2/-/g2-4.0.7.tgz", + "integrity": "sha512-Eacs+kehvkfuQkgWbhIpc2xlaruZtNSOAG4wzFFtskPGcTgL1mcKr6+H/ByTWYug79f8FBax4PSqdj4e+iLSNw==", + "requires": { + "@antv/adjust": "0.2.2", + "@antv/attr": "0.3.2", + "@antv/color-util": "2.0.4", + "@antv/component": "0.5.6", + "@antv/coord": "0.2.7", + "@antv/event-emitter": "0.1.2", + "@antv/g-base": "0.4.4", + "@antv/g-canvas": "0.4.8", + "@antv/g-svg": "0.4.4", + "@antv/matrix-util": "2.0.7", + "@antv/path-util": "2.0.7", + "@antv/scale": "0.3.1", + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/g2plot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@antv/g2plot/-/g2plot-1.0.3.tgz", + "integrity": "sha512-328WdD4sf9P/Q49QQDOszyOIscmmh4azXg2gYJNiULHZSLeCtEd+Car/PrL4lcfKUgL0Y4Ah5kyuC45WmHkg4g==", + "requires": { + "@antv/component": "0.5.6", + "@antv/coord": "0.2.7", + "@antv/dom-util": "2.0.2", + "@antv/event-emitter": "0.1.2", + "@antv/g-base": "0.4.4", + "@antv/g-canvas": "0.4.8", + "@antv/g-svg": "0.4.4", + "@antv/g2": "4.0.7", + "@antv/matrix-util": "2.0.7", + "@antv/scale": "0.3.1", + "@antv/util": "2.0.8", + "d3-regression": "1.3.4", + "resize-observer-polyfill": "1.5.1", + "warning": "4.0.3" + } + }, + "@antv/gl-matrix": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@antv/gl-matrix/-/gl-matrix-2.7.1.tgz", + "integrity": "sha512-oOWcVNlpELIKi9x+Mm1Vwbz8pXfkbJKykoCIOJ/dNK79hSIANbpXJ5d3Rra9/wZqK6MC961B7sybFhPlLraT3Q==" + }, + "@antv/matrix-util": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@antv/matrix-util/-/matrix-util-2.0.7.tgz", + "integrity": "sha512-bogifQY8jplWtSTZsPqBOdBlDdkM7IwDqYL8eMYL8OaSyOPCS7l9bnEQjQ9qTAwfCd7wHTuPoCnCpbiR8BYFvQ==", + "requires": { + "@antv/gl-matrix": "2.7.1", + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/path-util": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@antv/path-util/-/path-util-2.0.7.tgz", + "integrity": "sha512-1gvgPxYjQ7QGqeFLJC8C3cQd7hP+3GQSdSTKoSSW4Q7nVXdibVx8D521kJe2NkketdKLwsT8gmwJWcu+NU43+w==", + "requires": { + "@antv/util": "2.0.8", + "tslib": "1.10.0" + } + }, + "@antv/scale": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@antv/scale/-/scale-0.3.1.tgz", + "integrity": "sha512-bl1IAuiwVasrCpgeeT/aXYpiCiL5T3vJSWgFiRLPJeWhMGCTfsMYP/XKp6gqpD0nVj/WsF2VsoUhJG4VlyY3Pw==", + "requires": { + "@antv/util": "2.0.8", + "fecha": "3.0.3", + "tslib": "1.10.0" + } + }, + "@antv/util": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@antv/util/-/util-2.0.8.tgz", + "integrity": "sha512-G9QRygQJ8UNGMi8L1dfMIa4SofbEO+jkXwvRY4ek/MLd04Q01UN0U28JeMFzw6FCKJdxiFu+2uwT/zjoFr3QoQ==", + "requires": { + "tslib": "1.10.0" + } + }, "@babel/code-frame": { "version": "7.5.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", @@ -1524,6 +1721,11 @@ "requires": { "@babel/types": "7.6.1" } + }, + "@types/d3-timer": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-1.0.9.tgz", + "integrity": "sha512-WvfJ3LFxBbWjqRGz9n7GJt08RrTHPJDVsIwwoCMROlqF+iDacYiAFjf9oqnq0mXpb2juA2N/qjKP+MKdal3YNQ==" }, "@types/eslint-visitor-keys": { "version": "1.0.0", @@ -4211,6 +4413,34 @@ "type": "1.0.3" } }, + "d3-color": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-1.4.0.tgz", + "integrity": "sha512-TzNPeJy2+iEepfiL92LAAB7fvnp/dV2YwANPVHdDWmYMm23qIJBYww3qT8I8C1wXrmrg4UWs7BKc2tKIgyjzHg==" + }, + "d3-ease": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.6.tgz", + "integrity": "sha512-SZ/lVU7LRXafqp7XtIcBdxnWl8yyLpgOmzAk0mWBI9gXNzLDx5ybZgnRbH9dN/yY5tzVBqCQ9avltSnqVwessQ==" + }, + "d3-interpolate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.4.0.tgz", + "integrity": "sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==", + "requires": { + "d3-color": "1.4.0" + } + }, + "d3-regression": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/d3-regression/-/d3-regression-1.3.4.tgz", + "integrity": "sha512-o5nwONeooEfy+L98Ej+WPccb6LgLKtsnXLuWzXb8Ta1mN95Jy0Aw9X2TxV+S+OW+NcrBfEjxSURoSlQfVAEkrg==" + }, + "d3-timer": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.10.tgz", + "integrity": "sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw==" + }, "damerau-levenshtein": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz", @@ -4421,6 +4651,11 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "detect-browser": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-4.8.0.tgz", + "integrity": "sha512-f4h2dFgzHUIpjpBLjhnDIteXv8VQiUm8XzAuzQtYUqECX/eKh67ykuiVoyb7Db7a0PUSmJa3OGXStG0CbQFUVw==" }, "detect-indent": { "version": "4.0.0", @@ -6895,6 +7130,11 @@ } } }, + "fecha": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-3.0.3.tgz", + "integrity": "sha512-6LQK/1jud/FZnfEEZJ7y81vw7ge81DNd/XEsX0hgMUjhS+QMljkb1C0czBaP7dMNRVrd5mw/J2J7qI2Nw+TWZw==" + }, "figgy-pudding": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", @@ -7725,6 +7965,11 @@ "assert-plus": "1.0.0" } }, + "gl-matrix": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.3.0.tgz", + "integrity": "sha512-COb7LDz+SXaHtl/h4LeaFcNdJdAQSDeVqjiIihSXNrkWObZLhDI4hIkZC11Aeqp7bcE72clzB0BnDXr2SmslRA==" + }, "glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", diff --git a/package.json b/package.json index b90a3d0..781b4e4 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "version": "0.1.0", "private": true, "dependencies": { + "@antv/g2": "^4.0.7", + "@antv/g2plot": "^1.0.3", "@babel/core": "7.5.5", "@svgr/webpack": "4.3.2", "@typescript-eslint/eslint-plugin": "1.13.0", diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 6ead87e..0f79790 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -1188,7 +1188,7 @@ } render() { - const { view, setting, searchlist, actions, columns, loadingview, viewlost, pickup, config, triggerBtn, userConfig, tabActive } = this.state + const { view, setting, searchlist, actions, columns, loadingview, viewlost, pickup, config, triggerBtn, userConfig, tabActive, search } = this.state return ( <div> @@ -1266,6 +1266,7 @@ Tab={_tab} menuType="main" MenuID={_tab.linkTab} + mainSearch={_tab.searchPass === 'true' ? search : null} userConfig={userConfig ? userConfig[_tab.uuid] : null} triggerBtn={triggerBtn} SupMenuID={this.props.MenuID} diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 11b05d8..f044c02 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -31,6 +31,7 @@ BData: PropTypes.any, // 涓婄骇鏁版嵁 MenuID: PropTypes.string, // 鑿滃崟Id SupMenuID: PropTypes.string, // 涓婄骇鑿滃崟Id + mainSearch: PropTypes.any, // 涓昏〃鎼滅储鏉′欢 ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 @@ -81,6 +82,10 @@ this.setState({ triggerBtn: trigger + }) + } else if (!this.props.Tab.supMenu && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { + this.setState({}, () => { + this.loadmaindata() }) } } @@ -474,9 +479,15 @@ * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� */ getCustomParam = (BID) => { + const { mainSearch } = this.props const { pageIndex, pageSize, orderBy, search, setting } = this.state - let _search = Utils.formatCustomMainSearch(search) + let searches = search + if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 + searches = [...mainSearch, ...search] + } + + let _search = Utils.formatCustomMainSearch(searches) let param = { PageIndex: pageIndex, @@ -515,9 +526,15 @@ * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� */ getDefaultParam = (BID) => { + const { mainSearch } = this.props const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state - let _search = Utils.joinMainSearchkey(search) + let searches = search + if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 + searches = [...mainSearch, ...search] + } + + let _search = Utils.joinMainSearchkey(searches) _search = _search ? 'where ' + _search : '' let param = { @@ -679,13 +696,18 @@ * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ getexceloutparam = () => { - const { Tab } = this.props + const { Tab, mainSearch } = this.props const { arr_field, orderBy, search, setting} = this.state + + let searches = search + if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 + searches = [...mainSearch, ...search] + } return { arr_field: arr_field, orderBy: orderBy || setting.order, - search: search, + search: searches, menuName: Tab.label } } @@ -713,7 +735,6 @@ data: record } }) - // this.refs.subButton.actionTrigger(btn, record) } /** diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 2f65609..b96888c 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -1965,6 +1965,28 @@ let viewParam = this.props.getexceloutparam() let name = `${viewParam.menuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` let pageSize = 1000 + + if (btn.search === 'true' && viewParam.search && viewParam.search.length > 0) { + let valid = false + viewParam.search.forEach(item => { + if (Array.isArray(item.value)) { + if (item.value.length > 0) { + valid = true + } + } else if (item.value || item.value === 0) { + valid = true + } + }) + + if (!valid) { + notification.warning({ + top: 92, + message: '鎼滅储鏉′欢涓嶅彲涓虹┖锛�', + duration: 5 + }) + return + } + } this.setState({loadingUuid: btn.uuid}) diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx index 0af7ce9..ec5a928 100644 --- a/src/templates/comtableconfig/actionform/index.jsx +++ b/src/templates/comtableconfig/actionform/index.jsx @@ -111,9 +111,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (_opentype === 'excelOut') { // 瀵煎叆瀵煎嚭 if (_intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } } else if (_opentype === 'excelIn') { // 瀵煎叆瀵煎嚭 if (_intertype === 'outer') { @@ -214,9 +214,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (value === 'excelOut') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } } else if (value === 'excelIn') { if (this.state.interType === 'outer') { @@ -363,9 +363,9 @@ let _options = null if (openType === 'excelOut') { if (value === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } } else if (openType === 'excelIn') { if (value === 'outer') { diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index aa5d11e..ac8f3cc 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -20,7 +20,6 @@ import TabForm from '@/templates/zshare/tabform' import SearchForm from '@/templates/zshare/searchform' import ColumnForm from '@/templates/zshare/columnform' -import PasteForm from '@/templates/zshare/pasteform' import DragElement from '@/templates/zshare/dragelement' import ColspanForm from '@/templates/zshare/colspanform' import GridBtnForm from '@/templates/zshare/gridbtnform' @@ -31,7 +30,7 @@ import VerifyCardPrint from '@/templates/zshare/verifycardprint' import MenuForm from '@/templates/zshare/menuform' import TabDragElement from '@/templates/zshare/tabdragelement' -import TransferForm from '@/components/transferform' +import EditComponent from '@/templates/zshare/editcomponent' import SourceElement from '@/templates/zshare/dragelement/source' import CreateFunc from '@/templates/zshare/createfunc' import CreateInterface from '@/templates/zshare/createinterface' @@ -77,8 +76,6 @@ tabviews: [], // 鎵�鏈夋爣绛鹃〉 profileVisible: false, // 楠岃瘉淇℃伅妯℃�佹 optionLibs: null, // 鑷畾涔変笅鎷夐�夐」搴� - thawBtnVisible: false, // 瑙e喕鎸夐挳寮圭獥 - thawbtnlist: null, // 瑙e喕鎸夐挳鍒楄〃 thawButtons: [], // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 sqlVerifing: false // sql楠岃瘉 @@ -675,6 +672,21 @@ tooltip: '澶栭敭鏃ㄥ湪鏍囩椤典腑鎵ц榛樿鍑芥暟锛堟坊鍔狅級鏃讹紝鏇挎崲BID瀛楁', initVal: card.foreignKey || '', required: false + }, + { + type: 'radio', + key: 'searchPass', + label: '涓昏〃鎼滅储', + initVal: card.searchPass || 'false', + tooltip: '浣跨敤涓昏〃鎼滅储鏉′欢鏃讹紝涓昏〃鐨勬悳绱㈡潯浠朵細浼犲叆瀛愯〃涓��', + required: false, + options: [{ + value: 'true', + text: '浣跨敤' + }, { + value: 'false', + text: '涓嶄娇鐢�' + }] } ] }) @@ -2762,86 +2774,6 @@ }) } - /** - * @description 瑙e喕鎸夐挳 - */ - handleThaw = () => { - const { menu } = this.props - - this.setState({ - thawBtnVisible: true - }) - - Api.getSystemConfig({ - func: 'sPC_Get_FrozenMenu', - ParentID: menu.MenuID, - TYPE: 40 - }).then(res => { - if (res.status) { - let _list = [] - - res.data.forEach(menu => { - let _conf = '' - - if (menu.ParentParam) { - try { - _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam))) - } catch (e) { - console.warn('Parse Failure') - _conf = '' - } - } - - if (_conf) { - _list.push({ - key: menu.MenuID, - title: menu.MenuName, - btnParam: _conf - }) - } - }) - - this.setState({ - thawbtnlist: _list - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - /** - * @description 瑙e喕鎸夐挳鎻愪氦 - */ - thawBtnSubmit = () => { - const { thawButtons, config, thawbtnlist } = this.state - // 涓夌骇鑿滃崟瑙i櫎鍐荤粨 - if (this.refs.trawmenu.state.targetKeys.length === 0) { - notification.warning({ - top: 92, - message: this.state.dict['form.required.select'] + this.state.dict['header.form.thawbutton'], - duration: 5 - }) - } else { - - thawbtnlist.forEach(item => { - if (this.refs.trawmenu.state.targetKeys.includes(item.key)) { - config.action.push(item.btnParam) - } - }) - - this.setState({ - thawButtons: [...thawButtons, ...this.refs.trawmenu.state.targetKeys], - config: config, - thawBtnVisible: false - }) - } - } - handleGroup = (index, type) => { let config = JSON.parse(JSON.stringify(this.state.config)) @@ -2897,38 +2829,21 @@ this.props.handleView() } - pasteSubmit = () => { - const { config } = this.state - - this.pasteFormRef.handleConfirm().then(res => { + updateConfig = (res) => { + if (res.type === 'thaw') { + this.setState({ + thawButtons: res.thawButtons, + config: res.config + }) + } else if (res.type === 'paste') { if (res.copyType === 'action') { - this.setState({ - modaltype: '' - }, () => { - this.handleAction(res, 'copy') - }) + this.handleAction(res.content, 'copy') } else if (res.copyType === 'columns') { - if (config.columns && config.columns.length > 0) { - notification.warning({ - top: 92, - message: '鏄剧ず鍒楀凡瀛樺湪锛�', - duration: 5 - }) - return - } - this.setState({ - modaltype: '', - config: {...config, columns: res.columns} - }) - } else { - notification.warning({ - top: 92, - message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', - duration: 5 + config: res.config }) } - }) + } } render () { @@ -3026,9 +2941,6 @@ {this.state.dict['header.menu.action.configurable']} </p> : null } - <div className="thawbutton" title={this.state.dict['header.form.thawbutton']} onClick={this.handleThaw}> - <Icon type="unlock" /> - </div> </div> {configAction.map((item, index) => { return ( @@ -3090,6 +3002,7 @@ </div> } bordered={false} extra={ <div> + <EditComponent dict={this.state.dict} type="maintable" config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> @@ -3114,9 +3027,6 @@ <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> <Icon type="question-circle" /> </Tooltip> - <div className="copybutton" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({modaltype: 'paste'})}}> - <Icon type="snippets" /> - </div> <DragElement type="action" list={config.action} @@ -3410,34 +3320,6 @@ destroyOnClose > {this.state.dict['header.menu.config.placeholder']} - </Modal> - {/* 瑙e喕鎸夐挳妯℃�佹 */} - <Modal - title={this.state.dict['header.form.thawbutton']} - okText={this.state.dict['header.confirm']} - cancelText={this.state.dict['header.cancel']} - visible={this.state.thawBtnVisible} - onOk={this.thawBtnSubmit} - onCancel={() => {this.setState({thawBtnVisible: false, thawbtnlist: null})}} - destroyOnClose - > - {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>} - </Modal> - {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} - <Modal - title={this.state.dict['header.form.paste']} - visible={modaltype === 'paste'} - width={600} - maskClosable={false} - onOk={this.pasteSubmit} - onCancel={() => {this.setState({modaltype: ''})}} - destroyOnClose - > - <PasteForm - dict={this.state.dict} - wrappedComponentRef={(inst) => this.pasteFormRef = inst} - /> </Modal> {this.state.loading && <Spin size="large" />} </div> diff --git a/src/templates/comtableconfig/index.scss b/src/templates/comtableconfig/index.scss index af090ab..700a7a9 100644 --- a/src/templates/comtableconfig/index.scss +++ b/src/templates/comtableconfig/index.scss @@ -308,17 +308,6 @@ display: inline-block; } } - .copybutton { - position: absolute; - right: 10px; - top: 5px; - z-index: 2; - padding: 5px; - cursor: pointer; - i { - font-size: 16px; - } - } } .column-list { position: relative; diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx index 84a1cbf..db9c896 100644 --- a/src/templates/subtableconfig/actionform/index.jsx +++ b/src/templates/subtableconfig/actionform/index.jsx @@ -118,9 +118,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (_opentype === 'excelOut') { if (_intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } } else if (_opentype === 'excelIn') { if (_intertype === 'outer') { @@ -239,9 +239,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (value === 'excelOut') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } } else if (value === 'excelIn') { if (this.state.interType === 'outer') { @@ -407,9 +407,9 @@ if (openType === 'excelOut') { if (value === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] } } else if (openType === 'excelIn') { if (value === 'outer') { diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 2930bf1..dab3aa9 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -4,7 +4,7 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch, Tooltip } from 'antd' +import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch, Tooltip, message } from 'antd' import moment from 'moment' import Api from '@/api' @@ -20,7 +20,6 @@ import SearchForm from '@/templates/zshare/searchform' import ColumnForm from '@/templates/zshare/columnform' import DragElement from '@/templates/zshare/dragelement' -import PasteForm from '@/templates/zshare/pasteform' import ColspanForm from '@/templates/zshare/colspanform' import GridBtnForm from '@/templates/zshare/gridbtnform' import EditCard from '@/templates/zshare/editcard' @@ -29,7 +28,7 @@ import VerifyCardExcelIn from '@/templates/zshare/verifycardexcelin' import VerifyCardExcelOut from '@/templates/zshare/verifycardexcelout' import MenuForm from '@/templates/zshare/menuform' -import TransferForm from '@/components/transferform' +import EditComponent from '@/templates/zshare/editcomponent' import SourceElement from '@/templates/zshare/dragelement/source' import CreateFunc from '@/templates/zshare/createfunc' import CreateInterface from '@/templates/zshare/createinterface' @@ -83,8 +82,6 @@ tabviews: [], // 鎵�鏈夋爣绛鹃〉 profileVisible: false, // 楠岃瘉淇℃伅妯℃�佹 optionLibs: null, // 鑷畾涔変笅鎷夐�夐」搴� - thawBtnVisible: false, // 瑙e喕鎸夐挳寮圭獥 - thawbtnlist: null, // 瑙e喕鎸夐挳鍒楄〃 thawButtons: [], // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 sqlVerifing: false // sql楠岃瘉 @@ -2106,86 +2103,6 @@ } /** - * @description 瑙e喕鎸夐挳 - */ - handleThaw = () => { - const { config } = this.state - - this.setState({ - thawBtnVisible: true - }) - - Api.getSystemConfig({ - func: 'sPC_Get_FrozenMenu', - ParentID: config.uuid, - TYPE: 40 - }).then(res => { - if (res.status) { - let _list = [] - - res.data.forEach(menu => { - let _conf = '' - - if (menu.ParentParam) { - try { - _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam))) - } catch (e) { - console.warn('Parse Failure') - _conf = '' - } - } - - if (_conf) { - _list.push({ - key: menu.MenuID, - title: menu.MenuName, - btnParam: _conf - }) - } - }) - - this.setState({ - thawbtnlist: _list - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - /** - * @description 瑙e喕鎸夐挳鎻愪氦 - */ - thawBtnSubmit = () => { - const { thawButtons, config, thawbtnlist } = this.state - // 涓夌骇鑿滃崟瑙i櫎鍐荤粨 - if (this.refs.trawmenu.state.targetKeys.length === 0) { - notification.warning({ - top: 92, - message: this.state.dict['form.required.select'] + this.state.dict['header.form.thawbutton'], - duration: 5 - }) - } else { - - thawbtnlist.forEach(item => { - if (this.refs.trawmenu.state.targetKeys.includes(item.key)) { - config.action.push(item.btnParam) - } - }) - - this.setState({ - thawButtons: [...thawButtons, ...this.refs.trawmenu.state.targetKeys], - config: config, - thawBtnVisible: false - }) - } - } - - /** * @description 鍒涘缓鎸夐挳鎺ュ彛锛堝啓鍏ワ級 */ btnCreatInterface = () => { @@ -2244,30 +2161,42 @@ }) } - pasteSubmit = () => { - this.pasteFormRef.handleConfirm().then(res => { - if (res.copyType !== 'action') { - notification.warning({ - top: 92, - message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', - duration: 5 - }) - return - } else if (!['pop', 'prompt', 'exec', 'excelIn', 'excelOut', 'popview'].includes(res.OpenType)) { - notification.warning({ - top: 92, - message: '涓嶆敮鎸佹鎵撳紑鏂瑰紡锛�', - duration: 5 - }) - return - } + copycolumn = () => { + const { config } = this.state + let oInput = document.createElement('input') + let val = { + copyType: 'columns', + columns: config.columns + } + + oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val))) + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + oInput.className = 'oInput' + oInput.style.display = 'none' + + message.success('澶嶅埗鎴愬姛銆�') + + document.body.removeChild(oInput) + } + + updateConfig = (res) => { + if (res.type === 'thaw') { this.setState({ - modaltype: '' - }, () => { - this.handleAction(res, 'copy') + thawButtons: res.thawButtons, + config: res.config }) - }) + } else if (res.type === 'paste') { + if (res.copyType === 'action') { + this.handleAction(res.content, 'copy') + } else if (res.copyType === 'columns') { + this.setState({ + config: res.config + }) + } + } } render () { @@ -2359,9 +2288,6 @@ {this.state.dict['header.menu.action.configurable']} </p> : null } - <div className="thawbutton" title={this.state.dict['header.form.thawbutton']} onClick={this.handleThaw}> - <Icon type="unlock" /> - </div> </div> {configAction.map((item, index) => { return ( @@ -2395,6 +2321,7 @@ </div> } bordered={false} extra={ <div> + <EditComponent dict={this.state.dict} type="subtable" config={this.state.config} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> @@ -2414,13 +2341,24 @@ placeholder={this.state.dict['header.form.search.placeholder']} /> </div> + {/* <div className="action-list"> + <DragElement + type="action" + list={this.state.config.action} + setting={this.state.config.setting} + handleList={this.handleList} + handleMenu={this.handleAction} + copyElement={(val) => this.handleAction(val, 'copy')} + deleteMenu={this.deleteElement} + profileMenu={this.profileAction} + doubleClickCard={this.btnDoubleClick} + placeholder={this.state.dict['header.form.action.placeholder']} + /> + </div> */} <div className="action-list"> <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> <Icon type="question-circle" /> </Tooltip> - <div className="copybutton" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({modaltype: 'paste'})}}> - <Icon type="snippets" /> - </div> <DragElement type="action" list={this.state.config.action} @@ -2438,6 +2376,7 @@ <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃樉绀哄垪銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬樉绀哄垪鎷栬嚦姝ゅ娣诲姞锛涙垨鐐瑰嚮銆婃坊鍔犳樉绀哄垪銆嬫寜閽壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ�傛敞锛氭坊鍔犲悎骞跺垪鏃讹紝闇�璁剧疆鍙�夊垪銆�"> <Icon type="question-circle" /> </Tooltip> + {config.columns && config.columns.length > 0 ? <Icon className="column-copy" title="copy" type="copy" onClick={this.copycolumn} /> : null} <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showColumnName} onChange={this.onColumnNameChange} /> <DragElement type="columns" @@ -2668,34 +2607,6 @@ destroyOnClose > {this.state.dict['header.menu.config.placeholder']} - </Modal> - {/* 瑙e喕鎸夐挳妯℃�佹 */} - <Modal - title={this.state.dict['header.form.thawbutton']} - okText={this.state.dict['header.confirm']} - cancelText={this.state.dict['header.cancel']} - visible={this.state.thawBtnVisible} - onOk={this.thawBtnSubmit} - onCancel={() => {this.setState({thawBtnVisible: false, thawbtnlist: null})}} - destroyOnClose - > - {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>} - </Modal> - {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} - <Modal - title={this.state.dict['header.form.paste']} - visible={modaltype === 'paste'} - width={600} - maskClosable={false} - onOk={this.pasteSubmit} - onCancel={() => {this.setState({modaltype: ''})}} - destroyOnClose - > - <PasteForm - dict={this.state.dict} - wrappedComponentRef={(inst) => this.pasteFormRef = inst} - /> </Modal> {this.state.loading && <Spin size="large" />} </div> diff --git a/src/templates/subtableconfig/index.scss b/src/templates/subtableconfig/index.scss index 629477c..6d596e6 100644 --- a/src/templates/subtableconfig/index.scss +++ b/src/templates/subtableconfig/index.scss @@ -59,17 +59,6 @@ color: #1890ff; border-bottom: 1px solid #e8e8e8; } - .thawbutton { - position: absolute; - right: 10px; - top: 0px; - padding: 0px; - cursor: pointer; - i { - font-size: 16px; - color: #1890ff; - } - } } .tables { .ant-select-selection-selected-value { @@ -302,17 +291,6 @@ display: inline-block; } } - .copybutton { - position: absolute; - right: 10px; - top: 5px; - z-index: 2; - padding: 5px; - cursor: pointer; - i { - font-size: 16px; - } - } } .column-list { position: relative; @@ -322,6 +300,13 @@ right: 20px; top: -10px; } + .column-copy { + position: absolute; + font-size: 16px; + right: 75px; + top: -7px; + color: #26C281; + } > .ant-row { background: #fafafa; border-radius: 4px; diff --git a/src/templates/zshare/editcomponent/index.jsx b/src/templates/zshare/editcomponent/index.jsx new file mode 100644 index 0000000..cf54d8d --- /dev/null +++ b/src/templates/zshare/editcomponent/index.jsx @@ -0,0 +1,226 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Menu, Dropdown, Icon, Modal, Spin, notification } from 'antd' + +import Api from '@/api' +import PasteForm from '@/templates/zshare/pasteform' +import TransferForm from '@/components/transferform' +import './index.scss' + +class editComponent extends Component { + static propTpyes = { + type: PropTypes.string, + MenuID: PropTypes.any, + config: PropTypes.object, + thawButtons: PropTypes.array, + refresh: PropTypes.func + } + + state = { + thawVisible: false, + thawbtnlist: null, + pasteVisible: false + } + + handleMenuClick = e => { + if (e.key === 'thaw') { + this.handleThaw() + } else if (e.key === 'paste') { + this.setState({pasteVisible: true}) + } + } + + /** + * @description 瑙e喕鎸夐挳 + */ + handleThaw = () => { + const { config } = this.props + + this.setState({ + thawVisible: true + }) + + let uuid = config.uuid + + if (this.props.type === 'maintable') { + uuid = this.props.MenuID + } + + Api.getSystemConfig({ + func: 'sPC_Get_FrozenMenu', + ParentID: uuid, + TYPE: 40 + }).then(res => { + if (res.status) { + let _list = [] + + res.data.forEach(menu => { + let _conf = '' + + if (menu.ParentParam) { + try { + _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam))) + } catch (e) { + console.warn('Parse Failure') + _conf = '' + } + } + + if (_conf) { + _list.push({ + key: menu.MenuID, + title: menu.MenuName, + btnParam: _conf + }) + } + }) + + this.setState({ + thawbtnlist: _list + }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + }) + } + + /** + * @description 瑙e喕鎸夐挳鎻愪氦 + */ + thawBtnSubmit = () => { + const { thawButtons } = this.props + const { thawbtnlist } = this.state + let config = JSON.parse(JSON.stringify(this.props.config)) + + // 涓夌骇鑿滃崟瑙i櫎鍐荤粨 + if (this.refs.trawmenu.state.targetKeys.length === 0) { + notification.warning({ + top: 92, + message: this.props.dict['form.required.select'] + this.props.dict['header.form.thawbutton'], + duration: 5 + }) + } else { + + thawbtnlist.forEach(item => { + if (this.refs.trawmenu.state.targetKeys.includes(item.key)) { + config.action.push(item.btnParam) + } + }) + + this.props.refresh({ + type: 'thaw', + thawButtons: [...thawButtons, ...this.refs.trawmenu.state.targetKeys], + config: config + }) + + this.setState({ + thawVisible: false + }) + } + } + + pasteSubmit = () => { + const { config } = this.props + + this.pasteFormRef.handleConfirm().then(res => { + if (res.copyType === 'action') { + if (this.props.type === 'subtable' && !['pop', 'prompt', 'exec', 'excelIn', 'excelOut', 'popview'].includes(res.OpenType)) { + notification.warning({ + top: 92, + message: '涓嶆敮鎸佹鎵撳紑鏂瑰紡锛�', + duration: 5 + }) + return + } + this.setState({ + pasteVisible: false + }, () => { + this.props.refresh({ + type: 'paste', + copyType: 'action', + content: res + }) + }) + } else if (res.copyType === 'columns') { + if (config.columns && config.columns.length > 0) { + notification.warning({ + top: 92, + message: '鏄剧ず鍒楀凡瀛樺湪锛�', + duration: 5 + }) + return + } + + this.setState({ + pasteVisible: false + }, () => { + this.props.refresh({ + type: 'paste', + copyType: 'columns', + config: {...config, columns: res.columns} + }) + }) + } else { + notification.warning({ + top: 92, + message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', + duration: 5 + }) + } + }) + } + + render() { + const menu = ( + <Menu onClick={this.handleMenuClick}> + <Menu.Item key="thaw"><Icon type="unlock" />{this.props.dict['header.form.thawbutton']}</Menu.Item> + <Menu.Item key="paste"><Icon type="snippets" />{this.props.dict['header.form.paste']}</Menu.Item> + <Menu.Item key="replace"><Icon type="retweet" />鏇挎崲</Menu.Item> + </Menu> + ) + + return ( + <div style={{display: 'inline-block'}}> + <Dropdown overlay={menu} overlayClassName="edit-component-box"> + <span style={{color: '#1890ff', display: 'inline-block', height: 25}}> + 缂栬緫 <Icon type="down" /> + </span> + </Dropdown> + {/* 瑙e喕鎸夐挳妯℃�佹 */} + <Modal + title={this.props.dict['header.form.thawbutton']} + okText={this.props.dict['header.confirm']} + cancelText={this.props.dict['header.cancel']} + visible={this.state.thawVisible} + onOk={this.thawBtnSubmit} + onCancel={() => {this.setState({thawVisible: false, thawbtnlist: null})}} + destroyOnClose + > + {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} + {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>} + </Modal> + {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} + <Modal + title={this.props.dict['header.form.paste']} + visible={this.state.pasteVisible} + width={600} + maskClosable={false} + onOk={this.pasteSubmit} + onCancel={() => {this.setState({pasteVisible: false})}} + destroyOnClose + > + <PasteForm + dict={this.props.dict} + wrappedComponentRef={(inst) => this.pasteFormRef = inst} + /> + </Modal> + </div> + ) + } +} + +export default editComponent \ No newline at end of file diff --git a/src/templates/zshare/editcomponent/index.scss b/src/templates/zshare/editcomponent/index.scss new file mode 100644 index 0000000..15674f0 --- /dev/null +++ b/src/templates/zshare/editcomponent/index.scss @@ -0,0 +1,5 @@ +.edit-component-box { + .ant-dropdown-menu-item { + min-width: 120px;; + } +} \ No newline at end of file diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 8ea25d1..d72cf10 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -600,6 +600,20 @@ value: 'false', text: Formdict['header.form.false'] }] + }, + { + type: 'radio', + key: 'search', + label: '鎼滅储鏉′欢', + initVal: card.search || 'false', + required: false, + options: [{ + value: 'true', + text: '蹇呭~' + }, { + value: 'false', + text: '闈炲繀濉�' + }] } ] } diff --git a/src/templates/zshare/tabform/index.jsx b/src/templates/zshare/tabform/index.jsx index 98d21c0..0f8cf4d 100644 --- a/src/templates/zshare/tabform/index.jsx +++ b/src/templates/zshare/tabform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, Icon, Tooltip } from 'antd' +import { Form, Row, Col, Input, Select, Icon, Tooltip, Radio } from 'antd' import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' import './index.scss' @@ -201,6 +201,37 @@ </Form.Item> </Col> ) + } else if (item.type === 'radio') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <Icon type="question-circle" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal, + rules: [ + { + required: !!item.required, + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( + <Radio.Group> + { + item.options.map(option => { + return ( + <Radio key={option.value} value={option.value}>{option.text}</Radio> + ) + }) + } + </Radio.Group> + )} + </Form.Item> + </Col> + ) } }) diff --git a/src/utils/utils.js b/src/utils/utils.js index a3f9b02..2a4bd06 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -58,19 +58,19 @@ static verifySql (sql, type) { if (!sql) return '' let chars = [ - {key: 'create', reg: '(^|\\s)create\\s'}, - {key: 'insert', reg: '(^|\\s)insert\\s'}, - {key: 'delete', reg: '(^|\\s)delete\\s'}, - {key: 'update', reg: '(^|\\s)update\\s'}, - {key: 'set', reg: '(^|\\s)set\\s'}, - {key: 'drop', reg: '(^|\\s)drop\\s'}, - {key: 'alter', reg: '(^|\\s)alter\\s'}, - {key: 'truncate', reg: '(^|\\s)truncate\\s'}, - {key: 'if', reg: '(^|\\s)if\\s'}, - {key: 'exec', reg: 'exec'}, - {key: 'OBJECT', reg: 'OBJECT'}, - {key: 'sys.', reg: 'sys.'}, - {key: 'kill', reg: 'kill'}, + {key: 'create', reg: /(^|\s)create\s/ig}, + {key: 'insert', reg: /(^|\s)insert\s/ig}, + {key: 'delete', reg: /(^|\s)delete\s/ig}, + {key: 'update', reg: /(^|\s)update\s/ig}, + {key: 'set', reg: /(^|\s)set\s/ig}, + {key: 'drop', reg: /(^|\s)drop\s/ig}, + {key: 'alter', reg: /(^|\s)alter\s/ig}, + {key: 'truncate', reg: /(^|\s)truncate\s/ig}, + {key: 'if', reg: /(^|\s)if\s/ig}, + {key: 'exec', reg: /exec/ig}, + {key: 'OBJECT', reg: /object/ig}, + {key: 'sys.', reg: /sys\./ig}, + {key: 'kill', reg: /kill/ig} ] if (type === 'customscript') { @@ -79,7 +79,7 @@ let error = '' chars.forEach(char => { - if (!error && new RegExp(char.reg, 'ig').test(sql)) { + if (!error && char.reg.test(sql)) { error = char.key } }) -- Gitblit v1.8.0