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,162 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Button, Col, Image, Modal, Popconfirm, Row} from "antd";
|
|
3
|
+
import {VEControlProps} from "../../tmpl/interface";
|
|
4
|
+
import SignatureCanvas from 'react-signature-canvas';
|
|
5
|
+
import {HighlightOutlined} from '@ant-design/icons';
|
|
6
|
+
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
7
|
+
|
|
8
|
+
interface SignatureProps extends VEControlProps {
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface SignatureState {
|
|
13
|
+
modalVisible: boolean,
|
|
14
|
+
molFileLoaded: boolean,
|
|
15
|
+
trimmedDataURL:any,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default class Signature extends React.PureComponent<SignatureProps, SignatureState> {
|
|
19
|
+
|
|
20
|
+
static defaultProps = {
|
|
21
|
+
viewOrEdit: 'view',
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
state = {
|
|
26
|
+
modalVisible: false,
|
|
27
|
+
molFileLoaded: false,
|
|
28
|
+
molFile: undefined,
|
|
29
|
+
trimmedDataURL:undefined,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
componentDidMount() {
|
|
33
|
+
this.loadData();
|
|
34
|
+
}
|
|
35
|
+
signCanvas=undefined;
|
|
36
|
+
|
|
37
|
+
loadData = async () => {
|
|
38
|
+
const {value} = this.props
|
|
39
|
+
if (value) {
|
|
40
|
+
let val = JSON.parse(value);
|
|
41
|
+
let file
|
|
42
|
+
if (val.valid == true) {//此处要优化
|
|
43
|
+
if(/^image\/png;base64/.test(val.base.type)){
|
|
44
|
+
file = await HcserviceV3.loadFileTxt(val.base.path);
|
|
45
|
+
}
|
|
46
|
+
} else if (val.valid == 'new') {
|
|
47
|
+
file = val.body;
|
|
48
|
+
} else {
|
|
49
|
+
file = undefined;
|
|
50
|
+
}
|
|
51
|
+
console.log('file:', file);
|
|
52
|
+
|
|
53
|
+
this.setState({
|
|
54
|
+
trimmedDataURL:file,
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
saveMolfile = async () => {
|
|
60
|
+
let value = this.signCanvas.getTrimmedCanvas().toDataURL('image/png');
|
|
61
|
+
// let val=value.replace(/^data:image\/\w+;base64,/, "");
|
|
62
|
+
// let bytes = window.atob(val);
|
|
63
|
+
// // 处理异常,将ascii码小于0的转换为大于0
|
|
64
|
+
// let ab = new ArrayBuffer(bytes.length);
|
|
65
|
+
// // 生成视图(直接针对内存):8位无符号整数,长度1个字节
|
|
66
|
+
// let ia = new Uint8Array(ab);
|
|
67
|
+
// for (let i = 0; i < bytes.length; i++) {
|
|
68
|
+
// ia[i] = bytes.charCodeAt(i);
|
|
69
|
+
// }
|
|
70
|
+
// let b= new Blob([ia], {
|
|
71
|
+
// type: 'image/png'
|
|
72
|
+
// });
|
|
73
|
+
|
|
74
|
+
console.log('DataURL value:', value);
|
|
75
|
+
// let data = this.signCanvas.toData();
|
|
76
|
+
// console.log('data data:', value);
|
|
77
|
+
this.triggerChange(value);
|
|
78
|
+
this.setState({
|
|
79
|
+
modalVisible: false,
|
|
80
|
+
trimmedDataURL:value,
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
triggerChange = (changedValue) => {
|
|
85
|
+
const {onChange} = this.props
|
|
86
|
+
if (onChange) {
|
|
87
|
+
onChange(JSON.stringify({valid: 'new', body: changedValue,suffix:'image/png;base64',fileName:'signature.png'}));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
showView = async () => {
|
|
93
|
+
this.signCanvas.clear();
|
|
94
|
+
this.signCanvas.fromDataURL(this.state.trimmedDataURL);
|
|
95
|
+
this.setState({
|
|
96
|
+
modalVisible: true
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
onCancel = () => {
|
|
100
|
+
this.setState({
|
|
101
|
+
modalVisible: false,
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
onClear=()=>{
|
|
105
|
+
this.signCanvas.clear();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
render() {
|
|
109
|
+
const {id,disabled, viewOrEdit, value,} = this.props
|
|
110
|
+
const {molFile,trimmedDataURL} = this.state
|
|
111
|
+
return (
|
|
112
|
+
<span id={id}>{trimmedDataURL?<Image
|
|
113
|
+
width={90}
|
|
114
|
+
src={trimmedDataURL}
|
|
115
|
+
preview={{
|
|
116
|
+
src: trimmedDataURL,
|
|
117
|
+
}}
|
|
118
|
+
/>:""}
|
|
119
|
+
{viewOrEdit == 'edit'?
|
|
120
|
+
<Button
|
|
121
|
+
onClick={this.showView}>
|
|
122
|
+
<HighlightOutlined/>编 辑
|
|
123
|
+
</Button>:""
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
<Modal
|
|
127
|
+
closable={false}
|
|
128
|
+
visible={this.state.modalVisible}
|
|
129
|
+
forceRender={true}
|
|
130
|
+
centered
|
|
131
|
+
style={{maxWidth: 'calc(100vw - 62px)', maxHeight: 'calc(100vw - 50px)'}}
|
|
132
|
+
width={900}
|
|
133
|
+
onCancel={() => {
|
|
134
|
+
this.onCancel()
|
|
135
|
+
}}
|
|
136
|
+
footer={disabled ? [<Button key={1} onClick={() => {
|
|
137
|
+
this.onCancel()
|
|
138
|
+
}}>取消</Button>] : [<Button key={1} onClick={() => {
|
|
139
|
+
this.onClear();
|
|
140
|
+
}} >清除</Button>,<Popconfirm key={2} placement="top" title={"确定要取消本次编辑的数据吗?"}
|
|
141
|
+
onConfirm={this.onCancel} okText="确定"
|
|
142
|
+
cancelText="取消"><Button>取消</Button></Popconfirm>,
|
|
143
|
+
<Button key={3} onClick={() => {
|
|
144
|
+
this.saveMolfile();
|
|
145
|
+
}} type='primary'>确定</Button>]}
|
|
146
|
+
bodyStyle={{width: '900px'}}
|
|
147
|
+
>
|
|
148
|
+
<Row style={{
|
|
149
|
+
height: '430px',
|
|
150
|
+
border: '1px solid #00f',
|
|
151
|
+
maxWidth: '860px',
|
|
152
|
+
maxHeight: 'calc(100vw - 80px)'
|
|
153
|
+
}}>
|
|
154
|
+
<Col key={1} span={24} style={{height: '400px'}}>
|
|
155
|
+
<SignatureCanvas ref={( ref ) => { this.signCanvas=ref} } penColor='#000' canvasProps={{ width:860,height:400,className: 'sigCanvas'}} ></SignatureCanvas>
|
|
156
|
+
</Col>
|
|
157
|
+
</Row>
|
|
158
|
+
</Modal>
|
|
159
|
+
</span>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Select, Steps as AntdSteps} from "antd";
|
|
3
|
+
import {VEControlProps} from "../../tmpl/interface";
|
|
4
|
+
import Units from "../../units";
|
|
5
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
6
|
+
|
|
7
|
+
const {Step} = AntdSteps;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
interface StepsProps extends VEControlProps {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const Steps: React.FC<StepsProps> = ({viewOrEdit = 'view', ...props}) => {
|
|
17
|
+
|
|
18
|
+
const {value, itemType, fieldConfig, onChange} = props;
|
|
19
|
+
|
|
20
|
+
let entryControl = undefined;
|
|
21
|
+
|
|
22
|
+
const changeValue = (value) => {
|
|
23
|
+
if (onChange) {
|
|
24
|
+
onChange(value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let enumItems = HCDataSource.getEnums(fieldConfig.mstrucId);
|
|
29
|
+
let currentIndex = undefined;
|
|
30
|
+
for (let i in enumItems) {
|
|
31
|
+
if (value == enumItems[i].value) {
|
|
32
|
+
currentIndex = parseInt(i);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if ((fieldConfig.disabled || viewOrEdit=='view') ) {
|
|
37
|
+
entryControl = <AntdSteps current={currentIndex} size="small">
|
|
38
|
+
{enumItems.map(item => (
|
|
39
|
+
<Step key={item.value} title={item.title}/>
|
|
40
|
+
))}
|
|
41
|
+
</AntdSteps>
|
|
42
|
+
} else {
|
|
43
|
+
entryControl = <Select
|
|
44
|
+
placeholder={`请选择${fieldConfig.title}`}
|
|
45
|
+
notFoundContent="暂无选项"
|
|
46
|
+
allowClear={true}
|
|
47
|
+
showSearch
|
|
48
|
+
value={value}
|
|
49
|
+
onChange={changeValue}
|
|
50
|
+
>
|
|
51
|
+
{Units.getSelectOptions(enumItems)}
|
|
52
|
+
</Select>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return entryControl;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default Steps;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Units from "../../units";
|
|
3
|
+
import {Button, Popover,Card} from "antd";
|
|
4
|
+
|
|
5
|
+
interface EllipsisTextProps {
|
|
6
|
+
isHtml?:boolean;
|
|
7
|
+
value:string;
|
|
8
|
+
showMax?:number;
|
|
9
|
+
maxWidth?:string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface EllipsisTextState {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default class EllipsisText extends React.PureComponent<EllipsisTextProps, EllipsisTextState> {
|
|
16
|
+
|
|
17
|
+
state={
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static defaultProps={
|
|
21
|
+
isHtml:false,
|
|
22
|
+
showMax:20,
|
|
23
|
+
maxWidth:"1024px"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
toString=(value)=>{
|
|
27
|
+
if(value){
|
|
28
|
+
return value.toString();
|
|
29
|
+
}else{
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
viewButton=()=>{
|
|
35
|
+
const {value,isHtml,maxWidth}=this.props
|
|
36
|
+
return <>
|
|
37
|
+
<Popover overlayStyle={{maxWidth}} placement="leftBottom" trigger="click" content={
|
|
38
|
+
// <Card bodyStyle={{padding:'0px'}}>
|
|
39
|
+
<>
|
|
40
|
+
{isHtml?<div style={{padding:'6px'}} dangerouslySetInnerHTML={{__html: value}} ></div>:<div style={{padding:'6px'}}>{value}</div>}
|
|
41
|
+
|
|
42
|
+
</>
|
|
43
|
+
// </Card>
|
|
44
|
+
} >
|
|
45
|
+
<Button type={"link"} size={'small'}
|
|
46
|
+
>查看</Button> </Popover>
|
|
47
|
+
</>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
render(){
|
|
51
|
+
const {value,isHtml,showMax}=this.props;
|
|
52
|
+
var text=this.toString(value);
|
|
53
|
+
if(isHtml){
|
|
54
|
+
var re = new RegExp('<[^<>]+>', 'g');
|
|
55
|
+
text = value.replace(re, "");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let style = Units.getLongTextStyle(text.substring(0,showMax));
|
|
59
|
+
return <>
|
|
60
|
+
{ text.length<=showMax?<span className="infoStyle" style={style}>{text}</span>:
|
|
61
|
+
<span className="infoStyle" style={style}>{text.substring(0,showMax)}...
|
|
62
|
+
{this.viewButton()}
|
|
63
|
+
</span>
|
|
64
|
+
}
|
|
65
|
+
</>
|
|
66
|
+
|
|
67
|
+
;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Button, Upload as AntdUpload, message, Modal} from 'antd'
|
|
3
|
+
import {UploadOutlined} from '@ant-design/icons';
|
|
4
|
+
import HcserviceV3 from "./../../tmpl/hcservice-v3"
|
|
5
|
+
import {EControlProps,FileValue} from "../../tmpl/interface";
|
|
6
|
+
import Super from "../../tmpl/superagent";
|
|
7
|
+
import {UploadFile} from "antd/es/upload/interface";
|
|
8
|
+
import Units from '../../units'
|
|
9
|
+
interface UploadProps extends EControlProps{
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface UploadState {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export default class Upload extends React.PureComponent<UploadProps, UploadState>{
|
|
19
|
+
|
|
20
|
+
state={
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// handleRemove=(info)=>{
|
|
25
|
+
// Modal.confirm({
|
|
26
|
+
// title: "删除提示",
|
|
27
|
+
// content: "您确定删除此图片吗?",
|
|
28
|
+
// okText: "确认",
|
|
29
|
+
// cancelText: "取消",
|
|
30
|
+
// onOk: () => {
|
|
31
|
+
// let fileList = []
|
|
32
|
+
// this.props.onChange(JSON.stringify({valid:'delete'}));
|
|
33
|
+
// },
|
|
34
|
+
// onCancel: () => {
|
|
35
|
+
// return false;
|
|
36
|
+
// }
|
|
37
|
+
// });
|
|
38
|
+
//
|
|
39
|
+
// return false;
|
|
40
|
+
// }
|
|
41
|
+
handleRemove=(info)=>{
|
|
42
|
+
this.props.onChange(JSON.stringify({valid:'delete'}));
|
|
43
|
+
}
|
|
44
|
+
handleChange= async (info)=>{
|
|
45
|
+
console.log('file change:',info);
|
|
46
|
+
|
|
47
|
+
if (info.file.status=='done'){
|
|
48
|
+
let newFile:FileValue={
|
|
49
|
+
valid:'new',
|
|
50
|
+
fileKey:info.file.response.fileKey,
|
|
51
|
+
fileName:info.file.originFileObj.name,
|
|
52
|
+
}
|
|
53
|
+
const {onChange} = this.props
|
|
54
|
+
onChange(JSON.stringify(newFile));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// triggerChange = (changedValue) => {
|
|
58
|
+
// onChange(changedValue);
|
|
59
|
+
// if (onChange) {
|
|
60
|
+
// onChange(changedValue);
|
|
61
|
+
// }
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
beforeUpload=(file)=>{
|
|
65
|
+
|
|
66
|
+
const isLt5M = file.size / 1024 / 1024 < 40;
|
|
67
|
+
if (!isLt5M) {
|
|
68
|
+
message.error('超过40M限制 不允许上传~')
|
|
69
|
+
return false
|
|
70
|
+
}else{
|
|
71
|
+
return true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
render(){
|
|
77
|
+
const {id,itemType,disabled,value}=this.props
|
|
78
|
+
let fileList:UploadFile[]=[];
|
|
79
|
+
if(value){
|
|
80
|
+
let value_1:FileValue=value;
|
|
81
|
+
if(typeof value_1=='string'){
|
|
82
|
+
value_1=JSON.parse(value);
|
|
83
|
+
}
|
|
84
|
+
if(value_1.valid===true){
|
|
85
|
+
fileList.push( {
|
|
86
|
+
uid: '-1',
|
|
87
|
+
name: value_1.base.fileName,
|
|
88
|
+
status: 'done',
|
|
89
|
+
url: Units.api()+'/v3/files'+value_1.base.path+`?@token=${Units.getLocalStorge("hydrocarbonToken")}&disposition=attachment`,
|
|
90
|
+
})
|
|
91
|
+
}else if(value_1.valid=='new'){
|
|
92
|
+
fileList.push({
|
|
93
|
+
uid: '-2',
|
|
94
|
+
name: value_1.fileName,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div>
|
|
101
|
+
<AntdUpload id={id}
|
|
102
|
+
maxCount={1}
|
|
103
|
+
accept={itemType==='picture'?".png, .jpg, .jpeg":itemType==='video'?".mp4":undefined}
|
|
104
|
+
listType={itemType =='picture'?'picture':'text'}
|
|
105
|
+
fileList={fileList.length==0?undefined:fileList}
|
|
106
|
+
disabled={disabled}
|
|
107
|
+
name={'file'}
|
|
108
|
+
headers={Super.getHeaderObj()}
|
|
109
|
+
action={HcserviceV3.postFileAction}
|
|
110
|
+
beforeUpload={this.beforeUpload}
|
|
111
|
+
onChange={this.handleChange}
|
|
112
|
+
onRemove={this.handleRemove}
|
|
113
|
+
>
|
|
114
|
+
{fileList && fileList.length>=1?"":
|
|
115
|
+
<Button disabled={disabled}>
|
|
116
|
+
<UploadOutlined /> {disabled?"无需上传":'点击上传'}
|
|
117
|
+
</Button>}
|
|
118
|
+
</AntdUpload>
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Alert, Badge, Input, Spin, Tag} from "antd";
|
|
3
|
+
import loadable from "@loadable/component";
|
|
4
|
+
import {ControlHolderType, EnumItem, FieldConfig, ViewOrEdit} from "../tmpl/interface";
|
|
5
|
+
import ControlTypeSupportor from '../tmpl/control-type-supportor';
|
|
6
|
+
import EnumTags from './enum-tag';
|
|
7
|
+
import EnumBadge from './enum-badge';
|
|
8
|
+
import Steps from "./steps";
|
|
9
|
+
import Units from './../units';
|
|
10
|
+
import FileView from '../controls/file-view';
|
|
11
|
+
import Rfield from "./rfield";
|
|
12
|
+
import moment from "moment";
|
|
13
|
+
import Progress from './progress'
|
|
14
|
+
import ColorPicker from "./color-picker";
|
|
15
|
+
import EllipsisText from './text/ellipsis-text'
|
|
16
|
+
//import ChemStruc from "./chemstruc/graph";
|
|
17
|
+
// import HtmlEditor from "../HtmlEditor/tinymce";
|
|
18
|
+
const Loading = <Spin tip="Loading...">
|
|
19
|
+
<Alert
|
|
20
|
+
message="正在加载数据。。。"
|
|
21
|
+
description="初次访问加载数据较多,可能需要几秒或几分钟,请耐心等待!!"
|
|
22
|
+
type="info"
|
|
23
|
+
/>
|
|
24
|
+
</Spin>;
|
|
25
|
+
const Signature = loadable(() =>
|
|
26
|
+
import("./signature"), {fallback: Loading});
|
|
27
|
+
const ChemStruc = loadable(() =>
|
|
28
|
+
import("./chemstruc/graph"), {fallback: Loading});
|
|
29
|
+
const HtmlEditor = loadable(() =>
|
|
30
|
+
import("./html-editor/draft"), {fallback: Loading});
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
interface FieldViewControlProps {
|
|
35
|
+
value?: any;
|
|
36
|
+
fieldConfig: FieldConfig;
|
|
37
|
+
holderType:ControlHolderType;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function renderControl(fieldConfig: FieldConfig, fieldValue: any,pHolderType:ControlHolderType, width: any) {
|
|
41
|
+
|
|
42
|
+
let itemType = ControlTypeSupportor.getControlType(fieldConfig, fieldValue);
|
|
43
|
+
let holderType:ControlHolderType=pHolderType;
|
|
44
|
+
if(!holderType){
|
|
45
|
+
holderType="descriptions";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const colNum = fieldConfig.colNum;
|
|
49
|
+
let scalableWidth = width;
|
|
50
|
+
if (colNum == 2) {
|
|
51
|
+
scalableWidth = width * colNum * 1.52;
|
|
52
|
+
}
|
|
53
|
+
let viewControl = undefined;
|
|
54
|
+
|
|
55
|
+
let placeholder = !fieldConfig.disabled ? `请输入${fieldConfig.title}` : "无需输入";
|
|
56
|
+
let disabled: boolean = fieldConfig.disabled;
|
|
57
|
+
let value = fieldValue ? fieldValue : fieldConfig.defaultValue ? fieldConfig.defaultValue : "";
|
|
58
|
+
let viewOrEdit:ViewOrEdit='view';
|
|
59
|
+
let controlProps = {
|
|
60
|
+
fieldConfig, itemType, value,viewOrEdit,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const unSupportControl =
|
|
64
|
+
<span className="infoStyle">{`暂未完成-${itemType}`}</span>;
|
|
65
|
+
|
|
66
|
+
switch (itemType) {
|
|
67
|
+
case 'int':
|
|
68
|
+
case 'decimal':
|
|
69
|
+
case 'float':
|
|
70
|
+
case 'double':
|
|
71
|
+
case 'intrange':
|
|
72
|
+
case 'decimalrange':
|
|
73
|
+
case "range":
|
|
74
|
+
viewControl = <span className="infoStyle">{value}</span>
|
|
75
|
+
break;
|
|
76
|
+
case 'date-YY':
|
|
77
|
+
case 'date-M1':
|
|
78
|
+
case 'date':
|
|
79
|
+
case 'datetime-HH':
|
|
80
|
+
case 'datetime-mm':
|
|
81
|
+
case 'datetime':
|
|
82
|
+
case 'time-HH':
|
|
83
|
+
case 'time-mm':
|
|
84
|
+
case 'time':
|
|
85
|
+
viewControl = <span className="infoStyle">{value ? moment(value).format(Units.getMomentFormat(itemType)) : undefined}</span>
|
|
86
|
+
break;
|
|
87
|
+
case 'daterange-YY':
|
|
88
|
+
case 'daterange-M1':
|
|
89
|
+
case 'daterange':
|
|
90
|
+
case 'datetimerange-HH':
|
|
91
|
+
case 'datetimerange-mm':
|
|
92
|
+
case 'datetimerange':
|
|
93
|
+
case 'timerange-HH':
|
|
94
|
+
case 'timerange-mm':
|
|
95
|
+
case 'timerange':
|
|
96
|
+
viewControl = <span className="infoStyle">{value}</span>
|
|
97
|
+
break;
|
|
98
|
+
case 'text':
|
|
99
|
+
case 'textarea':
|
|
100
|
+
case 'preselect':
|
|
101
|
+
if(holderType=='table'){
|
|
102
|
+
viewControl=<EllipsisText maxWidth={'400px'} isHtml={false} value={value} ></EllipsisText>
|
|
103
|
+
}else{
|
|
104
|
+
viewControl = <span className="infoStyle">{value}</span>
|
|
105
|
+
}
|
|
106
|
+
break;
|
|
107
|
+
case 'select':
|
|
108
|
+
case 'radio':
|
|
109
|
+
viewControl = <EnumBadge {...controlProps}/>
|
|
110
|
+
break;
|
|
111
|
+
case 'multiselect':
|
|
112
|
+
case 'checkbox':
|
|
113
|
+
viewControl = <EnumTags {...controlProps} />
|
|
114
|
+
break;
|
|
115
|
+
case 'html':
|
|
116
|
+
if(holderType=='table'){
|
|
117
|
+
viewControl=<EllipsisText isHtml={true} value={value} ></EllipsisText>
|
|
118
|
+
}else{
|
|
119
|
+
viewControl=<div dangerouslySetInnerHTML={{__html: value}} ></div>;
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
case 'steps':
|
|
123
|
+
viewControl = <Steps {...controlProps}/>
|
|
124
|
+
break;
|
|
125
|
+
case 'password':
|
|
126
|
+
viewControl = unSupportControl;
|
|
127
|
+
break;
|
|
128
|
+
case 'caselect':
|
|
129
|
+
viewControl = unSupportControl;
|
|
130
|
+
break;
|
|
131
|
+
case 'relation':
|
|
132
|
+
viewControl = unSupportControl
|
|
133
|
+
break;
|
|
134
|
+
case 'file':
|
|
135
|
+
case 'picture':
|
|
136
|
+
case 'video':
|
|
137
|
+
viewControl = <FileView {...controlProps}></FileView>
|
|
138
|
+
break;
|
|
139
|
+
case 'chemstruc':
|
|
140
|
+
viewControl = <ChemStruc {...controlProps}></ChemStruc>
|
|
141
|
+
//viewControl = unSupportControl
|
|
142
|
+
break;
|
|
143
|
+
case 'relselect':
|
|
144
|
+
case 'refselect':
|
|
145
|
+
case 'entity-select':
|
|
146
|
+
case 'table-entity-select':
|
|
147
|
+
viewControl = <Rfield {...controlProps}/>;
|
|
148
|
+
break;
|
|
149
|
+
case 'progress':
|
|
150
|
+
viewControl=<Progress {...controlProps}></Progress>
|
|
151
|
+
break;
|
|
152
|
+
case 'signature':
|
|
153
|
+
viewControl=<Signature {...controlProps}></Signature>
|
|
154
|
+
break;
|
|
155
|
+
case 'color':
|
|
156
|
+
viewControl = <ColorPicker {...controlProps}></ColorPicker>
|
|
157
|
+
break;
|
|
158
|
+
case 'hidden'://
|
|
159
|
+
viewControl = <Input
|
|
160
|
+
type="hidden"
|
|
161
|
+
value={fieldValue}
|
|
162
|
+
disabled={true}
|
|
163
|
+
/>;
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
viewControl =unSupportControl;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
return viewControl;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const ViewControl: React.FC<FieldViewControlProps> = (props) => {
|
|
173
|
+
const {fieldConfig, value,holderType} = props;
|
|
174
|
+
return renderControl(fieldConfig, value, holderType,null);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export default ViewControl;
|