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,155 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Button, Card, Tooltip} from 'antd'
|
|
3
|
+
import {DtmplBaseProps, DtmplConfig, DtmplData} from "../../tmpl/interface";
|
|
4
|
+
|
|
5
|
+
import {ReloadOutlined, ScheduleOutlined,EditOutlined} from '@ant-design/icons';
|
|
6
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
7
|
+
import '../dtmpl.css';
|
|
8
|
+
import SnapshotTimeline from "./snapshot-timeline";
|
|
9
|
+
import DtmplView from "./dtmpl-view";
|
|
10
|
+
import Units from '../../units'
|
|
11
|
+
import ActionUtils from "../../controls/action/utils";
|
|
12
|
+
|
|
13
|
+
export interface ActDtmplViewProps extends DtmplBaseProps {
|
|
14
|
+
versionId?: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export interface ActDtmplViewStat {
|
|
18
|
+
loading: boolean,
|
|
19
|
+
dtmplConfig: DtmplConfig,
|
|
20
|
+
dtmplData: DtmplData,
|
|
21
|
+
premisesTitle: string,
|
|
22
|
+
snapshotVisible: boolean,
|
|
23
|
+
layout: object,
|
|
24
|
+
refreshCode: string,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
class ActDtmplView extends React.PureComponent<ActDtmplViewProps, ActDtmplViewStat> {
|
|
28
|
+
static defaultProps = {
|
|
29
|
+
showRightNav: true,
|
|
30
|
+
rightBarPositionRight: 15,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
state = {
|
|
34
|
+
loading: true,
|
|
35
|
+
dtmplConfig: undefined,
|
|
36
|
+
snapshotVisible: false,
|
|
37
|
+
dtmplData: undefined,
|
|
38
|
+
premisesTitle: "默认字段",
|
|
39
|
+
layout: {
|
|
40
|
+
labelCol: {span: 8},
|
|
41
|
+
wrapperCol: {span: 16},
|
|
42
|
+
},
|
|
43
|
+
refreshCode: undefined
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async componentDidMount() {
|
|
47
|
+
const { sourceId, code, versionId} = this.props;
|
|
48
|
+
let dtmplConfig = await HCDataSource.requestDtmplConfig(sourceId);
|
|
49
|
+
this.setState({
|
|
50
|
+
dtmplConfig,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// async componentDidUpdate(prevProps) {
|
|
55
|
+
// const {sourceName, sourceId, code, versionId} = this.props;
|
|
56
|
+
// const {code: preCode, versionId: preVersionId} = prevProps;
|
|
57
|
+
// if (code != preCode || (versionId && versionId != prevProps)) {
|
|
58
|
+
// await this.loadData();
|
|
59
|
+
// }
|
|
60
|
+
// }
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
//
|
|
64
|
+
// const layout = {
|
|
65
|
+
// labelCol: {span: 8},
|
|
66
|
+
// wrapperCol: {span: 16},
|
|
67
|
+
// };
|
|
68
|
+
|
|
69
|
+
doRefresh = async () => {
|
|
70
|
+
this.setState({
|
|
71
|
+
refreshCode: Units.getRandomNum(6)
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
goEdit = () => {
|
|
76
|
+
const {goDtmpl,code}=this.props;
|
|
77
|
+
goDtmpl(code);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
showSnapshot = () => {
|
|
81
|
+
|
|
82
|
+
this.setState({
|
|
83
|
+
snapshotVisible: true,
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onSnapshotClose = () => {
|
|
90
|
+
|
|
91
|
+
this.setState({
|
|
92
|
+
snapshotVisible: false,
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
toSnapshot = () => {
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
render() {
|
|
104
|
+
const {showRightNav, rightBarPositionRight, code, sourceId,goDtmpl} = this.props;
|
|
105
|
+
const {dtmplConfig, premisesTitle, loading, dtmplData, layout, snapshotVisible,refreshCode} = this.state;
|
|
106
|
+
const buttons = dtmplConfig ? dtmplConfig.buttons : undefined;
|
|
107
|
+
const premises = dtmplConfig ? dtmplConfig.premises : undefined;
|
|
108
|
+
let showRightNav_ = showRightNav;
|
|
109
|
+
if (dtmplConfig && dtmplConfig.groups.length < 4) {
|
|
110
|
+
showRightNav_ = false;
|
|
111
|
+
}
|
|
112
|
+
return (
|
|
113
|
+
<div className={`detailPage ${showRightNav_ ? 'showRightNav' : 'noRightNav'}`}>
|
|
114
|
+
<Card bordered={false}
|
|
115
|
+
key={"detailTitle"}
|
|
116
|
+
className="hoverable pageHeader"
|
|
117
|
+
>
|
|
118
|
+
<h3>
|
|
119
|
+
{'详情'}
|
|
120
|
+
<div className="fr">
|
|
121
|
+
{buttons && buttons.includes("dtmplEdit") && goDtmpl && !dtmplConfig.editAction ?
|
|
122
|
+
<Button
|
|
123
|
+
className="hoverbig"
|
|
124
|
+
onClick={this.goEdit}>
|
|
125
|
+
<EditOutlined/>
|
|
126
|
+
</Button> : ""}
|
|
127
|
+
{buttons && buttons.includes("history") ?
|
|
128
|
+
<Tooltip title="数据快照">
|
|
129
|
+
<Button
|
|
130
|
+
className="hoverbig"
|
|
131
|
+
onClick={this.showSnapshot}>
|
|
132
|
+
<ScheduleOutlined/>
|
|
133
|
+
</Button></Tooltip> : ""}
|
|
134
|
+
<Button
|
|
135
|
+
className="hoverbig"
|
|
136
|
+
title="刷新"
|
|
137
|
+
onClick={this.doRefresh}
|
|
138
|
+
><ReloadOutlined/></Button>
|
|
139
|
+
<SnapshotTimeline dtmplConfig={dtmplConfig} code={code} onClose={this.onSnapshotClose}
|
|
140
|
+
showSnapshot={this.toSnapshot} sourceId={sourceId}
|
|
141
|
+
visible={snapshotVisible}></SnapshotTimeline>
|
|
142
|
+
</div>
|
|
143
|
+
</h3>
|
|
144
|
+
</Card>
|
|
145
|
+
<DtmplView refreshCode={refreshCode} showRightNav={showRightNav_} rightBarPositionRight={rightBarPositionRight}
|
|
146
|
+
dtmplConfig={dtmplConfig} sourceId={sourceId}
|
|
147
|
+
code={code}></DtmplView>
|
|
148
|
+
</div>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
export default ActDtmplView;
|
|
155
|
+
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Button, Card} from 'antd'
|
|
3
|
+
import {DtmplBaseProps, DtmplConfig, DtmplData, FieldGroupConfig} from "../../tmpl/interface";
|
|
4
|
+
import RelationTable from "../../table/relation-table";
|
|
5
|
+
import FieldViewGroup from './field-view-group';
|
|
6
|
+
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
7
|
+
import RightBar from "../rightbar";
|
|
8
|
+
import '../dtmpl.css';
|
|
9
|
+
import {HolderOutlined} from '@ant-design/icons';
|
|
10
|
+
import Units from '../../units';
|
|
11
|
+
import CollapseCard from "../../controls/collapse-card";
|
|
12
|
+
import CqueryButtonBar from "../button/cquery-button-bar";
|
|
13
|
+
|
|
14
|
+
export interface DtmplViewProps extends DtmplBaseProps {
|
|
15
|
+
versionId?: number;
|
|
16
|
+
dtmplConfig: DtmplConfig,
|
|
17
|
+
refreshCode?:string,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface DtmplViewStat {
|
|
21
|
+
id?:string;
|
|
22
|
+
loading: boolean,
|
|
23
|
+
dtmplData: DtmplData,
|
|
24
|
+
premisesTitle: string,
|
|
25
|
+
layout: object,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
|
|
29
|
+
static defaultProps = {
|
|
30
|
+
showRightNav: true,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
state = {
|
|
34
|
+
loading: true,
|
|
35
|
+
id:'dtmplView'+Units.getRandomNum(6),
|
|
36
|
+
snapshotVisible: false,
|
|
37
|
+
dtmplData: undefined,
|
|
38
|
+
premisesTitle: "默认字段",
|
|
39
|
+
layout: {
|
|
40
|
+
labelCol: {span: 8},
|
|
41
|
+
wrapperCol: {span: 16},
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async componentDidMount() {
|
|
46
|
+
await this.loadData();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async componentDidUpdate(prevProps) {
|
|
50
|
+
const { sourceId, code, versionId,refreshCode} = this.props;
|
|
51
|
+
const {code: preCode, versionId: preVersionId,refreshCode:preRefreshCode} = prevProps;
|
|
52
|
+
if (code != preCode || (versionId && versionId != prevProps.versionId) || (refreshCode && refreshCode!=preRefreshCode)) {
|
|
53
|
+
await this.loadData();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
loadData = async () => {
|
|
58
|
+
const { sourceId, code, versionId} = this.props;
|
|
59
|
+
if (code) {
|
|
60
|
+
this.setState({
|
|
61
|
+
loading: true,
|
|
62
|
+
})
|
|
63
|
+
const dtmplData = await HcserviceV3.requestDtmplData( sourceId, code, versionId);
|
|
64
|
+
this.setState({
|
|
65
|
+
dtmplData, loading:false,
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
fieldGroupList = () => {
|
|
71
|
+
const {dtmplConfig} = this.props;
|
|
72
|
+
const { dtmplData, loading,id} = this.state;
|
|
73
|
+
|
|
74
|
+
let groups: FieldGroupConfig[] = [];
|
|
75
|
+
if (dtmplConfig) {
|
|
76
|
+
groups = dtmplConfig.groups;
|
|
77
|
+
}
|
|
78
|
+
return groups.map((item) => {
|
|
79
|
+
if (item.type == 'relation') {//关系
|
|
80
|
+
if (item.fields) {
|
|
81
|
+
let data: DtmplData[] = undefined;
|
|
82
|
+
if (dtmplData) {
|
|
83
|
+
data = dtmplData.arrayMap[item.id];
|
|
84
|
+
}
|
|
85
|
+
// console.log("dtmplData", dtmplData );
|
|
86
|
+
// console.log("dtmplData data", data );
|
|
87
|
+
// console.log("initCollapsed", dtmplData && (!data || data.length<=0));
|
|
88
|
+
return <RelationTable initCollapse={ dtmplData && (!data || data.length<=0)} loading={loading} parentId={id} key={item.id} fieldGroupConfig={item} value={data}
|
|
89
|
+
viewOrEdit={"view"}/>
|
|
90
|
+
}
|
|
91
|
+
} else {//字段组
|
|
92
|
+
return <CollapseCard
|
|
93
|
+
title={item.title}
|
|
94
|
+
key={item.id}
|
|
95
|
+
id={id+item.id}
|
|
96
|
+
className="hoverable"
|
|
97
|
+
headStyle={{background: "#f2f4f5"}}
|
|
98
|
+
loading={loading}
|
|
99
|
+
>
|
|
100
|
+
<FieldViewGroup fields={item.fields} valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
101
|
+
width={220}></FieldViewGroup>
|
|
102
|
+
</CollapseCard>
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
render() {
|
|
110
|
+
const {showRightNav, rightBarPositionRight, code, sourceId,dtmplConfig} = this.props;
|
|
111
|
+
const {premisesTitle, loading, dtmplData, layout, snapshotVisible,id} = this.state;
|
|
112
|
+
const premises = dtmplConfig ? dtmplConfig.premises : undefined;
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div>
|
|
116
|
+
{this.fieldGroupList()}
|
|
117
|
+
{premises && premises.length > 0 ?
|
|
118
|
+
<CollapseCard
|
|
119
|
+
// title={<Button type="text"><HolderOutlined />{premisesTitle}</Button>}
|
|
120
|
+
title={premisesTitle}
|
|
121
|
+
key={premisesTitle}
|
|
122
|
+
id={id+premises[0].id}
|
|
123
|
+
className="hoverable"
|
|
124
|
+
headStyle={{background: "#f2f4f5"}}
|
|
125
|
+
loading={loading}
|
|
126
|
+
>
|
|
127
|
+
<FieldViewGroup
|
|
128
|
+
fields={premises}/>
|
|
129
|
+
</CollapseCard>
|
|
130
|
+
: ""
|
|
131
|
+
}
|
|
132
|
+
{showRightNav ?
|
|
133
|
+
<RightBar parentId={id} positionRight={rightBarPositionRight} dtmplConfig={dtmplConfig}/> : ""
|
|
134
|
+
}
|
|
135
|
+
<CqueryButtonBar dtmplConfig={dtmplConfig} mainCode={code}></CqueryButtonBar>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
export default DtmplView;
|
|
143
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Col,Row,Descriptions} from 'antd';
|
|
3
|
+
import {FieldConfig, FieldGroupConfig} from "../../tmpl/interface";
|
|
4
|
+
import ViewControl from './../../controls/view-control';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
interface FieldViewGroupProps {
|
|
8
|
+
fields: FieldConfig[],
|
|
9
|
+
valueMap?: object,
|
|
10
|
+
width?: number,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
interface FieldViewGroupState {
|
|
14
|
+
fileList: any,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default class FieldViewGroup extends React.PureComponent<FieldViewGroupProps, FieldViewGroupState> {
|
|
18
|
+
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.state = {
|
|
22
|
+
fileList: [],
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
initViewList = () => {
|
|
27
|
+
const {fields, valueMap} = this.props
|
|
28
|
+
const formItemList = [];
|
|
29
|
+
|
|
30
|
+
if (fields.length > 0) {
|
|
31
|
+
fields.forEach((item, index) => {
|
|
32
|
+
const title = item.title;
|
|
33
|
+
let fieldValue = valueMap?valueMap[item.id]:undefined;
|
|
34
|
+
//fieldValue 没有值时不能为null 要为 undefined。antd input所限制
|
|
35
|
+
fieldValue = fieldValue ? fieldValue : item.defaultValue ? item.defaultValue : undefined;
|
|
36
|
+
const fieldKey = item.id + Math.random() * 100;
|
|
37
|
+
|
|
38
|
+
if(item.extControlType!='hidden'){
|
|
39
|
+
const formItem = <Descriptions.Item label={item.title} span={item.colNum} key={index}
|
|
40
|
+
className='labelcss'
|
|
41
|
+
>
|
|
42
|
+
<ViewControl holderType={'descriptions'} value={fieldValue} fieldConfig={item}/>
|
|
43
|
+
</Descriptions.Item>
|
|
44
|
+
formItemList.push(formItem);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return formItemList;
|
|
49
|
+
// const colList = [];
|
|
50
|
+
//
|
|
51
|
+
// for (let i = 0; i < formItemList.length; i = i + 1) {
|
|
52
|
+
// let colNum = fields[i].colNum;
|
|
53
|
+
// let col = <Col span={12 * colNum}>
|
|
54
|
+
// {formItemList[i]}
|
|
55
|
+
// </Col>
|
|
56
|
+
// colList.push(col);
|
|
57
|
+
// }
|
|
58
|
+
//
|
|
59
|
+
// const row =
|
|
60
|
+
// <Row gutter={[16, 8]} key={1}>
|
|
61
|
+
// {colList}
|
|
62
|
+
// </Row>
|
|
63
|
+
//return row;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
render() {
|
|
67
|
+
return (
|
|
68
|
+
<Descriptions column={2}>
|
|
69
|
+
{this.initViewList()}
|
|
70
|
+
</Descriptions>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Modal, ModalProps as AntdModalProps,Form,Button} from 'antd'
|
|
3
|
+
import {DtmplConfig, EnumItem, ViewOrEdit} from "../../tmpl/interface";
|
|
4
|
+
import ActDtmplView, {ActDtmplViewProps} from "./act-dtmpl-view";
|
|
5
|
+
import Scrollbars from 'react-custom-scrollbars';
|
|
6
|
+
interface ModalDtmplViewProps extends AntdModalProps, ActDtmplViewProps{
|
|
7
|
+
height:any,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ModalDtmplViewState {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default class ModalDtmplView extends React.PureComponent<ModalDtmplViewProps, ModalDtmplViewState> {
|
|
15
|
+
|
|
16
|
+
static defaultProps = {
|
|
17
|
+
showConfirm: true,
|
|
18
|
+
height:500,
|
|
19
|
+
//antd modal
|
|
20
|
+
forceRender:true,
|
|
21
|
+
style:{maxWidth: 'calc(100vw - 60px)', maxHeight: 'calc(100vh - 50px)'},
|
|
22
|
+
cancelText:"取消",
|
|
23
|
+
form:Form.useForm,
|
|
24
|
+
}
|
|
25
|
+
static state={
|
|
26
|
+
viewOrEdit:'view',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// onCancel=()=>{
|
|
31
|
+
//
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
render() {
|
|
35
|
+
// console.log('antdModalProps:',this.antdModalProps);
|
|
36
|
+
const {height,onOk,onCancel,code,style,sourceId,visible} = this.props
|
|
37
|
+
console.log('antdModalProps code :',code);
|
|
38
|
+
//const {code} = this.state;
|
|
39
|
+
return <Modal
|
|
40
|
+
visible={visible}
|
|
41
|
+
title={"查看"}
|
|
42
|
+
// style={style}
|
|
43
|
+
width={'1250px'}
|
|
44
|
+
centered
|
|
45
|
+
bodyStyle={{height: height, overflow: 'auto'}}
|
|
46
|
+
onCancel={onCancel}
|
|
47
|
+
footer={[
|
|
48
|
+
<Button key="back" onClick={onCancel}>
|
|
49
|
+
取 消
|
|
50
|
+
</Button>]}
|
|
51
|
+
>
|
|
52
|
+
{code?<ActDtmplView rightBarPositionRight={30} sourceId={sourceId} code={code} > </ActDtmplView>:""}
|
|
53
|
+
</Modal>
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Button, Drawer, Timeline} from 'antd'
|
|
3
|
+
import HcserviceV3 from "../../tmpl/hcservice-v3";
|
|
4
|
+
import '../dtmpl.css';
|
|
5
|
+
import {DtmplConfig, SourceName} from "../../tmpl/interface";
|
|
6
|
+
import Units from '../../units';
|
|
7
|
+
import DtmplView from "./dtmpl-view";
|
|
8
|
+
|
|
9
|
+
export interface SnapshotTimelineProps {
|
|
10
|
+
sourceId: string;
|
|
11
|
+
code: string;
|
|
12
|
+
showSnapshot?: (id: number) => void;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
visible: boolean;
|
|
15
|
+
dtmplConfig: DtmplConfig;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export interface SnapshotTimelineStat {
|
|
19
|
+
list: any[],
|
|
20
|
+
loading: boolean,
|
|
21
|
+
current?: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
class SnapshotTimeline extends React.PureComponent<SnapshotTimelineProps, SnapshotTimelineStat> {
|
|
25
|
+
static defaultProps = {}
|
|
26
|
+
|
|
27
|
+
state = {
|
|
28
|
+
list: undefined,
|
|
29
|
+
loading: false,
|
|
30
|
+
current: undefined,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async componentDidMount() {
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async componentDidUpdate(prevProps) {
|
|
38
|
+
const {visible} = this.props;
|
|
39
|
+
const {list} = this.state;
|
|
40
|
+
if (visible && !list) {
|
|
41
|
+
this.loadData();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
loadData = async () => {
|
|
46
|
+
const {sourceId, code, showSnapshot} = this.props;
|
|
47
|
+
const {current} = this.state;
|
|
48
|
+
if (code) {
|
|
49
|
+
this.setState({
|
|
50
|
+
loading: true,
|
|
51
|
+
})
|
|
52
|
+
const list = await HcserviceV3.requestVersionList( sourceId, code);
|
|
53
|
+
this.setState({
|
|
54
|
+
list, current: !current && list.length > 0 ? list[0].code : current,
|
|
55
|
+
loading: false,
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
onChange = (code: number) => {
|
|
61
|
+
const {showSnapshot} = this.props;
|
|
62
|
+
this.setState({
|
|
63
|
+
current: code
|
|
64
|
+
})
|
|
65
|
+
showSnapshot(code);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
detailHistory = () => {
|
|
69
|
+
const {list, current} = this.state;
|
|
70
|
+
let detailHistory
|
|
71
|
+
if (list.length > 0) {
|
|
72
|
+
detailHistory = list.map((item, index) => {
|
|
73
|
+
const isCurrentItem = (current ? item.code === current : false);
|
|
74
|
+
const color = isCurrentItem ? "red" : "blue";
|
|
75
|
+
return <Timeline.Item color={color} key={index}>
|
|
76
|
+
{Units.formateDate(item.time)}<br/>
|
|
77
|
+
{`` + item.userName}
|
|
78
|
+
{isCurrentItem ? "" : <Button
|
|
79
|
+
style={{marginLeft: 10}}
|
|
80
|
+
type="primary"
|
|
81
|
+
size="small"
|
|
82
|
+
onClick={() => this.onChange(item.code)}
|
|
83
|
+
>查看</Button>
|
|
84
|
+
}
|
|
85
|
+
</Timeline.Item>
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
return detailHistory;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
render() {
|
|
93
|
+
const {visible, onClose, dtmplConfig, sourceId, code} = this.props;
|
|
94
|
+
const {list, current} = this.state;
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<Drawer
|
|
98
|
+
title="快照列表"
|
|
99
|
+
closable={true}
|
|
100
|
+
onClose={onClose}
|
|
101
|
+
visible={visible}
|
|
102
|
+
width={350}
|
|
103
|
+
>
|
|
104
|
+
{list && list.length > 0 ? <Timeline mode="alternate">
|
|
105
|
+
{this.detailHistory()}
|
|
106
|
+
</Timeline> : "暂无历史记录"}
|
|
107
|
+
</Drawer>
|
|
108
|
+
<Drawer
|
|
109
|
+
placement={'left'}
|
|
110
|
+
title="快照查看"
|
|
111
|
+
closable={true}
|
|
112
|
+
mask={false}
|
|
113
|
+
onClose={onClose}
|
|
114
|
+
visible={visible}
|
|
115
|
+
width={'calc(100% - 380px)'}
|
|
116
|
+
style={{
|
|
117
|
+
maxWidth: 1960,
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<DtmplView showRightNav={false} dtmplConfig={dtmplConfig} sourceId={sourceId}
|
|
121
|
+
code={code} versionId={current}></DtmplView>
|
|
122
|
+
</Drawer>
|
|
123
|
+
</>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
export default SnapshotTimeline;
|
|
130
|
+
|