aldehyde 0.2.234 → 0.2.236

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.
Files changed (102) hide show
  1. package/lib/controls/entity-select/popover-entity-select.d.ts.map +1 -1
  2. package/lib/controls/entity-select/popover-entity-select.js +3 -3
  3. package/lib/controls/entity-select/popover-entity-select.js.map +1 -1
  4. package/lib/controls/entry-control.d.ts.map +1 -1
  5. package/lib/controls/entry-control.js +6 -0
  6. package/lib/controls/entry-control.js.map +1 -1
  7. package/lib/controls/file-view/drawer-file-view.js +1 -1
  8. package/lib/controls/file-view/drawer-file-view.js.map +1 -1
  9. package/lib/controls/file-view/index.d.ts +1 -1
  10. package/lib/controls/file-view/index.d.ts.map +1 -1
  11. package/lib/controls/file-view/index.js +3 -3
  12. package/lib/controls/file-view/index.js.map +1 -1
  13. package/lib/controls/file-view/multi-file-view.d.ts +12 -0
  14. package/lib/controls/file-view/multi-file-view.d.ts.map +1 -0
  15. package/lib/controls/file-view/multi-file-view.js +27 -0
  16. package/lib/controls/file-view/multi-file-view.js.map +1 -0
  17. package/lib/controls/tree-select/tree-entity-select.d.ts.map +1 -1
  18. package/lib/controls/tree-select/tree-entity-select.js +0 -1
  19. package/lib/controls/tree-select/tree-entity-select.js.map +1 -1
  20. package/lib/controls/upload/index.d.ts.map +1 -1
  21. package/lib/controls/upload/index.js +3 -2
  22. package/lib/controls/upload/index.js.map +1 -1
  23. package/lib/controls/upload/mult-file-upload.d.ts +33 -0
  24. package/lib/controls/upload/mult-file-upload.d.ts.map +1 -0
  25. package/lib/controls/upload/mult-file-upload.js +181 -0
  26. package/lib/controls/upload/mult-file-upload.js.map +1 -0
  27. package/lib/controls/view-control.d.ts.map +1 -1
  28. package/lib/controls/view-control.js +5 -14
  29. package/lib/controls/view-control.js.map +1 -1
  30. package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
  31. package/lib/detail/view/act-dtmpl-view.js.map +1 -1
  32. package/lib/detail/view/dtmpl-view.d.ts.map +1 -1
  33. package/lib/detail/view/dtmpl-view.js +0 -3
  34. package/lib/detail/view/dtmpl-view.js.map +1 -1
  35. package/lib/detail/view/tab-act-dtmpl-view.d.ts +66 -0
  36. package/lib/detail/view/tab-act-dtmpl-view.d.ts.map +1 -0
  37. package/lib/detail/view/tab-act-dtmpl-view.js +182 -0
  38. package/lib/detail/view/tab-act-dtmpl-view.js.map +1 -0
  39. package/lib/form/criteria-form.d.ts.map +1 -1
  40. package/lib/form/criteria-form.js +11 -3
  41. package/lib/form/criteria-form.js.map +1 -1
  42. package/lib/module/dtmpl-edit-card.d.ts.map +1 -1
  43. package/lib/module/dtmpl-edit-card.js +0 -1
  44. package/lib/module/dtmpl-edit-card.js.map +1 -1
  45. package/lib/routable/dtmpl-route.d.ts.map +1 -1
  46. package/lib/routable/dtmpl-route.js +2 -2
  47. package/lib/routable/dtmpl-route.js.map +1 -1
  48. package/lib/routable/ltmpl-route.d.ts.map +1 -1
  49. package/lib/routable/ltmpl-route.js +0 -4
  50. package/lib/routable/ltmpl-route.js.map +1 -1
  51. package/lib/table/act-table.d.ts +6 -1
  52. package/lib/table/act-table.d.ts.map +1 -1
  53. package/lib/table/act-table.js +47 -29
  54. package/lib/table/act-table.js.map +1 -1
  55. package/lib/table/column/column-builder.d.ts.map +1 -1
  56. package/lib/table/column/column-builder.js +98 -79
  57. package/lib/table/column/column-builder.js.map +1 -1
  58. package/lib/table/query-table.d.ts +3 -3
  59. package/lib/table/query-table.d.ts.map +1 -1
  60. package/lib/table/query-table.js +28 -9
  61. package/lib/table/query-table.js.map +1 -1
  62. package/lib/table/stat/restat.d.ts +1 -1
  63. package/lib/table/stat/restat.d.ts.map +1 -1
  64. package/lib/table/stat/restat.js +1 -1
  65. package/lib/table/stat/restat.js.map +1 -1
  66. package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
  67. package/lib/tmpl/control-type-supportor.js +1 -0
  68. package/lib/tmpl/control-type-supportor.js.map +1 -1
  69. package/lib/tmpl/hcservice-v3.d.ts +3 -2
  70. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  71. package/lib/tmpl/hcservice-v3.js +40 -21
  72. package/lib/tmpl/hcservice-v3.js.map +1 -1
  73. package/lib/tmpl/interface.d.ts +18 -0
  74. package/lib/tmpl/interface.d.ts.map +1 -1
  75. package/lib/tmpl/interface.js.map +1 -1
  76. package/lib/tree/tree-utils.js +1 -1
  77. package/lib/tree/tree-utils.js.map +1 -1
  78. package/package.json +2 -2
  79. package/src/aldehyde/controls/entity-select/popover-entity-select.tsx +4 -3
  80. package/src/aldehyde/controls/entry-control.tsx +6 -0
  81. package/src/aldehyde/controls/file-view/drawer-file-view.tsx +1 -1
  82. package/src/aldehyde/controls/file-view/index.tsx +4 -4
  83. package/src/aldehyde/controls/file-view/multi-file-view.tsx +43 -0
  84. package/src/aldehyde/controls/tree-select/tree-entity-select.tsx +0 -1
  85. package/src/aldehyde/controls/upload/index.tsx +8 -3
  86. package/src/aldehyde/controls/upload/mult-file-upload.tsx +216 -0
  87. package/src/aldehyde/controls/view-control.tsx +5 -14
  88. package/src/aldehyde/detail/view/act-dtmpl-view.tsx +0 -2
  89. package/src/aldehyde/detail/view/dtmpl-view.tsx +1 -4
  90. package/src/aldehyde/detail/view/tab-act-dtmpl-view.tsx +307 -0
  91. package/src/aldehyde/form/criteria-form.tsx +23 -3
  92. package/src/aldehyde/module/dtmpl-edit-card.tsx +0 -1
  93. package/src/aldehyde/routable/dtmpl-route.tsx +2 -1
  94. package/src/aldehyde/routable/ltmpl-route.tsx +1 -4
  95. package/src/aldehyde/table/act-table.tsx +72 -142
  96. package/src/aldehyde/table/column/column-builder.tsx +249 -251
  97. package/src/aldehyde/table/query-table.tsx +41 -11
  98. package/src/aldehyde/table/stat/restat.tsx +2 -3
  99. package/src/aldehyde/tmpl/control-type-supportor.tsx +1 -0
  100. package/src/aldehyde/tmpl/hcservice-v3.tsx +38 -22
  101. package/src/aldehyde/tmpl/interface.tsx +20 -0
  102. package/src/aldehyde/tree/tree-utils.tsx +1 -1
