aldehyde 0.2.517 → 0.2.519
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/lib/detail/view/act-dtmpl-view.d.ts +5 -1
- package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/act-dtmpl-view.js +7 -3
- package/lib/detail/view/act-dtmpl-view.js.map +1 -1
- package/lib/detail/view/audit-data-popover.d.ts +11 -0
- package/lib/detail/view/audit-data-popover.d.ts.map +1 -0
- package/lib/detail/view/audit-data-popover.js +48 -0
- package/lib/detail/view/audit-data-popover.js.map +1 -0
- package/lib/detail/view/dtmpl-view.d.ts +6 -1
- package/lib/detail/view/dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/dtmpl-view.js +21 -17
- package/lib/detail/view/dtmpl-view.js.map +1 -1
- package/lib/detail/view/field-view-group.d.ts +8 -0
- package/lib/detail/view/field-view-group.d.ts.map +1 -1
- package/lib/detail/view/field-view-group.js +15 -14
- package/lib/detail/view/field-view-group.js.map +1 -1
- package/lib/form/dtmpl-form.d.ts +12 -1
- package/lib/form/dtmpl-form.d.ts.map +1 -1
- package/lib/form/dtmpl-form.js +38 -28
- package/lib/form/dtmpl-form.js.map +1 -1
- package/lib/form/form-Item-group.d.ts +9 -0
- package/lib/form/form-Item-group.d.ts.map +1 -1
- package/lib/form/form-Item-group.js +13 -3
- package/lib/form/form-Item-group.js.map +1 -1
- package/lib/list/card-list/card-list-item.d.ts.map +1 -1
- package/lib/list/card-list/card-list-item.js +28 -6
- package/lib/list/card-list/card-list-item.js.map +1 -1
- package/lib/module/dtmpl-edit-page.d.ts +1 -0
- package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
- package/lib/module/dtmpl-edit-page.js +5 -5
- package/lib/module/dtmpl-edit-page.js.map +1 -1
- package/lib/module/dtmpl-view-card.d.ts +2 -0
- package/lib/module/dtmpl-view-card.d.ts.map +1 -1
- package/lib/module/dtmpl-view-card.js +7 -4
- package/lib/module/dtmpl-view-card.js.map +1 -1
- package/lib/module/dtmpl-view-drawer.d.ts +2 -0
- package/lib/module/dtmpl-view-drawer.d.ts.map +1 -1
- package/lib/module/dtmpl-view-drawer.js +3 -2
- package/lib/module/dtmpl-view-drawer.js.map +1 -1
- package/lib/module/dtmpl-view-modal.d.ts +2 -0
- package/lib/module/dtmpl-view-modal.d.ts.map +1 -1
- package/lib/module/dtmpl-view-modal.js +3 -2
- package/lib/module/dtmpl-view-modal.js.map +1 -1
- package/lib/module/ttmpl-table.d.ts.map +1 -1
- package/lib/module/ttmpl-table.js +1 -1
- package/lib/module/ttmpl-table.js.map +1 -1
- package/lib/routable/index.less +5 -0
- package/lib/routable/ltmpl-route.d.ts +1 -0
- package/lib/routable/ltmpl-route.d.ts.map +1 -1
- package/lib/routable/ltmpl-route.js +37 -7
- package/lib/routable/ltmpl-route.js.map +1 -1
- package/lib/routable/ttmpl-table-route.d.ts.map +1 -1
- package/lib/routable/ttmpl-table-route.js +1 -1
- package/lib/routable/ttmpl-table-route.js.map +1 -1
- package/lib/table/act-table.d.ts +2 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +4 -4
- package/lib/table/act-table.js.map +1 -1
- package/lib/table/column/column-builder.d.ts.map +1 -1
- package/lib/table/column/column-builder.js +19 -7
- package/lib/table/column/column-builder.js.map +1 -1
- package/lib/table/pagination.js +1 -1
- package/lib/table/pagination.js.map +1 -1
- package/lib/table/relation-table.d.ts +5 -0
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/table/relation-table.js +54 -10
- package/lib/table/relation-table.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +1 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +13 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +16 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js +1 -0
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/units/index.d.ts +2 -0
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +48 -2
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +11 -3
- package/src/aldehyde/detail/view/audit-data-popover.tsx +70 -0
- package/src/aldehyde/detail/view/dtmpl-view.tsx +23 -27
- package/src/aldehyde/detail/view/field-view-group.tsx +16 -19
- package/src/aldehyde/form/dtmpl-form.tsx +62 -56
- package/src/aldehyde/form/form-Item-group.tsx +16 -5
- package/src/aldehyde/list/card-list/card-list-item.tsx +26 -7
- package/src/aldehyde/module/dtmpl-edit-page.tsx +10 -1
- package/src/aldehyde/module/dtmpl-view-card.tsx +39 -34
- package/src/aldehyde/module/dtmpl-view-drawer.tsx +4 -2
- package/src/aldehyde/module/dtmpl-view-modal.tsx +4 -2
- package/src/aldehyde/module/ttmpl-table.tsx +1 -0
- package/src/aldehyde/routable/index.less +5 -0
- package/src/aldehyde/routable/ltmpl-route.tsx +39 -4
- package/src/aldehyde/routable/ttmpl-table-route.tsx +1 -0
- package/src/aldehyde/table/act-table.tsx +6 -4
- package/src/aldehyde/table/column/column-builder.tsx +13 -2
- package/src/aldehyde/table/pagination.tsx +1 -1
- package/src/aldehyde/table/relation-table.tsx +77 -16
- package/src/aldehyde/tmpl/hcservice-v3.tsx +11 -0
- package/src/aldehyde/tmpl/interface.tsx +19 -3
- package/src/aldehyde/units/index.tsx +46 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Button, Popover, Table } from "antd";
|
|
3
|
+
import { OneToOneOutlined } from "@ant-design/icons";
|
|
4
|
+
import { AuditData, DtmplConfig } from "../../tmpl/interface";
|
|
5
|
+
import ViewControl from "../../controls/view-control";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
translate: Function;
|
|
9
|
+
auditData: AuditData;
|
|
10
|
+
serverKey: string;
|
|
11
|
+
dtmplConfig?: DtmplConfig;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Index = (props: Props) => {
|
|
15
|
+
const { translate, auditData, dtmplConfig, serverKey } = props;
|
|
16
|
+
|
|
17
|
+
const columns = [
|
|
18
|
+
{
|
|
19
|
+
title: translate("${变更数据}"),
|
|
20
|
+
dataIndex: 'fieldTitle',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: translate("${当前数据}"),
|
|
24
|
+
dataIndex: 'entityVal',
|
|
25
|
+
render: (text, record) => {
|
|
26
|
+
return <ViewControl
|
|
27
|
+
serverKey={serverKey}
|
|
28
|
+
holderType={"table"}
|
|
29
|
+
fieldConfig={record.field}
|
|
30
|
+
value={record.entityVal}
|
|
31
|
+
/>;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: translate("${变更前}"),
|
|
36
|
+
dataIndex: 'previousVal',
|
|
37
|
+
render: (text, record) => {
|
|
38
|
+
return <ViewControl
|
|
39
|
+
serverKey={serverKey}
|
|
40
|
+
holderType={"table"}
|
|
41
|
+
fieldConfig={record.field}
|
|
42
|
+
value={record.previousVal}
|
|
43
|
+
/>;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const dataSource = useMemo(() => {
|
|
49
|
+
if (!auditData) return [];
|
|
50
|
+
const { changeInfo, entity, previous } = auditData;
|
|
51
|
+
const fields = dtmplConfig?.groups?.[0]?.fields || [];
|
|
52
|
+
const temData = changeInfo?.changeFields?.map(item => {
|
|
53
|
+
const field = fields?.find(r => r.id === item);
|
|
54
|
+
const entityVal = entity?.fieldMap?.[item];
|
|
55
|
+
const previousVal = previous?.fieldMap?.[item];
|
|
56
|
+
return { fieldTitle: translate("${" + field?.title + "}"), entityVal, previousVal, field };
|
|
57
|
+
});
|
|
58
|
+
return temData;
|
|
59
|
+
}, [auditData])
|
|
60
|
+
|
|
61
|
+
const content = <Table columns={columns} dataSource={dataSource} pagination={false} />;
|
|
62
|
+
|
|
63
|
+
return <Popover content={content} trigger="click">
|
|
64
|
+
<Button className="hoverbig" title={translate("${数据对比}")}>
|
|
65
|
+
<OneToOneOutlined />
|
|
66
|
+
</Button>
|
|
67
|
+
</Popover>;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default Index;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DtmplBaseProps,
|
|
4
4
|
DtmplConfig,
|
|
5
5
|
DtmplData,
|
|
6
|
-
FieldGroupConfig,
|
|
6
|
+
FieldGroupConfig, AuditData
|
|
7
7
|
} from "../../tmpl/interface";
|
|
8
8
|
import RelationTable from "../../table/relation-table";
|
|
9
9
|
import FieldViewGroup from "./field-view-group";
|
|
@@ -16,6 +16,7 @@ import TmplConfigAnalysis from "../../tmpl/tmpl-config-analysis";
|
|
|
16
16
|
import { Card, Tabs } from "antd";
|
|
17
17
|
import LtmplTable from "../../module/ltmpl-table";
|
|
18
18
|
import DtmplViewCard from "../../module/dtmpl-view-card";
|
|
19
|
+
import { ProgramConfig } from "../../index";
|
|
19
20
|
|
|
20
21
|
export interface DtmplViewProps extends DtmplBaseProps {
|
|
21
22
|
versionId?: number;
|
|
@@ -23,6 +24,8 @@ export interface DtmplViewProps extends DtmplBaseProps {
|
|
|
23
24
|
refreshCode?: string;
|
|
24
25
|
parentId?: string;
|
|
25
26
|
tabBarExtraContent?: ReactNode;
|
|
27
|
+
isAudit?: boolean; // 是否审计
|
|
28
|
+
getAuditData?: (val: AuditData) => void; // 获取审计变更数据
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
export interface DtmplViewStat {
|
|
@@ -31,12 +34,14 @@ export interface DtmplViewStat {
|
|
|
31
34
|
dtmplData?: DtmplData;
|
|
32
35
|
premisesTitle?: string;
|
|
33
36
|
layout?: object;
|
|
37
|
+
auditData?: AuditData;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
|
|
37
41
|
static defaultProps = {
|
|
38
42
|
showRightNav: true,
|
|
39
43
|
maxColsOnRow: 2,
|
|
44
|
+
isAudit: false,
|
|
40
45
|
};
|
|
41
46
|
|
|
42
47
|
state = {
|
|
@@ -44,6 +49,7 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
|
|
|
44
49
|
id: "dtmplView" + Units.getRandomNum(6),
|
|
45
50
|
snapshotOpen: false,
|
|
46
51
|
dtmplData: undefined,
|
|
52
|
+
auditData: undefined,
|
|
47
53
|
premisesTitle: "默认字段",
|
|
48
54
|
layout: {
|
|
49
55
|
labelCol: { span: 8 },
|
|
@@ -72,36 +78,24 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
|
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
loadData = async () => {
|
|
75
|
-
const {
|
|
76
|
-
sourceId,
|
|
77
|
-
code: propsCode,
|
|
78
|
-
versionId,
|
|
79
|
-
serverKey,
|
|
80
|
-
codeSource,
|
|
81
|
-
} = this.props;
|
|
81
|
+
const { sourceId, code: propsCode, versionId, serverKey, codeSource, isAudit, getAuditData } = this.props;
|
|
82
82
|
let code = propsCode;
|
|
83
83
|
if (!code && codeSource) {
|
|
84
84
|
code = await HcserviceV3.queryCode(sourceId, codeSource, serverKey);
|
|
85
85
|
}
|
|
86
86
|
if (code) {
|
|
87
|
-
this.setState({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
code,
|
|
95
|
-
|
|
96
|
-
);
|
|
97
|
-
this.setState({
|
|
98
|
-
dtmplData,
|
|
99
|
-
loading: false,
|
|
100
|
-
});
|
|
87
|
+
this.setState({ loading: true, dtmplData: undefined });
|
|
88
|
+
let dtmplData, auditData;
|
|
89
|
+
if (isAudit) { // 审计查看页面
|
|
90
|
+
auditData = await HcserviceV3.requestViewDtmplAuditData(serverKey, sourceId, code, versionId);
|
|
91
|
+
dtmplData = { ...(auditData?.entity || {}), sourceId: auditData?.sourceId };
|
|
92
|
+
getAuditData(auditData);
|
|
93
|
+
} else { // 普通查看页面
|
|
94
|
+
dtmplData = await HcserviceV3.requestViewDtmplData(serverKey, sourceId, code, versionId);
|
|
95
|
+
}
|
|
96
|
+
this.setState({ dtmplData, auditData, loading: false });
|
|
101
97
|
} else {
|
|
102
|
-
this.setState({
|
|
103
|
-
loading: false,
|
|
104
|
-
});
|
|
98
|
+
this.setState({ loading: false });
|
|
105
99
|
}
|
|
106
100
|
};
|
|
107
101
|
|
|
@@ -111,9 +105,9 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
|
|
|
111
105
|
serverKey,
|
|
112
106
|
mainCode,
|
|
113
107
|
showRightNav,
|
|
114
|
-
parentId, maxColsOnRow, code
|
|
108
|
+
parentId, maxColsOnRow, code, isAudit
|
|
115
109
|
} = this.props;
|
|
116
|
-
const { dtmplData, loading, id } = this.state;
|
|
110
|
+
const { dtmplData, loading, id, auditData } = this.state;
|
|
117
111
|
const { pageLayout } = dtmplConfig;
|
|
118
112
|
let groups: FieldGroupConfig[] = [];
|
|
119
113
|
if (dtmplConfig) {
|
|
@@ -224,6 +218,7 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
|
|
|
224
218
|
value={data}
|
|
225
219
|
viewOrEdit={"view"}
|
|
226
220
|
showCollapseCard={pageLayout !== "horizontalTabs"}
|
|
221
|
+
audit={{ isAudit, previousData: ProgramConfig.arrayToMap(auditData?.previous?.arrayMap?.[item.id], "code"), changeInfo: auditData?.changeInfo?.arrayChangeInfos?.[item.id] }}
|
|
227
222
|
/>;
|
|
228
223
|
return pageLayout === "horizontalTabs" ? { key: item.id, label: item.title, children } : children;
|
|
229
224
|
}
|
|
@@ -234,6 +229,7 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
|
|
|
234
229
|
fields={item.fields}
|
|
235
230
|
valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
236
231
|
width={220}
|
|
232
|
+
audit={{ isAudit, auditMap: auditData?.previous?.fieldMap || undefined, changeFields: auditData?.changeInfo?.changeFields }}
|
|
237
233
|
/>;
|
|
238
234
|
return (
|
|
239
235
|
pageLayout === "horizontalTabs" ?
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Descriptions } from "antd";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { Descriptions, Tooltip } from "antd";
|
|
3
3
|
import { FieldConfig } from "../../tmpl/interface";
|
|
4
4
|
import ViewControl from "../../controls/view-control";
|
|
5
5
|
import { LocaleContext } from "../../locale/LocaleProvider";
|
|
@@ -12,6 +12,7 @@ interface FieldViewGroupProps {
|
|
|
12
12
|
width?: number;
|
|
13
13
|
dataCode?: string;
|
|
14
14
|
column?: number;
|
|
15
|
+
audit?: { isAudit: boolean, auditMap?: object, changeFields?: string[] }; // 是否审计查看,审计查看配置
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
interface FieldViewGroupState {
|
|
@@ -30,41 +31,37 @@ export default class FieldViewGroup extends React.PureComponent<
|
|
|
30
31
|
}
|
|
31
32
|
static defaultProps = {
|
|
32
33
|
column: 2,
|
|
34
|
+
audit: { isAudit: false }
|
|
33
35
|
};
|
|
34
36
|
static contextType = LocaleContext;
|
|
35
37
|
context: React.ContextType<typeof LocaleContext>;
|
|
36
38
|
|
|
37
39
|
initViewList = () => {
|
|
38
|
-
const { fields, valueMap, serverKey, dataCode } = this.props;
|
|
40
|
+
const { fields, valueMap, serverKey, dataCode, audit } = this.props;
|
|
39
41
|
const { translate } = this.context;
|
|
40
42
|
const formItemList = [];
|
|
41
43
|
|
|
42
44
|
if (fields.length > 0) {
|
|
43
45
|
fields.forEach((item, index) => {
|
|
44
|
-
const title = item.title;
|
|
45
46
|
let fieldValue = valueMap ? valueMap[item.id] : undefined;
|
|
46
47
|
//fieldValue 没有值时不能为null 要为 undefined。antd input所限制
|
|
47
|
-
fieldValue = fieldValue
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
fieldValue = fieldValue ? fieldValue : item.defaultValue ? item.defaultValue : undefined;
|
|
49
|
+
let label: ReactNode = translate("${" + item.title + "}");
|
|
50
|
+
if (audit?.isAudit && audit.changeFields?.includes(item.id)) { // 审计查看页面-上次更新内容在label标注
|
|
51
|
+
const tValue = audit.auditMap ? audit.auditMap[item.id] : undefined;
|
|
52
|
+
const tTitle = <ViewControl dataCode={dataCode} serverKey={serverKey} holderType={"descriptions"} value={tValue} fieldConfig={item} />
|
|
53
|
+
label = <span style={{ cursor: "pointer", color: "#ff4d4f" }}>{label}</span>;
|
|
54
|
+
label = (tValue || tValue === 0) ? <Tooltip title={tTitle}>{label}</Tooltip> : label;
|
|
55
|
+
}
|
|
56
|
+
if (item.extControlType !== "hidden" && !item.hidden) {
|
|
55
57
|
const formItem = (
|
|
56
58
|
<Descriptions.Item
|
|
57
|
-
label={
|
|
59
|
+
label={label}
|
|
58
60
|
span={item.colSpan}
|
|
59
61
|
key={index}
|
|
60
62
|
className="labelcss"
|
|
61
63
|
>
|
|
62
|
-
<div
|
|
63
|
-
className="description-content"
|
|
64
|
-
style={{
|
|
65
|
-
width: "100%",
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
64
|
+
<div className="description-content" style={{ width: "100%" }}>
|
|
68
65
|
<ViewControl
|
|
69
66
|
dataCode={dataCode}
|
|
70
67
|
serverKey={serverKey}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Card,
|
|
5
5
|
Form as AntdForm,
|
|
6
6
|
message,
|
|
7
|
-
Switch,
|
|
7
|
+
Switch, Collapse
|
|
8
8
|
} from "antd";
|
|
9
9
|
import {
|
|
10
10
|
DtmplConfig,
|
|
@@ -27,6 +27,9 @@ import LtmplTable from "../module/ltmpl-table";
|
|
|
27
27
|
import TmplConfigAnalysis from "../tmpl/tmpl-config-analysis";
|
|
28
28
|
import DtmplViewCard from "../module/dtmpl-view-card";
|
|
29
29
|
import { LocaleContext } from "../locale/LocaleProvider";
|
|
30
|
+
import AuditDataPopover from "../detail/view/audit-data-popover";
|
|
31
|
+
|
|
32
|
+
interface AuditData { entity: DtmplData, previous?: DtmplData, changeInfo?: { changeFields: string[], arrayChangeInfos: object } }; // 审计对比数据
|
|
30
33
|
|
|
31
34
|
interface DtmplFormStat {
|
|
32
35
|
loading?: boolean;
|
|
@@ -35,6 +38,7 @@ interface DtmplFormStat {
|
|
|
35
38
|
embedForm?: object;
|
|
36
39
|
embedRefValue?: object;
|
|
37
40
|
editingGroups?: string[];
|
|
41
|
+
auditData?: AuditData;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
export default class DtmplForm extends React.PureComponent<
|
|
@@ -49,6 +53,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
49
53
|
state = {
|
|
50
54
|
loading: true,
|
|
51
55
|
currentDtmplData: undefined,
|
|
56
|
+
auditData: undefined,
|
|
52
57
|
appDtmplConfig: undefined,
|
|
53
58
|
embedForm: {},
|
|
54
59
|
embedRefValue: {},
|
|
@@ -58,6 +63,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
58
63
|
maxCols: 2,
|
|
59
64
|
showHeader: true,
|
|
60
65
|
showRightNav: false,
|
|
66
|
+
isAudit: false,
|
|
61
67
|
};
|
|
62
68
|
|
|
63
69
|
async componentDidMount() {
|
|
@@ -73,51 +79,31 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
loadData = async () => {
|
|
76
|
-
const {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
dtmplConfig,
|
|
82
|
-
serverKey,
|
|
83
|
-
} = this.props;
|
|
84
|
-
let dtmplData_;
|
|
85
|
-
if (code) {
|
|
86
|
-
this.setState({
|
|
87
|
-
loading: true,
|
|
88
|
-
});
|
|
89
|
-
dtmplData_ = await HcserviceV3.requestDtmplData(
|
|
90
|
-
serverKey,
|
|
91
|
-
sourceId,
|
|
92
|
-
code,
|
|
93
|
-
null
|
|
94
|
-
);
|
|
95
|
-
} else if (dtmplData) {
|
|
96
|
-
dtmplData_ = dtmplData;
|
|
82
|
+
const { sourceId, code, formRef, dtmplData, serverKey, isAudit } = this.props;
|
|
83
|
+
let dtmplData_, auditData_;
|
|
84
|
+
if (isAudit && code) { // 审计编辑页面
|
|
85
|
+
auditData_ = await HcserviceV3.requestViewDtmplAuditData(serverKey, sourceId, code, null);
|
|
86
|
+
dtmplData_ = { ...(auditData_?.entity || {}), sourceId: auditData_?.sourceId };
|
|
97
87
|
} else {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
88
|
+
if (dtmplData) {
|
|
89
|
+
dtmplData_ = dtmplData;
|
|
90
|
+
} else if (code) {
|
|
91
|
+
this.setState({ loading: true });
|
|
92
|
+
dtmplData_ = await HcserviceV3.requestDtmplData(serverKey, sourceId, code, null);
|
|
93
|
+
} else {
|
|
94
|
+
dtmplData_ = { code: undefined, title: undefined, fieldMap: {}, arrayMap: {} };
|
|
95
|
+
}
|
|
104
96
|
}
|
|
105
97
|
//应用静态配置
|
|
106
|
-
let appDtmplConfig = ProgramConfig.getAppDtmplConfig(
|
|
107
|
-
dtmplConfig,
|
|
108
|
-
dtmplData,
|
|
109
|
-
this.props
|
|
110
|
-
);
|
|
98
|
+
let appDtmplConfig = ProgramConfig.getAppDtmplConfig(this.props.dtmplConfig, dtmplData, this.props);
|
|
111
99
|
this.setState({
|
|
112
100
|
appDtmplConfig,
|
|
113
101
|
currentDtmplData: dtmplData_,
|
|
102
|
+
auditData: auditData_,
|
|
114
103
|
loading: false,
|
|
115
104
|
embedRefValue: {},
|
|
116
105
|
});
|
|
117
|
-
setTimeout(
|
|
118
|
-
() => (formRef.current ? formRef.current.resetFields() : undefined),
|
|
119
|
-
200
|
|
120
|
-
);
|
|
106
|
+
setTimeout(() => (formRef.current ? formRef.current.resetFields() : undefined), 200);
|
|
121
107
|
};
|
|
122
108
|
|
|
123
109
|
doRefresh = async () => {
|
|
@@ -271,16 +257,8 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
271
257
|
}
|
|
272
258
|
};
|
|
273
259
|
|
|
274
|
-
fieldGroupList = (dtmplConfig: DtmplConfig, dtmplData: DtmplData) => {
|
|
275
|
-
const {
|
|
276
|
-
parentId,
|
|
277
|
-
maxColsOnRow,
|
|
278
|
-
mainCode,
|
|
279
|
-
formRef,
|
|
280
|
-
serverKey,
|
|
281
|
-
showRightNav,
|
|
282
|
-
valueFieldMap
|
|
283
|
-
} = this.props;
|
|
260
|
+
fieldGroupList = (dtmplConfig: DtmplConfig, dtmplData: DtmplData, auditData: AuditData) => {
|
|
261
|
+
const { parentId, maxColsOnRow, mainCode, formRef, serverKey, showRightNav, valueFieldMap, isAudit } = this.props;
|
|
284
262
|
const { loading, embedForm } = this.state;
|
|
285
263
|
let groups: FieldGroupConfig[] = [];
|
|
286
264
|
if (dtmplConfig) {
|
|
@@ -383,8 +361,16 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
383
361
|
if (dtmplData) {
|
|
384
362
|
data = dtmplData.arrayMap[item.id];
|
|
385
363
|
}
|
|
386
|
-
|
|
387
|
-
|
|
364
|
+
return <CollapseCard
|
|
365
|
+
showRightNav={showRightNav}
|
|
366
|
+
initCollapse={item.displayConfig.includes("folded")}
|
|
367
|
+
title={item.title}
|
|
368
|
+
tip={item.tip}
|
|
369
|
+
id={parentId + item.id}
|
|
370
|
+
className="hoverable"
|
|
371
|
+
styles={{ header: { background: "#f2f4f5" }, body: { padding: "6px" } }}
|
|
372
|
+
loading={loading}
|
|
373
|
+
>
|
|
388
374
|
<RelationTable
|
|
389
375
|
showRightNav={showRightNav}
|
|
390
376
|
serverKey={serverKey}
|
|
@@ -396,12 +382,30 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
396
382
|
value={data}
|
|
397
383
|
parentFormInstance={formRef?.current}
|
|
398
384
|
viewOrEdit={item.readOnly ? "view" : "edit"}
|
|
399
|
-
onEditing={(editing) =>
|
|
400
|
-
this.onGroupEditing(item.id, editing);
|
|
401
|
-
}}
|
|
385
|
+
onEditing={(editing) => this.onGroupEditing(item.id, editing)}
|
|
402
386
|
onChange={this.onGroupChange}
|
|
387
|
+
showCollapseCard={false}
|
|
403
388
|
/>
|
|
404
|
-
|
|
389
|
+
{(isAudit && auditData?.changeInfo?.arrayChangeInfos?.[item.id]?.length) ?
|
|
390
|
+
<Collapse ghost size="small"
|
|
391
|
+
styles={{ header: { padding: "6px 0", color: "red" } }}
|
|
392
|
+
items={[{
|
|
393
|
+
key: "audit", label: "变更数据",
|
|
394
|
+
children: <RelationTable
|
|
395
|
+
serverKey={serverKey}
|
|
396
|
+
initCollapse={dtmplData && (!data || data.length <= 0)}
|
|
397
|
+
loading={loading}
|
|
398
|
+
parentId={parentId}
|
|
399
|
+
key={item.id}
|
|
400
|
+
fieldGroupConfig={item}
|
|
401
|
+
value={data}
|
|
402
|
+
viewOrEdit={"view"}
|
|
403
|
+
showCollapseCard={false}
|
|
404
|
+
audit={{ isAudit, previousData: ProgramConfig.arrayToMap(auditData?.previous?.arrayMap?.[item.id], "code"), changeInfo: auditData?.changeInfo?.arrayChangeInfos?.[item.id] }}
|
|
405
|
+
/>
|
|
406
|
+
}]} />
|
|
407
|
+
: ""}
|
|
408
|
+
</CollapseCard>;
|
|
405
409
|
}
|
|
406
410
|
} else {
|
|
407
411
|
//字段组
|
|
@@ -431,6 +435,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
431
435
|
valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
432
436
|
valueFieldMap={valueFieldMap}
|
|
433
437
|
editStatus={dtmplData?.code ? "changed" : "new"} // 新增或修改状态
|
|
438
|
+
audit={{ dataCode: dtmplData ? dtmplData.code : null, isAudit, auditMap: auditData?.previous?.fieldMap || undefined, changeFields: auditData?.changeInfo?.changeFields }}
|
|
434
439
|
/>}
|
|
435
440
|
</CollapseCard>
|
|
436
441
|
);
|
|
@@ -489,9 +494,9 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
489
494
|
code,
|
|
490
495
|
parentId,
|
|
491
496
|
showHeader,
|
|
492
|
-
serverKey, dtmplData,
|
|
497
|
+
serverKey, dtmplData, isAudit
|
|
493
498
|
} = this.props;
|
|
494
|
-
const { currentDtmplData, appDtmplConfig } = this.state;
|
|
499
|
+
const { currentDtmplData, appDtmplConfig, auditData } = this.state;
|
|
495
500
|
const { translate } = this.context;
|
|
496
501
|
if (!dtmplConfig || !dtmplData) {
|
|
497
502
|
return <Card loading={true}>{translate("${加载中}")}... ...</Card>;
|
|
@@ -514,6 +519,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
514
519
|
: translate("[${新增}]")}
|
|
515
520
|
{dtmplConfig ? <ToolTipBar content={dtmplConfig.tip} /> : null}
|
|
516
521
|
<div className="fr">
|
|
522
|
+
{isAudit ? <AuditDataPopover translate={translate} auditData={auditData} dtmplConfig={dtmplConfig} serverKey={serverKey} /> : ""}
|
|
517
523
|
{buttons && buttons.includes("fusionMode") ? (
|
|
518
524
|
<Switch
|
|
519
525
|
checkedChildren={translate("${开}")}
|
|
@@ -549,7 +555,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
549
555
|
<AntdForm.Item hidden={true} name={"actionId"}></AntdForm.Item>
|
|
550
556
|
<AntdForm.Item hidden={true} name={"mainCode"}></AntdForm.Item>
|
|
551
557
|
{this.addHiddenItem(dtmplConfig.hiddenFields)}
|
|
552
|
-
{this.fieldGroupList(appDtmplConfig, currentDtmplData)}
|
|
558
|
+
{this.fieldGroupList(appDtmplConfig, currentDtmplData, auditData)}
|
|
553
559
|
</AntdForm>
|
|
554
560
|
{premises && premises.length > 0 ? (
|
|
555
561
|
<CollapseCard
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { RefObject, useState, useMemo } from "react";
|
|
2
|
-
import { Col, Form, Row, Popconfirm } from "antd";
|
|
1
|
+
import React, { RefObject, useState, useMemo, ReactNode } from "react";
|
|
2
|
+
import { Col, Form, Row, Popconfirm, Tooltip } from "antd";
|
|
3
3
|
import { FieldConfig, EditStatus } from "../tmpl/interface";
|
|
4
4
|
import EntryControl from "../controls/entry-control";
|
|
5
|
+
import ViewControl from "../controls/view-control";
|
|
5
6
|
import Units from "../units";
|
|
6
7
|
import { FormInstance } from "antd/lib/form/hooks/useForm";
|
|
7
8
|
import { LocaleContext } from "../locale/LocaleProvider";
|
|
@@ -66,7 +67,8 @@ export interface FieldGroupProps {
|
|
|
66
67
|
dataCode?: string,
|
|
67
68
|
layout?: "horizontal" | "vertical";
|
|
68
69
|
valueFieldMap?: { [key: string]: any }; // 表单关联项配置
|
|
69
|
-
editStatus?: EditStatus
|
|
70
|
+
editStatus?: EditStatus;
|
|
71
|
+
audit?: { dataCode: string; isAudit: boolean, auditMap?: object, changeFields?: string[] }; // 是否审计编辑,审计编辑配置
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
interface FieldGroupState {
|
|
@@ -80,6 +82,7 @@ export default class FormItemGroup extends React.PureComponent<
|
|
|
80
82
|
static defaultProps = {
|
|
81
83
|
nameAttr: "id",
|
|
82
84
|
maxColsOnRow: 2,
|
|
85
|
+
audit: { isAudit: false }
|
|
83
86
|
};
|
|
84
87
|
static contextType = LocaleContext;
|
|
85
88
|
context: React.ContextType<typeof LocaleContext>;
|
|
@@ -125,7 +128,7 @@ export default class FormItemGroup extends React.PureComponent<
|
|
|
125
128
|
return fieldConfig;
|
|
126
129
|
};
|
|
127
130
|
initFormItem = (fieldConfig: FieldConfig, fieldValue) => {
|
|
128
|
-
const { nameAttr, maxColsOnRow, layout } = this.props;
|
|
131
|
+
const { nameAttr, maxColsOnRow, layout, serverKey, audit } = this.props;
|
|
129
132
|
const { translate } = this.context;
|
|
130
133
|
let item = this.getFieldConfig(fieldConfig);
|
|
131
134
|
|
|
@@ -139,9 +142,17 @@ export default class FormItemGroup extends React.PureComponent<
|
|
|
139
142
|
wrapperColSpan = maxColsOnRow == 1 ? 18 : item.colSpan == 1 ? 15 : 19;
|
|
140
143
|
}
|
|
141
144
|
|
|
145
|
+
let label: ReactNode = translate("${" + item.title + "}");
|
|
146
|
+
if (audit?.isAudit && audit.changeFields?.includes(item.id)) { // 审计查看页面-上次更新内容在label标注
|
|
147
|
+
const tValue = audit.auditMap ? audit.auditMap[item.id] : undefined;
|
|
148
|
+
const tTitle = <ViewControl dataCode={audit.dataCode} serverKey={serverKey} holderType={"descriptions"} value={tValue} fieldConfig={item} />
|
|
149
|
+
label = <span style={{ cursor: "pointer", color: "#ff4d4f" }}>{label}</span>;
|
|
150
|
+
label = (tValue || tValue === 0) ? <Tooltip title={tTitle}>{label}</Tooltip> : label;
|
|
151
|
+
}
|
|
152
|
+
|
|
142
153
|
return (
|
|
143
154
|
<FormItem
|
|
144
|
-
label={
|
|
155
|
+
label={label}
|
|
145
156
|
noStyle={item.noStyle || false}
|
|
146
157
|
hidden={item.hidden}
|
|
147
158
|
name={fieldConfig.controlType == "field-history" ? undefined : item[nameAttr]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { useLocale } from "../../locale/useLocale";
|
|
3
|
-
import { Card, Row, Col, Empty } from "antd";
|
|
3
|
+
import { Card, Row, Col, Empty, Space } from "antd";
|
|
4
4
|
import ViewControl from "../../controls/view-control";
|
|
5
5
|
import { CardListConfig } from "../../tmpl/interface";
|
|
6
6
|
import CustomDetailModalPage from "../../custom-page/custom-detail-modal-page";
|
|
@@ -14,7 +14,7 @@ type Props = {
|
|
|
14
14
|
sourceId?: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const dataKeys = ["primaryColumn", "primaryColumnLabel", "secondColumn", "secondColumnLabel", "cardShowCols", "labelColumn", "mainPicture", "mainPictureLabel"];
|
|
17
|
+
const dataKeys = ["primaryColumn", "primaryColumnLabel", "secondColumn", "secondColumnLabel", "cardShowCols", "labelColumn", "mainPicture", "mainPictureLabel", "secondaryPicture"];
|
|
18
18
|
|
|
19
19
|
const Index = (props: Props) => {
|
|
20
20
|
const { cardListConfig, item, renderOpt, serverKey, sourceId } = props;
|
|
@@ -40,7 +40,7 @@ const Index = (props: Props) => {
|
|
|
40
40
|
const value = item[itemConfig.id];
|
|
41
41
|
const element = <ViewControl serverKey={serverKey} holderType="table" value={value} fieldConfig={type === "mainPicture" ? { ...itemConfig, isFallback: true, preview: false, defShowIcon: false } : itemConfig} />;
|
|
42
42
|
const title = itemConfig.title;
|
|
43
|
-
return { element, value, title };
|
|
43
|
+
return { element, value, title, itemConfig };
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
useEffect(() => {
|
|
@@ -60,6 +60,28 @@ const Index = (props: Props) => {
|
|
|
60
60
|
setDetailOpen(true);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
const renderPictures = () => {
|
|
64
|
+
const secondaryPictureConfig = cardListConfig["secondaryPicture"];
|
|
65
|
+
if (secondaryPictureConfig) { // 存在次图片字段,显示图片列表
|
|
66
|
+
let tElement;
|
|
67
|
+
const dMainPicture = data["mainPicture"];
|
|
68
|
+
const dSPicture = data["secondaryPicture"];
|
|
69
|
+
if (["relfile", "relimage"].includes(secondaryPictureConfig.controlType)) {
|
|
70
|
+
const dSValue = JSON.parse(dSPicture?.value || "[]");
|
|
71
|
+
const tValue = dMainPicture?.value ? [dMainPicture?.value, ...dSValue] : dSValue;
|
|
72
|
+
tElement = dSPicture ? <ViewControl serverKey={serverKey} holderType="table" value={tValue} fieldConfig={dSPicture?.itemConfig} /> : dMainPicture?.element;
|
|
73
|
+
} else {
|
|
74
|
+
tElement = <Space wrap>{dMainPicture?.element}{dSPicture?.element}</Space>
|
|
75
|
+
}
|
|
76
|
+
return <div style={{ padding: "6px" }}>{tElement}</div>;
|
|
77
|
+
} else { // 普通主图
|
|
78
|
+
return data["mainPicture"] ? <div className="card-main-picture">
|
|
79
|
+
{data["mainPicture"].value ? data["mainPicture"].element : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={translate("${暂无图片}")} />}
|
|
80
|
+
<div className="card-main-picture-label">{data["mainPictureLabel"].element}</div>
|
|
81
|
+
</div> : "";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
63
85
|
return (
|
|
64
86
|
<Card className="card-list-item" styles={{ body: { height: "100%", padding: "0 12px 12px" } }} >
|
|
65
87
|
<div className="card-list-item-body">
|
|
@@ -84,10 +106,7 @@ const Index = (props: Props) => {
|
|
|
84
106
|
</div>
|
|
85
107
|
</div>
|
|
86
108
|
<div className="card-list-item-main" onClick={onClickDetail}>
|
|
87
|
-
{
|
|
88
|
-
{data["mainPicture"].value ? data["mainPicture"].element : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={translate("${暂无图片}")} />}
|
|
89
|
-
<div className="card-main-picture-label">{data["mainPictureLabel"].element}</div>
|
|
90
|
-
</div> : ""}
|
|
109
|
+
{renderPictures()}
|
|
91
110
|
{data["cardShowCols"] ?
|
|
92
111
|
<div className="card-show-cols">
|
|
93
112
|
<Row gutter={6}>
|
|
@@ -41,6 +41,7 @@ interface ModalEditorProps extends DtmplBaseProps {
|
|
|
41
41
|
title?: ReactNode;
|
|
42
42
|
extendButtons?: ReactNode[];
|
|
43
43
|
isCopy?: boolean;
|
|
44
|
+
isAudit?: boolean; // 是否审计编辑页
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
interface ModalEditorState {
|
|
@@ -488,11 +489,12 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
488
489
|
sourceId,
|
|
489
490
|
open,
|
|
490
491
|
mainCode,
|
|
492
|
+
code,
|
|
491
493
|
width,
|
|
492
494
|
pageType,
|
|
493
495
|
maxColsOnRow,
|
|
494
496
|
title,
|
|
495
|
-
serverKey, parentFormInstance
|
|
497
|
+
serverKey, parentFormInstance, isAudit
|
|
496
498
|
} = this.props;
|
|
497
499
|
const { dtmplConfig, id, dtmplData, valueFieldMap, drawerSize } = this.state;
|
|
498
500
|
const placement = this.props.placement || "left";
|
|
@@ -535,6 +537,8 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
535
537
|
onValuesChange={this.onValuesChange}
|
|
536
538
|
parentFormInstance={parentFormInstance}
|
|
537
539
|
valueFieldMap={valueFieldMap}
|
|
540
|
+
isAudit={isAudit}
|
|
541
|
+
code={code}
|
|
538
542
|
/>
|
|
539
543
|
</div>
|
|
540
544
|
</Scrollbars>}
|
|
@@ -550,6 +554,7 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
550
554
|
size={drawerSize}
|
|
551
555
|
maxSize={maxSize}
|
|
552
556
|
closable={true}
|
|
557
|
+
destroyOnHidden={true}
|
|
553
558
|
mask={false}
|
|
554
559
|
onClose={onCancel}
|
|
555
560
|
open={open}
|
|
@@ -572,6 +577,8 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
572
577
|
onValuesChange={this.onValuesChange}
|
|
573
578
|
parentFormInstance={parentFormInstance}
|
|
574
579
|
valueFieldMap={valueFieldMap}
|
|
580
|
+
isAudit={isAudit}
|
|
581
|
+
code={code}
|
|
575
582
|
/>
|
|
576
583
|
</div>
|
|
577
584
|
</Drawer>
|
|
@@ -591,6 +598,8 @@ export default class DtmplEditPage extends React.PureComponent<
|
|
|
591
598
|
onValuesChange={this.onValuesChange}
|
|
592
599
|
parentFormInstance={parentFormInstance}
|
|
593
600
|
valueFieldMap={valueFieldMap}
|
|
601
|
+
isAudit={isAudit}
|
|
602
|
+
code={code}
|
|
594
603
|
/>
|
|
595
604
|
</Card>
|
|
596
605
|
)}
|