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,308 @@
|
|
|
1
|
+
export type ViewOrEdit = 'view' | 'edit' ;
|
|
2
|
+
|
|
3
|
+
export type AddOrUpdate = 'add' | 'update'| 'copy' ;
|
|
4
|
+
|
|
5
|
+
export type SourceName = 'menu' | 'ratmpl' | 'user' | 'rfield' | 'field-group' | 'rcriteria' ;
|
|
6
|
+
|
|
7
|
+
export type ConfigName = 'statViewConfig' | 'ltmplConfig';
|
|
8
|
+
|
|
9
|
+
export type BeforeExeConfirm = 'default' | 'danger' | 'none' ;
|
|
10
|
+
|
|
11
|
+
export type StatColType = 'fact' | 'dimension';
|
|
12
|
+
|
|
13
|
+
export type ActTableViewModel = 'table' | 'verticalList' | 'horizontalList';
|
|
14
|
+
|
|
15
|
+
export type ControlHolderType= 'table' | 'descriptions'
|
|
16
|
+
|
|
17
|
+
export interface TmplBase {
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface OrderableTmplBase extends TmplBase {
|
|
23
|
+
order?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface FieldBase extends OrderableTmplBase {
|
|
27
|
+
colNum?: number;
|
|
28
|
+
mstrucId?: string;
|
|
29
|
+
defaultValue?: string;
|
|
30
|
+
tip?: string;
|
|
31
|
+
controlType?: string;
|
|
32
|
+
extControlType?: string;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
comparator?:Comparator;
|
|
35
|
+
}
|
|
36
|
+
export interface CQueryConfig extends OrderableTmplBase {
|
|
37
|
+
path?:string,
|
|
38
|
+
mainCodeColId?:string,
|
|
39
|
+
type?:string,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export interface ActionConfig extends OrderableTmplBase {
|
|
44
|
+
multible: boolean,
|
|
45
|
+
beforeExeConfirm:string,
|
|
46
|
+
preposes:FieldConfig[],
|
|
47
|
+
writes:FieldConfig[],
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface JumpConfig extends OrderableTmplBase {
|
|
51
|
+
multible: boolean
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface Level2Menu extends MenuBase {
|
|
55
|
+
customPath?: string;
|
|
56
|
+
displayTotal?: boolean;
|
|
57
|
+
count?:number;
|
|
58
|
+
defaultCriteriaValue?:object
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface Level1Menu extends MenuBase {
|
|
62
|
+
l2Menus: Level2Menu[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface MenuBase extends OrderableTmplBase {
|
|
66
|
+
tip: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface BlockMenu extends MenuBase {
|
|
70
|
+
l1Menus: Level1Menu[]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface CriteriaConfig extends FieldConfig {
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ColumnConfig extends FieldConfig {
|
|
78
|
+
statColType?: StatColType;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type FieldGroupType = 'relation' | 'fieldGroup' ;
|
|
82
|
+
|
|
83
|
+
export type ButtonName = 'rowAdd' | 'rowEdit' | 'delete' | 'selectAdd' | 'dtmplAdd' | 'dtmplEdit' | 'copy'|
|
|
84
|
+
'exportDtmplExcel' | 'importDtmplExcel' | 'fusionMode' | 'history' | 'dtmplSave' | 'query' |
|
|
85
|
+
'detail' | 'exportLtmplExcel' | 'importLtmplExcel' | 'showChart'
|
|
86
|
+
| 'statRefresh' | 'ltmplRefresh' | 'dtmplRefresh' | 'analysis' | 'ltmplSelectAdd' | 'reStat' | 'drilling';
|
|
87
|
+
|
|
88
|
+
export type ChartType = 'line' | 'pie' | 'column';
|
|
89
|
+
export type GroupDisplayConfig = 'nonDataNonDisplayed' | 'displayed' | 'folded' |'unfold' | 'listview' | 'tableview';
|
|
90
|
+
export interface FieldGroupConfig extends OrderableTmplBase {
|
|
91
|
+
// relation tableAttr fieldGroup
|
|
92
|
+
type: FieldGroupType;
|
|
93
|
+
//rowAdd rowEdit detail delete selectAdd dtmplAdd dtmplEdit
|
|
94
|
+
buttons: ButtonName[];
|
|
95
|
+
min: number;
|
|
96
|
+
max: number;
|
|
97
|
+
showRowNum?: boolean;
|
|
98
|
+
relationNames?: string[];
|
|
99
|
+
showRelationName?: boolean;
|
|
100
|
+
fields: FieldConfig[];
|
|
101
|
+
rowActions:ActionConfig[];
|
|
102
|
+
displayConfig:GroupDisplayConfig;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type SaveJumpType = 'list' | 'add' | 'edit';
|
|
106
|
+
|
|
107
|
+
export interface DtmplConfig extends TmplBase {
|
|
108
|
+
authSaveInterval: number;
|
|
109
|
+
//exportExcel fusionMode history dtmplSave refresh
|
|
110
|
+
buttons: ButtonName[];
|
|
111
|
+
// list add edit
|
|
112
|
+
saveJumpTo: SaveJumpType[];
|
|
113
|
+
cQuerys:CQueryConfig[];
|
|
114
|
+
editAction:ActionConfig;
|
|
115
|
+
actions: ActionConfig[];
|
|
116
|
+
premises: FieldConfig[];
|
|
117
|
+
groups: FieldGroupConfig[];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type Comparator = 'equal' | 'unequal' | 'includeOne' | 'exclude' | 'noLess' | 'noGreater';
|
|
121
|
+
|
|
122
|
+
export interface FieldConfig extends FieldBase {
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
max?: number;
|
|
125
|
+
min?: number;
|
|
126
|
+
buttons?: ButtonName[];
|
|
127
|
+
rules?: FileRule[];
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface FileRule {
|
|
132
|
+
pattern: string;
|
|
133
|
+
message: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface SelectConfig extends TmplBase {
|
|
137
|
+
defaultPageSize: number;
|
|
138
|
+
// query
|
|
139
|
+
buttons: ButtonName[];
|
|
140
|
+
columns: ColumnConfig[];
|
|
141
|
+
criterias: CriteriaConfig[];
|
|
142
|
+
defaultCriteriaValue?:object;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface RActionConfig extends OrderableTmplBase {
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
export interface LtmplConfigRes {
|
|
151
|
+
// configName: ConfigName;
|
|
152
|
+
sourceId: string;
|
|
153
|
+
// statViewConfig?:StatViewConfig;
|
|
154
|
+
ltmplConfig?: LtmplConfig;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// export interface StatViewConfig extends SelectConfig {
|
|
158
|
+
//
|
|
159
|
+
// // reStat query analysis
|
|
160
|
+
//
|
|
161
|
+
// }
|
|
162
|
+
|
|
163
|
+
export interface LtmplConfig extends SelectConfig {
|
|
164
|
+
actions?: ActionConfig[];
|
|
165
|
+
rowActions: ActionConfig[];
|
|
166
|
+
ractions?: RActionConfig[];
|
|
167
|
+
jumps?: JumpConfig[];
|
|
168
|
+
cQuerys?:CQueryConfig[];
|
|
169
|
+
rowCQuerys?:CQueryConfig[];
|
|
170
|
+
chartType?: ChartType[];
|
|
171
|
+
reStatParams?: CriteriaConfig[];
|
|
172
|
+
editAction:ActionConfig;
|
|
173
|
+
drillingParams?: CriteriaConfig[];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface EnumItem {
|
|
177
|
+
title: string;
|
|
178
|
+
value: string;
|
|
179
|
+
color: string;
|
|
180
|
+
order:string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export type EditStatus ='new'|'changed'|'persisted'
|
|
184
|
+
|
|
185
|
+
export interface DtmplData {
|
|
186
|
+
code: string;
|
|
187
|
+
editStatus?:EditStatus;
|
|
188
|
+
title?: string;
|
|
189
|
+
relationLabel?: string;
|
|
190
|
+
fieldMap: object;
|
|
191
|
+
arrayMap?: object;//Map<number,DtmplData[]>
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface PageInfo {
|
|
195
|
+
pageNo: number;
|
|
196
|
+
pageSize: number;
|
|
197
|
+
virtualEndPageNo?: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface LtmplData {
|
|
201
|
+
entities: DtmplData[];
|
|
202
|
+
pageInfo: PageInfo;
|
|
203
|
+
queryKey: string;
|
|
204
|
+
isEndList: boolean;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface UserInfo {
|
|
208
|
+
id: string;
|
|
209
|
+
name: string;
|
|
210
|
+
nickName?: string;
|
|
211
|
+
roles?:string[];
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface QueryKey {
|
|
215
|
+
key: string;
|
|
216
|
+
criteriaValueMap: object;
|
|
217
|
+
hiddenColIds: number[];
|
|
218
|
+
sortColIds: number[];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface QueryData {
|
|
222
|
+
entities: DtmplData[];
|
|
223
|
+
touchEnd: boolean;
|
|
224
|
+
key: string;
|
|
225
|
+
pageInfo: PageInfo;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface EControlProps extends ControlBaseProps {
|
|
229
|
+
onChange?: (value: any) => void;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface VEControlProps extends EControlProps {
|
|
233
|
+
viewOrEdit?: ViewOrEdit;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface VControlProps extends ControlBaseProps {
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface ControlBaseProps {
|
|
240
|
+
id?:any;
|
|
241
|
+
value?: any;
|
|
242
|
+
fieldConfig: FieldConfig;
|
|
243
|
+
itemType?: string;
|
|
244
|
+
style?: object;
|
|
245
|
+
disabled?: boolean;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface SelectedRow {
|
|
249
|
+
code: string;
|
|
250
|
+
title: string | string[];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface RouterCompProps {
|
|
254
|
+
match?: any;
|
|
255
|
+
history?: any;
|
|
256
|
+
location?: any;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface TmplBaseProps {
|
|
260
|
+
sourceId: string,
|
|
261
|
+
mainCode?: string,
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export interface DtmplBaseProps extends TmplBaseProps {
|
|
265
|
+
showConfirm?: boolean,
|
|
266
|
+
code?: string,
|
|
267
|
+
defaultDtmplData?:DtmplData,
|
|
268
|
+
showRightNav?: boolean,
|
|
269
|
+
rightBarPositionRight?: number,
|
|
270
|
+
serialNumber?: number,
|
|
271
|
+
goDtmpl?: (code?:string) => void,
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export interface ChartConfig {
|
|
275
|
+
xAxisTitle: string,
|
|
276
|
+
yAxisTitle: string,
|
|
277
|
+
xField: string,
|
|
278
|
+
yField: string
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface SubChartProps {
|
|
282
|
+
data: [],
|
|
283
|
+
config: ChartConfig,
|
|
284
|
+
groupName?: string,
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export type FileValueValid = true | 'new' | 'delete';
|
|
288
|
+
|
|
289
|
+
export interface FileLoadInfo {
|
|
290
|
+
path: string,
|
|
291
|
+
fileName: string,
|
|
292
|
+
size?: string,
|
|
293
|
+
type?: string,
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export interface FileValue {
|
|
297
|
+
valid: FileValueValid,
|
|
298
|
+
fileKey?: string,
|
|
299
|
+
fileName?: string,
|
|
300
|
+
suffix?:string,
|
|
301
|
+
body?: [],
|
|
302
|
+
icon?: FileLoadInfo,
|
|
303
|
+
thn?: FileLoadInfo,
|
|
304
|
+
base?: FileLoadInfo,
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import superagent from 'superagent'
|
|
2
|
+
import { message } from 'antd';
|
|
3
|
+
import Units from '../units';
|
|
4
|
+
|
|
5
|
+
export default class Superagent{
|
|
6
|
+
static super(options,type,load){
|
|
7
|
+
const hydrocarbonToken=Units.getLocalStorge("hydrocarbonToken")?Units.getLocalStorge("hydrocarbonToken")
|
|
8
|
+
:options.header && options.header.hydrocarbonToken?
|
|
9
|
+
options.header.hydrocarbonToken:null;
|
|
10
|
+
let loading;
|
|
11
|
+
if(options.data && options.data.isShowLoading!==false){
|
|
12
|
+
loading=document.getElementById('ajaxLoading')
|
|
13
|
+
loading.style.display=load?load:"block"
|
|
14
|
+
}
|
|
15
|
+
let ty="form"
|
|
16
|
+
if(type==="formdata"){
|
|
17
|
+
ty=null
|
|
18
|
+
}else if(type==="json"){
|
|
19
|
+
ty="application/json"
|
|
20
|
+
}
|
|
21
|
+
let method=options.method?options.method:"POST";
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
return new Promise((resolve,reject)=>{
|
|
26
|
+
superagent(method,Units.joinPath(Units.api(),options.url))
|
|
27
|
+
.type(ty)
|
|
28
|
+
.set("hydrocarbon-token",hydrocarbonToken)
|
|
29
|
+
.set("program-token",hydrocarbonToken)
|
|
30
|
+
.query(options.query||'')
|
|
31
|
+
.send(options.data)
|
|
32
|
+
.end((req,res)=>{
|
|
33
|
+
if(options.data && options.data.isShowLoading!==false){
|
|
34
|
+
loading=document.getElementById('ajaxLoading')
|
|
35
|
+
loading.style.display="none"
|
|
36
|
+
}
|
|
37
|
+
if(res.status===200){
|
|
38
|
+
Units.setLocalStorge("hydrocarbonToken",hydrocarbonToken)
|
|
39
|
+
let result = res.body;
|
|
40
|
+
if(result && result.status === 'error'){
|
|
41
|
+
message.error("错误消息:"+result.message)
|
|
42
|
+
}
|
|
43
|
+
resolve(result)
|
|
44
|
+
} if(res.status===201){
|
|
45
|
+
Units.setLocalStorge("hydrocarbonToken",hydrocarbonToken)
|
|
46
|
+
resolve(res)
|
|
47
|
+
}
|
|
48
|
+
else if(res.status===403){
|
|
49
|
+
//message.info("请求权限不足,可能是token已经超时")
|
|
50
|
+
window.location.hash="/login";
|
|
51
|
+
}else if(res.status===404||res.status===504){
|
|
52
|
+
message.info("服务器连接失败!")
|
|
53
|
+
}else if(res.status===500){
|
|
54
|
+
message.info("后台处理错误。")
|
|
55
|
+
}else{
|
|
56
|
+
reject(res.body)
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
static get(options){
|
|
62
|
+
return new Promise((resolve,reject)=>{
|
|
63
|
+
superagent
|
|
64
|
+
.get(Units.joinPath(Units.api(),options.url))
|
|
65
|
+
.query(options.query||'')
|
|
66
|
+
.end((req,res)=>{
|
|
67
|
+
if(res.status===200){
|
|
68
|
+
resolve(res.body)
|
|
69
|
+
}else if(res.status===403){
|
|
70
|
+
//message.info("请求权限不足,可能是token已经超时")
|
|
71
|
+
window.location.hash = "#/login";
|
|
72
|
+
}else if(res.status===404||res.status === 504){
|
|
73
|
+
message.info("服务器连接失败!")
|
|
74
|
+
}else if(res.status===500){
|
|
75
|
+
message.info("后台处理错误。")
|
|
76
|
+
}else{
|
|
77
|
+
reject(res.body)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
static getHeaderObj(){
|
|
83
|
+
return {
|
|
84
|
+
'hydrocarbon-token':Units.getLocalStorge("hydrocarbonToken"),
|
|
85
|
+
'program-token':Units.getLocalStorge("hydrocarbonToken")
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import moment, {DurationInputArg2} from "moment";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function TmplConfigAnalysis() {
|
|
5
|
+
|
|
6
|
+
}
|
|
7
|
+
TmplConfigAnalysis.current = function ( currentConfig: string,format_1?:string) {
|
|
8
|
+
let format=format_1;
|
|
9
|
+
if(!format){
|
|
10
|
+
format='YYYY-MM-DD HH:mm:ss SSS';
|
|
11
|
+
}
|
|
12
|
+
if(!currentConfig){
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
let configs=[currentConfig];
|
|
16
|
+
if(currentConfig.includes("~")){
|
|
17
|
+
configs=currentConfig.split("~");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let values:string[]=[];
|
|
21
|
+
for(let i in configs){
|
|
22
|
+
let v= this.currentL1(configs[i],format);
|
|
23
|
+
if(v){
|
|
24
|
+
values[i]=v;
|
|
25
|
+
}else{
|
|
26
|
+
values[i]="";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if(configs.length==1){
|
|
30
|
+
return values[0];
|
|
31
|
+
}else{
|
|
32
|
+
return values[0]+"~"+values[1];
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
TmplConfigAnalysis.currentL1 = function ( config: string,format:string) {
|
|
37
|
+
if(!config){
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//解析模式 className={'course-box-80'}:(-/+)NX,$$current为固定模式
|
|
42
|
+
// regx2=new RegExp("(\$\$current):?([-,+]?)(\d?)([D,M,Y,m,s,h]?)");
|
|
43
|
+
var regx2=new RegExp("current:?([-,+]?)([0-9]*)([D,M,Y,m,s,h]?)");
|
|
44
|
+
// regx2=new RegExp("current");
|
|
45
|
+
|
|
46
|
+
let match= regx2.exec(config);
|
|
47
|
+
if(match){
|
|
48
|
+
let unit=match[3];
|
|
49
|
+
//没有单位
|
|
50
|
+
if(unit==""){
|
|
51
|
+
return moment().format(format);
|
|
52
|
+
}else{
|
|
53
|
+
//系数
|
|
54
|
+
let symbol=match[1];
|
|
55
|
+
if(symbol==""){
|
|
56
|
+
symbol="+";
|
|
57
|
+
}
|
|
58
|
+
let nstr=match[2];
|
|
59
|
+
if(nstr==""){
|
|
60
|
+
nstr="1";
|
|
61
|
+
}
|
|
62
|
+
let n:number=parseInt(nstr);
|
|
63
|
+
let momentUnit:DurationInputArg2="days";
|
|
64
|
+
|
|
65
|
+
switch (unit) {
|
|
66
|
+
case "D":
|
|
67
|
+
momentUnit="days";
|
|
68
|
+
break;
|
|
69
|
+
case "M":
|
|
70
|
+
momentUnit="months";
|
|
71
|
+
break;
|
|
72
|
+
case "Y":
|
|
73
|
+
momentUnit="years";
|
|
74
|
+
break;
|
|
75
|
+
case "W":
|
|
76
|
+
momentUnit="weeks";
|
|
77
|
+
break;
|
|
78
|
+
case "h":
|
|
79
|
+
momentUnit="hours";
|
|
80
|
+
break;
|
|
81
|
+
case "m":
|
|
82
|
+
momentUnit="minutes";
|
|
83
|
+
break;
|
|
84
|
+
case "s":
|
|
85
|
+
momentUnit="seconds";
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
if(symbol=="-"){
|
|
89
|
+
//console.log("moment().subtract(n,momentUnit)",moment().subtract(n,momentUnit));
|
|
90
|
+
return moment().subtract(n,momentUnit).format(format);
|
|
91
|
+
}else{
|
|
92
|
+
//console.log("moment().add(n,momentUnit)",moment().add(n,momentUnit));
|
|
93
|
+
return moment().add(n,momentUnit).format(format);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}else{
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// console.log("$$current",regx2.exec("current"));
|
|
101
|
+
// console.log("$$current:",regx2.exec("$$current:"));
|
|
102
|
+
// console.log("$$current:-",regx2.exec("$$current:-"));
|
|
103
|
+
// console.log("$$current:-D",regx2.exec("$$current:-D"));
|
|
104
|
+
// console.log("$$current:h",regx2.exec("$$current:h"));
|
|
105
|
+
// console.log("$$current:2h",regx2.exec("$$current:2h"));
|
|
106
|
+
// console.log("$$current:+12h",regx2.exec("$$current:+12h"));
|
|
107
|
+
// console.log("$$current:-9h",regx2.exec("$$current:-9h"));
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
export default TmplConfigAnalysis;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import CryptoJS from 'crypto-js'
|
|
3
|
+
import JSEncrypt from 'jsencrypt';
|
|
4
|
+
|
|
5
|
+
export default class EncryptUtils {
|
|
6
|
+
//加密
|
|
7
|
+
static aesEncrypt(word, keyStr){
|
|
8
|
+
keyStr = keyStr ? keyStr : 'kuangkie';
|
|
9
|
+
var key = CryptoJS.enc.Utf8.parse(keyStr);//Latin1 w8m31+Yy/Nw6thPsMpO5fg==
|
|
10
|
+
var srcs = CryptoJS.enc.Utf8.parse(word);
|
|
11
|
+
var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
|
|
12
|
+
return encrypted.toString();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//解密
|
|
16
|
+
static aesDecrypt(word, keyStr){
|
|
17
|
+
let keys = keyStr ? keyStr : 'kuangkie';
|
|
18
|
+
var key = CryptoJS.enc.Utf8.parse(keys);//Latin1 w8m31+Yy/Nw6thPsMpO5fg==
|
|
19
|
+
var decrypt = CryptoJS.AES.decrypt(word, key, {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7});
|
|
20
|
+
return CryptoJS.enc.Utf8.stringify(decrypt).toString();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static rsaEncrypt (word, keyStr) {
|
|
24
|
+
const encrypt = new JSEncrypt();
|
|
25
|
+
encrypt.setPublicKey(keyStr);
|
|
26
|
+
return encrypt.encrypt(word);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static rsaDecrypt(word, keyStr){
|
|
30
|
+
const encrypt = new JSEncrypt();
|
|
31
|
+
encrypt.setPrivateKey(keyStr);
|
|
32
|
+
return encrypt.decrypt(word);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|