# 模型

来源快照：`result_data_new_260518.json`

- 来源 ID：`1185201289194561538`
- 模块：前端逻辑编排
- 目录：逻辑编排设计器 - 变量和模型
- space ID：`1182582763689992228`
- 原文链接：未提供
- 产品基线：未提供

## 正文

## 一、功能背景及价值用途

在逻辑编排过程中，为了描述一些有特定结构的JSON变量，我们特意引入了模型，来描述这种变量的结构，模型使得这类变量的结构可以被语义化描述，并且可以设置每种属性的类型和描述。赋予变量自定义模型的类型后就可以用变量接收或者处理此类的数据。这不仅提高了数据处理的灵活性，还增强了代码的可读性和可维护性。通过模型定义，开发者可以清晰地了解每个属性的含义和预期的数据类型，避免了因数据类型不匹配而导致的错误。此外，这种语义化的描述方式也为后续的数据校验、自动补全等功能提供了基础，极大地提升了开发效率和数据处理的准确性。

## 二、功能概述及使用说明

### 1、功能概述

模式是一种特殊的变量类型，可以描述变量的结构

1、

### 新建模型

新建模型的入口有很多，可以在变量-模型子菜单中新建

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201366555205639&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201379437461518&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

也可以在变量类型选择框中点击新建模型

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201357972152321&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201362207260673&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

 

2、

### 模型名称

模型名称是必填项

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201345047781379&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201370841784326&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型名称是模型在当前逻辑流的唯一标识，所以不能重复

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201345047781377&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201366514229253&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型名称必须以字母开头，可以包含字母、数字、下划线

若不满足条件保存时会报错：模型格式错误

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201345047781381&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201366555205635&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

可点击后方复制图标来复制当前模型名称

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201370841784320&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201357881384969&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

3、

### 模型描述

模型描述如字面意思，可以简单的描述模型的内容，会在变量类型选择的时候，展示在模型名称后方，非必填

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201357890740233&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201349246861312&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

 

4、

### 模型结构

模型描述结构的属性，默认是个灰色齿轮，有结构内容后，并保存后会展示高亮齿轮并显示“已配置”

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201370721697796&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201357890740230&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构默认有一行空数据，属性名称和显示名称都为空，类型为文本

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201349323497472&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201379437461507&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构弹窗，默认高度最小可展示一行属性，最大为窗口的90%，表格区域超出滚动

可以通过右上角的添加按钮在结构最后添加一行属性

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201362260238343&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201375229992970&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构中，属性的删除，依靠选中前方check框，然后选择批量删除，确认删除后则删除

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201345080369153&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201353696436225&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构中，类型额外增加了Object(对象)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201375217991683&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201362207260679&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构中，保存结构的时候，会校验属性是否为空，若为空则报错：属性名称不能为空

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201375093301250&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201366486589442&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

保存结构的时候还会校验是否存在同层级相同的属性，会高亮两个相同属性，并且跳转到这两个属性中后面一个属性的位置。若不同层级，可以存在相同属性名称

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201379437461515&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201370842750980&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201353676046339&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201375229992966&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

 

选择Object(对象)类型或者Array<Object>后，可以新增子属性，不过新增时会校验当前属性名称是否为空、校验当前属性是否存在同级一样的属性名，若校验不通过会提示报错，阻止新增子属性

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201357881384963&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201340844122118&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

点击添加子属性后，会在当前属性最后方添加一行属性行，默认选中属性名称。并且子属性前方会增加折行缩进图标，父属性前方会增加展开收缩按钮

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201370841784328&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201353744293893&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

鼠标移入展开收缩按钮，会展示点击后的效果

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201375217991692&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201353586417666&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

 

鼠标移入折行缩进图标，会展示当前属性前缀属性（一直到最外层）

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201362260238348&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201349300805637&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

点击折行缩进图标，会将父属性滚动到可视区域，并且高亮一次父属性前方展开收缩按钮

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201349246861314&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201349300805634&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构弹窗，考虑到性能情况，每次打开的时候默认都是收缩所有父属性，只展示第一层的属性

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201379312771077&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201353744293891&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构中属性的类型，可以选择已经保存的模型，并且在模型结构中不允洗新建模型

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201345080369159&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201345080369157&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

若当前模型已经保存过，则类型仍然可以选择当前模型，实现嵌套调用

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201353586417668&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201379515604993&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

模型结构支持导入，点击导入可以展示导入弹窗，导入方式分为：从粘贴内容中生成、选择数据源。默认选择“从粘贴内容中生成”

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201349323497479&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201362124513283&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

从粘贴内容中生成：粘贴一段json会自动分析生成对应的结构

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201366514229249&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201357972152326&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

选择数据源：点击导入方式，打开选择数据源的弹窗，选择对应的数据源后直接导入数据源中的字段信息

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201340844122120&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201375229992963&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

5、

### 模型编辑和删除

模型菜单列表中可以编辑和删除模型

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201379437461511&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

![](https://weapp.eteams.cn/papi/file/preview?fileId=1185201366555205637&type=redirect&customParam=%7B%22isExtDist%22%3Atrue%2C%22distributeId%22%3A%22%22%2C%22externalId%22%3A%22%22%2C%22appId%22%3A%22%22%7D)

## 三、上下游关联功能点

变量：作为数据存储介质，以利于后续处理与输出。[ _更多详情点击查看_](https://eteams.cn/community/help)
