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,536 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {message, Radio, Select} from 'antd'
|
|
3
|
+
import ProgramConfig from '../../../public/programConfig.json'
|
|
4
|
+
import Axios from "axios";
|
|
5
|
+
import Logo from "./logo.png";
|
|
6
|
+
import {EnumItem} from "../tmpl/interface";
|
|
7
|
+
import HCDataSource from "../tmpl/hc-data-source";
|
|
8
|
+
import moment from "moment";
|
|
9
|
+
import TmplConfigAnalysis from "../tmpl/tmpl-config-analysis";
|
|
10
|
+
|
|
11
|
+
const Option = Select.Option;
|
|
12
|
+
|
|
13
|
+
const api = ProgramConfig.hydrocarbonServer;
|
|
14
|
+
const programCode=ProgramConfig.programCode;
|
|
15
|
+
const programName = ProgramConfig.programName;
|
|
16
|
+
const programName_sub = ProgramConfig.programName_sub;
|
|
17
|
+
const programName_NavLeft = ProgramConfig.programName_NavLeft;
|
|
18
|
+
let storageKeyPrefix = undefined;
|
|
19
|
+
|
|
20
|
+
//加载本地配置
|
|
21
|
+
Axios.create().get('programConfig.json').then((result) => {
|
|
22
|
+
window.localStorage['programName'] = result.data.programName
|
|
23
|
+
window.localStorage['hydrocarbonServer'] = result.data.hydrocarbonServer
|
|
24
|
+
window.localStorage['programName_NavLeft'] = result.data.programName_NavLeft
|
|
25
|
+
window.localStorage['programName_sub'] = result.data.programName_sub
|
|
26
|
+
window.localStorage['programName_Logo'] = result.data.programName_Logo
|
|
27
|
+
window.localStorage['programCode'] = result.data.programCode
|
|
28
|
+
}).catch((error) => {
|
|
29
|
+
console.log(error)
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
api() {
|
|
34
|
+
return window.localStorage['hydrocarbonServer'] ? window.localStorage['hydrocarbonServer'] : api
|
|
35
|
+
},
|
|
36
|
+
programCode(){
|
|
37
|
+
return window.localStorage['programCode'] ? window.localStorage['programCode'] : programCode
|
|
38
|
+
},
|
|
39
|
+
programName() {
|
|
40
|
+
return window.localStorage['programName'] ? window.localStorage['programName'] : programName
|
|
41
|
+
},
|
|
42
|
+
programName_sub() {
|
|
43
|
+
return window.localStorage['programName_sub'] ? window.localStorage['programName_sub'] : programName_sub
|
|
44
|
+
},
|
|
45
|
+
programName_NavLeft() {
|
|
46
|
+
return window.localStorage['programName_NavLeft'] ? window.localStorage['programName_NavLeft'] : programName_NavLeft
|
|
47
|
+
},
|
|
48
|
+
programName_Logo() {
|
|
49
|
+
return window.localStorage['programName_Logo'] ? window.localStorage['programName_Logo'] : Logo
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
formateDate(time) {
|
|
53
|
+
if (!time) return '';
|
|
54
|
+
return moment(new Date(time)).format("YYYY-MM-DD HH:mm:ss");
|
|
55
|
+
//let str=date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
56
|
+
// return str;
|
|
57
|
+
},
|
|
58
|
+
dateToString(date) { //日期转字符串
|
|
59
|
+
console.log(date)
|
|
60
|
+
let year = date.getFullYear();
|
|
61
|
+
let month = (date.getMonth() + 1).toString();
|
|
62
|
+
let day = (date.getDate()).toString();
|
|
63
|
+
if (month.length === 1) {
|
|
64
|
+
month = "0" + month;
|
|
65
|
+
}
|
|
66
|
+
if (day.length === 1) {
|
|
67
|
+
day = "0" + day;
|
|
68
|
+
}
|
|
69
|
+
const dateTime = year + "-" + month + "-" + day;
|
|
70
|
+
return dateTime;
|
|
71
|
+
},
|
|
72
|
+
pagination(data, callback) {
|
|
73
|
+
const page = {
|
|
74
|
+
onchange: (current) => {
|
|
75
|
+
callback(current)
|
|
76
|
+
},
|
|
77
|
+
current: data.pageInfo.pageNo,
|
|
78
|
+
pageSize: data.pageInfo.pageSize,
|
|
79
|
+
total: data.pageInfo.count,
|
|
80
|
+
showTotal: () => {
|
|
81
|
+
return `共${data.pageInfo.count}条`
|
|
82
|
+
},
|
|
83
|
+
showQuickIumper: true
|
|
84
|
+
}
|
|
85
|
+
return page
|
|
86
|
+
},
|
|
87
|
+
getRadioList(data) {
|
|
88
|
+
if (!data) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const options = []
|
|
92
|
+
data.map((item) => {
|
|
93
|
+
options.push(<Radio value={item.id} key={item.id}>{item.name}</Radio>)
|
|
94
|
+
return false
|
|
95
|
+
})
|
|
96
|
+
return options
|
|
97
|
+
},
|
|
98
|
+
downloadFile_(url) {
|
|
99
|
+
try {
|
|
100
|
+
let elemIF = document.createElement("iframe");
|
|
101
|
+
//elemIF.src = url;
|
|
102
|
+
elemIF.src = "javascript: '<script>location.href=\"" + url + "\"</script>'"
|
|
103
|
+
elemIF.style.display = "none";
|
|
104
|
+
document.body.appendChild(elemIF);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
message.error(e)
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
openFile(url, fileName) {
|
|
110
|
+
try {
|
|
111
|
+
let a = document.createElement("a");
|
|
112
|
+
a.href = url;
|
|
113
|
+
a.target= "_blank";
|
|
114
|
+
document.body.appendChild(a);
|
|
115
|
+
a.click();
|
|
116
|
+
document.body.removeChild(a);
|
|
117
|
+
} catch (e) {
|
|
118
|
+
message.error(e)
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
downloadFile(url, fileName) {
|
|
122
|
+
try {
|
|
123
|
+
let a = document.createElement("a");
|
|
124
|
+
a.download = fileName;
|
|
125
|
+
a.href = url;
|
|
126
|
+
//a.target= "_blank";
|
|
127
|
+
document.body.appendChild(a);
|
|
128
|
+
a.click();
|
|
129
|
+
document.body.removeChild(a);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
message.error(e)
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
downloadFile_old(url) {
|
|
135
|
+
try {
|
|
136
|
+
let a = document.createElement("form");
|
|
137
|
+
a.action = url;
|
|
138
|
+
//a.target= "_blank";
|
|
139
|
+
document.body.appendChild(a);
|
|
140
|
+
a.submit();
|
|
141
|
+
document.body.removeChild(a);
|
|
142
|
+
} catch (e) {
|
|
143
|
+
message.error(e)
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
//随机数
|
|
147
|
+
getRandomNum(n) {
|
|
148
|
+
let rnd = "";
|
|
149
|
+
for (let i = 0; i < n; i++)
|
|
150
|
+
rnd += Math.floor(Math.random() * 10);
|
|
151
|
+
return rnd;
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* 获得用于在本地持久缓存的数据的Key前缀
|
|
155
|
+
* 当前返回的值是第一次访问当前方法时的所在页面链接的pathname
|
|
156
|
+
* 表示在不同的pathname下,永久缓存的数据将互不干扰
|
|
157
|
+
* @returns {undefined}
|
|
158
|
+
*/
|
|
159
|
+
getStorageKeyPrefix() {
|
|
160
|
+
if (storageKeyPrefix === undefined) {
|
|
161
|
+
storageKeyPrefix = window.location.pathname || '';
|
|
162
|
+
}
|
|
163
|
+
return storageKeyPrefix;
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
getLongTextStyle(value) {
|
|
167
|
+
if (!value) {
|
|
168
|
+
return {}
|
|
169
|
+
}
|
|
170
|
+
let style = {
|
|
171
|
+
minWidth: 'normal',
|
|
172
|
+
maxWidth: '1000px',
|
|
173
|
+
display: 'block',
|
|
174
|
+
textAlign: 'left',
|
|
175
|
+
whiteSpace: 'normal',
|
|
176
|
+
lineHeight: '20px'
|
|
177
|
+
};
|
|
178
|
+
let min_value_length = value.length > 200 ? '350px' : value.length > 150 ? '300px' : value.length > 100 ? '250px' : value.length > 50 ? '200px' : value.length >= 20 ? '160px' : '80px';
|
|
179
|
+
//let min_value_length = value.length > 20 ? '160px' : '80px';
|
|
180
|
+
style.minWidth = min_value_length;
|
|
181
|
+
return style;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
setLocalStorge(key, value, min = 60) {
|
|
185
|
+
if (key) {
|
|
186
|
+
key = this.getStorageKeyPrefix() + key;
|
|
187
|
+
}
|
|
188
|
+
// 设置过期原则
|
|
189
|
+
if (!value) {
|
|
190
|
+
localStorage.removeItem(key)
|
|
191
|
+
} else {
|
|
192
|
+
const Min = min || 60
|
|
193
|
+
const exp = new Date();
|
|
194
|
+
const expireAddTime = Min * 60 * 1000;
|
|
195
|
+
localStorage.setItem(key, JSON.stringify({
|
|
196
|
+
value, expireAddTime,
|
|
197
|
+
expires: exp.getTime() + expireAddTime
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
getLocalStorge(name) {
|
|
202
|
+
if (name) {
|
|
203
|
+
name = this.getStorageKeyPrefix() + name;
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
let o = JSON.parse(localStorage[name])
|
|
207
|
+
if (!o || o.expires < Date.now()) {
|
|
208
|
+
return null
|
|
209
|
+
} else {
|
|
210
|
+
o.expires = Date.now() + o.expireAddTime;
|
|
211
|
+
localStorage.setItem(name, JSON.stringify(o));
|
|
212
|
+
return o.value;
|
|
213
|
+
}
|
|
214
|
+
} catch (e) {
|
|
215
|
+
// 兼容其他localstorage
|
|
216
|
+
return localStorage[name]
|
|
217
|
+
} finally {
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
transQueryParamsToStr(data, isPrefix = false) {
|
|
221
|
+
let prefix = isPrefix ? '?' : '';
|
|
222
|
+
let _result = [];
|
|
223
|
+
|
|
224
|
+
let paramKeys = [];
|
|
225
|
+
//寻找参数
|
|
226
|
+
for (let key in data) {
|
|
227
|
+
let value = data[key]
|
|
228
|
+
// 去掉为空的参数
|
|
229
|
+
if ([undefined, null].includes(value)) {
|
|
230
|
+
value = ""
|
|
231
|
+
continue
|
|
232
|
+
} else {
|
|
233
|
+
paramKeys.push(key);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
//排序
|
|
237
|
+
paramKeys.sort();
|
|
238
|
+
|
|
239
|
+
for (let key of paramKeys) {
|
|
240
|
+
let value = data[key];
|
|
241
|
+
let str = encodeURI(key)
|
|
242
|
+
if (!value) {
|
|
243
|
+
|
|
244
|
+
} else if (value && value.constructor === Array) {
|
|
245
|
+
value.forEach(_value => {
|
|
246
|
+
_result.push(str + '[]=' + encodeURI(_value))
|
|
247
|
+
})
|
|
248
|
+
} else {
|
|
249
|
+
_result.push(str + '=' + encodeURI(value))
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return _result.length ? prefix + _result.join('&') : ''
|
|
253
|
+
},
|
|
254
|
+
transQueryStrToParams(str) {
|
|
255
|
+
let obj = {};
|
|
256
|
+
const arr1 = str.split("?");
|
|
257
|
+
if (arr1 && arr1.length == 2) {
|
|
258
|
+
const arr2 = arr1[1].split("&");
|
|
259
|
+
for (let i = 0; i < arr2.length; i++) {
|
|
260
|
+
if (arr2[i].indexOf("[]=") > 0) {
|
|
261
|
+
const res = arr2[i].split("[]=");
|
|
262
|
+
const name = res[0];
|
|
263
|
+
if (!obj[name]) {
|
|
264
|
+
obj[name] = [];
|
|
265
|
+
}
|
|
266
|
+
obj[name].push(decodeURI(this.configParamTrans(res[1])));
|
|
267
|
+
} else {
|
|
268
|
+
const res = arr2[i].split("=");
|
|
269
|
+
const name = res[0];
|
|
270
|
+
if(name){
|
|
271
|
+
obj[name] = decodeURI(this.configParamTrans(res[1]));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return obj;
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
configParamTrans(value:string){
|
|
280
|
+
if(value && value.startsWith && value.startsWith("$$current")){
|
|
281
|
+
return TmplConfigAnalysis.current(value);
|
|
282
|
+
}
|
|
283
|
+
return value;
|
|
284
|
+
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
uniq(array, gWord) {
|
|
288
|
+
const res = []
|
|
289
|
+
array.map((item) => {
|
|
290
|
+
let flag = true;
|
|
291
|
+
res.map((it) => {
|
|
292
|
+
if (item[gWord] === it[gWord]) {
|
|
293
|
+
flag = false;
|
|
294
|
+
}
|
|
295
|
+
return false
|
|
296
|
+
})
|
|
297
|
+
if (flag) {
|
|
298
|
+
res.push(item);
|
|
299
|
+
}
|
|
300
|
+
return false
|
|
301
|
+
})
|
|
302
|
+
return res
|
|
303
|
+
},
|
|
304
|
+
deepCopy(obj) {
|
|
305
|
+
var result = Array.isArray(obj) ? [] : {};
|
|
306
|
+
for (var key in obj) {
|
|
307
|
+
if (obj.hasOwnProperty(key)) {
|
|
308
|
+
if (typeof obj[key] === 'object') {
|
|
309
|
+
result[key] = this.deepCopy(obj[key]); //递归复制
|
|
310
|
+
} else {
|
|
311
|
+
result[key] = obj[key];
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return result;
|
|
316
|
+
},
|
|
317
|
+
forPic(fieldMap) { //原始数据的图片url转化为图片
|
|
318
|
+
for (let i in fieldMap) {
|
|
319
|
+
if (fieldMap[i] && fieldMap[i].includes("download-files")) {
|
|
320
|
+
const url = this.api() + fieldMap[i]
|
|
321
|
+
fieldMap[i] = <img
|
|
322
|
+
style={{width: 55}}
|
|
323
|
+
src={url}
|
|
324
|
+
alt=""/>
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return fieldMap
|
|
328
|
+
},
|
|
329
|
+
getFileUrl(file) {
|
|
330
|
+
if (!file) {
|
|
331
|
+
return file;
|
|
332
|
+
} else if ((file).constructor === String) {
|
|
333
|
+
return file;
|
|
334
|
+
} else if ((file).constructor === Object) {
|
|
335
|
+
if (file.props.children.props) {
|
|
336
|
+
const {href} = file.props.children.props;
|
|
337
|
+
return href;
|
|
338
|
+
} else if (file.props.owlner) {
|
|
339
|
+
return file.props.owlner;
|
|
340
|
+
} else {
|
|
341
|
+
return file;
|
|
342
|
+
}
|
|
343
|
+
} else {
|
|
344
|
+
return file;
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
|
|
348
|
+
getOptionColor(options: EnumItem[], value) {
|
|
349
|
+
if (!value) {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
let color;
|
|
353
|
+
if (options) {
|
|
354
|
+
options.forEach((option) => {
|
|
355
|
+
if (option.value === value) {
|
|
356
|
+
if (option.color) {
|
|
357
|
+
color = option.color;
|
|
358
|
+
}
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
return color;
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
getFieldItemType(item) {
|
|
367
|
+
return item.extType ? item.extType : item.msExtType ? item.msExtType : item.msType ? item.msType : item.type;
|
|
368
|
+
},
|
|
369
|
+
isEmpty(obj) {
|
|
370
|
+
if (!obj) {
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
for (let key in obj) {
|
|
374
|
+
return false; //非空
|
|
375
|
+
}
|
|
376
|
+
return true;
|
|
377
|
+
}, getMomentFormat(itemType) {
|
|
378
|
+
let format = 'YYYY-MM-DD HH:mm:ss'
|
|
379
|
+
|
|
380
|
+
switch (itemType) {
|
|
381
|
+
case 'daterange-YY':
|
|
382
|
+
case 'date-YY':
|
|
383
|
+
format = 'YYYY';
|
|
384
|
+
break;
|
|
385
|
+
case 'date-M1':
|
|
386
|
+
case 'daterange-M1':
|
|
387
|
+
format = 'YYYY-MM';
|
|
388
|
+
break;
|
|
389
|
+
case 'date':
|
|
390
|
+
case 'daterange':
|
|
391
|
+
format = 'YYYY-MM-DD';
|
|
392
|
+
break;
|
|
393
|
+
case 'datetime-HH':
|
|
394
|
+
case 'datetimerange-HH':
|
|
395
|
+
format = 'YYYY-MM-DD HH';
|
|
396
|
+
break;
|
|
397
|
+
case 'datetime-mm':
|
|
398
|
+
case 'datetimerange-mm':
|
|
399
|
+
format = 'YYYY-MM-DD HH:mm';
|
|
400
|
+
break;
|
|
401
|
+
case 'datetime':
|
|
402
|
+
case 'datetimerange':
|
|
403
|
+
format = 'YYYY-MM-DD HH:mm:ss';
|
|
404
|
+
break;
|
|
405
|
+
case "timestamp":
|
|
406
|
+
format = 'YYYY-MM-DD HH:mm:ss SSS';
|
|
407
|
+
break;
|
|
408
|
+
case 'time-HH':
|
|
409
|
+
case 'timerange-HH':
|
|
410
|
+
format = 'HH';
|
|
411
|
+
break;
|
|
412
|
+
case 'time-mm':
|
|
413
|
+
case 'timerange-mm':
|
|
414
|
+
format = 'HH:mm';
|
|
415
|
+
break;
|
|
416
|
+
case 'time':
|
|
417
|
+
case 'timerange':
|
|
418
|
+
format = 'HH:mm:ss';
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
return format;
|
|
423
|
+
|
|
424
|
+
}, getDateTimeFormat(itemType) {
|
|
425
|
+
let format = '';
|
|
426
|
+
switch (itemType) {
|
|
427
|
+
case 'time-HH':
|
|
428
|
+
case 'timerange-HH':
|
|
429
|
+
case 'datetime-HH':
|
|
430
|
+
case 'datetimerange-HH':
|
|
431
|
+
return 'HH';
|
|
432
|
+
case 'time-mm':
|
|
433
|
+
case 'timerange-mm':
|
|
434
|
+
case 'datetime-mm':
|
|
435
|
+
case 'datetimerange-mm':
|
|
436
|
+
return 'HH:mm';
|
|
437
|
+
case 'timestamp':
|
|
438
|
+
case 'time':
|
|
439
|
+
case 'timerange':
|
|
440
|
+
case 'datetime':
|
|
441
|
+
case 'datetimerange':
|
|
442
|
+
return 'HH:mm:ss';
|
|
443
|
+
default:
|
|
444
|
+
return "";
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return format;
|
|
448
|
+
},
|
|
449
|
+
getSelectOptions(data: EnumItem[]) {
|
|
450
|
+
// debugger
|
|
451
|
+
if (!data) {
|
|
452
|
+
return [];
|
|
453
|
+
}
|
|
454
|
+
const options = []
|
|
455
|
+
data.map((item) => {
|
|
456
|
+
options.push(<Option value={item.value} key={item.title}>{item.title}</Option>)
|
|
457
|
+
return false
|
|
458
|
+
})
|
|
459
|
+
return options
|
|
460
|
+
},
|
|
461
|
+
getSelectListOfStrList(data) {
|
|
462
|
+
// debugger
|
|
463
|
+
if (!data) {
|
|
464
|
+
return [];
|
|
465
|
+
}
|
|
466
|
+
const options = []
|
|
467
|
+
data.map((item) => {
|
|
468
|
+
options.push(<Option value={item} key={item}>{item}</Option>)
|
|
469
|
+
return false
|
|
470
|
+
})
|
|
471
|
+
return options
|
|
472
|
+
},
|
|
473
|
+
getSelectOptionsOfMstrucId(mstrucId: string) {
|
|
474
|
+
return this.getSelectOptions(HCDataSource.getEnums(mstrucId));
|
|
475
|
+
}, concatValue(value1, vaule2) {
|
|
476
|
+
let newValue = undefined;
|
|
477
|
+
if (value1) {
|
|
478
|
+
newValue = value1 + "~"
|
|
479
|
+
} else {
|
|
480
|
+
newValue = "~"
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
if (vaule2) {
|
|
484
|
+
newValue = newValue + vaule2
|
|
485
|
+
}
|
|
486
|
+
return newValue;
|
|
487
|
+
}, splitValue(value) {
|
|
488
|
+
let valueBegin, valueEnd;
|
|
489
|
+
if (value) {
|
|
490
|
+
if (value.toString().indexOf("~") >= 0) {
|
|
491
|
+
let splitValue: string[] = value.split("~");
|
|
492
|
+
valueBegin = splitValue[0] ? splitValue[0] : undefined;
|
|
493
|
+
valueEnd = splitValue[1] ? splitValue[1] : undefined;
|
|
494
|
+
} else {
|
|
495
|
+
valueBegin = value;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
return {valueBegin, valueEnd};
|
|
500
|
+
},str2UTF8(str){
|
|
501
|
+
var bytes = new Array();
|
|
502
|
+
var len,c;
|
|
503
|
+
len = str.length;
|
|
504
|
+
for(var i = 0; i < len; i++){
|
|
505
|
+
c = str.charCodeAt(i);
|
|
506
|
+
if(c >= 0x010000 && c <= 0x10FFFF){
|
|
507
|
+
bytes.push(((c >> 18) & 0x07) | 0xF0);
|
|
508
|
+
bytes.push(((c >> 12) & 0x3F) | 0x80);
|
|
509
|
+
bytes.push(((c >> 6) & 0x3F) | 0x80);
|
|
510
|
+
bytes.push((c & 0x3F) | 0x80);
|
|
511
|
+
}else if(c >= 0x000800 && c <= 0x00FFFF){
|
|
512
|
+
bytes.push(((c >> 12) & 0x0F) | 0xE0);
|
|
513
|
+
bytes.push(((c >> 6) & 0x3F) | 0x80);
|
|
514
|
+
bytes.push((c & 0x3F) | 0x80);
|
|
515
|
+
}else if(c >= 0x000080 && c <= 0x0007FF){
|
|
516
|
+
bytes.push(((c >> 6) & 0x1F) | 0xC0);
|
|
517
|
+
bytes.push((c & 0x3F) | 0x80);
|
|
518
|
+
}else{
|
|
519
|
+
bytes.push(c & 0xFF);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return bytes;
|
|
523
|
+
},
|
|
524
|
+
joinPath(path1,path2){
|
|
525
|
+
let path=path1;
|
|
526
|
+
if(!path.endsWith('/') && !path.endsWith('\\')){
|
|
527
|
+
path=path+"/";
|
|
528
|
+
}
|
|
529
|
+
if(path2.startsWith('/') || path.startsWith('\\')){
|
|
530
|
+
path=path+path2.slice(1);
|
|
531
|
+
}else{
|
|
532
|
+
path=path+path2;
|
|
533
|
+
}
|
|
534
|
+
return path;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
Binary file
|