变量(VAR)用于统一管理脚本、报表、流程等元素运行时需要使用的参数,适合承载年度、场景、期间、组织范围等跨元素共享参数,也支持按用户保存个性化变量值。
变量组件对外能力主要分为两类:
变量取值接口:用于页面、脚本或外部系统读取变量值。
变量元素管理接口:用于查询变量定义,以及统一保存变量变更。
在实际应用中,变量组件以读取为主,因此本文档优先说明常用查询接口,再补充变量维护接口。
用于按变量名称查询单个变量的当前值与变量定义信息。适合页面初始化、脚本运行前取默认参数、外部组件按名称读取变量值等场景。
请求
|
项目 |
值 |
|---|---|
|
HTTP Method |
|
|
Path |
|
|
参数名 |
类型 |
必填 |
说明 |
示例 |
|---|---|---|---|---|
|
elementName |
String |
是 |
变量元素名称 |
|
|
folderId |
String |
否 |
变量元素所在目录 ID,与 |
|
|
path |
String |
否 |
变量元素所在路径,与 |
|
|
name |
String |
是 |
变量名称 |
|
|
scope |
Integer |
否 |
变量范围, |
|
响应
|
字段名 |
类型 |
说明 |
|---|---|---|
|
value |
String |
变量当前值 |
|
name |
String |
变量名称 |
|
scope |
Integer |
变量范围 |
|
valueType |
Integer |
变量值类型 |
|
valueTypeMap |
Object |
变量类型详细配置 |
|
valueTypeMap.valueType |
Integer |
值类型 |
|
valueTypeMap.defaultValue |
String |
默认值 |
|
valueTypeMap.instruction |
String |
变量说明 |
|
valueTypeMap.length |
Integer |
显示长度 |
|
valueTypeMap.maxLen |
Integer |
最大长度 |
|
valueTypeMap.digitLen |
Integer |
小数位数 |
|
valueTypeMap.minimun |
String |
最小值 |
|
valueTypeMap.maximun |
String |
最大值 |
|
valueTypeMap.displayDigitLen |
Integer |
展示小数位数 |
|
valueTypeMap.minEqual |
Boolean |
是否允许等于最小值 |
|
valueTypeMap.maxEqual |
Boolean |
是否允许等于最大值 |
|
valueTypeMap.percentage |
Boolean |
是否按百分比展示 |
|
valueTypeMap.thousandthSymbol |
Boolean |
是否展示千分位 |
|
valueTypeMap.functionCode |
String |
变量类型编码 |
|
valueTypeMap.defaultValueShow |
String |
默认值展示文本 |
{
"value": "8",
"name": "vPeriod",
"scope": 0,
"valueType": 1,
"valueTypeMap": {
"valueType": 1,
"defaultValue": "8",
"instruction": "当前滚测期间",
"length": 2,
"maxLen": 2,
"digitLen": 0,
"minimun": "1",
"maximun": "12",
"displayDigitLen": 0,
"minEqual": true,
"maxEqual": true,
"percentage": false,
"thousandthSymbol": false,
"functionCode": "number",
"defaultValueShow": "8"
}
}
用于一次性查询多个变量元素下的多个变量值。适合脚本启动前批量取参数、集成接口减少往返调用次数、一次性加载多个公共变量的场景。
请求
|
项目 |
值 |
|---|---|
|
HTTP Method |
|
|
Path |
|
|
字段名 |
类型 |
必填 |
说明 |
示例 |
|---|---|---|---|---|
|
elementName |
String |
是 |
变量元素名称 |
|
|
folderId |
String |
否 |
变量元素所在目录 ID,与 |
|
|
path |
String |
否 |
变量元素所在路径,与 |
|
|
nameList |
Array |
是 |
待查询的变量名称列表 |
`[ |
|
“vYear”, | ||||
|
“vScenario”, | ||||
|
“vPeriod” | ||||
|
]` |
[
{
"elementName": "VAR",
"folderId": "10783",
"path": "/01_Application/07_VAR",
"nameList": ["vYear", "vScenario", "vPeriod"]
}
]
响应
|
字段名 |
类型 |
说明 |
|---|---|---|
|
variableMemberList |
Array |
返回的变量列表 |
|
variableMemberList[].value |
String |
变量值 |
|
variableMemberList[].name |
String |
变量名称 |
|
variableMemberList[].scope |
Integer |
变量范围 |
|
variableMemberList[].valueType |
Integer |
变量值类型 |
[
{
"variableMemberList": [
{
"value": "2025",
"name": "vYear",
"scope": 0,
"valueType": 1
},
{
"value": "F05",
"name": "vScenario",
"scope": 0,
"valueType": 0
},
{
"value": "8",
"name": "vPeriod",
"scope": 0,
"valueType": 1
}
]
}
]
用于查询指定变量元素中已配置的变量明细。适合变量编辑页初始化、变量配置巡检,以及在使用 Python SDK 前加载变量元数据等场景。
请求
|
项目 |
值 |
|---|---|
|
HTTP Method |
|
|
Path |
|
|
参数名 |
类型 |
必填 |
说明 |
示例 |
|---|---|---|---|---|
|
folderId |
String |
否 |
变量元素所在目录 ID,与 |
|
|
elementName |
String |
是 |
变量元素名称 |
|
|
path |
String |
否 |
变量元素所在路径,与 |
|
响应
|
字段名 |
类型 |
说明 |
|---|---|---|
|
globalVariables |
Array |
全局变量列表 |
|
globalVariables[].id |
String |
变量 ID |
|
globalVariables[].name |
String |
变量名称 |
|
globalVariables[].value |
String |
变量值 |
|
globalVariables[].scope |
Integer |
变量范围 |
|
globalVariables[].status |
Boolean |
是否启用 |
|
globalVariables[].valueType |
Integer |
变量值类型 |
|
globalVariables[].description |
Object |
多语言描述 |
|
userVariables |
Array |
用户变量列表 |
|
description |
Object |
变量元素描述 |
{
"globalVariables": [
{
"id": "5f7d2c3a-0d9b-4d35-8f6a-1f4a9c0b1001",
"name": "vYear",
"value": "2025",
"scope": 1,
"status": true,
"valueType": 1,
"description": {
"zh-cn": "当前年份",
"en": "Current Year"
}
},
{
"id": "5f7d2c3a-0d9b-4d35-8f6a-1f4a9c0b1002",
"name": "vScenario",
"value": "F05",
"scope": 1,
"status": true,
"valueType": 0,
"description": {
"zh-cn": "当前场景",
"en": "Current Scenario"
}
}
],
"userVariables": [
{
"id": "5f7d2c3a-0d9b-4d35-8f6a-1f4a9c0b1003",
"name": "curr_entity",
"value": "E0101",
"scope": 2,
"status": true,
"valueType": 3,
"description": {
"zh-cn": "当前组织",
"en": "Current Entity"
}
}
],
"description": {
"zh-cn": "预算运行参数",
"en": "Budget Runtime Variables"
}
}
用于统一提交变量元素中的新增、更新、删除变更。适合调整滚测期间、切换默认场景、补充新的用户变量等场景。
请求
|
项目 |
值 |
|---|---|
|
HTTP Method |
|
|
Path |
|
|
字段名 |
类型 |
必填 |
说明 |
|---|---|---|---|
|
moduleId |
String |
是 |
组件 ID |
|
elementName |
String |
是 |
变量元素名称 |
|
folderId |
String |
否 |
变量元素所在目录 ID,与 |
|
path |
String |
否 |
变量元素所在路径,与 |
|
globalVariables |
Array |
否 |
全局变量变更列表 |
|
globalVariables[].id |
String |
否 |
变量 ID,更新时传入 |
|
globalVariables[].variableName |
String |
是 |
变量名称 |
|
globalVariables[].variableValue |
String |
是 |
变量值 |
|
globalVariables[].variableDefinedValue |
String |
否 |
变量定义值 |
|
globalVariables[].variableType |
Integer |
是 |
变量类型 |
|
globalVariables[].userId |
String |
否 |
操作用户 |
|
userVariables |
Array |
否 |
用户变量变更列表 |
|
dataTableInfo |
Object |
是 |
元素定位信息 |
|
dataTableInfo.elementName |
String |
是 |
元素名称 |
|
dataTableInfo.elementType |
String |
是 |
元素类型 |
|
dataTableInfo.folderId |
String |
否 |
目录 ID |
|
dataTableInfo.serverName |
String |
是 |
服务名称 |
|
dataTableInfo.path |
String |
否 |
元素路径 |
|
dataTableInfo.absoluteTag |
Boolean |
否 |
是否绝对路径 |
|
dataTableInfo.relativePath |
String |
否 |
相对路径 |
{
"moduleId": "VAR1_0",
"elementName": "VAR",
"folderId": "10783",
"path": "/01_Application/07_VAR",
"globalVariables": [
{
"id": "5f7d2c3a-0d9b-4d35-8f6a-1f4a9c0b1001",
"variableName": "vYear",
"variableValue": "2026",
"variableDefinedValue": "2026",
"variableType": 1,
"userId": "system"
},
{
"id": "5f7d2c3a-0d9b-4d35-8f6a-1f4a9c0b1002",
"variableName": "vPeriod",
"variableValue": "9",
"variableDefinedValue": "9",
"variableType": 1,
"userId": "system"
},
{
"variableName": "curr_version",
"variableValue": "V03",
"variableDefinedValue": "V03",
"variableType": 1,
"userId": "system"
}
],
"userVariables": [
{
"id": "5f7d2c3a-0d9b-4d35-8f6a-1f4a9c0b1003",
"variableName": "curr_entity",
"variableValue": "E0102",
"variableDefinedValue": "E0102",
"variableType": 3,
"userId": "demo_user"
}
],
"dataTableInfo": {
"elementName": "VAR",
"elementType": "VAR",
"folderId": "10783",
"serverName": "variable-server",
"path": "/01_Application/07_VAR",
"absoluteTag": true,
"relativePath": "/01_Application/07_VAR"
}
}
响应
|
字段名 |
类型 |
说明 |
|---|---|---|
|
status |
Boolean |
请求是否成功 |
|
code |
Integer |
响应码 |
|
message |
String |
响应消息 |
|
data |
Boolean |
是否保存成功 |
{
"status": true,
"code": 0,
"message": "success",
"data": true
}
回到顶部
咨询热线