@@ -0,0 +1,43 @@
1
+ import * as React from 'react'
2
+ import {Card, Space} from 'antd'
3
+ import FileView, {FileViewProps} from "./index";
4
+
5
+ interface MultiFileViewProps extends FileViewProps{
6
+
7
+ };
8
+
9
+ interface MultiFileViewState {
10
+
11
+ };
12
+
13
+ export default class MultiFileView extends React.PureComponent<MultiFileViewProps, MultiFileViewState> {
14
+ static defaultProps={
15
+
16
+ }
17
+
18
+ render() {
19
+ const {value} = this.props;
20
+ let value_1;
21
+ let fileList=[];
22
+ if (value && typeof value == "string" && value !=="") {
23
+ value_1 = JSON.parse(value);
24
+ if(value_1 instanceof Array) {
25
+ fileList=value_1;
26
+ }else{
27
+ fileList.push(value_1);
28
+ }
29
+ }
30
+ return <Space wrap={true}>
31
+ {
32
+ fileList.map(f=> {
33
+ return <FileView
34
+ {...this.props}
35
+ value={f}
36
+ />
37
+ })
38
+ }
39
+ </Space>
40
+
41
+ }
42
+
43
+ }
@@ -63,7 +63,6 @@ const TreeEntitySelect=(props:TreeEntitySelectProps)=> {
63
63
  }
