aldehyde 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/163.js +2 -0
- package/dist/163.js.LICENSE.txt +43 -0
- package/dist/41.js +1 -0
- package/dist/aldehyde.js +2 -0
- package/dist/aldehyde.js.LICENSE.txt +122 -0
- package/dist/chemstruc-graph.js +1 -0
- package/dist/css/163-24392163d3c7b54ea806.css +11 -0
- package/dist/css/290-5e8e152675ab7d201c00.css +886 -0
- package/dist/css/chemstruc-graph-87868f791bf92fb80db9.css +29 -0
- package/dist/css/main-2e6725ec1b56da516cee.css +256 -0
- package/dist/html-editor-draft.js +2 -0
- package/dist/html-editor-draft.js.LICENSE.txt +5 -0
- package/dist/images/logo-06f6a5d8.png +0 -0
- package/dist/index.html +4 -0
- package/dist/signature.js +2 -0
- package/dist/signature.js.LICENSE.txt +17 -0
- package/package.json +180 -0
- package/src/components/chart/antd/Chart.js +32 -0
- package/src/components/chart/antd/Chart10000.js +90 -0
- package/src/components/chart/antd/Max2DimLineChart.js +128 -0
- package/src/components/chart/antd/PieChart1.js +54 -0
- package/src/components/chart/antd/PieChart2.js +56 -0
- package/src/components/chart/antd/chart-utils.tsx +50 -0
- package/src/components/chart/antd/column-chart-sub.tsx +67 -0
- package/src/components/chart/antd/line-chart-sub.tsx +65 -0
- package/src/components/chart/antd/pie-chart-sub.tsx +54 -0
- package/src/components/chart/antd/statview-d2-chart.tsx +125 -0
- package/src/components/chart/statview-l2-chart.tsx +69 -0
- package/src/components/controls/action/index.css +9 -0
- package/src/components/controls/action/index.tsx +228 -0
- package/src/components/controls/action/utils.tsx +122 -0
- package/src/components/controls/auto-complete/index.tsx +80 -0
- package/src/components/controls/cascader/index.js +97 -0
- package/src/components/controls/chemstruc/graph.tsx +150 -0
- package/src/components/controls/chemstruc/index.css +28 -0
- package/src/components/controls/collapse-card/index.css +9 -0
- package/src/components/controls/collapse-card/index.tsx +59 -0
- package/src/components/controls/color-picker/index.css +27 -0
- package/src/components/controls/color-picker/index.tsx +88 -0
- package/src/components/controls/cquery/cquick-button.tsx +117 -0
- package/src/components/controls/date-picker/index.tsx +141 -0
- package/src/components/controls/entity-select/entity-select.tsx +277 -0
- package/src/components/controls/entity-select/index.css +6 -0
- package/src/components/controls/entity-select/popover-entity-select.tsx +112 -0
- package/src/components/controls/entry-control.tsx +240 -0
- package/src/components/controls/enum-badge/index.tsx +28 -0
- package/src/components/controls/enum-tag/index.tsx +30 -0
- package/src/components/controls/file-view/drawer-file-view.tsx +69 -0
- package/src/components/controls/file-view/index.tsx +145 -0
- package/src/components/controls/html-editor/draft.tsx +161 -0
- package/src/components/controls/html-editor/tinymce.js +55 -0
- package/src/components/controls/input-number/index.tsx +101 -0
- package/src/components/controls/input-range/index.tsx +48 -0
- package/src/components/controls/password-setter/index.css +3 -0
- package/src/components/controls/password-setter/index.js +70 -0
- package/src/components/controls/progress/index.tsx +61 -0
- package/src/components/controls/relation-existion/index.css +4 -0
- package/src/components/controls/relation-existion/index.tsx +108 -0
- package/src/components/controls/rfield/index.css +4 -0
- package/src/components/controls/rfield/index.tsx +161 -0
- package/src/components/controls/signature/index.tsx +162 -0
- package/src/components/controls/steps/index.tsx +58 -0
- package/src/components/controls/text/ellipsis-text.tsx +70 -0
- package/src/components/controls/upload/index.tsx +122 -0
- package/src/components/controls/view-control.tsx +177 -0
- package/src/components/detail/button/cquery-button-bar.tsx +112 -0
- package/src/components/detail/button/index.css +43 -0
- package/src/components/detail/button/submit-button-bar.tsx +151 -0
- package/src/components/detail/dtmpl.css +53 -0
- package/src/components/detail/edit/dtmpl-edit.tsx +218 -0
- package/src/components/detail/edit/fields-edit-card.tsx +103 -0
- package/src/components/detail/edit/modal-dtmpl-edit.tsx +198 -0
- package/src/components/detail/edit/modal-row-edit.tsx +72 -0
- package/src/components/detail/edit/post-result/index.tsx +52 -0
- package/src/components/detail/edit/row-edit-card.tsx +125 -0
- package/src/components/detail/edit/row-editor.tsx +71 -0
- package/src/components/detail/rightbar/index.css +35 -0
- package/src/components/detail/rightbar/index.tsx +76 -0
- package/src/components/detail/view/act-dtmpl-view.tsx +155 -0
- package/src/components/detail/view/dtmpl-view.tsx +143 -0
- package/src/components/detail/view/field-view-group.tsx +73 -0
- package/src/components/detail/view/modal-dtmpl-view.tsx +56 -0
- package/src/components/detail/view/snapshot-timeline.tsx +130 -0
- package/src/components/exportor/export-frame.css +3 -0
- package/src/components/exportor/export-frame.tsx +194 -0
- package/src/components/exportor/index.tsx +60 -0
- package/src/components/form/criteria-form.tsx +241 -0
- package/src/components/form/dtmpl-form.css +4 -0
- package/src/components/form/dtmpl-form.tsx +272 -0
- package/src/components/form/field-group-form.tsx +75 -0
- package/src/components/form/fields-form.tsx +51 -0
- package/src/components/form/form-Item-group.tsx +99 -0
- package/src/components/form/index.css +13 -0
- package/src/components/import/excel-import.tsx +316 -0
- package/src/components/import/index.css +54 -0
- package/src/components/import/template-builder.js +474 -0
- package/src/components/import/template.css +51 -0
- package/src/components/layout/MainPage.tsx +230 -0
- package/src/components/layout/footer/index.css +6 -0
- package/src/components/layout/footer/index.js +17 -0
- package/src/components/layout/header/index.css +86 -0
- package/src/components/layout/header/index.tsx +58 -0
- package/src/components/layout/menu/block.tsx +88 -0
- package/src/components/layout/menu/l2menu-message-bar.tsx +118 -0
- package/src/components/layout/menu/l2menu-quick-bar.tsx +132 -0
- package/src/components/layout/menu/menu-2layers.tsx +92 -0
- package/src/components/layout/menu/menu-render.tsx +49 -0
- package/src/components/layout/menu/reset-password.tsx +185 -0
- package/src/components/layout/menu/user-bar.tsx +97 -0
- package/src/components/layout/menu/userinfo-bar.tsx +70 -0
- package/src/components/layout/sidebar/index.css +26 -0
- package/src/components/layout/sidebar/index.tsx +38 -0
- package/src/components/login.js +137 -0
- package/src/components/module/criteria-page.tsx +175 -0
- package/src/components/module/dtmpl-page.tsx +70 -0
- package/src/components/module/ltmpl-page.tsx +181 -0
- package/src/components/routable/dtmpl-route.tsx +96 -0
- package/src/components/routable/import-route.tsx +28 -0
- package/src/components/routable/ltmpl-route.tsx +158 -0
- package/src/components/table/act-table.tsx +635 -0
- package/src/components/table/column/column-selector.tsx +79 -0
- package/src/components/table/column/index.css +14 -0
- package/src/components/table/index.css +45 -0
- package/src/components/table/l2-act-table.tsx +85 -0
- package/src/components/table/modal-select-table.tsx +248 -0
- package/src/components/table/pagination.css +15 -0
- package/src/components/table/pagination.tsx +72 -0
- package/src/components/table/query-table.tsx +331 -0
- package/src/components/table/relation-table.tsx +600 -0
- package/src/components/table/select-table.tsx +247 -0
- package/src/components/table/selected-rows-card.tsx +62 -0
- package/src/components/table/stat/restat.tsx +79 -0
- package/src/components/table/table-util.tsx +33 -0
- package/src/components/tmpl/control-type-supportor.tsx +97 -0
- package/src/components/tmpl/hc-data-source.tsx +230 -0
- package/src/components/tmpl/hcservice-v3.tsx +624 -0
- package/src/components/tmpl/interface.tsx +308 -0
- package/src/components/tmpl/superagent.js +93 -0
- package/src/components/tmpl/tmpl-config-analysis.tsx +111 -0
- package/src/components/units/EncryptUtils.js +38 -0
- package/src/components/units/image.d.ts +8 -0
- package/src/components/units/index.tsx +536 -0
- package/src/components/units/logo.png +0 -0
- package/src/components/units/storage.js +3 -0
- package/src/components/welcome/HCWelcome.js +232 -0
- package/src/components/welcome/index.css +13 -0
- package/src/components/welcome/logo.png +0 -0
- package/src/components/welcome/quick-entrance.tsx +77 -0
- package/src/components/welcome/workbench.tsx +76 -0
- package/src/index.js +4 -0
- package/src/style/common.css +79 -0
- package/src/style/coverstyle.css +49 -0
- package/src/style/transstyle.css +24 -0
- package/tsconfig.json +106 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {FormInstance, Layout} from 'antd'
|
|
3
|
+
import Footer from './footer';
|
|
4
|
+
import {BlockMenu} from "../tmpl/interface";
|
|
5
|
+
import Header from './header';
|
|
6
|
+
import SideBar from './sidebar';
|
|
7
|
+
import HCDataSource from "../tmpl/hc-data-source";
|
|
8
|
+
import DocumentTitle from "react-document-title";
|
|
9
|
+
import Units from '../units';
|
|
10
|
+
import Scrollbars from 'react-custom-scrollbars';
|
|
11
|
+
|
|
12
|
+
const {Content, Sider} = Layout;
|
|
13
|
+
|
|
14
|
+
interface MainPageProps {
|
|
15
|
+
children: any,
|
|
16
|
+
match?: any,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface MainPageState {
|
|
20
|
+
collapsed: boolean,
|
|
21
|
+
currentL2MenuId: string,
|
|
22
|
+
blocks: BlockMenu[],
|
|
23
|
+
currentBlockId?: string,
|
|
24
|
+
isImporter:boolean,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class MainPage extends React.PureComponent<MainPageProps, MainPageState> {
|
|
28
|
+
scrollbarRef = React.createRef();
|
|
29
|
+
state = {
|
|
30
|
+
collapsed: false,
|
|
31
|
+
blocks: [],
|
|
32
|
+
currentL2MenuId: undefined,
|
|
33
|
+
currentBlockId: undefined,
|
|
34
|
+
isImporter:false,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async componentDidMount() {
|
|
38
|
+
|
|
39
|
+
var currentURL = new URL(window.location.href);
|
|
40
|
+
console.log('main page currentURL:',currentURL);
|
|
41
|
+
const search = window.location.href.split("?")[1];
|
|
42
|
+
var searchParams = new URLSearchParams('?' + search);
|
|
43
|
+
let blockId = searchParams.get('blockId');
|
|
44
|
+
let l2MenuId = searchParams.get('menuId');
|
|
45
|
+
//进一步找找l2MenuId
|
|
46
|
+
if (!l2MenuId) {
|
|
47
|
+
let sourcePart = currentURL.hash.match(/[\w]+\-[\d]+/);
|
|
48
|
+
if (sourcePart) {
|
|
49
|
+
let source = sourcePart[0].split('-');
|
|
50
|
+
if (source[0] === 'menu') {
|
|
51
|
+
l2MenuId = source[1];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
let blockRes = await HCDataSource.requestBlocks(l2MenuId ? l2MenuId : undefined, blockId ? blockId : undefined);
|
|
56
|
+
this.setState({
|
|
57
|
+
isImporter:currentURL.hash.indexOf('/importer')>0,
|
|
58
|
+
blocks: blockRes.blocks,
|
|
59
|
+
currentL2MenuId: blockRes.l2MenuId,
|
|
60
|
+
currentBlockId: blockRes.blockId,
|
|
61
|
+
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
async componentDidUpdate(prevProps, prevState) {
|
|
68
|
+
|
|
69
|
+
var currentURL = new URL(window.location.href);
|
|
70
|
+
const search = window.location.href.split("?")[1];
|
|
71
|
+
var searchParams = new URLSearchParams('?' + search);
|
|
72
|
+
let blockId = searchParams.get('blockId');
|
|
73
|
+
let l2MenuId = searchParams.get('menuId');
|
|
74
|
+
let isImporter_= currentURL.hash.indexOf('/importer')>0;
|
|
75
|
+
if(prevState.isImporter!=isImporter_){
|
|
76
|
+
this.setState({
|
|
77
|
+
isImporter:isImporter_,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
//进一步找找l2MenuId
|
|
81
|
+
if (!l2MenuId) {
|
|
82
|
+
let sourcePart = currentURL.hash.match(/[\w]+\-[\d]+/);
|
|
83
|
+
if (sourcePart) {
|
|
84
|
+
let source = sourcePart[0].split('-');
|
|
85
|
+
if (source[0] === 'menu') {
|
|
86
|
+
l2MenuId = source[1];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const {currentL2MenuId, currentBlockId} = this.state;
|
|
92
|
+
if (l2MenuId && currentL2MenuId != l2MenuId) {
|
|
93
|
+
this.setState({
|
|
94
|
+
currentL2MenuId: l2MenuId,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!blockId) {
|
|
99
|
+
blockId = this.findBlockIdOfL2Menu(l2MenuId);
|
|
100
|
+
}
|
|
101
|
+
if (blockId && currentBlockId != blockId) {
|
|
102
|
+
this.setState({
|
|
103
|
+
currentBlockId: blockId,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
findBlockTitle = (blockId: string) => {
|
|
109
|
+
let blockTitle: string;
|
|
110
|
+
const {blocks} = this.state;
|
|
111
|
+
if (blockId) {
|
|
112
|
+
for (const block of blocks) {
|
|
113
|
+
if (block.id == blockId) {
|
|
114
|
+
blockTitle = block.title;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
let title = blockTitle ? blockTitle + '-' : "";
|
|
120
|
+
let programName = Units.programName() ? Units.programName() : 'HYDROCARBON';
|
|
121
|
+
title = title + programName;
|
|
122
|
+
return title;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
findBlockIdOfL2Menu = (leMenuId: string) => {
|
|
126
|
+
let blockId: string = undefined;
|
|
127
|
+
const {blocks} = this.state;
|
|
128
|
+
if (leMenuId) {
|
|
129
|
+
for (const block of blocks) {
|
|
130
|
+
for (const menul1 of block.l1Menus) {
|
|
131
|
+
for (const menul2 of menul1.l2Menus) {
|
|
132
|
+
if (menul2.id == leMenuId) {
|
|
133
|
+
blockId = block.id;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return blockId;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
findCurrentBlock = () => {
|
|
144
|
+
const {blocks, currentL2MenuId, currentBlockId} = this.state;
|
|
145
|
+
let result: BlockMenu = undefined;
|
|
146
|
+
|
|
147
|
+
if (currentL2MenuId ) {
|
|
148
|
+
for (const block of blocks) {
|
|
149
|
+
for (const menul1 of block.l1Menus) {
|
|
150
|
+
for (const menul2 of menul1.l2Menus) {
|
|
151
|
+
if (menul2.id == currentL2MenuId) {
|
|
152
|
+
result = block;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (currentBlockId && !result) {
|
|
160
|
+
for (const block of blocks) {
|
|
161
|
+
if (block.id === currentBlockId) {
|
|
162
|
+
result = block;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if(!result){
|
|
168
|
+
result = blocks.at(0);
|
|
169
|
+
}
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
toggle = () => {
|
|
174
|
+
this.setState({
|
|
175
|
+
collapsed: !this.state.collapsed,
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
render() {
|
|
180
|
+
const {match}=this.props;
|
|
181
|
+
|
|
182
|
+
const {collapsed, currentL2MenuId, currentBlockId,isImporter} = this.state;
|
|
183
|
+
//滚动条回到顶部
|
|
184
|
+
// document.body.scrollTop = document.documentElement.scrollTop = 0;
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
// eslint-disable-next-line no-unused-expressions
|
|
187
|
+
this.scrollbarRef?.current?.scrollToTop();
|
|
188
|
+
return (
|
|
189
|
+
<Scrollbars ref={this.scrollbarRef} style={{ height: 'calc(100vh)' }} autoHide autoHideTimeout={1000}>
|
|
190
|
+
<DocumentTitle title={(isImporter?'导入-':"") + this.findBlockTitle(currentBlockId)}>
|
|
191
|
+
<Layout>
|
|
192
|
+
<Sider
|
|
193
|
+
style={{
|
|
194
|
+
overflow: 'auto',
|
|
195
|
+
height: '100vh',
|
|
196
|
+
position: 'fixed',
|
|
197
|
+
left: 0,
|
|
198
|
+
top: 0,
|
|
199
|
+
bottom: 0,
|
|
200
|
+
}}
|
|
201
|
+
collapsed={collapsed}
|
|
202
|
+
>
|
|
203
|
+
<SideBar blockMenu={this.findCurrentBlock()}
|
|
204
|
+
currentL2MenuId={currentL2MenuId} collapsed={collapsed}/>
|
|
205
|
+
</Sider>
|
|
206
|
+
<Layout style={collapsed ? {background: '#fff', marginLeft: 80} : {
|
|
207
|
+
background: '#fff',
|
|
208
|
+
marginLeft: 200
|
|
209
|
+
}}>
|
|
210
|
+
<Header toggle={this.toggle} {...this.state} />
|
|
211
|
+
<Content style={{
|
|
212
|
+
margin: '24px 16px 0',
|
|
213
|
+
overflow: 'initial',
|
|
214
|
+
minHeight: 'calc(100vh)',
|
|
215
|
+
minWidth: 760,
|
|
216
|
+
maxWidth: 1960,
|
|
217
|
+
paddingBottom: '8px',
|
|
218
|
+
}}>
|
|
219
|
+
{this.props.children}
|
|
220
|
+
</Content>
|
|
221
|
+
<Footer/>
|
|
222
|
+
</Layout>
|
|
223
|
+
</Layout>
|
|
224
|
+
</DocumentTitle>
|
|
225
|
+
</Scrollbars>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export default MainPage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import "./index.css";
|
|
3
|
+
import {Layout } from 'antd';
|
|
4
|
+
const {Footer : AntdFooter}=Layout;
|
|
5
|
+
|
|
6
|
+
export default class Footer extends React.Component {
|
|
7
|
+
|
|
8
|
+
render() {
|
|
9
|
+
return (
|
|
10
|
+
<AntdFooter style={{textAlign: 'center'}}>
|
|
11
|
+
<div className="footer">
|
|
12
|
+
Enterprise Applications ©2022 Created by KUANGKIE
|
|
13
|
+
</div>
|
|
14
|
+
</AntdFooter>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.header-top{
|
|
2
|
+
min-height:50px;
|
|
3
|
+
line-height: 55px;
|
|
4
|
+
text-align:left;
|
|
5
|
+
color:#333;
|
|
6
|
+
background: #fff;
|
|
7
|
+
font-size: 16px;
|
|
8
|
+
border-bottom: 1px solid #40a9ff;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.header-col{
|
|
12
|
+
z-index:1000
|
|
13
|
+
}
|
|
14
|
+
.ant-dropdown-menu-item, .ant-dropdown-menu-submenu-title{
|
|
15
|
+
font-size: 14px!important;
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
.message-bar{
|
|
19
|
+
float:right;
|
|
20
|
+
min-width:50px;
|
|
21
|
+
width:auto;
|
|
22
|
+
text-align:center;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
}
|
|
25
|
+
.message-bar:hover{
|
|
26
|
+
background: #4a5f74;
|
|
27
|
+
color:#fff;
|
|
28
|
+
border-radius: 30px;
|
|
29
|
+
}
|
|
30
|
+
.message-bar-avatar{
|
|
31
|
+
background-color: #fff;
|
|
32
|
+
color:#1890ff;
|
|
33
|
+
}
|
|
34
|
+
.message-bar-avatar:hover{
|
|
35
|
+
background: #4a5f74;
|
|
36
|
+
color:#fff;
|
|
37
|
+
}
|
|
38
|
+
.userLogin{
|
|
39
|
+
float:right;
|
|
40
|
+
min-width:80px;
|
|
41
|
+
width:auto;
|
|
42
|
+
text-align:center;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
.userLogin i{
|
|
46
|
+
font-size: 24px!important;
|
|
47
|
+
}
|
|
48
|
+
.userLogin:hover{
|
|
49
|
+
background: #4a5f74;
|
|
50
|
+
color:#fff;
|
|
51
|
+
}
|
|
52
|
+
.ant-dropdown-menu-item:hover, .ant-dropdown-menu-submenu-title:hover{
|
|
53
|
+
color:#1890FF;
|
|
54
|
+
}
|
|
55
|
+
.dropdown-link{
|
|
56
|
+
display: inline-block;
|
|
57
|
+
margin:0 10px;
|
|
58
|
+
}
|
|
59
|
+
.header-block{
|
|
60
|
+
float: left;
|
|
61
|
+
/*padding-left: 10px;*/
|
|
62
|
+
padding-top: 2px;
|
|
63
|
+
}
|
|
64
|
+
.header-block:hover{
|
|
65
|
+
padding-top: 0px;
|
|
66
|
+
border-bottom-style: solid;
|
|
67
|
+
border-bottom-width:2px;
|
|
68
|
+
border-bottom-color:#1E90FF ;
|
|
69
|
+
}
|
|
70
|
+
.header-top .active{
|
|
71
|
+
background: #1E90FF;
|
|
72
|
+
}
|
|
73
|
+
.header-top .active>a {
|
|
74
|
+
color: #fcfcfc;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.trigger {
|
|
78
|
+
padding: 0 12px;
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
transition: color 0.3s;
|
|
81
|
+
font-size: 20px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.trigger:hover {
|
|
85
|
+
color: #1890ff;
|
|
86
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Col, Layout, Row} from 'antd'
|
|
3
|
+
import {MenuFoldOutlined, MenuUnfoldOutlined} from '@ant-design/icons';
|
|
4
|
+
import 'antd/dist/antd.css';
|
|
5
|
+
import "./index.css"
|
|
6
|
+
import Block, {BlockProps} from "../menu/block";
|
|
7
|
+
import L2MenuMessageBar from '../menu/l2menu-message-bar';
|
|
8
|
+
import L2MenuQuickBar from '../menu/l2menu-quick-bar';
|
|
9
|
+
import UserBar from '../menu/user-bar';
|
|
10
|
+
|
|
11
|
+
const { Header:AntdHeader, } = Layout;
|
|
12
|
+
|
|
13
|
+
interface HeaderProps extends BlockProps {
|
|
14
|
+
toggle: any;
|
|
15
|
+
collapsed: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface HeaderState {
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class Header extends React.PureComponent<HeaderProps, HeaderState> {
|
|
23
|
+
|
|
24
|
+
toggle = () => {
|
|
25
|
+
this.props.toggle();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
render() {
|
|
29
|
+
|
|
30
|
+
let {collapsed}=this.props;
|
|
31
|
+
return (
|
|
32
|
+
<AntdHeader style={{ padding: 0 , height: 'auto'}}>
|
|
33
|
+
<Row className="header-top" wrap={false}>
|
|
34
|
+
<Col span={20} className="header-col" >
|
|
35
|
+
<div style={{float: 'left'}}>
|
|
36
|
+
{React.createElement(collapsed ? MenuUnfoldOutlined : MenuFoldOutlined, {
|
|
37
|
+
className: 'trigger',
|
|
38
|
+
onClick: this.toggle,
|
|
39
|
+
})}
|
|
40
|
+
</div>
|
|
41
|
+
<Block {...this.props} />
|
|
42
|
+
</Col>
|
|
43
|
+
<Col span={1} style={{width: '100%'}}>
|
|
44
|
+
<L2MenuQuickBar></L2MenuQuickBar>
|
|
45
|
+
</Col>
|
|
46
|
+
<Col span={1} style={{width: '100%'}}>
|
|
47
|
+
<L2MenuMessageBar></L2MenuMessageBar>
|
|
48
|
+
</Col>
|
|
49
|
+
<Col span={2}>
|
|
50
|
+
<UserBar></UserBar>
|
|
51
|
+
</Col>
|
|
52
|
+
</Row>
|
|
53
|
+
</AntdHeader>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default Header
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Badge, Col, Dropdown, Menu, Row} from 'antd';
|
|
3
|
+
import {BlockMenu} from "../../tmpl/interface";
|
|
4
|
+
import {NavLink, withRouter} from 'react-router-dom';
|
|
5
|
+
import {
|
|
6
|
+
AppstoreTwoTone,
|
|
7
|
+
FormOutlined,
|
|
8
|
+
LogoutOutlined,
|
|
9
|
+
MenuFoldOutlined,
|
|
10
|
+
MenuUnfoldOutlined,
|
|
11
|
+
MessageTwoTone,
|
|
12
|
+
UserOutlined
|
|
13
|
+
} from '@ant-design/icons';
|
|
14
|
+
import MenuRender from './menu-render';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export interface BlockProps{
|
|
18
|
+
blocks:BlockMenu[];
|
|
19
|
+
currentBlockId?:string;
|
|
20
|
+
currentL2MenuId?:string;
|
|
21
|
+
}
|
|
22
|
+
interface BlockState{
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class Block extends React.PureComponent<BlockProps, BlockState> {
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
constructor(props) {
|
|
30
|
+
super(props);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
renderBlockMenu = (blockMenu:BlockMenu)=>{
|
|
34
|
+
return <Menu>
|
|
35
|
+
{MenuRender.renderL1Menu(blockMenu.l1Menus,null)}
|
|
36
|
+
</Menu>
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
findBlockId = (blocks:BlockMenu[],currentL2MenuId:string) => {
|
|
42
|
+
let blockId:string=undefined;
|
|
43
|
+
for(const block of blocks){
|
|
44
|
+
for(const menul1 of block.l1Menus){
|
|
45
|
+
for(const menul2 of menul1.l2Menus){
|
|
46
|
+
if(menul2.id===currentL2MenuId){
|
|
47
|
+
blockId=block.id;
|
|
48
|
+
return blockId;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return blockId;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
render(){
|
|
57
|
+
const {currentBlockId,blocks,currentL2MenuId}=this.props;
|
|
58
|
+
if(!blocks || blocks.length<1){
|
|
59
|
+
return <></>;
|
|
60
|
+
}
|
|
61
|
+
let blockId=currentBlockId;
|
|
62
|
+
if(currentL2MenuId && !blockId){
|
|
63
|
+
blockId=this.findBlockId(blocks,currentL2MenuId);
|
|
64
|
+
}
|
|
65
|
+
if(!blockId){
|
|
66
|
+
blockId=blocks.at(0).id;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
blocks.map((item, index) => {
|
|
71
|
+
return <div key={index}
|
|
72
|
+
className={`${item.id == blockId ? "active" : ""} header-block`}>
|
|
73
|
+
<Dropdown overlay={this.renderBlockMenu(item)}>
|
|
74
|
+
<a className="dropdown-link"
|
|
75
|
+
// href={`#/home?blockId=${item.id}`}
|
|
76
|
+
rel="noopener noreferrer"
|
|
77
|
+
>
|
|
78
|
+
{item.title}
|
|
79
|
+
</a>
|
|
80
|
+
</Dropdown>
|
|
81
|
+
</div>
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default withRouter(Block);
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Badge, Avatar, Dropdown, Menu} from 'antd'
|
|
3
|
+
import {MessageTwoTone,BellOutlined} from '@ant-design/icons';
|
|
4
|
+
import 'antd/dist/antd.css';
|
|
5
|
+
import {Level2Menu} from "../../tmpl/interface";
|
|
6
|
+
import HcserviceV3 from '../../tmpl/hcservice-v3'
|
|
7
|
+
import {NavLink} from 'react-router-dom';
|
|
8
|
+
import HCDataSource from './../../tmpl/hc-data-source'
|
|
9
|
+
import Units from "../../units";
|
|
10
|
+
interface L2MenuMessageBarProps {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface MessageBar {
|
|
15
|
+
l2Menu: Level2Menu;
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface L2MenuMessageBarState {
|
|
20
|
+
messageBars: MessageBar[];
|
|
21
|
+
anyState:boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class L2MenuMessageBar extends React.PureComponent<L2MenuMessageBarProps, L2MenuMessageBarState> {
|
|
26
|
+
state={
|
|
27
|
+
messageBars:undefined,
|
|
28
|
+
anyState:false,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async componentDidMount() {
|
|
32
|
+
let l2Menus = await HCDataSource.messageMenus();
|
|
33
|
+
const messageBars:MessageBar[]= [];
|
|
34
|
+
for (const item of l2Menus) {
|
|
35
|
+
const messageBar:MessageBar={
|
|
36
|
+
l2Menu:item,
|
|
37
|
+
count:0,
|
|
38
|
+
};
|
|
39
|
+
let that=this;
|
|
40
|
+
setInterval(async () => {
|
|
41
|
+
let count = await HcserviceV3.requestLtmplCount(item.id);
|
|
42
|
+
messageBar.count = count;
|
|
43
|
+
this.setState({
|
|
44
|
+
anyState:!this.state.anyState,
|
|
45
|
+
});
|
|
46
|
+
}, 180000);
|
|
47
|
+
let count = await HcserviceV3.requestLtmplCount(item.id);
|
|
48
|
+
messageBar.count=count;
|
|
49
|
+
messageBars.push(messageBar);
|
|
50
|
+
}
|
|
51
|
+
this.setState({
|
|
52
|
+
messageBars,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
renderMessageBar = (messageBars: MessageBar[]) => {
|
|
58
|
+
|
|
59
|
+
let total:number=0;
|
|
60
|
+
|
|
61
|
+
const menu = (
|
|
62
|
+
<Menu key={1}>
|
|
63
|
+
{ messageBars.map((messageBar, index) => {
|
|
64
|
+
if(messageBar.count){
|
|
65
|
+
total=total+messageBar.count;
|
|
66
|
+
}
|
|
67
|
+
let defaultCriteriaData="";
|
|
68
|
+
if(messageBar.l2Menu.defaultCriteriaValue){
|
|
69
|
+
defaultCriteriaData='&'+ Units.transQueryParamsToStr(messageBar.l2Menu.defaultCriteriaValue);
|
|
70
|
+
}
|
|
71
|
+
return <Menu.Item key={index}>
|
|
72
|
+
<NavLink to={`/${messageBar.l2Menu.id}/act-table?menuId=${messageBar.l2Menu.id}${defaultCriteriaData}`} >
|
|
73
|
+
{messageBar.l2Menu.title}<Badge count={messageBar.count} overflowCount={99} offset={[2, -2]} size="small" /></NavLink>
|
|
74
|
+
</Menu.Item>
|
|
75
|
+
})}
|
|
76
|
+
</Menu>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
if(!messageBars || messageBars.length==0){
|
|
80
|
+
return;
|
|
81
|
+
}else if(messageBars.length==1){
|
|
82
|
+
let messageBar=messageBars[0];
|
|
83
|
+
const l2Menu = messageBar.l2Menu;
|
|
84
|
+
let defaultCriteriaData="";
|
|
85
|
+
if(l2Menu.defaultCriteriaValue){
|
|
86
|
+
defaultCriteriaData='&'+ Units.transQueryParamsToStr(l2Menu.defaultCriteriaValue);
|
|
87
|
+
}
|
|
88
|
+
return (<div className={'message-bar'} >
|
|
89
|
+
<a href={l2Menu.customPath ? `/page-${l2Menu.id}${l2Menu.customPath}?menuId=${l2Menu.id}` : `#/${l2Menu.id}/act-table?menuId=${l2Menu.id}${defaultCriteriaData}`}
|
|
90
|
+
className="head-example" >
|
|
91
|
+
<Badge count={messageBar.count} overflowCount={99} offset={[8, -2]}>
|
|
92
|
+
<span style={{ fontSize: '20px', color: '#08c' }} ><BellOutlined /></span>
|
|
93
|
+
</Badge>
|
|
94
|
+
</a>
|
|
95
|
+
</div>)
|
|
96
|
+
}else{
|
|
97
|
+
return <Dropdown overlay={menu} placement="bottomCenter" >
|
|
98
|
+
<div className={'message-bar'} >
|
|
99
|
+
<Badge count={total} overflowCount={99} offset={[8, -2]}>
|
|
100
|
+
<span style={{ fontSize: '20px', color: '#08c' }} ><BellOutlined /></span>
|
|
101
|
+
</Badge>
|
|
102
|
+
</div>
|
|
103
|
+
</Dropdown>
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
render() {
|
|
109
|
+
const {messageBars} = this.state;
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
{messageBars?this.renderMessageBar(messageBars):""}
|
|
113
|
+
</>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default L2MenuMessageBar;
|