Skip to content

数据格式说明

  DDei的所有设计数据都以文件为单位保存在一个JSON对象中。JSON对象包含了全量的页签舞台图层控件位置以及属性信息。开发人员可以存储这个JSON到服务端数据库中,从而轻易的实现保存功能;也解析这个JSON,将其转换成自己业务应用想要的格式,使业务应用具备图形化编排和展示的能力,如:Activi/BPM等流程格式。本文档将对JSON格式进行详细说明。

JSON示例

  通过DDeiEditorfiles属性能够获取所有打开文件的文件,通过DDeiFiletoJSON方法就能够得到如下JSON。可以结合设计图可以很了解其结构,JSON是从DDeiFile这一层级开始。 alt text

json
{
    "id": "1234567890", 
    "name": "新建文件_NEW",
    "desc": "",
    "extData": {},
    "state": 2,
    "publish": "0",
    "lastUpdateTime": 1720510890856,
    "path": "/新建文件_NEW",
    "currentSheetIndex": 0,
    "modelType": "DDeiFile",
    "modelNumber": 6,
    "unicode": "7c2e23e9a3786cd895d4999084ef6262",
    "ddeiVersion": 1237,
    "sheets": [
        {
            "name": "页面-1",
            "desc": "页面-1",
            "stage": {
                "id": "stage_1",
                "layers": [
                    {
                        "id": "layer_11",
                        "name": "图层1",
                        "models": {
                            "end_17": {
                                "id": "end_17",
                                "modelCode": "102090",
                                "modelType": "DDeiPolygon",
                                "cpv": {
                                    "x": 175.48749999999998,
                                    "y": 110.159375,
                                    "z": 1
                                },
                                "hpv": [
                                    {
                                        "x": 175.48749999999998,
                                        "y": 110.159375,
                                        "z": 1
                                    },
                                    {
                                        "x": 201.94583333333333,
                                        "y": 110.159375,
                                        "z": 1
                                    }
                                ],
                                "exPvs": {},
                                "poly": 2,
                                "mirrorX": false,
                                "mirrorY": false,
                                "sptStyle": {},
                                "fill": {
                                    "color": "black"
                                },
                                "bpv": {
                                    "x": 186.07083333333333,
                                    "y": 120.74270833333333,
                                    "z": 1
                                }
                            },
                            "start_19": {
                                "id": "start_19",
                                "modelCode": "102001",
                                "modelType": "DDeiPolygon",
                                "cpv": {
                                    "x": 175.48749999999998,
                                    "y": 65.18020833333334,
                                    "z": 1
                                },
                                "hpv": [
                                    {
                                        "x": 175.48749999999998,
                                        "y": 65.18020833333334,
                                        "z": 1
                                    },
                                    {
                                        "x": 201.94583333333333,
                                        "y": 65.18020833333334,
                                        "z": 1
                                    }
                                ],
                                "exPvs": {},
                                "poly": 2,
                                "mirrorX": false,
                                "mirrorY": false,
                                "sptStyle": {},
                                "bpv": {
                                    "x": 186.07083333333333,
                                    "y": 75.76354166666667,
                                    "z": 1
                                }
                            }
                        },
                        "midList": [
                            "end_17",
                            "start_19"
                        ],
                        "modelType": "DDeiLayer",
                        "baseModelType": "DDeiLayer",
                        "index": 0,
                        "background": null,
                        "display": 1,
                        "lock": false,
                        "print": true,
                        "centerOpPoints": [],
                        "modelCode": "DDeiLayer",
                        "modelChanged": true,
                        "modelNumber": 2
                    },
                    {
                        "id": "layer_default",
                        "name": "图层",
                        "models": {
                            "task_6": {
                                "id": "task_6",
                                "modelCode": "102010",
                                "modelType": "DDeiPolygon",
                                "cpv": {
                                    "x": 92.14375000000001,
                                    "y": 65.70937500000001,
                                    "z": 1
                                },
                                "hpv": [
                                    {
                                        "x": 92.14375000000001,
                                        "y": 65.70937500000001,
                                        "z": 1
                                    },
                                    {
                                        "x": 118.60208333333334,
                                        "y": 65.70937500000001,
                                        "z": 1
                                    }
                                ],
                                "exPvs": {
                                    "_84b25e15bf91626b80631bd0d088255e": {
                                        "x": 92.14375000000001,
                                        "y": 74.96979166666667,
                                        "z": 1,
                                        "rate": 0.5,
                                        "sita": 90,
                                        "index": 0,
                                        "id": "_84b25e15bf91626b80631bd0d088255e"
                                    }
                                },
                                "poly": 2,
                                "mirrorX": false,
                                "mirrorY": false,
                                "sptStyle": {},
                                "text": "A",
                                "bpv": {
                                    "x": 121.24791666666667,
                                    "y": 84.23020833333334,
                                    "z": 1
                                }
                            },
                            "task_8": {
                                "id": "task_8",
                                "modelCode": "102011",
                                "modelType": "DDeiPolygon",
                                "cpv": {
                                    "x": 135.53541666666666,
                                    "y": 124.71145833333333,
                                    "z": 1
                                },
                                "hpv": [
                                    {
                                        "x": 135.53541666666666,
                                        "y": 124.71145833333333,
                                        "z": 1
                                    },
                                    {
                                        "x": 161.99375,
                                        "y": 124.71145833333333,
                                        "z": 1
                                    }
                                ],
                                "exPvs": {
                                    "_b9bcf285ebba6247bf5593eaa3f1fdb7": {
                                        "x": 135.53541666666666,
                                        "y": 115.45104166666667,
                                        "z": 1,
                                        "rate": 0.5,
                                        "sita": -90,
                                        "index": 2,
                                        "id": "_b9bcf285ebba6247bf5593eaa3f1fdb7"
                                    }
                                },
                                "poly": 2,
                                "mirrorX": false,
                                "mirrorY": false,
                                "sptStyle": {},
                                "text": "B",
                                "border": {
                                    "round": 5
                                },
                                "bpv": {
                                    "x": 164.63958333333335,
                                    "y": 143.23229166666667,
                                    "z": 1
                                }
                            },
                            "line_10": {
                                "id": "line_10",
                                "modelCode": "100401",
                                "modelType": "DDeiLine",
                                "hpv": [
                                    {
                                        "x": 92.14375000000001,
                                        "y": 74.96979166666667,
                                        "z": 1
                                    },
                                    {
                                        "x": 118.60208333333334,
                                        "y": 74.96979166666667,
                                        "z": 1
                                    }
                                ],
                                "pvs": [
                                    {
                                        "x": 92.14375000000001,
                                        "y": 74.96979166666667,
                                        "z": 1,
                                        "isVector3": true
                                    },
                                    {
                                        "x": 92.14375000000001,
                                        "y": 95.21041666666667,
                                        "z": 1
                                    },
                                    {
                                        "x": 135.53541666666666,
                                        "y": 95.21041666666667,
                                        "z": 1
                                    },
                                    {
                                        "x": 135.53541666666666,
                                        "y": 115.45104166666667,
                                        "z": 1,
                                        "isVector3": true
                                    }
                                ],
                                "exPvs": {},
                                "mirrorX": false,
                                "mirrorY": false,
                                "sptStyle": {},
                                "type": 2,
                                "linkModels": {
                                    "lsm_10": {
                                        "type": 3,
                                        "dmid": "lsm_10"
                                    }
                                },
                                "freeze": 0
                            },
                            "lsm_10": {
                                "id": "lsm_10",
                                "modelCode": "100200",
                                "modelType": "DDeiPolygon",
                                "cpv": {
                                    "x": 113.83958333333334,
                                    "y": 95.21041666666667,
                                    "z": 1
                                },
                                "hpv": [
                                    {
                                        "x": 113.83958333333334,
                                        "y": 95.21041666666667,
                                        "z": 1
                                    },
                                    {
                                        "x": 140.29791666666665,
                                        "y": 95.21041666666667,
                                        "z": 1
                                    }
                                ],
                                "exPvs": {},
                                "poly": 2,
                                "mirrorX": false,
                                "mirrorY": false,
                                "sptStyle": {},
                                "borderType": 0,
                                "text": "连接",
                                "font": {
                                    "size": 12
                                },
                                "bpv": {
                                    "x": 135.00625,
                                    "y": 101.82499999999999,
                                    "z": 1
                                }
                            }
                        },
                        "midList": [
                            "task_6",
                            "task_8",
                            "line_10",
                            "lsm_10"
                        ],
                        "modelType": "DDeiLayer",
                        "baseModelType": "DDeiLayer",
                        "index": 1,
                        "background": null,
                        "display": 1,
                        "lock": true,
                        "print": true,
                        "centerOpPoints": [],
                        "modelCode": "DDeiLayer",
                        "modelChanged": true,
                        "modelNumber": 4
                    }
                ],
                "layerIndex": 0,
                "idIdx": 20,
                "modelType": "DDeiStage",
                "ratio": 1,
                "width": 2245.0393700787404,
                "height": 1587.4015748031497,
                "wpv": {
                    "x": -658.5196850393702,
                    "y": -488.20078740157487,
                    "z": 0
                },
                "links": [
                    {
                        "smid": "task_6",
                        "dmid": "line_10",
                        "smpath": "exPvs._84b25e15bf91626b80631bd0d088255e",
                        "dmpath": "startPoint"
                    },
                    {
                        "smid": "task_8",
                        "dmid": "line_10",
                        "smpath": "exPvs._b9bcf285ebba6247bf5593eaa3f1fdb7",
                        "dmpath": "endPoint"
                    }
                ],
                "spv": {
                    "x": 561.2598425196851,
                    "y": 396.85039370078744,
                    "z": 1
                },
                "modelCode": "DDeiStage",
                "unit": "mm"
            },
            "active": 1,
            "modelType": "DDeiSheet",
            "unicode": "741d8249192061ceb6228a5ba7df035f"
        }
    ]
}

