aldehyde 0.2.516 → 0.2.518
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/controls/auto-complete/index.d.ts.map +1 -1
- package/lib/controls/auto-complete/index.js +2 -4
- package/lib/controls/auto-complete/index.js.map +1 -1
- package/lib/controls/direct-file-view/index.d.ts.map +1 -1
- package/lib/controls/direct-file-view/index.js +4 -1
- package/lib/controls/direct-file-view/index.js.map +1 -1
- package/lib/controls/entry-control.d.ts.map +1 -1
- package/lib/controls/entry-control.js +4 -0
- package/lib/controls/entry-control.js.map +1 -1
- package/lib/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +99 -99
- package/lib/controls/view-control.d.ts.map +1 -1
- package/lib/controls/view-control.js +1 -0
- package/lib/controls/view-control.js.map +1 -1
- package/lib/detail/view/act-dtmpl-view.d.ts +2 -0
- package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/act-dtmpl-view.js +3 -2
- package/lib/detail/view/act-dtmpl-view.js.map +1 -1
- package/lib/detail/view/dtmpl-view.d.ts +11 -0
- package/lib/detail/view/dtmpl-view.d.ts.map +1 -1
- package/lib/detail/view/dtmpl-view.js +20 -17
- package/lib/detail/view/dtmpl-view.js.map +1 -1
- package/lib/detail/view/field-view-group.d.ts +9 -0
- package/lib/detail/view/field-view-group.d.ts.map +1 -1
- package/lib/detail/view/field-view-group.js +17 -15
- package/lib/detail/view/field-view-group.js.map +1 -1
- package/lib/detail/view/index.less +6 -0
- package/lib/draw-canvas-edit/components/asset-bar/index.less +35 -35
- package/lib/draw-canvas-edit/components/main-header/index.less +23 -23
- 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 +35 -27
- 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/lowcode-components/base-table/index.less +61 -61
- package/lib/lowcode-components/data-number/index.d.ts +2 -0
- package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
- package/lib/lowcode-components/data-number/index.js +21 -1
- package/lib/lowcode-components/data-number/index.js.map +1 -1
- package/lib/lowcode-components/data-number/index.less +10 -10
- package/lib/lowcode-components/date-time/index.less +4 -4
- package/lib/lowcode-components/four-angle-glow-border/index.less +49 -49
- package/lib/lowcode-components/line-chart/index.js +7 -7
- package/lib/lowcode-components/line-chart/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/component/font/FontGlobal.css +26 -26
- package/lib/lowcode-components/lowcode-view/component/screen-fit/index.less +13 -13
- package/lib/lowcode-components/text-scroller/index.less +28 -28
- 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 +2 -1
- package/lib/routable/ttmpl-table-route.js.map +1 -1
- package/lib/table/act-table.d.ts +3 -0
- package/lib/table/act-table.d.ts.map +1 -1
- package/lib/table/act-table.js +9 -6
- 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 +22 -10
- 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/control-type-supportor.d.ts.map +1 -1
- package/lib/tmpl/control-type-supportor.js +1 -0
- package/lib/tmpl/control-type-supportor.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +2 -0
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +26 -0
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +8 -1
- package/lib/tmpl/interface.d.ts.map +1 -1
- 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 +45 -0
- package/lib/units/index.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/auto-complete/index.tsx +4 -6
- package/src/aldehyde/controls/direct-file-view/index.tsx +4 -1
- package/src/aldehyde/controls/entry-control.tsx +4 -0
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.css +99 -99
- package/src/aldehyde/controls/icon-selector/icon/phonenode-menu-icon/iconfont.json +156 -156
- package/src/aldehyde/controls/view-control.tsx +1 -0
- package/src/aldehyde/detail/view/act-dtmpl-view.tsx +4 -1
- package/src/aldehyde/detail/view/dtmpl-view.tsx +20 -26
- package/src/aldehyde/detail/view/field-view-group.tsx +20 -22
- package/src/aldehyde/detail/view/index.less +6 -0
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.less +35 -35
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.tsx +110 -110
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.less +23 -23
- package/src/aldehyde/draw-canvas-edit/components/main-header/index.tsx +263 -263
- package/src/aldehyde/draw-canvas-edit/components/render/draws/index.ts +7 -7
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/base-graph.ts +241 -241
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/circle.ts +699 -699
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/curve.ts +500 -500
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/index.ts +5 -5
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/line.ts +493 -493
- package/src/aldehyde/draw-canvas-edit/components/render/graphs/rect.ts +680 -680
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/drag-handlers.ts +68 -68
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/graph-handlers.ts +113 -113
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/index.ts +9 -9
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/key-move-handlers.ts +49 -49
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/link-handlers.ts +45 -45
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/shutcut-handlers.ts +45 -45
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/text-handlers.ts +81 -81
- package/src/aldehyde/draw-canvas-edit/components/render/handlers/zoom-handlers.ts +59 -59
- package/src/aldehyde/draw-canvas-edit/components/render/tools/align-tool.ts +89 -89
- package/src/aldehyde/draw-canvas-edit/components/render/tools/asset-tool.ts +154 -154
- package/src/aldehyde/draw-canvas-edit/components/render/tools/link-tool.ts +222 -222
- package/src/aldehyde/draw-canvas-edit/components/render/tools/z-index-tool.ts +224 -224
- package/src/aldehyde/draw-canvas-edit/components/render/utils/a-star.ts +116 -116
- package/src/aldehyde/draw-canvas-edit/components/render/utils/bezier-scene-func.ts +72 -72
- package/src/aldehyde/draw-canvas-edit/components/setting-form/imag-upload.tsx +119 -119
- package/src/aldehyde/form/dtmpl-form.tsx +59 -55
- package/src/aldehyde/form/form-Item-group.tsx +16 -5
- package/src/aldehyde/layout4/imgs/user.svg +26 -26
- package/src/aldehyde/list/card-list/card-list-item.tsx +26 -7
- package/src/aldehyde/lowcode-components/base-color-block/index.tsx +31 -31
- package/src/aldehyde/lowcode-components/base-table/index.less +61 -61
- package/src/aldehyde/lowcode-components/data-number/index.less +10 -10
- package/src/aldehyde/lowcode-components/data-number/index.tsx +22 -1
- package/src/aldehyde/lowcode-components/date-time/index.less +4 -4
- package/src/aldehyde/lowcode-components/date-time/index.tsx +64 -64
- package/src/aldehyde/lowcode-components/four-angle-glow-border/index.less +49 -49
- package/src/aldehyde/lowcode-components/four-angle-glow-border/index.tsx +53 -53
- package/src/aldehyde/lowcode-components/line-chart/index.tsx +7 -7
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-controller.ts +64 -64
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-definition.ts +77 -77
- package/src/aldehyde/lowcode-components/lowcode-view/component/abstract-designer-loader.ts +36 -36
- package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +144 -144
- package/src/aldehyde/lowcode-components/lowcode-view/component/font/FontGlobal.css +26 -26
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/controller.ts +36 -36
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/definition.ts +53 -53
- package/src/aldehyde/lowcode-components/lowcode-view/component/group-layer/index.tsx +15 -15
- package/src/aldehyde/lowcode-components/lowcode-view/component/layer-builder.tsx +98 -98
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.less +13 -13
- package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +121 -121
- package/src/aldehyde/lowcode-components/placeholder-component/index.tsx +81 -81
- package/src/aldehyde/lowcode-components/text-scroller/index.less +28 -28
- package/src/aldehyde/lowcode-components/text-scroller/index.tsx +173 -173
- 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 +3 -0
- package/src/aldehyde/table/act-table.tsx +11 -6
- package/src/aldehyde/table/column/column-builder.tsx +14 -3
- package/src/aldehyde/table/pagination.tsx +1 -1
- package/src/aldehyde/table/relation-table.tsx +77 -16
- package/src/aldehyde/tmpl/control-type-supportor.tsx +1 -0
- package/src/aldehyde/tmpl/hcservice-v3.tsx +23 -0
- package/src/aldehyde/tmpl/interface.tsx +9 -2
- package/src/aldehyde/units/index.tsx +44 -0
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import Konva from 'konva';
|
|
2
|
-
|
|
3
|
-
function rotatePoint(x1: number, y1: number, x2: number, y2: number, angleInDegrees: number) {
|
|
4
|
-
const radians = angleInDegrees * (Math.PI / 180);
|
|
5
|
-
const cosTheta = Math.cos(radians);
|
|
6
|
-
const sinTheta = Math.sin(radians);
|
|
7
|
-
|
|
8
|
-
// Translate point (x2, y2) to be relative to (x1, y1)
|
|
9
|
-
const x = x2 - x1;
|
|
10
|
-
const y = y2 - y1;
|
|
11
|
-
|
|
12
|
-
// Rotate point
|
|
13
|
-
const xPrime = cosTheta * x - sinTheta * y;
|
|
14
|
-
const yPrime = sinTheta * x + cosTheta * y;
|
|
15
|
-
|
|
16
|
-
// Translate back
|
|
17
|
-
const xNew = xPrime + x1;
|
|
18
|
-
const yNew = yPrime + y1;
|
|
19
|
-
|
|
20
|
-
return { x: xNew, y: yNew };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function drawPointer(ctx: Konva.Context, shape: Konva.Shape, startX: number, startY: number, ctrlX: number, ctrlY: number) {
|
|
24
|
-
const x2 = startX + 12;
|
|
25
|
-
const y2 = startY - 6;
|
|
26
|
-
const x3 = startX + 12;
|
|
27
|
-
const y3 = startY + 6;
|
|
28
|
-
const angle = (Math.atan2(ctrlY - startY, ctrlX - startX) * 180) / Math.PI;
|
|
29
|
-
const p2 = rotatePoint(startX, startY, x2, y2, angle);
|
|
30
|
-
const p3 = rotatePoint(startX, startY, x3, y3, angle);
|
|
31
|
-
ctx.beginPath();
|
|
32
|
-
ctx.moveTo(startX, startY);
|
|
33
|
-
ctx.lineTo(p2.x, p2.y);
|
|
34
|
-
ctx.lineTo(p3.x, p3.y);
|
|
35
|
-
ctx.lineTo(startX, startY);
|
|
36
|
-
ctx.lineTo(p2.x, p2.y);
|
|
37
|
-
ctx.strokeShape(shape);
|
|
38
|
-
ctx.fillShape(shape);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function BezierSceneFunc(ctx: Konva.Context, shape: Konva.Shape) {
|
|
42
|
-
if (shape instanceof Konva.Arrow) {
|
|
43
|
-
const ps = shape.points();
|
|
44
|
-
if (ps.length / 2 === 4) {
|
|
45
|
-
// 三次
|
|
46
|
-
ctx.beginPath();
|
|
47
|
-
ctx.moveTo(ps[0], ps[1]);
|
|
48
|
-
ctx.bezierCurveTo(ps[2], ps[3], ps[4], ps[5], ps[6], ps[7]);
|
|
49
|
-
ctx.strokeShape(shape);
|
|
50
|
-
ctx.closePath();
|
|
51
|
-
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
52
|
-
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[6], ps[7], ps[4], ps[5]);
|
|
53
|
-
} else if (ps.length / 2 === 3) {
|
|
54
|
-
// 二次
|
|
55
|
-
ctx.beginPath();
|
|
56
|
-
ctx.moveTo(ps[0], ps[1]);
|
|
57
|
-
ctx.quadraticCurveTo(ps[2], ps[3], ps[4], ps[5]);
|
|
58
|
-
ctx.strokeShape(shape);
|
|
59
|
-
ctx.closePath();
|
|
60
|
-
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
61
|
-
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[4], ps[5], ps[2], ps[3]);
|
|
62
|
-
} else {
|
|
63
|
-
// 直线
|
|
64
|
-
ctx.beginPath();
|
|
65
|
-
ctx.moveTo(ps[0], ps[1]);
|
|
66
|
-
ctx.lineTo(ps[2], ps[3]);
|
|
67
|
-
ctx.strokeShape(shape);
|
|
68
|
-
ctx.closePath();
|
|
69
|
-
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
70
|
-
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[2], ps[3], ps[0], ps[1]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
1
|
+
import Konva from 'konva';
|
|
2
|
+
|
|
3
|
+
function rotatePoint(x1: number, y1: number, x2: number, y2: number, angleInDegrees: number) {
|
|
4
|
+
const radians = angleInDegrees * (Math.PI / 180);
|
|
5
|
+
const cosTheta = Math.cos(radians);
|
|
6
|
+
const sinTheta = Math.sin(radians);
|
|
7
|
+
|
|
8
|
+
// Translate point (x2, y2) to be relative to (x1, y1)
|
|
9
|
+
const x = x2 - x1;
|
|
10
|
+
const y = y2 - y1;
|
|
11
|
+
|
|
12
|
+
// Rotate point
|
|
13
|
+
const xPrime = cosTheta * x - sinTheta * y;
|
|
14
|
+
const yPrime = sinTheta * x + cosTheta * y;
|
|
15
|
+
|
|
16
|
+
// Translate back
|
|
17
|
+
const xNew = xPrime + x1;
|
|
18
|
+
const yNew = yPrime + y1;
|
|
19
|
+
|
|
20
|
+
return { x: xNew, y: yNew };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function drawPointer(ctx: Konva.Context, shape: Konva.Shape, startX: number, startY: number, ctrlX: number, ctrlY: number) {
|
|
24
|
+
const x2 = startX + 12;
|
|
25
|
+
const y2 = startY - 6;
|
|
26
|
+
const x3 = startX + 12;
|
|
27
|
+
const y3 = startY + 6;
|
|
28
|
+
const angle = (Math.atan2(ctrlY - startY, ctrlX - startX) * 180) / Math.PI;
|
|
29
|
+
const p2 = rotatePoint(startX, startY, x2, y2, angle);
|
|
30
|
+
const p3 = rotatePoint(startX, startY, x3, y3, angle);
|
|
31
|
+
ctx.beginPath();
|
|
32
|
+
ctx.moveTo(startX, startY);
|
|
33
|
+
ctx.lineTo(p2.x, p2.y);
|
|
34
|
+
ctx.lineTo(p3.x, p3.y);
|
|
35
|
+
ctx.lineTo(startX, startY);
|
|
36
|
+
ctx.lineTo(p2.x, p2.y);
|
|
37
|
+
ctx.strokeShape(shape);
|
|
38
|
+
ctx.fillShape(shape);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function BezierSceneFunc(ctx: Konva.Context, shape: Konva.Shape) {
|
|
42
|
+
if (shape instanceof Konva.Arrow) {
|
|
43
|
+
const ps = shape.points();
|
|
44
|
+
if (ps.length / 2 === 4) {
|
|
45
|
+
// 三次
|
|
46
|
+
ctx.beginPath();
|
|
47
|
+
ctx.moveTo(ps[0], ps[1]);
|
|
48
|
+
ctx.bezierCurveTo(ps[2], ps[3], ps[4], ps[5], ps[6], ps[7]);
|
|
49
|
+
ctx.strokeShape(shape);
|
|
50
|
+
ctx.closePath();
|
|
51
|
+
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
52
|
+
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[6], ps[7], ps[4], ps[5]);
|
|
53
|
+
} else if (ps.length / 2 === 3) {
|
|
54
|
+
// 二次
|
|
55
|
+
ctx.beginPath();
|
|
56
|
+
ctx.moveTo(ps[0], ps[1]);
|
|
57
|
+
ctx.quadraticCurveTo(ps[2], ps[3], ps[4], ps[5]);
|
|
58
|
+
ctx.strokeShape(shape);
|
|
59
|
+
ctx.closePath();
|
|
60
|
+
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
61
|
+
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[4], ps[5], ps[2], ps[3]);
|
|
62
|
+
} else {
|
|
63
|
+
// 直线
|
|
64
|
+
ctx.beginPath();
|
|
65
|
+
ctx.moveTo(ps[0], ps[1]);
|
|
66
|
+
ctx.lineTo(ps[2], ps[3]);
|
|
67
|
+
ctx.strokeShape(shape);
|
|
68
|
+
ctx.closePath();
|
|
69
|
+
shape.pointerAtBeginning() && drawPointer(ctx, shape, ps[0], ps[1], ps[2], ps[3]);
|
|
70
|
+
shape.pointerAtEnding() && drawPointer(ctx, shape, ps[2], ps[3], ps[0], ps[1]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
73
|
}
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { Upload as AntdUpLoad, UploadFile, message } from "antd";
|
|
3
|
-
import { RcFile } from "antd/es/upload";
|
|
4
|
-
import { PlusOutlined } from "@ant-design/icons";
|
|
5
|
-
import { HydrocarbonService, Superagent, ProgramConfig } from "../../../index";
|
|
6
|
-
import { fileUpload } from "../../constant";
|
|
7
|
-
import { useLocale } from "../../../locale/useLocale";
|
|
8
|
-
|
|
9
|
-
const { sourceId, serverKey } = fileUpload;
|
|
10
|
-
|
|
11
|
-
// 本地文件上传,处理url
|
|
12
|
-
const handleImgUrl = (basePath: string) => {
|
|
13
|
-
if (basePath.startsWith("http")) {
|
|
14
|
-
return basePath;
|
|
15
|
-
}
|
|
16
|
-
const url = encodeURI(ProgramConfig.joinPath(
|
|
17
|
-
ProgramConfig.joinPath(ProgramConfig.api(), "/v3/files"),
|
|
18
|
-
basePath
|
|
19
|
-
)) +
|
|
20
|
-
`?@token=${ProgramConfig.hydrocarbonToken()}&@programToken=${ProgramConfig.programCode(serverKey)}&@applicationToken=${ProgramConfig.applicationCode(serverKey)}`;
|
|
21
|
-
return url;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const fileInfo = {
|
|
25
|
-
uid: '-1',
|
|
26
|
-
name: 'image.png',
|
|
27
|
-
status: 'done',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export interface CommonFilePath {
|
|
31
|
-
fileName?: string;
|
|
32
|
-
contentType?: string;//文件类型
|
|
33
|
-
path?: string;
|
|
34
|
-
iconPath?: string;
|
|
35
|
-
valid?: string;
|
|
36
|
-
baseType?: string;
|
|
37
|
-
basePath?: string;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export interface UploadProps {
|
|
42
|
-
accept?: string;
|
|
43
|
-
size?: number;
|
|
44
|
-
onChange?: (data: { src: string, code: string }) => void;
|
|
45
|
-
value?: { src: string, code: string };
|
|
46
|
-
recordCode?: string; // 当前画面关联数据code,用于图片命名区分
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const ImageUpload: React.FC<UploadProps> = (props) => {
|
|
50
|
-
const { onChange, accept, size, recordCode, value } = props;
|
|
51
|
-
const [fileList, setFileList] = useState([]);
|
|
52
|
-
const [imgCode, setImgCode] = useState<string>(); // 本地图片code
|
|
53
|
-
const { translate } = useLocale();
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
setFileList(value?.src ? [{ ...fileInfo, url: handleImgUrl(value?.src) }] : []);
|
|
57
|
-
setImgCode(value?.code);
|
|
58
|
-
}, [value]);
|
|
59
|
-
|
|
60
|
-
const beforeUpload = async (file: RcFile) => {
|
|
61
|
-
if (size && file.size > size * 1024 * 1024) {
|
|
62
|
-
message.warning(translate("${文件大小不能超过}") + `${size}M`);
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const handleChange = async (info) => {
|
|
69
|
-
if (info.file.status == "done") {
|
|
70
|
-
const fileKey = info.file.response.fileKey;
|
|
71
|
-
const fileName = info.file.name;
|
|
72
|
-
const data = { valid: "new", fileKey, fileName };
|
|
73
|
-
const result = { 描述: `${recordCode || ""}-${fileName}`, 文件: JSON.stringify(data) };
|
|
74
|
-
const { code } = await HydrocarbonService.postMstrucDtmplData(serverKey, sourceId, result, message);
|
|
75
|
-
setImgCode(code);
|
|
76
|
-
const imgData = await HydrocarbonService.requestMstrucDtmplData(serverKey, sourceId, code, null);
|
|
77
|
-
const basePath = JSON.parse(imgData.fieldMap["文件"] || "{}").base?.path;
|
|
78
|
-
if (basePath) {
|
|
79
|
-
const url = handleImgUrl(basePath);
|
|
80
|
-
setFileList([{ ...info.file, url }]);
|
|
81
|
-
// onChange?.(url);
|
|
82
|
-
onChange?.({ src: basePath, code });
|
|
83
|
-
} else {
|
|
84
|
-
setFileList([...info.fileList]);
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
setFileList([...info.fileList]);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const handleDelete = async () => {
|
|
92
|
-
await HydrocarbonService.deleteByCode(serverKey, sourceId, [imgCode]);
|
|
93
|
-
setFileList([]);
|
|
94
|
-
onChange?.(null);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<AntdUpLoad
|
|
99
|
-
action={(file) => HydrocarbonService.postFileAction(serverKey, file)}
|
|
100
|
-
headers={Superagent.getHeaderObj(serverKey)}
|
|
101
|
-
name={'file'}
|
|
102
|
-
beforeUpload={beforeUpload}
|
|
103
|
-
listType={'picture-card'}
|
|
104
|
-
fileList={fileList?.length ? fileList as Array<UploadFile> : undefined}
|
|
105
|
-
accept={accept}
|
|
106
|
-
onChange={handleChange}
|
|
107
|
-
onRemove={handleDelete}
|
|
108
|
-
onPreview={() => window.open(fileList[0].url)}
|
|
109
|
-
styles={{ root: { overflow: "hidden" } }}
|
|
110
|
-
>
|
|
111
|
-
{fileList.length > 0 ? null : <div className={'upload-btn'}>
|
|
112
|
-
<PlusOutlined />
|
|
113
|
-
<div style={{ marginTop: 8 }}>{translate("${上传图片}")}</div>
|
|
114
|
-
</div>}
|
|
115
|
-
</AntdUpLoad>
|
|
116
|
-
)
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export default ImageUpload;
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { Upload as AntdUpLoad, UploadFile, message } from "antd";
|
|
3
|
+
import { RcFile } from "antd/es/upload";
|
|
4
|
+
import { PlusOutlined } from "@ant-design/icons";
|
|
5
|
+
import { HydrocarbonService, Superagent, ProgramConfig } from "../../../index";
|
|
6
|
+
import { fileUpload } from "../../constant";
|
|
7
|
+
import { useLocale } from "../../../locale/useLocale";
|
|
8
|
+
|
|
9
|
+
const { sourceId, serverKey } = fileUpload;
|
|
10
|
+
|
|
11
|
+
// 本地文件上传,处理url
|
|
12
|
+
const handleImgUrl = (basePath: string) => {
|
|
13
|
+
if (basePath.startsWith("http")) {
|
|
14
|
+
return basePath;
|
|
15
|
+
}
|
|
16
|
+
const url = encodeURI(ProgramConfig.joinPath(
|
|
17
|
+
ProgramConfig.joinPath(ProgramConfig.api(), "/v3/files"),
|
|
18
|
+
basePath
|
|
19
|
+
)) +
|
|
20
|
+
`?@token=${ProgramConfig.hydrocarbonToken()}&@programToken=${ProgramConfig.programCode(serverKey)}&@applicationToken=${ProgramConfig.applicationCode(serverKey)}`;
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const fileInfo = {
|
|
25
|
+
uid: '-1',
|
|
26
|
+
name: 'image.png',
|
|
27
|
+
status: 'done',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface CommonFilePath {
|
|
31
|
+
fileName?: string;
|
|
32
|
+
contentType?: string;//文件类型
|
|
33
|
+
path?: string;
|
|
34
|
+
iconPath?: string;
|
|
35
|
+
valid?: string;
|
|
36
|
+
baseType?: string;
|
|
37
|
+
basePath?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
export interface UploadProps {
|
|
42
|
+
accept?: string;
|
|
43
|
+
size?: number;
|
|
44
|
+
onChange?: (data: { src: string, code: string }) => void;
|
|
45
|
+
value?: { src: string, code: string };
|
|
46
|
+
recordCode?: string; // 当前画面关联数据code,用于图片命名区分
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const ImageUpload: React.FC<UploadProps> = (props) => {
|
|
50
|
+
const { onChange, accept, size, recordCode, value } = props;
|
|
51
|
+
const [fileList, setFileList] = useState([]);
|
|
52
|
+
const [imgCode, setImgCode] = useState<string>(); // 本地图片code
|
|
53
|
+
const { translate } = useLocale();
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setFileList(value?.src ? [{ ...fileInfo, url: handleImgUrl(value?.src) }] : []);
|
|
57
|
+
setImgCode(value?.code);
|
|
58
|
+
}, [value]);
|
|
59
|
+
|
|
60
|
+
const beforeUpload = async (file: RcFile) => {
|
|
61
|
+
if (size && file.size > size * 1024 * 1024) {
|
|
62
|
+
message.warning(translate("${文件大小不能超过}") + `${size}M`);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const handleChange = async (info) => {
|
|
69
|
+
if (info.file.status == "done") {
|
|
70
|
+
const fileKey = info.file.response.fileKey;
|
|
71
|
+
const fileName = info.file.name;
|
|
72
|
+
const data = { valid: "new", fileKey, fileName };
|
|
73
|
+
const result = { 描述: `${recordCode || ""}-${fileName}`, 文件: JSON.stringify(data) };
|
|
74
|
+
const { code } = await HydrocarbonService.postMstrucDtmplData(serverKey, sourceId, result, message);
|
|
75
|
+
setImgCode(code);
|
|
76
|
+
const imgData = await HydrocarbonService.requestMstrucDtmplData(serverKey, sourceId, code, null);
|
|
77
|
+
const basePath = JSON.parse(imgData.fieldMap["文件"] || "{}").base?.path;
|
|
78
|
+
if (basePath) {
|
|
79
|
+
const url = handleImgUrl(basePath);
|
|
80
|
+
setFileList([{ ...info.file, url }]);
|
|
81
|
+
// onChange?.(url);
|
|
82
|
+
onChange?.({ src: basePath, code });
|
|
83
|
+
} else {
|
|
84
|
+
setFileList([...info.fileList]);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
setFileList([...info.fileList]);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const handleDelete = async () => {
|
|
92
|
+
await HydrocarbonService.deleteByCode(serverKey, sourceId, [imgCode]);
|
|
93
|
+
setFileList([]);
|
|
94
|
+
onChange?.(null);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<AntdUpLoad
|
|
99
|
+
action={(file) => HydrocarbonService.postFileAction(serverKey, file)}
|
|
100
|
+
headers={Superagent.getHeaderObj(serverKey)}
|
|
101
|
+
name={'file'}
|
|
102
|
+
beforeUpload={beforeUpload}
|
|
103
|
+
listType={'picture-card'}
|
|
104
|
+
fileList={fileList?.length ? fileList as Array<UploadFile> : undefined}
|
|
105
|
+
accept={accept}
|
|
106
|
+
onChange={handleChange}
|
|
107
|
+
onRemove={handleDelete}
|
|
108
|
+
onPreview={() => window.open(fileList[0].url)}
|
|
109
|
+
styles={{ root: { overflow: "hidden" } }}
|
|
110
|
+
>
|
|
111
|
+
{fileList.length > 0 ? null : <div className={'upload-btn'}>
|
|
112
|
+
<PlusOutlined />
|
|
113
|
+
<div style={{ marginTop: 8 }}>{translate("${上传图片}")}</div>
|
|
114
|
+
</div>}
|
|
115
|
+
</AntdUpLoad>
|
|
116
|
+
)
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export default ImageUpload;
|
|
@@ -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,
|
|
@@ -28,6 +28,8 @@ import TmplConfigAnalysis from "../tmpl/tmpl-config-analysis";
|
|
|
28
28
|
import DtmplViewCard from "../module/dtmpl-view-card";
|
|
29
29
|
import { LocaleContext } from "../locale/LocaleProvider";
|
|
30
30
|
|
|
31
|
+
interface AuditData { entity: DtmplData, previous?: DtmplData, changeInfo?: { changeFields: string[], arrayChangeInfos: object } }; // 审计对比数据
|
|
32
|
+
|
|
31
33
|
interface DtmplFormStat {
|
|
32
34
|
loading?: boolean;
|
|
33
35
|
currentDtmplData?: DtmplData;
|
|
@@ -35,6 +37,7 @@ interface DtmplFormStat {
|
|
|
35
37
|
embedForm?: object;
|
|
36
38
|
embedRefValue?: object;
|
|
37
39
|
editingGroups?: string[];
|
|
40
|
+
auditData?: AuditData;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
export default class DtmplForm extends React.PureComponent<
|
|
@@ -49,6 +52,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
49
52
|
state = {
|
|
50
53
|
loading: true,
|
|
51
54
|
currentDtmplData: undefined,
|
|
55
|
+
auditData: undefined,
|
|
52
56
|
appDtmplConfig: undefined,
|
|
53
57
|
embedForm: {},
|
|
54
58
|
embedRefValue: {},
|
|
@@ -58,6 +62,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
58
62
|
maxCols: 2,
|
|
59
63
|
showHeader: true,
|
|
60
64
|
showRightNav: false,
|
|
65
|
+
isAudit: false,
|
|
61
66
|
};
|
|
62
67
|
|
|
63
68
|
async componentDidMount() {
|
|
@@ -73,51 +78,31 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
73
78
|
}
|
|
74
79
|
|
|
75
80
|
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;
|
|
81
|
+
const { sourceId, code, formRef, dtmplData, serverKey, isAudit } = this.props;
|
|
82
|
+
let dtmplData_, auditData_;
|
|
83
|
+
if (isAudit && code) { // 审计编辑页面
|
|
84
|
+
auditData_ = await HcserviceV3.requestViewDtmplAuditData(serverKey, sourceId, code, null);
|
|
85
|
+
dtmplData_ = { ...(auditData_?.entity || {}), sourceId: auditData_?.sourceId };
|
|
97
86
|
} else {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
87
|
+
if (dtmplData) {
|
|
88
|
+
dtmplData_ = dtmplData;
|
|
89
|
+
} else if (code) {
|
|
90
|
+
this.setState({ loading: true });
|
|
91
|
+
dtmplData_ = await HcserviceV3.requestDtmplData(serverKey, sourceId, code, null);
|
|
92
|
+
} else {
|
|
93
|
+
dtmplData_ = { code: undefined, title: undefined, fieldMap: {}, arrayMap: {} };
|
|
94
|
+
}
|
|
104
95
|
}
|
|
105
96
|
//应用静态配置
|
|
106
|
-
let appDtmplConfig = ProgramConfig.getAppDtmplConfig(
|
|
107
|
-
dtmplConfig,
|
|
108
|
-
dtmplData,
|
|
109
|
-
this.props
|
|
110
|
-
);
|
|
97
|
+
let appDtmplConfig = ProgramConfig.getAppDtmplConfig(this.props.dtmplConfig, dtmplData, this.props);
|
|
111
98
|
this.setState({
|
|
112
99
|
appDtmplConfig,
|
|
113
100
|
currentDtmplData: dtmplData_,
|
|
101
|
+
auditData: auditData_,
|
|
114
102
|
loading: false,
|
|
115
103
|
embedRefValue: {},
|
|
116
104
|
});
|
|
117
|
-
setTimeout(
|
|
118
|
-
() => (formRef.current ? formRef.current.resetFields() : undefined),
|
|
119
|
-
200
|
|
120
|
-
);
|
|
105
|
+
setTimeout(() => (formRef.current ? formRef.current.resetFields() : undefined), 200);
|
|
121
106
|
};
|
|
122
107
|
|
|
123
108
|
doRefresh = async () => {
|
|
@@ -271,16 +256,8 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
271
256
|
}
|
|
272
257
|
};
|
|
273
258
|
|
|
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;
|
|
259
|
+
fieldGroupList = (dtmplConfig: DtmplConfig, dtmplData: DtmplData, auditData: AuditData) => {
|
|
260
|
+
const { parentId, maxColsOnRow, mainCode, formRef, serverKey, showRightNav, valueFieldMap, isAudit } = this.props;
|
|
284
261
|
const { loading, embedForm } = this.state;
|
|
285
262
|
let groups: FieldGroupConfig[] = [];
|
|
286
263
|
if (dtmplConfig) {
|
|
@@ -383,8 +360,16 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
383
360
|
if (dtmplData) {
|
|
384
361
|
data = dtmplData.arrayMap[item.id];
|
|
385
362
|
}
|
|
386
|
-
|
|
387
|
-
|
|
363
|
+
return <CollapseCard
|
|
364
|
+
showRightNav={showRightNav}
|
|
365
|
+
initCollapse={item.displayConfig.includes("folded")}
|
|
366
|
+
title={item.title}
|
|
367
|
+
tip={item.tip}
|
|
368
|
+
id={parentId + item.id}
|
|
369
|
+
className="hoverable"
|
|
370
|
+
styles={{ header: { background: "#f2f4f5" }, body: { padding: "6px" } }}
|
|
371
|
+
loading={loading}
|
|
372
|
+
>
|
|
388
373
|
<RelationTable
|
|
389
374
|
showRightNav={showRightNav}
|
|
390
375
|
serverKey={serverKey}
|
|
@@ -396,12 +381,30 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
396
381
|
value={data}
|
|
397
382
|
parentFormInstance={formRef?.current}
|
|
398
383
|
viewOrEdit={item.readOnly ? "view" : "edit"}
|
|
399
|
-
onEditing={(editing) =>
|
|
400
|
-
this.onGroupEditing(item.id, editing);
|
|
401
|
-
}}
|
|
384
|
+
onEditing={(editing) => this.onGroupEditing(item.id, editing)}
|
|
402
385
|
onChange={this.onGroupChange}
|
|
386
|
+
showCollapseCard={false}
|
|
403
387
|
/>
|
|
404
|
-
|
|
388
|
+
{(isAudit && auditData?.changeInfo?.arrayChangeInfos?.[item.id]?.length) ?
|
|
389
|
+
<Collapse ghost size="small"
|
|
390
|
+
styles={{ header: { padding: "6px 0", color: "red" } }}
|
|
391
|
+
items={[{
|
|
392
|
+
key: "audit", label: "变更数据",
|
|
393
|
+
children: <RelationTable
|
|
394
|
+
serverKey={serverKey}
|
|
395
|
+
initCollapse={dtmplData && (!data || data.length <= 0)}
|
|
396
|
+
loading={loading}
|
|
397
|
+
parentId={parentId}
|
|
398
|
+
key={item.id}
|
|
399
|
+
fieldGroupConfig={item}
|
|
400
|
+
value={data}
|
|
401
|
+
viewOrEdit={"view"}
|
|
402
|
+
showCollapseCard={false}
|
|
403
|
+
audit={{ isAudit, previousData: ProgramConfig.arrayToMap(auditData?.previous?.arrayMap?.[item.id], "code"), changeInfo: auditData?.changeInfo?.arrayChangeInfos?.[item.id] }}
|
|
404
|
+
/>
|
|
405
|
+
}]} />
|
|
406
|
+
: ""}
|
|
407
|
+
</CollapseCard>;
|
|
405
408
|
}
|
|
406
409
|
} else {
|
|
407
410
|
//字段组
|
|
@@ -431,6 +434,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
431
434
|
valueMap={dtmplData ? dtmplData.fieldMap : undefined}
|
|
432
435
|
valueFieldMap={valueFieldMap}
|
|
433
436
|
editStatus={dtmplData?.code ? "changed" : "new"} // 新增或修改状态
|
|
437
|
+
audit={{ dataCode: dtmplData ? dtmplData.code : null, isAudit, auditMap: auditData?.previous?.fieldMap || undefined, changeFields: auditData?.changeInfo?.changeFields }}
|
|
434
438
|
/>}
|
|
435
439
|
</CollapseCard>
|
|
436
440
|
);
|
|
@@ -491,7 +495,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
491
495
|
showHeader,
|
|
492
496
|
serverKey, dtmplData,
|
|
493
497
|
} = this.props;
|
|
494
|
-
const { currentDtmplData, appDtmplConfig } = this.state;
|
|
498
|
+
const { currentDtmplData, appDtmplConfig, auditData } = this.state;
|
|
495
499
|
const { translate } = this.context;
|
|
496
500
|
if (!dtmplConfig || !dtmplData) {
|
|
497
501
|
return <Card loading={true}>{translate("${加载中}")}... ...</Card>;
|
|
@@ -549,7 +553,7 @@ export default class DtmplForm extends React.PureComponent<
|
|
|
549
553
|
<AntdForm.Item hidden={true} name={"actionId"}></AntdForm.Item>
|
|
550
554
|
<AntdForm.Item hidden={true} name={"mainCode"}></AntdForm.Item>
|
|
551
555
|
{this.addHiddenItem(dtmplConfig.hiddenFields)}
|
|
552
|
-
{this.fieldGroupList(appDtmplConfig, currentDtmplData)}
|
|
556
|
+
{this.fieldGroupList(appDtmplConfig, currentDtmplData, auditData)}
|
|
553
557
|
</AntdForm>
|
|
554
558
|
{premises && premises.length > 0 ? (
|
|
555
559
|
<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]}
|