64
64
  let nodes= TreeUtils.getNodesOfKey({children:treeData},value);
65
65
  let values:string[]=[];
66
- debugger
67
66
  if(nodes){
68
67
  nodes.forEach(n=>{
69
68
  if(valueOnly){
@@ -7,7 +7,9 @@ import Super from "../../tmpl/superagent";
7
7
  import { UploadFile } from "antd/es/upload/interface";
8
8
  import Units from "../../units";
9
9
  import { LocaleContext } from "../../locale/LocaleProvider";
10
- interface UploadProps extends EControlProps {}
10
+ interface UploadProps extends EControlProps {
11
+
12
+ }
11
13
 
12
14
  interface UploadState {}
13
15
 
@@ -26,6 +28,7 @@ export default class Upload extends React.PureComponent<
26
28
  handleChange = async (info) => {
27
29
  console.log("file change:", info);
28
30
 
31
+
29
32
  if (info.file.status == "done") {
30
33
  let newFile: FileValue = {
31
34
  valid: "new",
@@ -85,11 +88,13 @@ export default class Upload extends React.PureComponent<
85
88
  }
86
89
  }
87
90
 
91
+ let maxCount=1;
92
+
88
93
  return (
89
94
  <div>
90
95
  <AntdUpload
91
96
  id={id}
92
- maxCount={1}
97
+ maxCount={maxCount}
93
98
  accept={
94
99
  itemType === "picture"
95
100
  ? ".png, .jpg, .jpeg"
@@ -107,7 +112,7 @@ export default class Upload extends React.PureComponent<
107
112
  onChange={this.handleChange}
108
113
  onRemove={this.handleRemove}
109
114
  >
110
- {fileList && fileList.length >= 1 ? (
115
+ {fileList && fileList.length >= maxCount ? (
111
116
  ""
112
117
  ) : (
113
118
  <Button disabled={disabled}>
@@ -0,0 +1,216 @@
1
+ import React from "react";
2
+ import { Button, Upload as AntdUpload, message } 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
+ import { LocaleContext } from "../../locale/LocaleProvider";
10
+ interface UploadProps extends EControlProps {
11
+ maxCount:number
12
+ }
13
+
14
+ interface UploadState {
15
+ fileList:any[],
16
+ }
17
+
18
+ export default class MultiFileUpload extends React.PureComponent<
19
+ UploadProps,
20
+ UploadState
21
+ > {
22
+ state = {fileList:null};
23
+ static contextType = LocaleContext;
24
+ context: React.ContextType<typeof LocaleContext>;
25
+
26
+ handleRemove = (info) => {
27
+ const {fileList}=this.state;
28
+ const { onChange } = this.props;
29
+ if(fileList && fileList.length>1){
30
+ let tFileList=[];
31
+ for(let f of fileList){
32
+ if(f.uid != info.uid){
33
+ tFileList.push(f);
34
+ }
35
+ }
36
+ //this.setState({fileList:fileList})
37
+ onChange(JSON.stringify(tFileList));
38
+ //this.setState({fileList:tFileList});
39
+ }else{
40
+ onChange(JSON.stringify({ valid: "delete" }));
41
+ }
42
+ };
43
+
44
+ handleChange = async (info) => {
45
+ console.log("file change:", info);
46
+ let fileList:any[]=[];
47
+ if(info.file.status == "uploading"){
48
+ if(info.fileList){
49
+ info.fileList.forEach(a=>{
50
+ if(a.status == "done"){
51
+ fileList.push(a);
52
+ }
53
+ })
54
+ }
55
+ // if (info.file.status == "uploading") {
56
+ let newFile: FileValue = {
57
+ valid: "new",
58
+ uid:info.file.uid,
59
+ status:info.file.status,
60
+ fileKey: "",
61
+ fileName: info.file.originFileObj.name,
62
+ };
63
+ fileList.push(newFile);
64
+ this.setState({fileList})
65
+ }else if (info.file.status == "done") {
66
+ let newFile: FileValue = {
67
+ valid: "new",
68
+ status:info.file.status,
69
+ uid:info.file.uid,
70
+ fileKey: info.file.response.fileKey,
71
+ fileName: info.file.originFileObj.name,
72
+ };
73
+ fileList.push(newFile);
74
+
75
+ if(info.fileList){
76
+ info.fileList.forEach(a=>{
77
+ if(!a.originFileObj){
78
+ fileList.push(a);
79
+ }
80
+ })
81
+ }
82
+ const { onChange } = this.props;
83
+ //this.setState({fileList:fileList})
84
+ onChange(JSON.stringify(fileList));
85
+ }
86
+ };
87
+
88
+ beforeUpload = (file) => {
89
+ const { translate } = this.context;
90
+
91
+ const isLt5M = file.size / 1024 / 1024 < 40;
92
+ if (!isLt5M) {
93
+ message.error(translate("${超过40M限制 不允许上传~}"),5);
94
+ return false;
95
+ } else {
96
+ return true;
97
+ }
98
+ };
99
+ componentDidMount() {
100
+ const {value}=this.props;
101
+ let fileList=this.transvalue(value);
102
+ this.setState({fileList})
103
+ }
104
+
105
+ componentDidUpdate(prevProps: Readonly<UploadProps>, prevState: Readonly<UploadState>, snapshot?: any) {
106
+ const {value:preValue}=prevProps;
107
+ const {value}=this.props;
108
+ if(value && value!=preValue){
109
+ let fileList=this.transvalue(value);
110
+ this.setState({fileList})
111
+ }
112
+ }
113
+
114
+ transvalue=(value)=>{
115
+ let value_1 = value;
116
+ let fileList = [];
117
+ if (typeof value_1 == "string") {
118
+ value_1 = JSON.parse(value);
119
+ if(value_1 instanceof Array){
120
+ value_1.forEach(a=>{
121
+ if (a.valid == "new") {
122
+ fileList.push({
123
+ valid:"new",
124
+ url:a.url,
125
+ fileKey:a.fileKey,
126
+ status:"done",
127
+ uid: a.uid,
128
+ name: a.fileName?a.fileName:a.name,
129
+ })
130
+ } else if(a.uid){
131
+ fileList.push({
132
+ atRatCode:a.atRatCode,
133
+ valid:a.valid,
134
+ uid: a.uid,
135
+ name: a.name,
136
+ fileKey:a.base?a.base.bytesInfoVO.code:a.fileKey,
137
+ status: "done",
138
+ url:a.url,
139
+ });
140
+ }else {
141
+ fileList.push({
142
+ atRatCode:a.atRatCode,
143
+ valid:a.valid,
144
+ uid: a.base?a.base.bytesInfoVO.code:a.fileKey,
145
+ name: a.base.fileName,
146
+ fileKey:a.base?a.base.bytesInfoVO.code:a.fileKey,
147
+ status: "done",
148
+ url: encodeURI(Units.joinPath(
149
+ Units.joinPath(Units.api(), "/v3/files"),
150
+ a.base.path
151
+ )) +
152
+ `?@token=${Units.hydrocarbonToken()}&@programToken=${Units.programCode()}&disposition=attachment`,
153
+ });
154
+ }
155
+
156
+ })
157
+ }else if (value_1.valid === true) {
158
+ fileList.push({
159
+ atRatCode:value_1.atRatCode,
160
+ uid: value_1.base.bytesInfoVO.code,
161
+ name: value_1.base.fileName,
162
+ fileKey:value_1.base.bytesInfoVO.code,
163
+ status: "done",
164
+ url:
165
+ encodeURI(Units.joinPath(
166
+ Units.joinPath(Units.api(), "/v3/files"),
167
+ value_1.base.path
168
+ )) +
169
+ `?@token=${Units.hydrocarbonToken()}&@programToken=${Units.programCode()}&disposition=attachment`,
170
+ });
171
+ }
172
+ }
173
+ return fileList;
174
+ }
175
+
176
+ render() {
177
+ const { id, itemType, disabled, value, serverKey } = this.props;
178
+ const { translate } = this.context;
179
+ const {fileList}=this.state;
180
+ let maxCount=this.props.maxCount?this.props.maxCount:1;
181
+
182
+ return (
183
+ <div>
184
+ <AntdUpload
185
+ id={id}
186
+ maxCount={maxCount}
187
+ accept={
188
+ itemType === "picture"
189
+ ? ".png, .jpg, .jpeg"
190
+ : itemType === "video"
191
+ ? ".mp4"
192
+ : undefined
193
+ }
194
+ listType={itemType == "picture" ? "picture" : "text"}
195
+ fileList={!fileList ? undefined : fileList}
196
+ disabled={disabled}
197
+ name={"file"}
198
+ headers={Super.getHeaderObj()}
199
+ action={(file) => HcserviceV3.postFileAction(serverKey, file)}
200
+ beforeUpload={this.beforeUpload}
201
+ onChange={this.handleChange}
202
+ onRemove={this.handleRemove}
203
+ >
204
+ {fileList && fileList.length >= maxCount ? (
205
+ ""
206
+ ) : (
207
+ <Button disabled={disabled}>
208
+ <UploadOutlined />{" "}
209
+ {disabled ? translate("${无需上传}") : translate("${点击上传}")}
210
+ </Button>
211
+ )}
212
+ </AntdUpload>
213
+ </div>
214
+ );
215
+ }
216
+ }
@@ -14,22 +14,9 @@ import Progress from "./progress";
14
14
  import EllipsisText from "./text/ellipsis-text";
15
15
  import { ProgramConfig, useLocale } from "../index";
16
16
  import FieldHistory from "./field-history";
17
+ import MultiFileView from "./file-view/multi-file-view";
17
18
 
18
- // const Loading = (() => {
19
- // const { translate } = useLocale();
20
19
 
21
- // return (
22
- // <Spin tip="Loading...">
23
- // <Alert
24
- // message={translate("${正在加载数据}...")}
25
- // description={translate(
26
- // "${初次访问加载数据较多, 可能需要几秒或几分钟, 请耐心等待!!}"
27
- // )}
28
- // type="info"
29
- // />
30
- // </Spin>
31
- // );
32
- // })();
33
20
  // 暂时先这样, 异步组件国际化有问题
34
21
  const Loading = <>loading</>;
35
22
 
@@ -226,6 +213,10 @@ function renderControl(
226
213
  case "video":
227
214
  viewControl = <FileView {...controlProps}></FileView>;
228
215
  break;
216
+ case "relfile":
217
+ //只是配置了,内部未做开发
218
+ viewControl = <MultiFileView {...controlProps}></MultiFileView>;
219
+ break;
229
220
  case "non-download-file":
230
221
  viewControl = (
231
222
  <FileView {...controlProps} downloadable={false}></FileView>
@@ -275,8 +275,6 @@ class ActDtmplView extends React.PureComponent<
275
275
  >
276
276
  <AntdForm.Item hidden={true} name={"actionId"}></AntdForm.Item>
277
277
  <AntdForm.Item hidden={true} name={"mainCode"}></AntdForm.Item>
278
- {/*{this.addHiddenItem(dtmplConfig.hiddenFields)}*/}
279
- {/*{this.fieldGroupList(appDtmplConfig, currentDtmplData)}*/}
280
278
  </AntdForm>
281
279
  </div>
282
280
  );
@@ -217,9 +217,7 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
217
217
  if (dtmplData) {
218
218
  data = dtmplData.arrayMap[item.id];
219
219
  }
220
- // console.log("dtmplData", dtmplData );
221
- // console.log("dtmplData data", data );
222
- // console.log("initCollapsed", dtmplData && (!data || data.length<=0));
220
+
223
221
  return (
224
222
  <RelationTable
225
223
  serverKey={serverKey}
@@ -234,7 +232,6 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
234
232
  );
235
233
  }
236
234
  } else {
237
-
238
235
  //字段组
239
236
  return (
240
237
  <CollapseCard
@@ -0,0 +1,307 @@
1
+ import React from "react";
2
+ import {Button, Card, Form as AntdForm, FormInstance, message, Tabs, Tooltip} from "antd";
3
+ import {DtmplBaseProps, DtmplConfig, DtmplData} from "../../tmpl/interface";
4
+ import {
5
+ ReloadOutlined,
6
+ ScheduleOutlined,
7
+ EditOutlined, BankOutlined,
8
+ } from "@ant-design/icons";
9
+ import HCDataSource from "../../tmpl/hc-data-source";
10
+ import "../dtmpl.css";
11
+ import SnapshotTimeline from "./snapshot-timeline";
12
+ import DtmplView from "./dtmpl-view";
13
+ import Units from "../../units";
14
+ import ToolTipBar from "../tooltipbar";
15
+ import {LocaleContext} from "../../locale/LocaleProvider";
16
+ import Action from "../../controls/action";
17
+ import HcserviceV3 from "../../tmpl/hcservice-v3";
18
+ import LtmplTable from "../../module/ltmpl-table";
19
+ import ActionUtils from "../../controls/action/utils";
20
+
21
+ export interface ActDtmplViewProps extends DtmplBaseProps {
22
+ versionId?: number;
23
+ goBackToLtmpl?: () => void,
24
+ title?: any;
25
+ showHeader?: boolean;
26
+ }
27
+
28
+ export interface ActDtmplViewStat {
29
+ loading?: boolean;
30
+ dtmplConfig?: DtmplConfig;
31
+ premisesTitle?: string;
32
+ snapshotOpen?: boolean;
33
+ layout?: object;
34
+ refreshCode?: string;
35
+ actionDtmplData?:DtmplData;
36
+ }
37
+
38
+ class TabActDtmplView extends React.PureComponent<
39
+ ActDtmplViewProps,
40
+ ActDtmplViewStat
41
+ > {
42
+ static defaultProps = {
43
+ showRightNav: true,
44
+ rightBarPositionRight: 15,
45
+ showHeader: true,
46
+ };
47
+ formRef = React.createRef<FormInstance>();
48
+ static contextType = LocaleContext;
49
+ context: React.ContextType<typeof LocaleContext>;
50
+
51
+ state = {
52
+ loading: true,
53
+ dtmplConfig: undefined,
54
+ snapshotOpen: false,
55
+ premisesTitle: "默认字段",
56
+ layout: {
57
+ labelCol: {span: 8},
58
+ wrapperCol: {span: 16},
59
+ },
60
+ refreshCode: undefined,
61
+ actionDtmplData:undefined,
62
+ };
63
+
64
+ async componentDidMount() {
65
+ const {sourceId,code, serverKey} = this.props;
66
+ let dtmplConfig = await HCDataSource.requestViewDtmplConfig(
67
+ serverKey,
68
+ sourceId
69
+ );
70
+
71
+ await this.loadActionDtmplData(dtmplConfig);
72
+
73
+ this.setState({
74
+ dtmplConfig,
75
+ });
76
+ }
77
+
78
+ loadActionDtmplData = async (dtmplConfig:DtmplConfig) => {
79
+ let actionDtmplData=undefined;
80
+ const {sourceId,code, serverKey} = this.props;
81
+ if(dtmplConfig.viewActions && dtmplConfig?.viewActions.length>0){
82
+ actionDtmplData = await HcserviceV3.requestViewDtmplData(
83
+ serverKey,
84
+ sourceId,
85
+ code,null
86
+ );
87
+ }
88
+ this.setState({
89
+ actionDtmplData,
90
+ });
91
+ };
92
+
93
+ doRefresh = async () => {
94
+ const {dtmplConfig} = this.state;
95
+ await this.loadActionDtmplData(dtmplConfig);
96
+ this.setState({
97
+ refreshCode: Units.getRandomNum(6),
98
+ });
99
+ };
100
+
101
+ goEdit = () => {
102
+ const {goDtmpl, code} = this.props;
103
+ goDtmpl(code);
104
+ };
105
+
106
+ showSnapshot = () => {
107
+ this.setState({
108
+ snapshotOpen: true,
109
+ });
110
+ };
111
+
112
+ onSnapshotClose = () => {
113
+ this.setState({
114
+ snapshotOpen: false,
115
+ });
116
+ };
117
+
118
+ toSnapshot = () => {
119
+ };
120
+
121
+ onSubmit = async (values: any) => {
122
+ this.setState({
123
+ loading: true,
124
+ });
125
+ const { sourceId, code, serverKey } = this.props;
126
+ if (code) {
127
+ //有code是修改,没有是新增实体模板
128
+ values["唯一编码"] = code;
129
+ }
130
+ let res = await HcserviceV3.postDtmplData(
131
+ serverKey,
132
+ sourceId,
133
+ values,
134
+ message
135
+ );
136
+ this.setState({
137
+ loading: false,
138
+ });
139
+ if (res.status === "success") {
140
+ if(this.props.goBackToLtmpl){
141
+ this.props.goBackToLtmpl();
142
+ }else{
143
+ this.doRefresh();
144
+ }
145
+ }
146
+ };
147
+
148
+ doSubmit = (actionId?: number, codes?: string[], params?: object) => {
149
+ const { mainCode } = this.props;
150
+ //if (actionId) {
151
+ this.formRef.current.setFieldsValue({ actionId: actionId });
152
+ // }
153
+ if (mainCode) {
154
+ this.formRef.current.setFieldsValue({ mainCode: mainCode });
155
+ }
156
+ if (params) {
157
+ this.formRef.current.setFieldsValue(params);
158
+ }
159
+ this.formRef.current.submit();
160
+ };
161
+
162
+ render() {
163
+ const {
164
+ showRightNav,
165
+ rightBarPositionRight,
166
+ code,
167
+ sourceId,
168
+ goDtmpl,
169
+ serverKey,
170
+ codeSource,
171
+ title,
172
+ showHeader
173
+ } = this.props;
174
+ const {
175
+ dtmplConfig,
176
+ premisesTitle,
177
+ loading,
178
+ layout,
179
+ snapshotOpen,
180
+ refreshCode,actionDtmplData,
181
+ } = this.state;
182
+ const {translate} = this.context;
183
+
184
+ const buttons = dtmplConfig ? dtmplConfig.buttons : undefined;
185
+ const premises = dtmplConfig ? dtmplConfig.premises : undefined;
186
+ let showRightNav_ = showRightNav;
187
+ if (dtmplConfig && dtmplConfig.groups.length < 4) {
188
+ showRightNav_ = false;
189
+ }
190
+
191
+ let items=[];
192
+ items.push( {
193
+ label: <BankOutlined size={50}/>,
194
+ key: 'main',
195
+ children: <DtmplView
196
+ codeSource={codeSource}
197
+ serverKey={serverKey}
198
+ refreshCode={refreshCode}
199
+ showRightNav={showRightNav_}
200
+ rightBarPositionRight={rightBarPositionRight}
201
+ dtmplConfig={dtmplConfig}
202
+ sourceId={sourceId}
203
+ code={code}
204
+ ></DtmplView>,
205
+ })
206
+ if(code && dtmplConfig?.viewRactions){
207
+ dtmplConfig.viewRactions.forEach(r=>{
208
+ if(ActionUtils.isShow(
209
+ r?.preposes,
210
+ [actionDtmplData],
211
+ undefined
212
+ )){
213
+ items.push( {
214
+ label: r.title,
215
+ key: r.id,
216
+ children: <LtmplTable readOnly={true}
217
+ serverKey={null}
218
+ sourceId={r.id}
219
+ mainCode={code}
220
+ ></LtmplTable>,
221
+ });
222
+ }
223
+
224
+ })
225
+ }
226
+ return (
227
+ <div
228
+ className={`detailPage ${
229
+ showRightNav_ ? "showRightNav" : "noRightNav"
230
+ }`}
231
+ ><Tabs type="card"
232
+ defaultActiveKey="main"
233
+ // size={"small"}
234
+ style={{ marginBottom: 32 }}
235
+ tabBarExtraContent={{left:<h3 style={{marginRight:20,marginLeft:10}}>{translate("${" + (title ? title : "详情") + "}")}
236
+ {dtmplConfig ? <ToolTipBar content={dtmplConfig.tip}/> : null}</h3>,
237
+ right:<div className="fr">
238
+ {buttons &&
239
+ buttons.includes("dtmplEdit") &&
240
+ goDtmpl &&
241
+ !dtmplConfig.editAction ? (
242
+ <Button className="hoverbig" onClick={this.goEdit}>
243
+ <EditOutlined/>
244
+ </Button>
245
+ ) : (
246
+ ""
247
+ )}
248
+ {dtmplConfig?.viewActions?.map((ac) => {
249
+ return (<Action
250
+ serverKey={serverKey}
251
+ iconType={"icon-title"}
252
+ hiddenType={"disabled"}
253
+ data={[actionDtmplData]}
254
+ key={ac.id}
255
+ formRef={this.formRef}
256
+ actionConfig={ac}
257
+ doAction={this.doSubmit}
258
+ ></Action>)
259
+ })}
260
+
261
+ {buttons && buttons.includes("history") ? (
262
+ <Tooltip title={translate("${数据快照}")}>
263
+ <Button className="hoverbig" onClick={this.showSnapshot}>
264
+ <ScheduleOutlined/>
265
+ </Button>
266
+ </Tooltip>
267
+ ) : (
268
+ ""
269
+ )}
270
+ <Button
271
+ className="hoverbig"
272
+ title={translate("${刷新}")}
273
+ onClick={this.doRefresh}
274
+ >
275
+ <ReloadOutlined/>
276
+ </Button>
277
+ <SnapshotTimeline
278
+ serverKey={serverKey}
279
+ dtmplConfig={dtmplConfig}
280
+ code={code}
281
+ onClose={this.onSnapshotClose}
282
+ showSnapshot={this.toSnapshot}
283
+ sourceId={sourceId}
284
+ open={snapshotOpen}
285
+ ></SnapshotTimeline>
286
+ </div>}
287
+ }
288
+ items={items}
289
+ />
290
+
291
+ <AntdForm
292
+ scrollToFirstError={true}
293
+ labelWrap={true}
294
+ ref={this.formRef}
295
+ name="control-hooks"
296
+ //onValuesChange={this.onValuesChange}
297
+ onFinish={this.onSubmit}
298
+ >
299
+ <AntdForm.Item hidden={true} name={"actionId"}></AntdForm.Item>
300
+ <AntdForm.Item hidden={true} name={"mainCode"}></AntdForm.Item>
301
+ </AntdForm>
302
+ </div>
303
+ );
304
+ }
305
+ }
306
+
307
+ export default TabActDtmplView;