属性说明

第一级DDeiFile

属性名说明数据类型默认值备注
ididstring文件唯一标识
unicode标识码string唯一标识
name名称string文件名称
path路径string文件路径
desc说明string文件说明
modelNumber模型数量number文件的所有页签的图形数量总和
modelType模型类型stringDDeiFile文件的模型类别
state状态number文件状态
publish发布状态number0未发布,1已发布
lastUpdateTime最后更新时间number最后修改文件的时间
extData扩展数据object用于存储一些业务相关的扩展数据
ddeiVersionDDei版本number当前文件保存时的DDei版本,用于兼容性检查
currentSheetIndex当前页签下标number0当前哪个页签处于激活状态
sheets页签object[]文件所包含的页签集合,至少包含1个页签,参考第二级DDeiSheet

第二级DDeiSheet

属性名说明数据类型默认值备注
unicode标识码string页签唯一标识
name页签名称string页签的显示标题名称
desc页签说明string页签的说明备注
modelType模型类型stringDDeiSheet页签的模型类型
active激活状态number01激活/0未激活
stage舞台object页签的舞台,一个页签有且只有一个舞台,参考第三级DDeiStage

第三级DDeiStage

属性名说明数据类型默认值备注
id舞台IDstring舞台的唯一标识
unicode唯一编号string系统生成自动编码
modelCode模型类型stringDDeiStage舞台的模型类型
modelType模型类型stringDDeiStage舞台的模型类型
idIdx当前图形的ID种子number
ratio缩放比率number1.0
width画布宽度number
height画布高度number
wpv视窗开始点object(0,0,0)
spv纸张标量开始点object中心
mark水印object查看详情
paper纸张object查看详情
ruler标尺object查看详情
grid网格线object查看详情
unit单位stringpxpx像素/cm厘米/mm毫米/inch英寸/m米,当前舞台用来表示大小和位置的单位
links链接集合object[]记录了舞台中所有连线和图形的链接信息,可以用此对象来判定两个图形的前后连接关系
links[n].smid源对象IDstring一般为图形的ID
links[n].dmid目标对象IDstring一般为线的ID
links[n].smpath源对象属性路径string一般为线的端点之一
links[n].dmpath目标对象属性路径string一般为图形的扩展端点
layerIndex当前的图层下标number-1
layers图层集合object[]舞台的所有图层结合,参考第四级DDeiLayer

