From 08cdae93f171dc807a3caf3c98ff0aeda923aacd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 19 七月 2023 09:36:17 +0800 Subject: [PATCH] Merge branch 'develop' --- src/components/tabview/index.jsx | 2 src/components/tabview/index.scss | 7 src/tabviews/custom/components/card/cardcellList/index.jsx | 9 src/assets/css/viewstyle.scss | 124 ++----------- src/tabviews/custom/components/form/tab-form/index.scss | 6 src/components/header/index.jsx | 23 + src/templates/zshare/unattended/settingform/index.jsx | 1 src/views/main/index.jsx | 5 src/views/mkiframe/index.jsx | 13 src/tabviews/custom/components/group/normal-group/index.scss | 3 src/tabviews/zshare/automatic/index.jsx | 37 +++- src/components/breadview/index.jsx | 2 /dev/null | 145 ---------------- src/tabviews/basetable/index.jsx | 2 src/tabviews/home/index.jsx | 55 ++---- src/tabviews/zshare/topSearch/index.scss | 14 + src/tabviews/commontable/index.jsx | 10 src/components/breadview/index.scss | 7 src/assets/css/main.scss | 17 + 19 files changed, 153 insertions(+), 329 deletions(-) diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 713b55b..21ebdd8 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -296,6 +296,12 @@ border: 1px solid rgba(0, 0, 0, 0.07); background: rgba(0, 0, 0, 0); } + .ant-modal-footer { + .ant-btn:not(.ant-btn-primary):active, .ant-btn:not(.ant-btn-primary).active, .ant-btn:not(.ant-btn-primary):hover, .ant-btn:not(.ant-btn-primary):focus { + color: var(--mk-sys-color); + border-color: var(--mk-sys-color); + } + } } // 璁剧疆妯℃�佹鏍峰紡锛岃瀹氭渶澶ф渶灏忛珮搴︼紝閲嶇疆婊氬姩鏉� @@ -325,6 +331,17 @@ border: 1px solid rgba(0, 0, 0, 0.07); background: rgba(0, 0, 0, 0); } + + .ant-modal-footer { + .ant-btn:not(.ant-btn-primary):active, .ant-btn:not(.ant-btn-primary).active, .ant-btn:not(.ant-btn-primary):hover, .ant-btn:not(.ant-btn-primary):focus { + color: var(--mk-sys-color); + border-color: var(--mk-sys-color); + } + .ant-btn-primary { + background-color: var(--mk-sys-color); + border-color: var(--mk-sys-color); + } + } } .moveable-modal { overflow-x: hidden!important; diff --git a/src/assets/css/viewstyle.scss b/src/assets/css/viewstyle.scss index 4ecf104..94f61a3 100644 --- a/src/assets/css/viewstyle.scss +++ b/src/assets/css/viewstyle.scss @@ -8,33 +8,7 @@ // color8 8闃惰壊 // color9 9闃惰壊 // color10 10闃惰壊 -@mixin viewstyle($color1, $color2, $color3, $color4, $color5, $color6, $color7) { - #root > .mk-main-view { - >.mk-tabview-wrap { - >.content-header { - >.ant-tabs { - >.ant-tabs-bar { - .ant-tabs-tab:hover { - color: $color5; - } - .ant-tabs-tab.ant-tabs-tab-active { - color: $color6; - } - .ant-tabs-ink-bar { - background-color: $color6; - } - } - } - } - } - >.mk-breadview-wrap { - >.ant-breadcrumb { - .anticon-redo:hover, .anticon-home:hover { - color: $color5; - } - } - } - } +@mixin viewstyle($color1, $color2, $color3, $color4, $color5, $color6) { .custom-data-card-box, .custom-prop-card-box { .data-zoom.radio.active, .data-zoom.checkbox.active { .mk-card:not(.active):not(.selected):hover { @@ -106,34 +80,6 @@ } } } - .normal-group-wrap { - .print-button:hover, .print-button:focus, .print-button:active { - color: $color5; - } - } - // 鎼滅储鏍� - .mk-search-wrap { - >.ant-row { - .ant-col.search-button { - .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):active, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link).active, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):hover, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):focus { - color: $color7; - border-color: $color7; - } - .ant-btn-primary { - background-color: $color6; - border-color: $color6; - } - .ant-btn-link { - color: $color6; - } - } - } - .advanced-list { - .advance-value { - color: $color6; - } - } - } // 琛ㄦ牸 .normal-data-table, .normal-custom-table, .edit-custom-table { table { @@ -156,34 +102,12 @@ } } } - // 寮圭獥鎸夐挳 - .popview-modal { - .ant-modal-footer { - .ant-btn:not(.ant-btn-primary):active, .ant-btn:not(.ant-btn-primary).active, .ant-btn:not(.ant-btn-primary):hover, .ant-btn:not(.ant-btn-primary):focus { - color: $color7; - border-color: $color7; - } - } - } - // 琛ㄥ崟寮圭獥 - .action-modal { - .ant-modal-footer { - .ant-btn:not(.ant-btn-primary):active, .ant-btn:not(.ant-btn-primary).active, .ant-btn:not(.ant-btn-primary):hover, .ant-btn:not(.ant-btn-primary):focus { - color: $color7; - border-color: $color7; - } - .ant-btn-primary { - background-color: $color6; - border-color: $color6; - } - } - } // 鏄惁妗� .ant-modal-confirm-confirm { .ant-modal-confirm-btns { .ant-btn:not(.ant-btn-primary):active, .ant-btn:not(.ant-btn-primary).active, .ant-btn:not(.ant-btn-primary):hover, .ant-btn:not(.ant-btn-primary):focus { - color: $color7; - border-color: $color7; + color: $color6; + border-color: $color6; } .ant-btn-primary { background-color: $color6; @@ -199,7 +123,7 @@ background-color: $color6; } .ant-tabs-nav .ant-tabs-tab:active { - color: $color7; + color: $color6; } .ant-tabs-nav .ant-tabs-tab:hover { color: $color5; @@ -313,16 +237,6 @@ color: $color6; } - .custom-tab-form-box .mk-normal-form-title.mkbtn { - .form-title { - color: $color6; - border-color: $color6; - } - .form-title.active { - background: $color6; - color: #ffffff; - } - } .ant-input-search .ant-input-group-addon .ant-input-search-button { background-color: $color6; border-color: $color6; @@ -396,7 +310,7 @@ --mk-sys-color3: #91d5ff; --mk-sys-color4: #69c0ff; --mk-sys-color5: #40a9ff; - @include viewstyle(#e6f7ff, #bae7ff, #91d5ff, #69c0ff, #40a9ff, #1890ff, #096dd9); + @include viewstyle(#e6f7ff, #bae7ff, #91d5ff, #69c0ff, #40a9ff, #1890ff); } body[class*='mk-red-'] { @@ -406,7 +320,7 @@ --mk-sys-color3: #ffa39e; --mk-sys-color4: #ff7875; --mk-sys-color5: #ff4d4f; - @include viewstyle(#fff1f0, #ffccc7, #ffa39e, #ff7875, #ff4d4f, #f5222d, #cf1322); + @include viewstyle(#fff1f0, #ffccc7, #ffa39e, #ff7875, #ff4d4f, #f5222d); } body[class*='mk-orange-red-'] { @@ -416,7 +330,7 @@ --mk-sys-color3: #ffbb96; --mk-sys-color4: #ff9c6e; --mk-sys-color5: #ff7a45; - @include viewstyle(#fff2e8, #ffd8bf, #ffbb96, #ff9c6e, #ff7a45, #fa541c, #d4380d); + @include viewstyle(#fff2e8, #ffd8bf, #ffbb96, #ff9c6e, #ff7a45, #fa541c); } body[class*='mk-orange-'] { @@ -426,7 +340,7 @@ --mk-sys-color3: #ffd591; --mk-sys-color4: #ffc069; --mk-sys-color5: #ffa940; - @include viewstyle(#fff7e6, #ffe7ba, #ffd591, #ffc069, #ffa940, #fa8c16, #d46b08); + @include viewstyle(#fff7e6, #ffe7ba, #ffd591, #ffc069, #ffa940, #fa8c16); } body[class*='mk-orange-yellow-'] { @@ -436,7 +350,7 @@ --mk-sys-color3: #ffe58f; --mk-sys-color4: #ffd666; --mk-sys-color5: #ffc53d; - @include viewstyle(#fffbe6, #fff1b8, #ffe58f, #ffd666, #ffc53d, #faad14, #d48806); + @include viewstyle(#fffbe6, #fff1b8, #ffe58f, #ffd666, #ffc53d, #faad14); } body[class*='mk-yellow-'] { @@ -446,7 +360,7 @@ --mk-sys-color3: #fffb8f; --mk-sys-color4: #fff566; --mk-sys-color5: #ffec3d; - @include viewstyle(#feffe6, #ffffb8, #fffb8f, #fff566, #ffec3d, #fadb14, #d4b106); + @include viewstyle(#feffe6, #ffffb8, #fffb8f, #fff566, #ffec3d, #fadb14); } body[class*='mk-yellow-green-'] { @@ -456,7 +370,7 @@ --mk-sys-color3: #eaff8f; --mk-sys-color4: #d3f261; --mk-sys-color5: #bae637; - @include viewstyle(#fcffe6, #f4ffb8, #eaff8f, #d3f261, #bae637, #a0d911, #7cb305); + @include viewstyle(#fcffe6, #f4ffb8, #eaff8f, #d3f261, #bae637, #a0d911); } body[class*='mk-green-'] { @@ -466,7 +380,7 @@ --mk-sys-color3: #b7eb8f; --mk-sys-color4: #95de64; --mk-sys-color5: #73d13d; - @include viewstyle(#f6ffed, #d9f7be, #b7eb8f, #95de64, #73d13d, #52c41a, #389e0d); + @include viewstyle(#f6ffed, #d9f7be, #b7eb8f, #95de64, #73d13d, #52c41a); } body[class*='mk-cyan-'] { @@ -476,7 +390,7 @@ --mk-sys-color3: #87e8de; --mk-sys-color4: #5cdbd3; --mk-sys-color5: #36cfc9; - @include viewstyle(#e6fffb, #b5f5ec, #87e8de, #5cdbd3, #36cfc9, #13c2c2, #08979c); + @include viewstyle(#e6fffb, #b5f5ec, #87e8de, #5cdbd3, #36cfc9, #13c2c2); } body[class*='mk-blue-purple-'] { @@ -486,7 +400,7 @@ --mk-sys-color3: #adc6ff; --mk-sys-color4: #85a5ff; --mk-sys-color5: #597ef7; - @include viewstyle(#f0f5ff, #d6e4ff, #adc6ff, #85a5ff, #597ef7, #2f54eb, #1d39c4); + @include viewstyle(#f0f5ff, #d6e4ff, #adc6ff, #85a5ff, #597ef7, #2f54eb); } body[class*='mk-purple-'] { @@ -496,7 +410,7 @@ --mk-sys-color3: #d3adf7; --mk-sys-color4: #b37feb; --mk-sys-color5: #9254de; - @include viewstyle(#f9f0ff, #efdbff, #d3adf7, #b37feb, #9254de, #722ed1, #531dab); + @include viewstyle(#f9f0ff, #efdbff, #d3adf7, #b37feb, #9254de, #722ed1); } body[class*='mk-magenta-'] { @@ -506,7 +420,7 @@ --mk-sys-color3: #ffadd2; --mk-sys-color4: #ff85c0; --mk-sys-color5: #f759ab; - @include viewstyle(#fff0f6, #ffd6e7, #ffadd2, #ff85c0, #f759ab, #eb2f96, #c41d7f); + @include viewstyle(#fff0f6, #ffd6e7, #ffadd2, #ff85c0, #f759ab, #eb2f96); } body[class*='mk-grass-green-'] { @@ -516,7 +430,7 @@ --mk-sys-color3: #d9d26c; --mk-sys-color4: #ccc845; --mk-sys-color5: #bfbf22; - @include viewstyle(#f2efda, #e6de97, #d9d26c, #ccc845, #bfbf22, #aeb303, #838c00); + @include viewstyle(#f2efda, #e6de97, #d9d26c, #ccc845, #bfbf22, #aeb303); } body[class*='mk-deep-red-'] { @@ -526,7 +440,7 @@ --mk-sys-color3: #e89b9e; --mk-sys-color4: #db7077; --mk-sys-color5: #cf4856; - @include viewstyle(#fff0f0, #f5cbcb, #e89b9e, #db7077, #cf4856, #c32539, #9c162c); + @include viewstyle(#fff0f0, #f5cbcb, #e89b9e, #db7077, #cf4856, #c32539); } body[class*='mk-deep-blue-'] { @@ -536,5 +450,5 @@ --mk-sys-color3: #dbdfe6; --mk-sys-color4: #c6cede; --mk-sys-color5: #394c6f; - @include viewstyle(#eff1f4, #e0e3e9, #dbdfe6, #c6cede, #394c6f, #1d3661, #1d3661); + @include viewstyle(#eff1f4, #e0e3e9, #dbdfe6, #c6cede, #394c6f, #1d3661); } \ No newline at end of file diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx index 15a578b..4773add 100644 --- a/src/components/breadview/index.jsx +++ b/src/components/breadview/index.jsx @@ -153,7 +153,7 @@ const { tabview, hasNavBar } = this.state return ( - <section id="mk-breadview-wrap" className="mk-breadview-wrap"> + <section id="mk-tabgroup-wrap" className="mk-breadview-wrap"> {hasNavBar && tabview ? <Breadcrumb separator=""> <Breadcrumb.Item> <HomeOutlined onClick={this.gotoHome} /> diff --git a/src/components/breadview/index.scss b/src/components/breadview/index.scss index 84c6567..bf7a267 100644 --- a/src/components/breadview/index.scss +++ b/src/components/breadview/index.scss @@ -13,15 +13,16 @@ cursor: pointer; margin-right: 5px; } + .anticon-redo:hover, .anticon-home:hover { + color: var(--mk-sys-color5); + } .ant-breadcrumb-link + .ant-breadcrumb-separator { display: none; } } - >.commontable, >.calendar-page { + >.commontable { padding-left: 15px; padding-right: 15px; - } - >.commontable, >.calendar-page { > .mk-search-wrap { padding-left: 0; padding-right: 0; diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 8317b28..6157a99 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -135,12 +135,9 @@ window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}] - if (_menu) { // 寤舵椂鎵撳紑锛岄槻姝㈡爣绛剧粍鏈畬鎴愬姞杞� - setTimeout(() => { - MKEmitter.emit('modifyTabs', _menu) - }, 200) + if (_menu) { + this.openTab(_menu, 0) } - MKEmitter.emit('mkMenuLoaded') }) // 鑾峰彇瑙掕壊鏉冮檺, edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A' @@ -167,12 +164,26 @@ }) } - MKEmitter.emit('mkActionLoaded') window.GLOB.mkActions = _permAction }) }, 50) } + openTab = (menu, times) => { + if (times > 50) return + times++ + + let tabgroup = document.getElementById('mk-tabgroup-wrap') + + if (window.GLOB.mkActions.loaded && tabgroup) { + MKEmitter.emit('modifyTabs', menu) + } else { + setTimeout(() => { + this.openTab(times) + }, 200) + } + } + getMenulist = (result) => { let thdMenuList = [] let menulist = [] diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index 789e4ad..1c79abe 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -251,7 +251,7 @@ const { tabviews, activeId } = this.state return ( - <section className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '')}> + <section id="mk-tabgroup-wrap" className={'mk-tabview-wrap' + (this.props.collapse ? ' collapsed' : '')}> <div className="content-header"> {tabviews && tabviews.length > 0 && <Tabs activeKey={activeId}> diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index 13cb998..4e303c7 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -47,6 +47,7 @@ } } .ant-tabs-tab:hover { + color: var(--mk-sys-color5); span.tab-control .anticon-close { display: inline-block; } @@ -56,6 +57,12 @@ display: inline-block; } } + .ant-tabs-tab.ant-tabs-tab-active { + color: var(--mk-sys-color); + } + .ant-tabs-ink-bar { + background-color: var(--mk-sys-color); + } } >.ant-tabs-content { height: 100%; diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 2b93477..e62eb9e 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -682,7 +682,7 @@ {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null} <Row className="component-wrap">{this.getComponents()}</Row> {config && window.GLOB.breakpoint ? <DebugTable /> : null} - {!window.GLOB.mkHS && config && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config.components[0]} /> : null} + {!window.GLOB.mkHS && config && autoMatic ? <AutoMatic autoMatic={autoMatic} tabId={config.MenuID} config={config.components[0]} /> : null} {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} {!window.GLOB.mkHS && config ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 10dcee9..6ad0a67 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -22,8 +22,8 @@ const SubTable = asyncSpinComponent(() => import('@/tabviews/subtable')) const CardComponent = asyncSpinComponent(() => import('@/tabviews/zshare/cardcomponent')) const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent')) -const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) -const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic')) +// const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) +// const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic')) const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) const { TabPane } = Tabs @@ -1006,7 +1006,7 @@ render() { const { MenuID } = this.props - const { BID, setting, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state + const { BID, setting, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts } = this.state return ( <div className="commontable" id={this.state.ContainerId}> @@ -1144,8 +1144,8 @@ </Tabs>)) } {setting && window.GLOB.breakpoint ? <DebugTable /> : null} - {!window.GLOB.mkHS && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : null} - {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config}/> : null} + {/* {!window.GLOB.mkHS && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : null} */} + {/* {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config}/> : null} */} {!window.GLOB.mkHS && setting ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> diff --git a/src/tabviews/custom/components/card/cardcellList/asyncButtonComponent.jsx b/src/tabviews/custom/components/card/cardcellList/asyncButtonComponent.jsx deleted file mode 100644 index aa0307b..0000000 --- a/src/tabviews/custom/components/card/cardcellList/asyncButtonComponent.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, {Component} from 'react' -/** - * @description 寮傛鍔犺浇妯″潡 - * @param {*} importComponent - */ -export default function asyncComponent(importComponent) { - return class extends Component { - constructor(props) { - super(props) - - this.state = { - component: null - } - } - - async componentDidMount() { - const {default: component} = await importComponent() - - this.setState({component}) - } - - componentWillUnmount () { - this.setState = () => { - return - } - } - - // <Button className="loading-skeleton" disabled={true}></Button> // 楠ㄦ灦鎸夐挳 - render() { - const C = this.state.component - - return C ? <C {...this.props} /> : null - } - } -} \ No newline at end of file diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 275b422..42ff8eb 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -5,8 +5,7 @@ import moment from 'moment' // import Api from '@/api' -import asyncComponent from './asyncButtonComponent' -import asyncElementComponent from '@/utils/asyncComponent' +import asyncComponent from '@/utils/asyncComponent' import { getMark } from '@/utils/utils.js' import MkIcon from '@/components/mk-icon' import Encrypts from '@/components/encrypts' @@ -25,9 +24,9 @@ const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) -const BarCode = asyncElementComponent(() => import('@/components/barcode')) -const QrCode = asyncElementComponent(() => import('@/components/qrcode')) -const MkProgress = asyncElementComponent(() => import('@/components/mkProgress')) +const BarCode = asyncComponent(() => import('@/components/barcode')) +const QrCode = asyncComponent(() => import('@/components/qrcode')) +const MkProgress = asyncComponent(() => import('@/components/mkProgress')) const Video = asyncComponent(() => import('@/components/video')) const MkPicture = asyncComponent(() => import('@/components/mkPicture')) const PicRadio = { diff --git a/src/tabviews/custom/components/form/tab-form/index.scss b/src/tabviews/custom/components/form/tab-form/index.scss index 04a53bd..c26ee74 100644 --- a/src/tabviews/custom/components/form/tab-form/index.scss +++ b/src/tabviews/custom/components/form/tab-form/index.scss @@ -24,12 +24,12 @@ .mk-normal-form-title.mkbtn { .form-title { background: #ffffff; - color: #1890ff; - border: 1px solid #1890ff; + color: var(--mk-sys-color); + border: 1px solid var(--mk-sys-color); transition: all 0.3s; } .form-title.active { - background: #1890ff; + background: var(--mk-sys-color); color: #ffffff; } .form-title:first-child { diff --git a/src/tabviews/custom/components/group/normal-group/index.scss b/src/tabviews/custom/components/group/normal-group/index.scss index a179389..cafae68 100644 --- a/src/tabviews/custom/components/group/normal-group/index.scss +++ b/src/tabviews/custom/components/group/normal-group/index.scss @@ -7,6 +7,9 @@ border: 0; background: transparent; } + .print-button:hover, .print-button:focus, .print-button:active { + color: var(--mk-sys-color5); + } .group-header { position: relative; diff --git a/src/tabviews/home/index.jsx b/src/tabviews/home/index.jsx index 23338d0..a6a8a60 100644 --- a/src/tabviews/home/index.jsx +++ b/src/tabviews/home/index.jsx @@ -4,7 +4,6 @@ import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' -import MKEmitter from '@/utils/events.js' import './index.scss' const DefaultHome = asyncComponent(() => import('./defaulthome')) @@ -18,27 +17,14 @@ state = { loading: true, background: sessionStorage.getItem('home_background'), - waitMenu: true, - waitAction: true, + waiting: true, view: '' } componentDidMount () { this.loadHomeConfig() - if (window.GLOB.mkThdMenus.length > 0) { - this.setState({ - waitMenu: false - }) - } else { - MKEmitter.addListener('mkMenuLoaded', this.mkMenuLoaded) - } - if (window.GLOB.mkActions.loaded) { - this.setState({ - waitAction: false - }) - } else { - MKEmitter.addListener('mkActionLoaded', this.mkActionLoaded) - } + + this.check(0) } /** @@ -48,20 +34,20 @@ this.setState = () => { return } - MKEmitter.removeListener('mkMenuLoaded', this.mkMenuLoaded) - MKEmitter.removeListener('mkActionLoaded', this.mkActionLoaded) } - mkMenuLoaded = () => { - this.setState({ - waitMenu: false - }) - } + check = (times) => { + times++ - mkActionLoaded = () => { - this.setState({ - waitAction: false - }) + if ((window.GLOB.mkThdMenus.length > 0 && window.GLOB.mkActions.loaded) || times > 50) { + this.setState({ + waiting: false + }) + } else { + setTimeout(() => { + this.check(times) + }, 200) + } } loadHomeConfig = () => { @@ -84,8 +70,7 @@ if (!config || !config.enabled) { this.setState({ loading: false, - waitMenu: false, - waitAction: false, + waiting: false, view: 'default' }) } else { @@ -97,16 +82,14 @@ } else { this.setState({ loading: false, - waitMenu: false, - waitAction: false, + waiting: false, view: 'default' }) } } else { this.setState({ loading: false, - waitMenu: false, - waitAction: false, + waiting: false, view: 'default' }) notification.warning({ @@ -119,9 +102,9 @@ } render() { - const { loading, waitAction, waitMenu, view, background } = this.state + const { loading, waiting, view, background } = this.state - if (loading || waitAction || waitMenu) { + if (loading || waiting) { return (<div className="home-loading-view" style={{background: background}}><Spin className="home-box-spin" size="large" /></div>) } else if (view === 'custom') { return (<CustomPage MenuID={this.props.MenuID} MenuName="棣栭〉"/>) diff --git a/src/tabviews/tabmanage/index.jsx b/src/tabviews/tabmanage/index.jsx deleted file mode 100644 index 5274ea9..0000000 --- a/src/tabviews/tabmanage/index.jsx +++ /dev/null @@ -1,577 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Row, Col, Input, Button, Card, notification, Modal, Empty, Spin } from 'antd' -import moment from 'moment' - -import Api from '@/api' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' -import Utils from '@/utils/utils.js' -import MKEmitter from '@/utils/events.js' -import TransferForm from './transferform' -import MutilForm from './mutilform' -import subtableurl from '@/assets/img/subtable.jpg' - -import './index.scss' - -const { Search } = Input -const { confirm } = Modal - -class TabManage extends Component { - static propTpyes = { - MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuID: PropTypes.string // 鑿滃崟Id - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id - searchKey: '', - tabviews: null, - loading: true, - modaltype: '', - editTab: null, - submitloading: false, - cols: 8, - thawVisible: false, - thawmenulist: null - - } - - getTabs = () => { - Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { - if (res.status) { - this.setState({ - loading: false, - tabviews: res.UserTemp.map(temp => { - return { - uuid: temp.MenuID, - value: temp.MenuID, - MenuName: temp.MenuName || '', - type: temp.Template, - MenuNo: temp.MenuNo || '', - Remark: temp.Remark - } - }) - }) - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - UNSAFE_componentWillMount () { - let docwidth = document.body.offsetWidth - let cols = 8 - - if (docwidth > 1800) { - cols = 6 - } - - this.setState({ - cols: cols - }) - } - - componentDidMount () { - this.getTabs() - MKEmitter.addListener('reloadMenuView', this.reloadMenuView) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) - } - - reloadMenuView = (menuId) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - this.setState({ - searchKey: '', - tabviews: null, - loading: true, - modaltype: '', - editTab: null, - submitloading: false, - thawVisible: false, - thawmenulist: null - }) - this.getTabs() - } - - handleTab = (tab, type) => { - let _this = this - - if (type === 'delete') { - confirm({ - title: "纭畾鍒犻櫎璇ユ爣绛惧悧锛�", - onOk() { - return new Promise(resolve => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: tab.uuid - } - - Api.getSystemConfig(_param).then(res => { - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } else { - notification.success({ - top: 92, - message: '鎵ц鎴愬姛', - duration: 2 - }) - _this.setState({ - loading: true, - tabviews: null - }, () => { - _this.getTabs() - }) - } - resolve() - }) - }) - }, - onCancel() {} - }) - } else { - this.setState({ - editTab: tab, - modaltype: type - }) - } - } - - handleSubmit = () => { - const { editTab, modaltype } = this.state - - this.tabFormRef.handleConfirm().then(res => { - - let _tab = {...editTab, ...res} - - this.setState({submitloading: true}) - - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: _tab.uuid - }).then(res => { - - if (!res.status) { - this.setState({ - submitloading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - return - } - - let param = { - func: 'sPC_Tab_AddUpt', - MenuID: _tab.uuid, - MenuNo: _tab.MenuNo, - Template: _tab.type, - MenuName: _tab.MenuName, - Remark: _tab.Remark, - PageParam: JSON.stringify({Template: _tab.type}), - Sort: 0 - } - - let _oriActions = [] - - let btnParam = { - func: 'sPC_Button_AddUpt', - Type: 40, - ParentID: _tab.uuid, - MenuNo: _tab.MenuNo, - Template: _tab.type, - PageParam: '', - LongParam: '', - LText: '' - } - - if (modaltype === 'edit') { - param.LongParam = res.LongParam - } else { - let _LongParam = '' - let _menuId = Utils.getuuid() - - // 瑙f瀽閰嶇疆 - if (res.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - - if (_LongParam) { - try { - _LongParam.uuid = _menuId - _LongParam.tabName = _tab.MenuName - _LongParam.tabNo = _tab.MenuNo - _LongParam.Remark = _tab.Remark - - let _linkchange = {} - btnParam.LText = [] - - _LongParam.action = _LongParam.action.map((item, index) => { - let uuid = Utils.getuuid() - - if (item.OpenType === 'pop') { - _oriActions.push({ - prebtn: JSON.parse(JSON.stringify(item)), - curuuid: uuid, - Template: 'Modal' - }) - } else if (item.OpenType === 'popview') { - _linkchange[item.linkTab] = Utils.getuuid() - - item.linkTab = _linkchange[item.linkTab] - } - - item.uuid = uuid - - btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) - - return item - }) - - if (_LongParam.funcs && _LongParam.funcs.length > 0) { - _LongParam.funcs = _LongParam.funcs.map(item => { - if (item.type === 'tab') { - item.linkTab = _linkchange[item.linkTab] - item.menuNo = '' - item.subfuncs = [] - } - - return item - }) - } - - btnParam.LText = btnParam.LText.join(' union all ') - btnParam.LText = Utils.formatOptions(btnParam.LText) - btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) - } catch (e) { - console.warn('Stringify Failure') - _LongParam = '' - } - } - - param.MenuID = _menuId - param.LongParam = _LongParam - - btnParam.ParentID = _menuId - } - - new Promise(resolve => { - Api.getSystemConfig(param).then(response => { - if (response.status) { - resolve(true) - } else { - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - resolve(false) - } - }) - }).then(result => { - if (!result) return result - if (modaltype === 'edit') return true - if (!btnParam.LText) return true - - return Api.getSystemConfig(btnParam) - }).then(result => { - if (!result) return result - if (modaltype === 'edit') return true - if (!btnParam.LText) return true - - if (result.status) { - return true - } else { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - return false - } - }).then(result => { - if (!result) return result - if (modaltype === 'edit') return true - if (_oriActions.length === 0) return true - - let deffers = _oriActions.map(item => { - return new Promise(resolve => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: item.prebtn.uuid - }).then(response => { - if (!response.status) { - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - resolve(false) - } else if (response.status && response.LongParam) { - let _param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: _tab.uuid, - MenuID: item.curuuid, - MenuNo: _tab.MenuNo, - Template: item.Template, - MenuName: item.prebtn.label, - PageParam: JSON.stringify({Template: item.Template}), - LongParam: response.LongParam - } - Api.getSystemConfig(_param).then(resp => { - if (!resp.status) { - notification.warning({ - top: 92, - message: resp.message, - duration: 5 - }) - resolve(false) - } else { - resolve(true) - } - }) - } else { - resolve(true) - } - }) - }) - }) - - return Promise.all(deffers) - }).then(result => { - if (!result) { - this.setState({ - submitloading: false - }) - return - } - - let isSuccess = true - - if (typeof(result) === 'object') { - result.forEach(resul => { - if (!resul) { - isSuccess = false - } - }) - } - - if (isSuccess) { - notification.success({ - top: 92, - message: '鎵ц鎴愬姛', - duration: 2 - }) - } - - this.setState({ - loading: true, - submitloading: false, - modaltype: '', - tabviews: null - }, () => { - this.getTabs() - }) - }) - }) - }) - } - - triggerDraw = () => { - this.setState({ - thawVisible: true - }) - - Api.getSystemConfig({ - func: 'sPC_Get_FrozenMenu', - TYPE: 50 - }).then(res => { - if (res.status) { - this.setState({ - thawmenulist: res.data.map(menu => { - return { - key: menu.MenuID, - title: menu.MenuName - } - }) - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - thawMenuSubmit = () => { - if (this.refs.trawmenu.state.targetKeys.length === 0) { - notification.warning({ - top: 92, - message: '璇烽�夋嫨瑕佽В闄ゅ喕缁撶殑鏍囩锛�', - duration: 5 - }) - } else { - this.setState({ - submitloading: true - }) - let defers = this.refs.trawmenu.state.targetKeys.map(item => { - return new Promise((resolve) => { - Api.getSystemConfig({ - func: 'sPC_MainMenu_ReDel', - MenuID: item - }).then(res => { - if (res.status) { - resolve('') - } else { - resolve(res.message) - } - }) - }) - }) - Promise.all(defers).then(res => { - let msg = res.filter(Boolean)[0] - if (msg) { - notification.error({ - top: 92, - message: msg, - duration: 10 - }) - this.setState({ - submitloading: false - }) - } else { - notification.success({ - top: 92, - message: '鎵ц鎴愬姛', - duration: 2 - }) - this.setState({ - submitloading: false, - thawVisible: false, - thawmenulist: null, - tabviews: null - }, () => { - this.getTabs() - }) - } - }) - } - } - - render() { - const { cols, tabviews, modaltype, editTab, searchKey, loading } = this.state - - let _tabviews = [] - if (tabviews) { - _tabviews = tabviews.filter(tab => tab.MenuName.toLowerCase().indexOf(searchKey.toLowerCase()) >= 0 || tab.MenuNo.toLowerCase().indexOf(searchKey.toLowerCase()) >= 0) - } - - return ( - <div className="tab-manage" id={this.state.ContainerId}> - {loading && <Spin size="large" />} - <Row> - <Col className="tab-search" span={6}> - <Search placeholder="璇疯緭鍏ユ爣绛惧悕绉�" onSearch={value => {this.setState({searchKey: value})}} enterButton /> - </Col> - <Col className="tab-thaw" span={6} offset={12}> - <Button type="primary" onClick={this.triggerDraw}>鏍囩瑙e喕</Button> - </Col> - </Row> - {_tabviews.length > 0 ? <Row className="tab-list"> - {_tabviews.map((tab, index) => { - return ( - <Col span={cols} key={index}> - <Card - className="tab-card" - title={tab.MenuName} - > - <img onClick={() => {this.previewPicture()}} src={subtableurl} alt=""/> - <div className="tab-operation"> - <Button type="primary" onClick={() => this.handleTab(tab, 'edit')}>缂栬緫</Button> - <Button className="mk-green" onClick={() => this.handleTab(tab, 'copy')}>澶嶅埗</Button> - <Button type="danger" onClick={() => this.handleTab(tab, 'delete')}>鍒犻櫎</Button> - </div> - </Card> - </Col> - ) - })} - </Row> : null} - {tabviews && _tabviews.length === 0 ? <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> : null} - {/* 鏍囩淇敼鎴栧鍒� */} - <Modal - title={modaltype === 'edit' ? '鏍囩缂栬緫' : '鏍囩澶嶅埗'} - visible={!!modaltype} - width={600} - maskClosable={false} - onOk={this.handleSubmit} - confirmLoading={this.state.submitloading} - onCancel={() => {this.setState({modaltype: '', editTab: null})}} - destroyOnClose - > - <MutilForm - dict={this.state.dict} - tab={editTab} - inputSubmit={this.handleSubmit} - wrappedComponentRef={(inst) => this.tabFormRef = inst} - /> - </Modal> - {/* 瑙e喕鏍囩妯℃�佹 */} - <Modal - title="鏍囩瑙i櫎鍐荤粨" - visible={this.state.thawVisible} - width={600} - onOk={this.thawMenuSubmit} - confirmLoading={this.state.submitloading} - onCancel={() => {this.setState({thawVisible: false, thawmenulist: null})}} - destroyOnClose - > - {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} - {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} - </Modal> - </div> - ) - } -} - -export default TabManage \ No newline at end of file diff --git a/src/tabviews/tabmanage/index.scss b/src/tabviews/tabmanage/index.scss deleted file mode 100644 index d9a7441..0000000 --- a/src/tabviews/tabmanage/index.scss +++ /dev/null @@ -1,58 +0,0 @@ -.tab-manage { - position: relative; - padding: 16px 20px 80px; - - .tab-search { - .ant-input-search { - max-width: 300px; - } - } - .tab-thaw { - text-align: right; - } - .tab-list { - padding-top: 20px; - margin-left: -10px; - margin-right: -10px; - .ant-col { - padding: 0 10px 30px; - } - .tab-card { - .ant-card-body { - position: relative; - padding: 20px 0; - img { - max-width: 100%; - } - .tab-operation { - position: absolute; - top: -10px; - right: 10px; - opacity: 0; - transition: all 0.1s linear; - - button { - margin-left: 10px; - } - } - } - } - .tab-card:hover { - .ant-card-body { - .tab-operation { - top: 10px; - opacity: 1; - } - } - } - } - .ant-empty { - margin: 25vh 0; - } - > .ant-spin { - position: fixed; - z-index: 10; - left: calc(50vw - 22px); - top: calc(50vh - 70px); - } -} diff --git a/src/tabviews/tabmanage/mutilform/index.jsx b/src/tabviews/tabmanage/mutilform/index.jsx deleted file mode 100644 index 962ffb7..0000000 --- a/src/tabviews/tabmanage/mutilform/index.jsx +++ /dev/null @@ -1,99 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input } from 'antd' -import './index.scss' - -const { TextArea } = Input - -class TabHandleForm extends Component { - static propTpyes = { - tab: PropTypes.object, // 鏍囩淇℃伅 - dict: PropTypes.object, // 瀛楀吀椤� - inputSubmit: PropTypes.func // input鍥炶溅鎻愪氦 - } - - componentDidMount () { - try { - let _form = document.getElementById('MenuName') - - if (_form && _form.select) { - _form.select() - } - } catch (e) { - console.warn('focus error锛�') - } - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - this.props.inputSubmit() - } - - render() { - const { getFieldDecorator } = this.props.form - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - return ( - <Form {...formItemLayout} className="tab-manage-form-field" id="tab-handle-form-box"> - <Row gutter={24}> - <Col span={24}> - <Form.Item label="鏍囩鍚嶇О"> - {getFieldDecorator('MenuName', { - initialValue: this.props.tab.MenuName || '', - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '鏍囩鍚嶇О!' - } - ] - })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="鏍囩鍙傛暟"> - {getFieldDecorator('MenuNo', { - initialValue: this.props.tab.MenuNo || '', - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '鏍囩鍙傛暟!' - } - ] - })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="澶囨敞"> - {getFieldDecorator('Remark', { - initialValue: this.props.tab.Remark || '' - })(<TextArea autoSize={{ minRows: 2, maxRows: 6 }} />)} - </Form.Item> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(TabHandleForm) \ No newline at end of file diff --git a/src/tabviews/tabmanage/mutilform/index.scss b/src/tabviews/tabmanage/mutilform/index.scss deleted file mode 100644 index f0d1e6e..0000000 --- a/src/tabviews/tabmanage/mutilform/index.scss +++ /dev/null @@ -1,47 +0,0 @@ -.tab-manage-form-field { - position: relative; - padding: 0px 24px 20px; - .ant-form-item { - display: flex; - } - .ant-form-item-control-wrapper { - flex: 1; - } - .ant-form-item-label { - overflow: hidden; - display: inline-block; - text-overflow: ellipsis; - white-space: nowrap; - } - .textarea-row { - .ant-col-sm-3 { - width: 10.5%; - } - .ant-col-sm-21 { - width: 89.5%; - } - } - .ant-form-explain { - overflow:hidden; - text-overflow:ellipsis; - white-space:nowrap; - } - p { - color: #1890ff; - border-bottom: 1px solid #d9d9d9; - } - .ant-input-disabled { - color: rgba(0, 0, 0, 0.65)!important; - cursor: default!important; - } - .ant-input-number-input { - color: rgba(0, 0, 0, 0.65)!important; - cursor: default!important; - } - .ant-select-disabled { - color: rgba(0, 0, 0, 0.65)!important; - .ant-select-selection--multiple .ant-select-selection__choice { - color: rgba(0, 0, 0, 0.65)!important; - } - } -} \ No newline at end of file diff --git a/src/tabviews/tabmanage/transferform/index.jsx b/src/tabviews/tabmanage/transferform/index.jsx deleted file mode 100644 index 8dd7462..0000000 --- a/src/tabviews/tabmanage/transferform/index.jsx +++ /dev/null @@ -1,43 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Transfer } from 'antd' - -import './index.scss' - -class TransferForm extends Component { - static propTypes = { - menulist: PropTypes.array - } - - state = { - targetKeys: [], - selectedKeys: [] - } - - handleChange = (nextTargetKeys, direction, moveKeys) => { - this.setState({ targetKeys: nextTargetKeys }) - } - - handleSelectChange = (sourceSelectedKeys, targetSelectedKeys) => { - this.setState({ selectedKeys: [...sourceSelectedKeys, ...targetSelectedKeys] }) - } - - render() { - const { targetKeys, selectedKeys } = this.state - - return ( - <div className="trawmenutransfer"> - <Transfer - dataSource={this.props.menulist} - targetKeys={targetKeys} - selectedKeys={selectedKeys} - onChange={this.handleChange} - onSelectChange={this.handleSelectChange} - render={item => item.title} - /> - </div> - ) - } -} - -export default TransferForm diff --git a/src/tabviews/tabmanage/transferform/index.scss b/src/tabviews/tabmanage/transferform/index.scss deleted file mode 100644 index 2e7be3b..0000000 --- a/src/tabviews/tabmanage/transferform/index.scss +++ /dev/null @@ -1,6 +0,0 @@ -.trawmenutransfer { - .ant-transfer-list { - width: calc(50% - 20px); - height: 250px; - } -} \ No newline at end of file diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx index c020117..951001a 100644 --- a/src/tabviews/zshare/automatic/index.jsx +++ b/src/tabviews/zshare/automatic/index.jsx @@ -9,6 +9,7 @@ class AutoMatic extends Component { static propTpyes = { autoMatic: PropTypes.object, + tabId: PropTypes.string, config: PropTypes.object } @@ -21,10 +22,18 @@ timer = null UNSAFE_componentWillMount() { - const { autoMatic } = this.props + const { autoMatic, tabId } = this.props if (autoMatic.gap && autoMatic.gap >= 1) { this.setState({gap: autoMatic.gap * 1000}) + } + + if (tabId && tabId === sessionStorage.getItem('autoExecId')) { + sessionStorage.removeItem('autoExecId') + + setTimeout(() => { + this.trigger() + }, 10000) } } @@ -180,7 +189,7 @@ } autoMaticOver = (MenuID) => { - const { config, autoMatic } = this.props + const { config, autoMatic, tabId } = this.props if (!this.state.running || MenuID !== config.MenuID) return @@ -189,16 +198,24 @@ if (autoMatic.onFinish !== 'over') { let interval = autoMatic.interval * 1000 || 10 - if (autoMatic.restart === 'first') { - this.setState({line: 1}) + if (autoMatic.restart === 'refresh') { + this.timer = setTimeout(() => { + sessionStorage.setItem('ThirdMenu', tabId) + sessionStorage.setItem('autoExecId', tabId) + window.location.reload() + }, interval) } else { - this.setState({line: this.state.line + 1}) + if (autoMatic.restart === 'first') { + this.setState({line: 1}) + } else { + this.setState({line: this.state.line + 1}) + } + + this.timer = setTimeout(() => { + this.setState({running: true}) + MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) + }, interval) } - - this.timer = setTimeout(() => { - this.setState({running: true}) - MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) - }, interval) } } diff --git a/src/tabviews/zshare/topSearch/index.scss b/src/tabviews/zshare/topSearch/index.scss index 0f226d7..49746f8 100644 --- a/src/tabviews/zshare/topSearch/index.scss +++ b/src/tabviews/zshare/topSearch/index.scss @@ -64,6 +64,17 @@ transform: rotate(180deg); } } + .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):active, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link).active, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):hover, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):focus { + color: var(--mk-sys-color); + border-color: var(--mk-sys-color); + } + .ant-btn-primary { + background-color: var(--mk-sys-color); + border-color: var(--mk-sys-color); + } + .ant-btn-link { + color: var(--mk-sys-color); + } } .advanced-list { font-size: 13px; @@ -83,6 +94,9 @@ padding: 2px; } } + .advance-value { + color: var(--mk-sys-color); + } } .ant-calendar-picker-clear, .ant-calendar-picker-icon { right: 8px; diff --git a/src/templates/sharecomponent/settingcalcomponent/index.jsx b/src/templates/sharecomponent/settingcalcomponent/index.jsx deleted file mode 100644 index d1d7909..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/index.jsx +++ /dev/null @@ -1,101 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Modal } from 'antd' -import { SettingOutlined } from '@ant-design/icons' - -import VerifyCard from './verifycard' -import './index.scss' - -class DataSource extends Component { - static propTpyes = { - config: PropTypes.any, - MenuID: PropTypes.string, - updateConfig: PropTypes.func - } - - state = { - sourcelist: [], - visible: false, - loading: false, - setting: null - } - - UNSAFE_componentWillMount () { - const { config } = this.props - - this.setState({setting: fromJS(config.setting).toJS()}) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - editDataSource = () => { - this.setState({ - visible: true - }) - } - - verifySubmit = () => { - const { config } = this.props - - this.setState({loading: true}) - this.verifyRef.submitDataSource().then(res => { - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') - res.scripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - }) - if (res.setting.dataresource) { - res.setting.dataresource = res.setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - } - }) - } - - res.show = config.setting.show || 'true' - res.advanceType = config.setting.advanceType || 'modal' - res.advanceWidth = config.setting.advanceWidth || 1000 - res.drawerPlacement = config.setting.drawerPlacement || 'right' - res.searchRatio = config.setting.searchRatio || 6 - res.searchLwidth = config.setting.searchLwidth !== undefined ? config.setting.searchLwidth : 33.3 - - this.setState({loading: false, visible: false}) - this.props.updateConfig({...config, ...res}) - }, () => { - this.setState({loading: false}) - }) - } - - render () { - const { config } = this.props - const { visible, loading } = this.state - - return ( - <div className="model-datasource"> - <SettingOutlined onClick={() => this.editDataSource()} /> - <Modal - wrapClassName="mk-pop-modal" - visible={visible} - width={'75vw'} - maskClosable={false} - okText="鎻愪氦" - onOk={this.verifySubmit} - confirmLoading={loading} - onCancel={() => { this.setState({ visible: false }) }} - destroyOnClose - > - <VerifyCard - config={config} - menuId={this.props.config.uuid} - searches={config.search} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> - </Modal> - </div> - ) - } -} - -export default DataSource \ No newline at end of file diff --git a/src/templates/sharecomponent/settingcalcomponent/index.scss b/src/templates/sharecomponent/settingcalcomponent/index.scss deleted file mode 100644 index fdc03f8..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/index.scss +++ /dev/null @@ -1,11 +0,0 @@ -.model-datasource { - position: absolute; - right: 7px; - top: 5px; - z-index: 1; - - >.anticon-setting { - font-size: 18px; - padding: 10px; - } -} diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/columnform/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/columnform/index.jsx deleted file mode 100644 index 2539ee3..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/columnform/index.jsx +++ /dev/null @@ -1,144 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Select, Button, Input } from 'antd' -import './index.scss' - - -class UniqueForm extends Component { - static propTpyes = { - columnChange: PropTypes.func // 淇敼鍑芥暟 - } - - state = { - editItem: null // 缂栬緫鍏冪礌 - } - - edit = (record) => { - this.setState({ - editItem: record - }) - - this.props.form.setFieldsValue({ - label: record.label, - field: record.field, - datatype: record.datatype - }) - } - - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - values.uuid = this.state.editItem ? this.state.editItem.uuid : '' - - this.setState({ - editItem: null - }, () => { - this.props.columnChange(values) - }) - this.props.form.setFieldsValue({ - label: '', - field: '' - }) - } - }) - } - - render() { - const { getFieldDecorator } = this.props.form - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <Form {...formItemLayout} className="verify-form" id="verifycard1"> - <Row gutter={24}> - <Col span={7}> - <Form.Item label={'鍚嶇О'}> - {getFieldDecorator('label', { - initialValue: '', - rules: [ - { - required: true, - message: '璇疯緭鍏ュ悕绉�!' - } - ] - })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> - <Col span={7}> - <Form.Item label={'瀛楁'}> - {getFieldDecorator('field', { - initialValue: '', - rules: [ - { - required: true, - message: '璇疯緭鍏ュ瓧娈�!' - } - ] - })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> - <Col span={7}> - <Form.Item label="鏁版嵁绫诲瀷"> - {getFieldDecorator('datatype', { - initialValue: '', - rules: [ - { - required: true, - message: '璇烽�夋嫨鏁版嵁绫诲瀷!' - } - ] - })( - <Select> - <Select.Option value="Nvarchar(50)"> Nvarchar(50) </Select.Option> - <Select.Option value="Nvarchar(100)"> Nvarchar(100) </Select.Option> - <Select.Option value="Nvarchar(512)"> Nvarchar(512) </Select.Option> - <Select.Option value="Nvarchar(1024)"> Nvarchar(1024) </Select.Option> - <Select.Option value="Nvarchar(2048)"> Nvarchar(2048) </Select.Option> - <Select.Option value="Nvarchar(max)"> Nvarchar(max) </Select.Option> - <Select.Option value="Int"> Int </Select.Option> - <Select.Option value="Decimal(18,0)"> Decimal(18,0) </Select.Option> - <Select.Option value="Decimal(18,1)"> Decimal(18,1) </Select.Option> - <Select.Option value="Decimal(18,2)"> Decimal(18,2) </Select.Option> - <Select.Option value="Decimal(18,3)"> Decimal(18,3) </Select.Option> - <Select.Option value="Decimal(18,4)"> Decimal(18,4) </Select.Option> - <Select.Option value="Decimal(18,5)"> Decimal(18,5) </Select.Option> - <Select.Option value="Decimal(18,6)"> Decimal(18,6) </Select.Option> - <Select.Option value="Decimal(18,7)"> Decimal(18,7) </Select.Option> - <Select.Option value="Decimal(18,8)"> Decimal(18,8) </Select.Option> - <Select.Option value="Decimal(18,9)"> Decimal(18,9) </Select.Option> - <Select.Option value="Decimal(18,10)"> Decimal(18,10) </Select.Option> - <Select.Option value="Decimal(18,11)"> Decimal(18,11) </Select.Option> - <Select.Option value="Decimal(18,12)"> Decimal(18,12) </Select.Option> - <Select.Option value="Decimal(18,13)"> Decimal(18,13) </Select.Option> - <Select.Option value="Decimal(18,14)"> Decimal(18,14) </Select.Option> - <Select.Option value="Decimal(18,15)"> Decimal(18,15) </Select.Option> - <Select.Option value="Decimal(18,16)"> Decimal(18,16) </Select.Option> - <Select.Option value="Decimal(18,17)"> Decimal(18,17) </Select.Option> - <Select.Option value="Decimal(18,18)"> Decimal(18,18) </Select.Option> - {/* <Select.Option value="date"> date </Select.Option> */} - </Select> - )} - </Form.Item> - </Col> - <Col span={3} className="add"> - <Button onClick={this.handleConfirm} type="primary" className="mk-green"> - 淇濆瓨 - </Button> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(UniqueForm) \ No newline at end of file diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/columnform/index.scss b/src/templates/sharecomponent/settingcalcomponent/verifycard/columnform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/columnform/index.scss +++ /dev/null diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx deleted file mode 100644 index 1280859..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ /dev/null @@ -1,440 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, Tabs, Table, Popconfirm, notification, Modal, Spin } from 'antd' -import { EditOutlined, DeleteOutlined } from '@ant-design/icons' -import moment from 'moment' - -import Api from '@/api' -import Utils from '@/utils/utils.js' - -import asyncComponent from '@/utils/asyncComponent' -import ColForm from './columnform' -import SettingForm from './settingform' -import SettingUtils from './utils' -import './index.scss' - -const { TabPane } = Tabs - -const CustomScript = asyncComponent(() => import('@/templates/zshare/customscript')) -const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) - -class VerifyCard extends Component { - static propTpyes = { - config: PropTypes.object, // 鏁版嵁婧愪俊鎭� - menuId: PropTypes.string, // 鑿滃崟Id - searches: PropTypes.array, // 鎼滅储鏉′欢 - } - - state = { - columns: [], - activeKey: 'setting', - loading: false, - usefulfields: '', - defaultsql: '', // 榛樿Sql - colColumns: [ - { - title: '鍚嶇О', - dataIndex: 'label', - width: '25%' - }, - { - title: '瀛楁', - dataIndex: 'field', - width: '25%' - }, - { - title: '鏁版嵁绫诲瀷', - dataIndex: 'datatype', - width: '25%', - }, - { - title: '鎿嶄綔', - align: 'center', - width: '25%', - dataIndex: 'operation', - render: (text, record) => - (<div> - <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span> - <Popconfirm - overlayClassName="popover-confirm" - title="纭畾鍒犻櫎鍚�?" - onConfirm={() => this.deleteColumn(record) - }> - <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> - </Popconfirm> - </div>) - } - ] - } - - UNSAFE_componentWillMount() { - const { config } = this.props - - let _setting = fromJS(config.setting).toJS() - let _scripts = fromJS(config.scripts).toJS() - - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') - _scripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - if (_setting.dataresource) { - _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) - } - }) - } - - this.setState({ - setting: _setting, - columns: fromJS(config.columns).toJS(), - scripts: _scripts - }) - } - - columnChange = (values) => { - let columns = fromJS(this.state.columns).toJS() - - if (values.uuid) { - columns = columns.map(item => { - if (item.uuid === values.uuid) { - return values - } else { - return item - } - }) - } else { - values.uuid = Utils.getuuid() - columns.push(values) - } - - this.setState({ columns }) - } - - deleteColumn = (record) => { - this.setState({ columns: this.state.columns.filter(item => item.uuid !== record.uuid) }) - } - - handleEdit = (record) => { - this.contrastForm.edit(record) - } - - changeTab = (val) => { - const { activeKey, setting } = this.state - - if (activeKey === 'setting') { - this.settingForm.handleConfirm().then(res => { - if (res.interType !== 'system' && val === 'scripts') { - notification.warning({ - top: 92, - message: '浣跨敤绯荤粺鎺ュ彛鏃讹紝鎵嶅彲浠ヨ缃嚜瀹氫箟鑴氭湰锛�', - duration: 5 - }) - return - } - - this.setState({ - setting: res - }, () => { - if (res.interType === 'system') { // 绯荤粺鎺ュ彛锛宻ql楠岃瘉 - this.setState({loading: true}) - - this.sqlverify(() => { // 楠岃瘉鎴愬姛 - this.setState({ - activeKey: val, - loading: false - }) - }, () => { // 楠岃瘉澶辫触 - this.setState({ - activeKey: val, - loading: false - }) - }, activeKey) - } else { - this.setState({ - activeKey: val - }) - } - }) - }) - } else if (activeKey === 'columns') { - if (setting.interType !== 'system' && val === 'scripts') { - notification.warning({ - top: 92, - message: '浣跨敤绯荤粺鎺ュ彛鏃讹紝鎵嶅彲浠ヨ缃嚜瀹氫箟鑴氭湰锛�', - duration: 5 - }) - return - } - - this.setState({ - activeKey: val - }) - } else if (activeKey === 'scripts') { - let _loading = false - if (this.scriptsForm && this.scriptsForm.state.editItem) { - _loading = true - } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } - - if (_loading) { - notification.warning({ - top: 92, - message: '瀛樺湪鏈繚瀛樿剼鏈紒', - duration: 5 - }) - } - - this.setState({loading: true}) - this.sqlverify(() => { // 楠岃瘉鎴愬姛 - this.setState({ - activeKey: val, - loading: false - }) - }, () => { // 楠岃瘉澶辫触 - this.setState({ - activeKey: val, - loading: false - }) - }, activeKey) - } - } - - submitDataSource = () => { - const { activeKey, setting, columns, scripts } = this.state - - return new Promise((resolve, reject) => { - if (activeKey === 'setting') { - this.settingForm.handleConfirm().then(res => { - this.setState({ - setting: res - }, () => { - this.sqlverify(() => { resolve({setting: res, columns, scripts }) }, reject, 'submit') - }) - }, () => { - reject() - }) - } else if (activeKey === 'columns') { - this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, 'submit') - } else if (activeKey === 'scripts') { - let _loading = false - if (this.scriptsForm && this.scriptsForm.state.editItem) { - _loading = true - } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { - _loading = true - } - - if (_loading) { - notification.warning({ - top: 92, - message: '瀛樺湪鏈繚瀛樿剼鏈紝璇风偣鍑荤‘瀹氫繚瀛橈紝鎴栫偣鍑诲彇娑堟斁寮冧慨鏀癸紒', - duration: 5 - }) - reject() - return - } - - this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, 'submit') - } - }) - } - - sqlverify = (resolve, reject, type, testScripts) => { - const { searches, config } = this.props - const { columns, setting, scripts } = this.state - - if (setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熸帴鍙f椂锛屼笉闇�瑕乻ql楠岃瘉 - resolve() - return - } - - let _scripts = [] - - if (testScripts) { - _scripts = testScripts.filter(item => item.status !== 'false') - } else { - _scripts = scripts.filter(item => item.status !== 'false') - } - - if (type === 'submit' && setting.execute === 'false' && _scripts.length === 0) { - notification.warning({ - top: 92, - message: '涓嶆墽琛岄粯璁ql鏃讹紝璇锋坊鍔犺嚜瀹氫箟鑴氭湰锛�', - duration: 5 - }) - reject() - return - } - - // 涓嶄娇鐢ㄩ粯璁ql鍒囨崲 - if (type === 'setting' && setting.execute === 'false') { - resolve() - } else if (type === 'scripts' && _scripts.length === 0) { - resolve() - } else if (setting.execute !== 'false' || _scripts.length > 0) { - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: SettingUtils.getDebugSql(setting, _scripts, columns, this.getRegOptions(searches), config.calendar, config.urlFields, timestamp) - } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = timestamp - param.secretkey = Utils.encrypt('', timestamp) - - Api.genericInterface(param).then(result => { - if (result.status) { - resolve() - } else { - reject() - Modal.error({ - title: result.message - }) - } - }) - } else { - resolve() - } - } - - getRegOptions = (searches) => { - if (!searches || searches.length === 0) return [] - - let options = [] - let fieldmap = new Map() - searches.forEach(search => { - let item = { - key: search.field, - value: '0' - } - - if (fieldmap.has(item.key)) { - item.key = item.key + '1' - } - - fieldmap.set(item.key, true) - - if (search.type === 'group') { - options.push({ - key: search.field, - value: '0' - }) - options.push({ - key: search.datefield, - value: '0' - }) - options.push({ - key: search.datefield + '1', - value: '0' - }) - options.push(item) - } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) { - options.push(item) - options.push({ - key: item.key + '1', - value: '0' - }) - } else if (search.type === 'text' || search.type === 'select') { - item.key.split(',').forEach(field => { - let cell = JSON.parse(JSON.stringify(item)) - cell.key = field - - options.push(cell) - }) - } else { - options.push(item) - } - }) - - return options - } - - updatefields = (columns) => { - this.setState({ - columns: columns - }) - } - - // 鑷畾涔夎剼鏈慨鏀� - scriptsChange = (scripts) => { - return new Promise((resolve, reject) => { - this.sqlverify(resolve, reject, 'verify', scripts) - }) - } - - // 鑷畾涔夎剼鏈洿鏂� - scriptsUpdate = (scripts) => { - this.setState({scripts}) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - render() { - const { config } = this.props - const { columns, setting, scripts, colColumns, activeKey, loading } = this.state - - return ( - <div className="model-verify-card-box-tab"> - {loading && <Spin size="large" />} - <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}> - <TabPane tab="鏁版嵁婧�" key="setting"> - <SettingForm - menuId={this.props.menuId} - columns={columns} - setting={setting} - scripts={scripts} - wrappedComponentRef={(inst) => this.settingForm = inst} - /> - </TabPane> - <TabPane tab="瀛楁闆�" key="columns"> - <ColForm - columnChange={this.columnChange} - wrappedComponentRef={(inst) => this.contrastForm = inst} - /> - <FieldsComponent - config={{...config, columns}} - type="fields" - updatefield={this.updatefields} - /> - <Table - bordered - rowKey="uuid" - className="custom-table" - dataSource={columns} - columns={colColumns} - pagination={false} - /> - </TabPane> - <TabPane tab={ - <span> - 鑷畾涔夎剼鏈� - {scripts.length ? <span className="count-tip">{scripts.length}</span> : null} - </span> - } key="scripts" id="mk-setting-scripts"> - <CustomScript - setting={setting} - scripts={scripts} - urlFields={config.urlFields} - defaultSql={this.state.defaultsql} - searches={this.props.searches} - scriptsChange={this.scriptsChange} - scriptsUpdate={this.scriptsUpdate} - wrappedComponentRef={(inst) => this.scriptsForm = inst} - /> - </TabPane> - </Tabs> - </div> - ) - } -} - -export default Form.create()(VerifyCard) \ No newline at end of file diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.scss b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.scss deleted file mode 100644 index 420b3ef..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.scss +++ /dev/null @@ -1,80 +0,0 @@ -.model-verify-card-box-tab { - .ant-spin { - position: absolute; - left: calc(50% - 16px); - top: 220px; - z-index: 1; - } - .verify-card-box { - .count-tip { - position: absolute; - top: 0px; - color: #1890ff; - font-size: 12px; - } - .ant-tabs-nav-scroll { - text-align: center; - } - .ant-tabs-content { - min-height: 40vh; - } - table tr td { - word-wrap: break-word; - word-break: break-word; - } - .quickly-add { - position: relative; - width: 100px; - float: right; - top: -5px; - z-index: 2; - } - .verify-form { - .sql { - .ant-col-sm-8 { - width: 10.5%; - } - .ant-col-sm-16 { - width: 89.5%; - padding-top: 4px; - } - } - .sqlfield { - .ant-form-item { - margin-bottom: 5px; - } - .ant-form-item-control { - line-height: 24px; - } - .ant-form-item-label { - line-height: 25px; - } - .ant-form-item-children { - line-height: 22px; - } - .ant-col-sm-8 { - width: 10.5%; - } - .ant-col-sm-16 { - width: 89.5%; - } - } - .add { - padding-top: 4px; - } - } - .custom-table .ant-empty { - margin: 20px 8px!important; - } - .errorval { - display: inline-block; - width: 30px; - } - .operation-btn { - display: inline-block; - font-size: 16px; - padding: 0 5px; - cursor: pointer; - } - } -} \ No newline at end of file diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx deleted file mode 100644 index 6b8f830..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx +++ /dev/null @@ -1,330 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Tooltip, notification } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' -import moment from 'moment' - -import Api from '@/api' -import { formRule } from '@/utils/option.js' -import Utils from '@/utils/utils.js' -import CodeMirror from '@/templates/zshare/codemirror' -// import './index.scss' - -const { TextArea } = Input - -class SettingForm extends Component { - static propTpyes = { - menuId: PropTypes.string, // 鑿滃崟Id - setting: PropTypes.object, // 鏁版嵁婧愰厤缃� - columns: PropTypes.array, // 鍒楄缃� - scripts: PropTypes.array, // 鑷畾涔夎剼鏈� - } - - state = { - interType: this.props.setting.interType || 'system', - usefulFields: [] - } - - UNSAFE_componentWillMount() { - let usefulFields = sessionStorage.getItem('permFuncField') - if (usefulFields) { - try { - usefulFields = JSON.parse(usefulFields) - } catch (e) { - usefulFields = [] - } - } else { - usefulFields = [] - } - - this.setState({ - usefulFields - }) - } - - handleConfirm = () => { - const { setting } = this.props - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - // 鏁版嵁婧愬墠绔獙璇� - if (values.interType === 'system' && values.execute !== 'false' && !values.dataresource) { - notification.warning({ - top: 92, - message: '璇峰~鍐欐暟鎹簮锛�', - duration: 5 - }) - reject() - return - } else if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { - let _quot = values.dataresource.match(/'{1}/g) - let _lparen = values.dataresource.match(/\({1}/g) - let _rparen = values.dataresource.match(/\){1}/g) - - _quot = _quot ? _quot.length : 0 - _lparen = _lparen ? _lparen.length : 0 - _rparen = _rparen ? _rparen.length : 0 - - if (_quot % 2 !== 0) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑\'蹇呴』鎴愬鍑虹幇', - duration: 5 - }) - reject() - return - } else if (_lparen !== _rparen) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑()蹇呴』鎴愬鍑虹幇', - duration: 5 - }) - reject() - return - } else if (/--/ig.test(values.dataresource)) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑锛屼笉鍙嚭鐜板瓧绗� -- 锛屾敞閲婅鐢� /*鍐呭*/', - duration: 5 - }) - reject() - return - } else if (/,,/ig.test(values.dataresource)) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑锛屼笉鍙嚭鐜拌繛缁殑鑻辨枃閫楀彿锛�,,锛�', - duration: 5 - }) - reject() - return - } - - let error = Utils.verifySql(values.dataresource) - - if (error) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑涓嶅彲浣跨敤' + error, - duration: 5 - }) - reject() - return - } - } - - // 鏁版嵁婧愪繚瀛� - if ( - values.interType === 'system' && values.execute !== 'false' && - /[^\s]+\s+[^\s]+/ig.test(values.dataresource) && setting.dataresource !== values.dataresource - ) { - let param = { - func: 's_DataSrc_Save', - LText: values.dataresource, - MenuID: this.props.menuId - } - - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - Api.genericInterface(param) - } - - resolve(values) - } else { - reject(err) - } - }) - }) - } - - onRadioChange = (e, key) => { - let value = e.target.value - - if (key === 'interType') { - this.setState({ - interType: value - }) - } - } - - render() { - const { setting } = this.props - const { getFieldDecorator } = this.props.form - const { interType, usefulFields } = this.state - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - let tooltip = null - let rules = [] - - if (usefulFields.length > 0) { - tooltip = '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', ') - let str = '^(' + usefulFields.join('|') + ')' - let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') - - rules.push({ - required: true, - message: '璇疯緭鍏ュ唴閮ㄥ嚱鏁�!' - }, { - pattern: _patten, - message: formRule.func.innerMessage - }) - } - - return ( - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={8}> - <Form.Item label="琛ㄥ悕"> - {getFieldDecorator('tableName', { - initialValue: setting.tableName, - rules: [ - { - required: true, - message: '璇疯緭鍏ヨ〃鍚�!' - }, - { - max: 50, - message: '琛ㄥ悕鏈�闀夸负50涓瓧绗�!' - } - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> - <Col span={8}> - <Form.Item label="鎺ュ彛绫诲瀷"> - {getFieldDecorator('interType', { - initialValue: interType, - rules: [ - { - required: true, - message: '璇烽�夋嫨鎺ュ彛绫诲瀷!' - }, - ] - })( - <Radio.Group onChange={(e) => {this.onRadioChange(e, 'interType')}}> - <Radio value="system">绯荤粺</Radio> - <Radio value="inner">鍐呴儴</Radio> - <Radio value="outer">澶栭儴</Radio> - </Radio.Group>)} - </Form.Item> - </Col> - {interType === 'inner' ? <Col span={8}> - <Form.Item label={tooltip ? - <Tooltip placement="topLeft" title={tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鍐呴儴鍑芥暟 - </Tooltip> : '鍐呴儴鍑芥暟' - }> - {getFieldDecorator('innerFunc', { - initialValue: setting.innerFunc || '', - rules: rules - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> : null} - {interType === 'outer' ? <Col span={8}> - <Form.Item label="澶栭儴鍑芥暟"> - {getFieldDecorator('outerFunc', { - initialValue: setting.outerFunc || '', - rules: [ - - ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> : null} - {interType === 'outer' ? <Col span={24} className="mk-through-line3"> - <Form.Item label="鎺ュ彛鍦板潃"> - {getFieldDecorator('interface', { - initialValue: setting.interface || '', - rules: [ - { - required: true, - message: '璇疯緭鍏ユ帴鍙e湴鍧�!' - }, - ] - })(<TextArea rows={2}/>)} - </Form.Item> - </Col> : null} - {interType === 'system' ? <Col span={24} className="mk-through-line3"> - <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={ - <Tooltip placement="topLeft" title={'浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� \'\'銆� @$ -> */ 鎴� \'\''}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鏁版嵁婧� - </Tooltip> - }> - {getFieldDecorator('dataresource', { - initialValue: setting.dataresource || '' - })(<CodeMirror />)} - </Form.Item> - </Col> : null} - {interType === 'system' ? <Col span={8}> - <Form.Item label={ - <Tooltip placement="topLeft" title={'鏌ヨ鏃讹紝鎼滅储鏉′欢浠here鏉′欢鎷兼帴杩涘叆sql锛岀粺璁℃椂锛屽皢鏁版嵁婧愪腑浠モ�淍+鎼滅储瀛楁+@鈥濈殑鍐呭锛屼互鎼滅储鏉′欢涓殑鍊艰繘琛屾浛鎹㈠悗锛屾彁浜ゆ煡璇紝娉細鏌ヨ绫诲瀷浠呭湪浣跨敤绯荤粺鍑芥暟鏃舵湁鏁堛��'}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鏌ヨ绫诲瀷 - </Tooltip> - }> - {getFieldDecorator('queryType', { - initialValue: setting.queryType || 'query' - })( - <Radio.Group> - <Radio value="query">鏌ヨ</Radio> - <Radio value="statistics">缁熻</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - {/* <Col span={8}> - <Form.Item label="涓婚敭"> - {getFieldDecorator('primaryKey', { - initialValue: setting.primaryKey || '' - })( - <Select> - {columns.map((option, i) => - <Select.Option key={i} value={option.field}> - {option.label} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> */} - {interType === 'system' ? <Col span={8}> - <Form.Item label="榛樿sql"> - {getFieldDecorator('execute', { - initialValue: setting.execute || 'true' - })( - <Radio.Group> - <Radio value="true">鎵ц</Radio> - <Radio value="false">涓嶆墽琛�</Radio> - </Radio.Group>)} - </Form.Item> - </Col> : null} - <Col span={8}> - <Form.Item label="鍒濆鍖�"> - {getFieldDecorator('onload', { - initialValue: setting.onload || 'true' - })( - <Radio.Group> - <Radio value="true">鍔犺浇鏁版嵁</Radio> - <Radio value="false">涓嶅姞杞芥暟鎹�</Radio> - </Radio.Group>)} - </Form.Item> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.scss b/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.scss +++ /dev/null diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx deleted file mode 100644 index 5eb0bce..0000000 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx +++ /dev/null @@ -1,145 +0,0 @@ - -export default class SettingUtils { - /** - * @description 鐢熸垚椤甸潰鏌ヨ璇彞 - * @return {String} scripts 鑷畾涔夎剼鏈� - * @return {String} searches 鎼滅储鏉′欢 - * @return {Object} setting 椤甸潰璁剧疆 - * @return {Array} columns 鏄剧ず瀛楁 - */ - static getDebugSql (setting, scripts, columns, searches, calendar, urlFields = [], timestamp) { - let sql = '' - let _dataresource = '' - let _customScript = '' - let arr_field = columns.map(item => item.field).join(',') - - if (scripts.length > 0) { - scripts.forEach(item => { - _customScript += ` - ${item.sql} - ` - }) - } - - if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' - ${_customScript} - ` - } - - if (setting.execute !== 'false') { - _dataresource = setting.dataresource || '' - } - - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(item => { - let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - }) - } - - _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) - _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) - _dataresource = _dataresource.replace(/@\$|\$@/ig, '') - _customScript = _customScript.replace(/@\$|\$@/ig, '') - - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) - _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) - } - - urlFields.forEach(field => { - _dataresource = _dataresource.replace(new RegExp('@' + field + '@', 'ig'), `'0'`) - _customScript = _customScript.replace(new RegExp('@' + field + '@', 'ig'), `'0'`) - }) - - // 姝e垯鏇挎崲 - let _regoptions = [] - let _search = '' - - if (setting.queryType === 'statistics' || _customScript) { - _regoptions = searches.map(item => { - return { - reg: new RegExp('@' + item.key + '@', 'ig'), - value: `'0'` - } - }) - } - - // 鏃ュ巻涓殑骞翠唤鏇挎崲 - if (calendar.refresh === 'true') { - _regoptions.push({ - reg: new RegExp('@calendarDate@', 'ig'), - value: `'1970-01-01 00:00:00.000'` - }, { - reg: new RegExp('@calendarDate1@', 'ig'), - value: `'2030-12-31 23:59:59.999'` - }) - } - - _regoptions.push({ - reg: new RegExp('@userName@', 'ig'), - value: `''` - }, { - reg: new RegExp('@fullName@', 'ig'), - value: `''` - }) - - if ((setting.queryType === 'statistics' || calendar.refresh === 'true') && _dataresource) { - _regoptions.forEach(item => { - _dataresource = _dataresource.replace(item.reg, item.value) - }) - - _search = '' - } - - if (_customScript) { - _regoptions.push({ - reg: new RegExp('@orderBy@', 'ig'), - value: setting.order - }) - if (setting.laypage !== 'false') { - _regoptions.push({ - reg: new RegExp('@pageSize@', 'ig'), - value: 10 - }, { - reg: new RegExp('@pageIndex@', 'ig'), - value: 1 - }) - } - _regoptions.forEach(item => { - _customScript = _customScript.replace(item.reg, item.value) - }) - } - - // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 - if (arr_field && _dataresource) { - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - _dataresource = `/*system_query*/select ${setting.laypage !== 'false' ? 'top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage !== 'false' ? 'where rows > 0' : ''} order by tmptable.rows` - } - - if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${_customScript} - ${_dataresource} - aaa: - if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ - ` - } else { - sql = `/* sql 楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' - ${_dataresource}` - } - sql = sql.replace(/\n\s{8}/ig, '\n') - console.info(sql) - sql = sql.replace(/\n/g, ' ') - - return sql - } -} \ No newline at end of file diff --git a/src/templates/zshare/unattended/settingform/index.jsx b/src/templates/zshare/unattended/settingform/index.jsx index e30dd8d..4142a57 100644 --- a/src/templates/zshare/unattended/settingform/index.jsx +++ b/src/templates/zshare/unattended/settingform/index.jsx @@ -160,6 +160,7 @@ <Radio.Group> <Radio value="first">绗竴琛�</Radio> <Radio value="next">涓嬩竴琛�</Radio> + <Radio value="refresh">鍒锋柊椤甸潰</Radio> </Radio.Group> )} </Form.Item> diff --git a/src/views/main/index.jsx b/src/views/main/index.jsx index 3fa342e..2f20d4d 100644 --- a/src/views/main/index.jsx +++ b/src/views/main/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import { ConfigProvider } from 'antd' -import enUS from 'antd/es/locale/en_US' +// import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' import asyncComponent from '@/utils/asyncComponent' @@ -14,7 +14,6 @@ const Tabview = asyncComponent(() => import('@/components/tabview')) const Breadview = asyncComponent(() => import('@/components/breadview')) -const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS class Main extends Component { state = { @@ -63,7 +62,7 @@ return ( <div className="mk-main-view"> - <ConfigProvider locale={_locale}> + <ConfigProvider locale={zhCN}> <Header key="header"/> {navBar === 'shutter' ? <Sidemenu key="sidemenu"/> : null} {navBar === 'shutter' || navBar === 'menu_board_navigation' ? diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index b2f079b..e3a1cde 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' -import { Spin, notification } from 'antd' +import { Spin, notification, ConfigProvider } from 'antd' +import zhCN from 'antd/es/locale/zh_CN' import Api from '@/api' import asyncComponent from '@/utils/asyncLoadComponent' @@ -38,7 +39,7 @@ localStorage.removeItem('getSysPermission') localStorage.removeItem('sysPermissions') - if (window.GLOB.mkActions) { + if (window.GLOB.mkActions && window.GLOB.mkActions.loaded) { this.setState({loading: false}) } else { this.getPermRole() @@ -176,9 +177,11 @@ return ( <div className="main-iframe"> - {loading ? <Spin size="large" /> : null} - {!loading && type === 'CustomPage' ? <CustomPage MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} - {!loading && type === 'BaseTable' ? <BaseTable MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} + <ConfigProvider locale={zhCN}> + {loading ? <Spin size="large" /> : null} + {!loading && type === 'CustomPage' ? <CustomPage MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} + {!loading && type === 'BaseTable' ? <BaseTable MenuID={MenuId} param={{$BID: BID}} changeTemp={this.changeTemp}/> : null} + </ConfigProvider> </div> ) } -- Gitblit v1.8.0