wujingjing
2025-03-20 1598df378ab18d8388483d129439eec3cac38afe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
import { defineStore } from 'pinia';
import { deepClone } from '/@/utils/other';
import { defaultProcessDrawingConfig } from '/@/config/flowConfig';
 
export const useFlowConfig = defineStore('flowConfig', {
    state: (): FlowConfig => ({
        flowConfig: {
            showGrid: true,
            type: 'dot',
            size: 10,
            color: '#a29a9a',
            thickness: 1,
            colorSecond: '#d0d0d0',
            thicknessSecond: 1,
            factor: 4,
            bgColor: '#ffffff',
            showImage: false,
            repeat: 'watermark',
            angle: 30,
            position: 'center',
            bgSize: 'auto auto',
            opacity: 0.9,
 
            strokeWidth: 4,
            outStrokeWidth: 7,
            stroke: '#cfe7f2',
            outStroke: '#456d89',
            strokeDasharray: 1,
            animation: 0,
            connector: 'normal',
            edgeRouter: 'orth',
            edgeTargetMarker: 'block',
            edgeSourceMarker: '无',
            edgeMarkerWidth: 12,
            edgeMarkerHeight: 8,
            edgeMarkerRadius: 5,
            edgeOffset: 32,
            edgeDirection: 'H',
            label: '',
 
            nodeStroke: '#5F95FF',
            nodeStrokeWidth: 1,
            nodeFill: '#ffffff',
            portId: '',
            portX: 0,
            portY: 0,
            portColor: '#5F95FF',
            portFill: '#FFF',
            ZIndex: 0,
            nodeFontSize: 12,
            nodeColor: '#080808',
            // 业务数据
            nodeStatus: 0,
            nodePointCode: '52',
            nodeFieldName: 'fieldName1',
 
            nodeType: '', // 节点类型(text、image)
        },
    }),
    actions: {
        updateshowGrid(showGrid) {
            this.flowConfig.showGrid = showGrid;
        },
        updatetype(type) {
            this.flowConfig.type = type;
        },
        updatesize(size) {
            this.flowConfig.size = size;
        },
        updatecolor(color) {
            this.flowConfig.color = color;
        },
        updatethickness(thickness) {
            this.flowConfig.thickness = thickness;
        },
        updatecolorSecond(colorSecond) {
            this.flowConfig.colorSecond = colorSecond;
        },
        updatethicknessSecond(thicknessSecond) {
            this.flowConfig.thicknessSecond = thicknessSecond;
        },
        updatefactor(factor) {
            this.flowConfig.factor = factor;
        },
        updatebgColor(bgColor) {
            this.flowConfig.bgColor = bgColor;
        },
        updateshowImage(showImage) {
            this.flowConfig.showImage = showImage;
        },
        updaterepeat(repeat) {
            this.flowConfig.repeat = repeat;
        },
        updateangle(angle) {
            this.flowConfig.angle = angle;
        },
        updateposition(position) {
            this.flowConfig.position = position;
        },
        updatebgSize(bgSize) {
            this.flowConfig.bgSize = bgSize;
        },
        updateopacity(opacity) {
            this.flowConfig.opacity = opacity;
        },
 
        updatestrokeWidth(strokeWidth) {
            this.flowConfig.strokeWidth = strokeWidth;
        },
        updateoutStrokeWidth(outStrokeWidth) {
            this.flowConfig.outStrokeWidth = outStrokeWidth;
        },
        updatestroke(stroke) {
            this.flowConfig.stroke = stroke;
        },
        updateoutStroke(outStroke) {
            this.flowConfig.outStroke = outStroke;
        },
        updatestrokeDasharray(strokeDasharray) {
            this.flowConfig.strokeDasharray = strokeDasharray;
        },
        updateanimation(animation) {
            this.flowConfig.animation = animation;
        },
        updateconnector(connector) {
            this.flowConfig.connector = connector;
        },
        updateedgeRouter(edgeRouter) {
            this.flowConfig.edgeRouter = edgeRouter;
        },
        updateedgeOffset(edgeOffset) {
            this.flowConfig.edgeOffset = edgeOffset;
        },
        updateedgeTargetMarker(edgeTargetMarker) {
            this.flowConfig.edgeTargetMarker = edgeTargetMarker;
        },
        updateedgeSourceMarker(edgeSourceMarker) {
            this.flowConfig.edgeSourceMarker = edgeSourceMarker;
        },
        updateedgeMarkerWidth(edgeMarkerWidth) {
            this.flowConfig.edgeMarkerWidth = edgeMarkerWidth;
        },
        updateedgeMarkerHeight(edgeMarkerHeight) {
            this.flowConfig.edgeMarkerHeight = edgeMarkerHeight;
        },
        updateedgeMarkerRadius(edgeMarkerRadius) {
            this.flowConfig.edgeMarkerRadius = edgeMarkerRadius;
        },
 
        updateedgeDirection(edgeDirection) {
            this.flowConfig.edgeDirection = edgeDirection;
        },
        updatelabel(label) {
            this.flowConfig.label = label;
        },
 
        updatenodeStroke(nodeStroke) {
            this.flowConfig.nodeStroke = nodeStroke;
        },
        updatenodeStrokeWidth(nodeStrokeWidth) {
            this.flowConfig.nodeStrokeWidth = nodeStrokeWidth;
        },
        updatenodeFill(nodeFill) {
            this.flowConfig.nodeFill = nodeFill;
        },
 
        updateportId(portId) {
            this.flowConfig.portId = portId;
        },
        updateportX(portX) {
            this.flowConfig.portX = portX;
        },
        updateportY(portY) {
            this.flowConfig.portY = portY;
        },
        updateportColor(portColor) {
            this.flowConfig.portColor = portColor;
        },
        updateportFill(portFill) {
            this.flowConfig.portFill = portFill;
        },
        updateZIndex(ZIndex) {
            this.flowConfig.ZIndex = ZIndex;
        },
        updatenodeFontSize(nodeFontSize) {
            this.flowConfig.nodeFontSize = nodeFontSize;
        },
        updatenodeColor(nodeColor) {
            this.flowConfig.nodeColor = nodeColor;
        },
        updatenodeStatus(nodeStatus) {
            this.flowConfig.nodeStatus = nodeStatus;
        },
        updatenodePointCode(nodePointCode) {
            this.flowConfig.nodePointCode = nodePointCode;
        },
        updatenodeFieldName(nodeFieldName) {
            this.flowConfig.nodeFieldName = nodeFieldName;
        },
 
        updateNodeType(nodeType) {
            this.flowConfig.nodeType = nodeType;
        },
 
        updateGrid(fieldsToUpdate: Partial<FlowConfig['flowConfig']>) {
            this.flowConfig = { ...this.flowConfig, ...fieldsToUpdate };
        },
    },
});
 