第四级DDeiLayers

属性名说明数据类型默认值备注
id图层IDstring
unicode唯一编号string系统生成自动编码
name名称string系统生成
models控件集合object<string,object>key为控件ID,value为控件对象,参考控件和容器
midList控件ID集合string[]子控件id列表,带排序
index下标number当前layer所在stage的下标
display是否显示number10不显示/1显示
lock锁定booleanfalse
print打印booleantrue
modelNumber模型总数量object0
bg背景object查看详情
modelType模型类型stringDDeiLayer

控件和容器

  到这一级就能够获取到具体控件的属性了,由于图形控件的属性支持自定义,因此只列举公共的属性。在这一层中有一种特殊情况,当出现组合控件或容器控件时,需要继续通过midListmodels进行遍历。才能获取更深层次的控件。

属性名说明数据类型默认值备注
id图形IDstring画布唯一
unicode唯一编号string系统生成自动编码
code编码string
text文本string
poly坐标策略number11直角坐标/2极坐标
rotate旋转量number1.0只读
cpv中心点向量object(0,0,0)中心点坐标
hpv平行拉伸向量objec[]用于计算旋转/拉伸量
pvs点向量object[]构成图形的所有点
essBounds实际大小object未经旋转、缩放的实际大小
text文本string显示文本
sptStyle特殊文本样式object[]
zIndex图层层次number影响渲染顺序
state背景DDeiEnumControlStateDEFAULT
stage所属舞台DDeiStage
layer所属图层DDeiLayer
pModel所属容器DDeiContainer
modelCode模型的编码string区分modelType相同,但业务含义不同的模型
modelType模型类型stringAbstractShape
border边框object
border.type边框类型number0无/1实线
border.color边框颜色string
border.opacity透明度number0-1之间1
border.width宽度number>01
border.dash线段样式Array>0
border.roung圆角number0-100
fill填充object
fill.type填充类型number0无/1纯色/2图片
fill.color填充颜色string
fill.image填充图片string
fill.opacity透明度number0-1之间1
font字体object
font.family字体名称string系统默认
font.color字体颜色stringblack
font.size字体大小string14
textStyle文本样式object
textStyle.align横向对齐number1左/2中/3右2
textStyle.valign纵向对齐number1上/2中/3下2
textStyle.feed自动换行number1是/0否1
textStyle.scale超范围策略number0隐藏/1省略/2缩小/3扩展0
textStyle.lockWidth锁定宽度number0否/1是0
textStyle.hollow镂空number0否/1是0
textStyle.bold加粗number0否/1是0
textStyle.italic斜体number0否/1是0
textStyle.underline下划线number0否/1是0
textStyle.deleteline删除线number0否/1是0
textStyle.bgcolor文本背景string
textStyle.hspace水平间距number0-100.5
textStyle.vspace垂直间距number0-100.5
mirrorX水平镜像booleanfalse
mirrorY垂直镜像booleanfalse

技术支持

QQ:3697355039
微信公众号:ddei757