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 };
|
},
|
},
|
});
|