/**
 * 工艺图 config
 */
export const useProcessDrawingConfig = defineStore('processDrawingConfig', {
    state: (): ProcessDrawingConfig => ({
        processDrawingConfig: deepClone(defaultProcessDrawingConfig),
    }),
    actions: {
        updateshowGrid(showGrid) {
            this.processDrawingConfig.showGrid = showGrid;
        },
        updatetype(type) {
            this.processDrawingConfig.type = type;
        },
        updatesize(size) {
            this.processDrawingConfig.size = size;
        },
        updatecolor(color) {
            this.processDrawingConfig.color = color;
        },
        updatethickness(thickness) {
            this.processDrawingConfig.thickness = thickness;
        },
        updatecolorSecond(colorSecond) {
            this.processDrawingConfig.colorSecond = colorSecond;
        },
        updatethicknessSecond(thicknessSecond) {
            this.processDrawingConfig.thicknessSecond = thicknessSecond;
        },
        updatefactor(factor) {
            this.processDrawingConfig.factor = factor;
        },
        updatebgColor(bgColor) {
            this.processDrawingConfig.bgColor = bgColor;
        },
        updateshowImage(showImage) {
            this.processDrawingConfig.showImage = showImage;
        },
        updateImageUrl(url) {
            this.processDrawingConfig.imageUrl = url;
        },
        updaterepeat(repeat) {
            this.processDrawingConfig.repeat = repeat;
        },
        updateangle(angle) {
            this.processDrawingConfig.angle = angle;
        },
        updateposition(position) {
            this.processDrawingConfig.position = position;
        },
        updatebgSize(bgSize) {
            this.processDrawingConfig.bgSize = bgSize;
        },
        updateopacity(opacity) {
            this.processDrawingConfig.opacity = opacity;
        },
 
        updateGrid(fieldsToUpdate: Partial<ProcessDrawingConfig['processDrawingConfig']>) {
            this.processDrawingConfig = { ...this.processDrawingConfig, ...fieldsToUpdate };
        },
    },
});