${value}秒","options":[{"label":"0.5","value":"0.5"},{"label":"1","value":"1"},{"label":"2","value":"2"},{"label":"3","value":"3"},{"label":"4","value":"4"},{"label":"5","value":"5"},{"label":"6","value":"6"},{"label":"7","value":"7"},{"label":"8","value":"8"}],"id":"u:f9762c0602ce","marks":{},"mode":"horizontal","multiple":false,"className":"w-full"}],"id":"u:18969f044f61"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:995482efad18","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:04e78b30faf4","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue), ''animationName'': ''旋转'' }, ''index'': index } }) } else {doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data),''animationName'': ''旋转'' }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:9707cde74e11","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:ec526d2df0ee","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:534114ea71cb","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:39bce4d2d60b"}],"id":"u:4a2208febcd4","className":"flex-auto"}],"id":"u:8ec6ca9fe14f","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":1}],"data":{"animationCombo":[{"dataPoint":"","min":"","max":""}]},"name":"animationService"}]}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p-sm"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "0db47794-ee89-44b6-b50e-6fcc85089fd9",
"type": "custom-cross-node",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "0db47794-ee89-44b6-b50e-6fcc85089fd9",
"width": 100,
"height": 100,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": "",
"strokeWidth": 1,
"showDefaultValue": false,
"showUnit": false,
"fontSize": 12,
"nodeAlias": "加号",
"fill": "",
"fontStyle": "",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "[{ \"val\": 0.00 }]",
"unit": ""
},
"eventsData": {
"eventCombo": [
{
"eventType": "click",
"config": "{\"globalInputParamsCalculated\":[],\"device\":\"\",\"command\":\"\",\"eventAction\":\"sendCommand\",\"dataPointParamsCalculate\":\"return [\\n {\\n key: \\\"\\\",\\n value: ''''\\n }\\n]\",\"sendCommandMethod\":\"config\",\"inputParamsCalculate\":\"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\\nconst condition = {\\n deviceName: deviceInfo.code,\\n attrCode: command.controlDeviceAttr,\\n value: event == 0 ? 1 : event == 1 ? 0 : event\\n}\\nreturn {\\n \\\"condition\\\": JSON.stringify(condition),\\n \\\"controlId\\\": command.id\\n}\",\"requestMethod\":\"post\",\"requestUrl\":\"/thing/device/control/control\"}"
}
]
},
"uiData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [
{
"type": "equal",
"label": "相等",
"name": ""
}
]
},
"animationData": {
"animationCombo": [
{
"min": "",
"max": "",
"animationName": "旋转",
"animationTime": 3
}
]
},
"hiddenData": {
"hiddenCombo": [
{
"dataPoint": "",
"min": "",
"max": "",
"showOrHiddenName": "隐藏"
}
]
}
}
}
}
]
}', '', '// 加号
class CrossModel extends RectResize.model {
realValue = ''''
initNodeData(data) {
super.initNodeData(data)
const { properties } = this;
this.width = properties.width || 100;
this.height = properties.height || 100;
this.text.editable = false; // 不允许文本被编辑
window.nodeEventsListeners(this);
}
setAttributes() {
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
const { normalData } = dynamic || {};
let textValue = properties.content || '''';
if (normalData) {
const { defaultValue } = normalData || {}
const realValue = window.resolveScadaNewValue(defaultValue)
this.realValue = realValue
const { showDefaultValue, showUnit } = properties
if(showDefaultValue) {
textValue += '' '' + realValue
}
if (showUnit) {
textValue += '' '' + normalData.unit
}
}
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: textValue,
}
}
getNodeStyle() {
const style = super.getNodeStyle();
const { properties } = this;
style.fill = properties.fill || style.fill;
window.changeBackgroundColor(style, properties);
style.stroke = properties.strokeColor || style.stroke;
style.strokeWidth = properties.strokeWidth || style.strokeWidth;
style.opacity = properties.opacity || 1;
return style;
}
getTextStyle() {
const style = super.getTextStyle();
const { properties } = this;
style.color = properties.fontColor || style.color;
style.fontSize = properties.fontSize || style.fontSize;
const fontStyle = properties.fontStyle;
if(fontStyle) {
if (fontStyle.includes(''bold'')) {
style.fontWeight = ''bolder'';
}
if(fontStyle.includes(''italic'')) {
style.fontStyle = ''italic''
}
if (fontStyle.includes(''underline,line-through'')) {
style.textDecoration = ''underline line-through''
} else if (fontStyle.includes(''line-through,underline'')) {
style.textDecoration = ''line-through underline''
} else if (fontStyle.includes(''underline'')) {
style.textDecoration = ''underline''
} else if (fontStyle.includes(''line-through'')) {
style.textDecoration = ''line-through''
}
}
window.changeFontColor(style, properties);
return style;
}
getResizeOutlineStyle() {
return {
stroke: "#00ffff",
strokeWidth: 1,
strokeDasharray: "none",
};
}
}
class CrossView extends RectResize.view {
getResizeShape() {
const { x, y, width, height } = this.props.model
const style = this.props.model.getNodeStyle()
const pointList = [
[x - 1/2 * width, y - 1/6 * height],
[x - 1/6 * width, y - 1/6 * height],
[x - 1/6 * width, y - 1/2 * height],
[x + 1/6 * width, y - 1/2 * height],
[x + 1/6 * width, y - 1/6 * height],
[x + 1/2 * width, y - 1/6 * height],
[x + 1/2 * width, y + 1/6 * height],
[x + 1/6 * width, y + 1/6 * height],
[x + 1/6 * width, y + 1/2 * height],
[x - 1/6 * width, y + 1/2 * height],
[x - 1/6 * width, y + 1/6 * height],
[x - 1/2 * width, y + 1/6 * height],
]
const points = pointList.map(item => {
return `${item[0]},${item[1]}`
})
const attrs = {
...style,
x,
y,
width,
height,
points: points.join('' '')
}
return h(''g'', {}, [
h(''polygon'', { ...attrs })
])
}
}
lf.register({
type: ''custom-cross-node'',
view: CrossView,
model: CrossModel
})', NULL, 1001, NULL, 1001, 1067246875800000001, 1703498148660, 1067246875800000001, 1721286640631, 't', '基础图形', 't', 't', NULL);
INSERT INTO "public"."iot_section_detail" VALUES (1739102611803475969, 'custom-heptagon-node', '八边形', 1, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:1954dc15dd5b","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:656efdb758ad","step":1,"suffix":"px","placeholder":"组件宽度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelClassName":"w-8","labelAlign":"left","precision":2,"inputClassName":"w-full"}],"id":"u:4274c47a4ef5","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:1ed6dcd98c1a","step":1,"suffix":"px","placeholder":"组件高度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelAlign":"left","labelClassName":"w-8","precision":2,"inputClassName":"w-full"}],"id":"u:3e9d1e71a69f","md":6}]},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"填充","name":"fill","id":"u:0d19ed3e2bdc","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:facc5c90e990","md":6},{"body":[{"type":"input-color","label":"描边","name":"strokeColor","id":"u:89afff5fd00d","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:7c903d9d40ab","md":6}],"id":"u:457970dd35bf","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-number","label":"边宽","name":"strokeWidth","id":"u:8dcf62d3dab5","placeholder":"描边宽度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":1,"value":1,"suffix":"px","inputClassName":"w-full"}],"id":"u:d701217b85ef","md":6},{"body":[{"type":"input-text","label":"内容","name":"content","id":"u:bea5a408f98f","mode":"horizontal","size":"full","inputControlClassName":"inputControlClassName-bea5a408f98f"}],"id":"u:afc37bde0156","md":6}],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"switch","label":"显示值","option":"","name":"showDefaultValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"},{"body":[{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:5b89c331fe7e"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"fieldset","id":"u:2a93d8eee7a9","className":"","title":"字体","collapsable":true,"body":[{"type":"container","id":"u:1606d0ad8360","body":[{"type":"select","id":"u:6f3470628b86","label":"字体类型","name":"fontFamily","mode":"horizontal","horizontal":{"leftFixed":"sm"},"size":"lg","options":[{},{"label":"宋体","value":"SimSun"},{"label":"微软雅黑","value":"Microsoft Yahei"},{"label":"苹方","value":"PingFang SC"},{"label":"Andale Mono","value":"andale mono,monospace"},{"label":"Arial","value":"arial,helvetica,sans-serif"},{"label":"Arial Black","value":"arial black,sans-serif"},{"label":"Book Antiqua","value":"book antiqua,palatino,serif"},{"label":"Comic Sans MS","value":"comic sans ms,sans-serif"},{"label":"Courier New","value":"courier new,courier,monospace"},{"label":"Georgia","value":"georgia,palatino,serif"},{"label":"Helvetica Neue","value":"Helvetica Neue"},{"label":"Helvetica","value":"helvetica,arial,sans-serif"},{"label":"Impact","value":"impact,sans-serif"},{"label":"Symbol","value":"symbol"},{"label":"Tahoma","value":"tahoma,arial,helvetica,sans-serif"},{"label":"Terminal","value":"terminal,monaco,monospace"},{"label":"Times New Roman","value":"times new roman,times,serif"},{"label":"Trebuchet MS","value":"trebuchet ms,geneva,sans-serif"},{"label":"Verdana","value":"verdana,geneva,sans-serif"}],"multiple":false,"className":"m-b","menuTpl":"
","inputClassName":""},{"type":"input-color","label":"字体","name":"fontColor","id":"u:f398c821eda1","mode":"horizontal","size":"lg","className":"m-b","format":"rgba","placeholder":"字体颜色","horizontal":{"leftFixed":"sm"},"inputClassName":""},{"type":"input-number","id":"u:0063eed6ed66","label":"字体大小","name":"fontSize","min":12,"step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"className":"m-b","keyboard":true,"displayMode":"enhance","value":12,"max":100},{"type":"checkboxes","id":"u:b34f4c274416","className":"custom-checkbox-style m-b","label":"文字样式","name":"fontStyle","options":[{"label":"fa-bold fa","value":"bold"},{"label":"fa-italic fa","value":"italic"},{"label":"fa-underline fa","value":"underline"},{"label":"fa fa-strikethrough","value":"line-through"}],"checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","multiple":true},{"type":"checkboxes","label":"文字位置","name":"fontAlign","multiple":false,"options":[{"label":"fa fa-align-left","value":"left"},{"label":"fa fa-align-center","value":"center"},{"label":"fa fa-align-right","value":"right"},{"label":"fa fa-align-justify","value":"justify"}],"id":"u:7e80e906ea14","checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","className":"custom-checkbox-style m-b"},{"type":"input-number","label":"文字行高","name":"lineHeight","keyboard":true,"id":"u:0063eed6ed66","step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"displayMode":"enhance","className":"m-b","min":12}],"style":{"position":"static","display":"block"},"wrapperBody":false}],"bodyClassName":"m-b"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","editorState":"default","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"},{"type":"service","body":[],"id":"u:0dd069ac163f"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"事件","body":[{"type":"service","id":"u:4ec2acc50405","body":[{"type":"combo","label":"","name":"eventCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ae1b0a0c0f55"},"items":[{"type":"select","name":"eventType","placeholder":"选择事件","options":[{"label":"单击","value":"click"},{"label":"双击","value":"dblClick"},{"label":"改变","value":"change"},{"label":"鼠标进入","value":"mouseEnter"},{"label":"鼠标离开","value":"mouseLeave"}],"id":"u:a7b44847011a","label":"名称"},{"type":"input-text","name":"config","placeholder":"事件配置","id":"u:d491386a95c2","onEvent":{"focus":{"actions":[{"actionType":"dialog","dialog":{"title":"设置事件","data":{"comboIndex":"${index}","&":"${config | toJson}","nodesList":"${graphDataList}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","evType":"${eventType}"},"body":[{"type":"form","title":"表单","body":[{"type":"radios","label":"事件行为","name":"eventAction","options":[{"label":"打开链接","value":"openLink"},{"label":"打开弹窗","value":"openDialog"},{"label":"下发指令","value":"sendCommand"},{"label":"显示隐藏","value":"showHide"}],"mode":"horizontal","horizontal":{"leftFixed":"sm"},"id":"u:9e7f1220367f","value":"openLink"},{"type":"input-text","label":"链接地址","name":"linkAddress","mode":"horizontal","horizontal":{"leftFixed":"sm"},"inputClassName":"w-full","id":"u:c5bda965ed3c","size":"full","visibleOn":"data.eventAction === ''openLink''"},{"type":"combo","label":"参数","name":"dataPointTable","id":"dataPointTable","addable":true,"strictMode":true,"removable":true,"horizontal":{"leftFixed":"sm"},"multiple":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bf2f6c98dbff"},"items":[{"type":"input-text","name":"dataPoint","id":"u:1eb050ec98d3","label":"","multiple":false,"size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"left":2,"right":10},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"select","label":"设备","name":"devices","id":"u:1cdb908c23a8","multiple":false,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"const selectedItems = event.data.selectedItems;\r\n if(selectedItems) { doAction({actionType: ''setValue'', componentId: ''u:51f0e51abd7c'', args: { value: { attrs: selectedItems.attrs, deviceCode: selectedItems.deviceCode } } }); }"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10}},{"type":"select","label":"数据点","name":"dataPoint","id":"u:8147daea685d","multiple":true,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}"},"submitText":""}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","dataPointTableIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"componentId":"dataPointTable","actionType":"setValue","args":{"value":{"dataPoint":"${event.data | json}"},"index":"${index}"}}]}}}}]}},"horizontal":{"left":1,"right":11}}],"syncFields":[],"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"editor","label":"参数计算","name":"dataPointParamsCalculate","id":"u:4d5e749b7f42","visibleOn":"data.eventAction === ''openLink''","className":"text-left m-b-xs","inputClassName":"w-full","language":"javascript","value":"return [\n {\n key: \"\",\n value: ''''\n }\n]"},{"type":"radios","label":"打开方式","name":"openMethod","id":"u:eec4f8737fe8","options":[{"label":"打开新页面","value":"openNewPage"},{"label":"打开到本页","value":"openLocalPage"}],"horizontal":{"leftFixed":"sm"},"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"radios","label":"下发指令方式","name":"sendCommandMethod","hiddenOn":"data.eventAction !== ''sendCommand''","id":"u:82d9feb7609d","options":[{"label":"配置","value":"config"},{"label":"代码","value":"codes"}],"value":"config"},{"type":"select","label":"选择设备","clearable":"true","name":"selectDevice","id":"u:891bca3a0150","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''device'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","inputClassName":"w-full","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/device","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"}},"labelField":"name","valueField":"id"},{"type":"select","id":"u:42026703278d","label":"选择指令","clearable":"true","name":"selectCommand","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''command'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/${selectDevice}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.selectDevice"},"labelField":"name","valueField":"id","inputClassName":"w-full"},{"type":"tpl","id":"u:f0e9dbf83675","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"function (deviceInfo, command, event){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:14d8542a2066","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left m-b-xs","label":"入参","name":"inputParamsCalculate","inputClassName":"w-full","language":"javascript","onEvent":{"blur":{"actions":[{"actionType":"custom","script":"const func = new Function(''paramsList'', ''command'', event.data.value);\n const newParams = func(event.data.__super.inputParamsTable || [], event.data.__super.selectCommand);\n doAction({actionType: ''setValue'', componentId: ''u:a13b61f23669'', args: { value: { globalInputParamsCalculated: newParams } } });"}]}},"value":"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\nreturn {\n \"condition\": \"\",\n \"controlId\": command.id,\n \"event\": event\n}"},{"type":"grid","id":"u:68833f10e2bf","columns":[{"body":[{"type":"select","label":"请求地址","name":"requestMethod","options":[{"label":"get","value":"get"},{"label":"post","value":"post"},{"label":"put","value":"put"},{"label":"delete","value":"delete"}],"id":"u:7c48788db8af","multiple":false,"hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","mode":"horizontal","size":"full","inputClassName":"w-full","value":"post"}],"id":"u:d9d274b50340"},{"body":[{"type":"input-text","label":false,"name":"requestUrl","id":"u:841b001e3bcd","size":"full","placeholder":"请输入请求地址","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","value":"/thing/device/control/control"}],"id":"u:c8fab8bb0860"},{"body":[{"type":"input-number","label":"","name":"requestIntervalNumber","keyboard":true,"id":"u:69a53fa6dc9f","step":1,"mode":"inline","placeholder":"请求间隔","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"},{"type":"select","label":"","name":"requestIntervalUnit","options":[{"label":"秒","value":"second"},{"label":"分","value":"minute"},{"label":"时","value":"hour"},{"label":"天","value":"day"}],"id":"u:69f93c61c28b","multiple":false,"mode":"inline","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"}],"id":"u:1827f27e041b"}]},{"type":"grid","id":"u:208413b258dc","className":"m-b","columns":[]},{"type":"tpl","id":"u:931d6b4e0374","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","visibleOn":"data.sendCommandMethod === ''codes''","tpl":"function (context, service, command, event ){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:52152e74a360","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left","visibleOn":"data.sendCommandMethod === ''codes''","label":"下发指令","name":"commandContent","inputClassName":"w-full","language":"javascript","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"函数入参为:","content":"''context'': logicflow 上下文实例; \n ''service'': axios 请求实例;"}},{"type":"tpl","id":"u:2bb06db3ddd9","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"}","inline":true,"wrapperComponent":"","visibleOn":"data.sendCommandMethod === ''codes''"},{"type":"input-text","label":"弹框标题","name":"dialogTitle","id":"u:efa5bfe4e760","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"input-text","label":"弹框内容","name":"dialogContent","id":"u:e1ee364f3318","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"list-select","label":"指令下一步","name":"commandNext","id":"u:158bf05d1e6b","multiple":true,"options":[{"label":"显示隐藏","value":"showOrHide"}],"hiddenOn":"data.eventAction !== ''sendCommand''","joinValues":false},{"type":"grid","id":"u:f9985214eb9e","columns":[{"body":[{"type":"editor","name":"showHideNewValue","id":"u:9f2d894d8fc6","mode":"horizontal","label":false,"placeholder":"返回计算后的组件显示和隐藏, 格式为: return { ''组件id xxxxx-xxx-xxx'': ''show'' / ''hide'' } 或 return { ''组件id xxxxx-xxx-xxx'': e ? ''show'' : ''hide'' } , e为事件值。","size":"full","language":"javascript","inputControlClassName":"w-full","remark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top"},"description":"","visibleOn":"data.eventAction === ''showHide''","className":"w-full","inputClassName":"w-full","value":""}],"id":"u:52e0c15d0c8f"}],"className":"m-b"},{"type":"list-select","label":"复制组件ID","name":"allComponentList","id":"u:77a71866967a","mode":"horizontal","visibleOn":"data.eventAction === ''showHide''","multiple":false,"source":"${nodesList || graphDataList}","onEvent":{"change":{"actions":[{"actionType":"copy","args":{"content":"${event.data.value}"}}]}}},{"type":"grid","id":"u:7e8dfba20aee","columns":[]}],"id":"u:a13b61f23669","name":"eventsForm","className":"text-left","data":{"globalInputParamsCalculated":[],"device":"${device}","command":"${command}"}}],"onEvent":{"confirm":{"actions":[{"componentId":"u:364496dd313b","actionType":"custom","script":"const evType = event.data.eventType || event.data.__super.evType; \r\n const index = event.data.__index | event.data.__super.comboIndex; \r\n doAction({''componentId'': ''u:364496dd313b'', ''actionType'': ''setValue'', ''args'': { ''index'': index, ''value'': { ''config'': JSON.stringify(event.data), ''eventType'': evType }} })"}]}},"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:57f536c19373","size":"lg","type":"dialog","bodyClassName":"setting-events-dialog","name":"settingEventsDialog"}}]}},"label":"动作","editorState":"default"},{"type":"checkBox","id":"u:79dadbc61f74","name":"enable","label":"启用"}],"id":"u:364496dd313b","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:6d4a75088bc2","className":"border-none"}}],"data":{"eventCombo":[{"eventType":"click","enable":false,"config":""},{"eventType":"dblClick","enable":false,"config":""}]},"name":"eventsService"}],"id":"u:14834e895716","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"外观","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[]},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"uiDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"combo","name":"conditionVariables","label":"","value":[{"type":"equal"}],"multiLine":false,"multiple":true,"typeSwitchable":false,"conditions":[{"label":"相等","test":"this.type === \"equal\"","scaffold":{"type":"equal","label":"相等","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"数值","name":"value","type":"input-text","id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"真假","test":"this.type === \"boolean\"","scaffold":{"type":"boolean","label":"真假","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"真假","name":"value","type":"input-text","id":"u:32b3714b545b","placeholder":"true/false"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"范围/颜色","test":"this.type === \"rangeColor\"","scaffold":{"type":"rangeColor","label":"范围/颜色","name":""},"items":[{"label":"起始","name":"from","type":"input-number","precision":2,"id":"u:6f9362ce0efb"},{"label":"结束","name":"to","type":"input-number","precision":2,"id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]}],"id":"u:c92fdccb153e","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:4d4df8658829"}}],"name":"uiService","className":"p-none"}],"id":"u:7c5fc82d356f","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"显示/隐藏","body":[{"type":"service","id":"u:fed27a06a9ce","body":[{"type":"combo","id":"hiddenCombo","label":"","name":"hiddenCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"showOrHiddenName","label":"","id":"u:61d49c5acb77","borderMode":"none","value":"${index === 0 ? ''隐藏'' : ''显示''}","readOnly":true}],"id":"u:ea4bc33a4fcb"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:1f58747ec3e6","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:2c37d59dc3fc","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue) }, ''index'': index } }) } else {doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data) }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:d97eb93589c9","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:2cfc36ebe439","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:eb05d4b8ed36","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:d1187ed5b0ca"}],"id":"u:82fb0182df72","className":"flex-auto"}],"id":"u:27d29971018c","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":2}],"data":{"hiddenCombo":[{"dataPoint":"","min":"","max":""}]},"name":"hiddenService"}],"id":"u:fe703d82df8b","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"动效","id":"u:379a620b2bbc","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none","body":[{"type":"service","id":"u:594a746a7e96","body":[{"type":"combo","id":"animationCombo","label":"","name":"animationCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"animationName","label":"","id":"u:1cfdcc5ad7c7","borderMode":"none","value":"${''旋转''}","readOnly":true}],"id":"u:e3990e007f9c"},{"type":"flex","justify":"space-between","items":[{"type":"select","label":"速度","name":"animationTime","visibleOn":"this.index === 0","menuTpl":"
${value}秒","options":[{"label":"0.5","value":"0.5"},{"label":"1","value":"1"},{"label":"2","value":"2"},{"label":"3","value":"3"},{"label":"4","value":"4"},{"label":"5","value":"5"},{"label":"6","value":"6"},{"label":"7","value":"7"},{"label":"8","value":"8"}],"id":"u:f9762c0602ce","marks":{},"mode":"horizontal","multiple":false,"className":"w-full"}],"id":"u:18969f044f61"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:995482efad18","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:04e78b30faf4","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue), ''animationName'': ''旋转'' }, ''index'': index } }) } else {doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data),''animationName'': ''旋转'' }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:9707cde74e11","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:ec526d2df0ee","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:534114ea71cb","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:39bce4d2d60b"}],"id":"u:4a2208febcd4","className":"flex-auto"}],"id":"u:8ec6ca9fe14f","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":1}],"data":{"animationCombo":[{"dataPoint":"","min":"","max":""}]},"name":"animationService"}]}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p-sm"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "d1f70cfd-ec5d-4f89-8c87-5e976d757190",
"type": "custom-heptagon-node",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "d1f70cfd-ec5d-4f89-8c87-5e976d757190",
"width": 100,
"height": 100,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"strokeWidth": 1,
"showDefaultValue": false,
"showUnit": false,
"fontSize": 12,
"nodeAlias": "八边形",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "[{ \"val\": 0.00 }]",
"unit": ""
},
"eventsData": {
"eventCombo": [
{
"eventType": "click",
"enable": false,
"config": "{\"globalInputParamsCalculated\":[],\"device\":\"\",\"command\":\"\",\"eventAction\":\"sendCommand\",\"dataPointParamsCalculate\":\"return [\\n {\\n key: \\\"\\\",\\n value: ''''\\n }\\n]\",\"sendCommandMethod\":\"config\",\"inputParamsCalculate\":\"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\\nconst condition = {\\n deviceName: deviceInfo.code,\\n attrCode: command.controlDeviceAttr,\\n value: event == 0 ? 1 : event == 1 ? 0 : event\\n}\\nreturn {\\n \\\"condition\\\": JSON.stringify(condition),\\n \\\"controlId\\\": command.id\\n}\",\"requestMethod\":\"post\",\"requestUrl\":\"/thing/device/control/control\"}"
},
{
"eventType": "dblClick",
"enable": false,
"config": ""
}
]
},
"uiData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [
{
"type": "equal",
"label": "相等",
"name": ""
}
]
},
"animationData": {
"animationCombo": [
{
"min": "",
"max": "",
"animationName": "旋转",
"animationTime": 3
}
]
},
"hiddenData": {
"hiddenCombo": [
{
"dataPoint": "",
"min": "",
"max": "",
"showOrHiddenName": "隐藏"
}
]
}
}
}
}
]
}', '', '// 八边形
class HeptagonModel extends RectResize.model {
realValue = ''''
initNodeData(data) {
super.initNodeData(data)
const { properties } = this;
this.width = properties.width || 100;
this.height = properties.height || 100;
this.text.editable = false; // 不允许文本被编辑
window.nodeEventsListeners(this);
}
setAttributes() {
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
const { normalData } = dynamic || {};
let textValue = properties.content || '''';
if (normalData) {
const { defaultValue } = normalData || {}
const realValue = window.resolveScadaNewValue(defaultValue)
this.realValue = realValue
const { showDefaultValue, showUnit } = properties
if(showDefaultValue) {
textValue += '' '' + realValue
}
if (showUnit) {
textValue += '' '' + normalData.unit
}
}
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: textValue,
}
}
getNodeStyle() {
const style = super.getNodeStyle();
const { properties } = this;
style.fill = properties.fill || style.fill;
window.changeBackgroundColor(style, properties);
style.stroke = properties.strokeColor || style.stroke;
style.strokeWidth = properties.strokeWidth || style.strokeWidth;
style.opacity = properties.opacity || 1;
return style;
}
getTextStyle() {
const style = super.getTextStyle();
const { properties } = this;
style.color = properties.fontColor || style.color;
style.fontSize = properties.fontSize || style.fontSize;
const fontStyle = properties.fontStyle;
if(fontStyle) {
if (fontStyle.includes(''bold'')) {
style.fontWeight = ''bolder'';
}
if(fontStyle.includes(''italic'')) {
style.fontStyle = ''italic''
}
if (fontStyle.includes(''underline,line-through'')) {
style.textDecoration = ''underline line-through''
} else if (fontStyle.includes(''line-through,underline'')) {
style.textDecoration = ''line-through underline''
} else if (fontStyle.includes(''underline'')) {
style.textDecoration = ''underline''
} else if (fontStyle.includes(''line-through'')) {
style.textDecoration = ''line-through''
}
}
window.changeFontColor(style, properties);
return style;
}
getResizeOutlineStyle() {
return {
stroke: "#00ffff",
strokeWidth: 1,
strokeDasharray: "none",
};
}
}
class HeptagonView extends RectResize.view {
getResizeShape() {
const { x, y, width, height } = this.props.model
const style = this.props.model.getNodeStyle()
const pointList = [
[x - 0.205 * width, y - 0.5 * height],
[x + 0.205 * width, y - 0.5 * height],
[x + 0.5 * width, y - 0.205 * height],
[x + 0.5 * width, y + 0.205 * height],
[x + 0.205 * width, y + 0.5 * height],
[x - 0.205 * width, y + 0.5 * height],
[x - 0.5 * width, y + 0.205 * height],
[x - 0.5 * width, y - 0.205 * height]
]
const points = pointList.map(item => {
return `${item[0]},${item[1]}`
})
const attrs = {
...style,
x,
y,
width,
height,
points: points.join('' '')
}
return h(''g'', {}, [
h(''polygon'', { ...attrs })
])
}
}
lf.register({
type: ''custom-heptagon-node'',
view: HeptagonView,
model: HeptagonModel
})', NULL, 1001, NULL, 1001, 1067246875800000001, 1703498148279, 1067246875800000001, 1721286640792, 't', '基础图形', 't', 't', NULL);
INSERT INTO "public"."iot_section_detail" VALUES (109420676273762304, 'horizontal-dishends-tank', '水平碟状边缘水箱', NULL, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:da449a94908a","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:29852d093d9d","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:1b561d652acc","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:dc8c1daed8ed","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:9672575193ac","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"描边颜色","name":"strokeColor","id":"u:7783b65d58a9","mode":"horizontal","format":"rgba","inputClassName":"w-full"},{"type":"input-color","label":"液体颜色","name":"liquidColor","id":"u:76fa4643d6bd","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"switch","label":"显示值","option":"","name":"showValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"select","id":"u:678a2c313b7f","label":"值类型","name":"valueType","options":[{"label":"百分比","value":"ratio"},{"label":"常规值","value":"normal"}],"multiple":false,"mode":"horizontal","inputClassName":"w-full"},{"type":"grid","id":"u:94b0e20f05da","columns":[{"body":[{"type":"input-color","label":"值颜色","name":"valueColor","id":"u:9b5b55cac08a","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"值字体大小","name":"valueFontSize","keyboard":true,"id":"u:06950e120b0a","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"最大值","name":"maxValue","keyboard":true,"id":"u:683b1f856544","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"告警值","name":"warnValue","keyboard":true,"id":"u:a8ad2a11c88b","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"告警颜色","name":"warnColor","id":"u:e99642a0f118","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"严重值","name":"seriousValue","keyboard":true,"id":"u:2401d1c7a03e","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"严重颜色","name":"seriousColor","id":"u:ca0bc3e7cd7b","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"}],"id":"u:ac26ae965c66"}]},{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b m-t"},{"type":"input-text","label":"单位","name":"unit","id":"u:e545f00b0967","mode":"horizontal"},{"type":"input-color","label":"单位颜色","name":"unitColor","id":"u:ba117b6e3f6f","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"单位字体大小","name":"unitFontSize","keyboard":true,"id":"u:73f9e15b38a9","step":1,"mode":"horizontal","inputClassName":"w-full"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "5e019bc7-8031-4273-af34-6b10920e09c6",
"type": "horizontal-dishends-tank",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "5e019bc7-8031-4273-af34-6b10920e09c6",
"width": 200,
"height": 200,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"showValue": true,
"valueColor": "rgba(74, 144, 226, 1)",
"warnColor": "rgba(245, 166, 35, 1)",
"seriousColor": "rgba(208, 2, 27, 1)",
"showUnit": true,
"unitColor": "rgba(74, 144, 226, 1)",
"nodeAlias": "水平碟状边缘水箱",
"showDefaultValue": false,
"fontSize": 12,
"strokeColor": "#242770",
"liquidColor": "#7A8BFF",
"valueType": "ratio",
"valueFontSize": 16,
"maxValue": 100,
"warnValue": 75,
"seriousValue": 90,
"unitFontSize": 12,
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "",
"unit": ""
}
}
}
}
]
}', '', 'const { createApp, createVNode, render } = Vue;
const app = createApp({})
const defaultVal = 62;
const HorizontalDishendsTank = {
template: `
`,
props: {
chartId: {
type: String,
default: ''''
},
currentData: {
type: Number,
default: 100
},
width: {
type: Number,
default: 350
},
height: {
type: Number,
default: 150
},
chartProps: {
type: Object,
default: () => { }
},
thingName: {
type: String,
default: ''''
},
attr: {
type: String,
default: ''''
},
unit: {
type: String,
default: ''''
},
},
computed: {
getTitleStyle() {
return {
position: ''absolute'',
top: ''0px'',
bottom: `0px`,
width: ''100%'',
zIndex: 100,
display: ''flex'',
justifyContent: ''center'',
alignItems: ''center''
}
}
},
setup(props) {
const { computed, ref, watch, toRefs, nextTick } = Vue;
const { chartProps, currentData, thingName, attr, width, height } = toRefs(props);
let valueStr = ref('''');
let unitStr = ref('''');
let finalLiquidColor = ref(''#7A8BFF'');
let finalStrokeColor = ref("#242770");
const updateChart = (realValue, properties) => {
const { warnValue, seriousValue, maxValue, warnColor, seriousColor, showValue, valueType, showUnit, unit, liquidColor, strokeColor } = properties;
const ratio = (realValue / maxValue * 100).toFixed(2);
if (showValue) {
if (valueType === ''ratio'') {
valueStr.value = ratio + ''''
showUnit && (unitStr.value = ''%'')
} else {
valueStr.value = realValue + ''''
showUnit && (unitStr.value = unit)
}
}
finalLiquidColor.value = liquidColor;
finalStrokeColor.value = strokeColor;
if (seriousValue && realValue >= seriousValue) {
finalLiquidColor.value = seriousColor
} else if (warnValue && realValue >= warnValue) {
finalLiquidColor.value = warnColor
}
setTimeout(() => {
const tankNode = document.getElementById(props.chartId);
const liquidLevel = Math.round(27 - (realValue / maxValue * 60));
tankNode.style.transform = `translateY(${liquidLevel}%)`;
}, 50)
}
watch([currentData, chartProps], ([val, properties]) => {
nextTick(() => {
updateChart(val, properties)
})
}, {
immediate: true,
deep: true,
})
const valueStyle = computed(() => {
return {
color: chartProps.value.valueColor,
fontSize: chartProps.value.valueFontSize + ''px''
}
})
const unitStyle = computed(() => {
return {
color: chartProps.value.unitColor,
fontSize: chartProps.value.unitFontSize + ''px'',
marginLeft: ''3px''
}
})
return {
valueStyle,
unitStyle,
valueStr,
unitStr,
finalLiquidColor,
finalStrokeColor,
}
}
}
class HorizontalDishendsTankNode extends HtmlResize.view {
realValue = defaultVal
oldProperties = {}
chartRendered = false
instance = null
setHtml(rootEl) {
if (!rootEl) return;
const { properties, width, height } = this.props.model;
const { normalData } = properties.dynamic || {}
let thingName = ''pressure'';
let attr = ''score'';
if (normalData && normalData.dataPoint) {
const dataPointStrParsed = JSON.parse(normalData.dataPoint || ''{}'')
const { deviceCode, dataPoint } = dataPointStrParsed;
thingName = deviceCode;
attr = dataPoint.split('','')[0];
}
if (this.instance) {
// 实时数据不能推送一次就创建一次图表,可以在原有实例基础之上更改数据。
Object.assign(this.instance.component.props, {
name: properties.nodeAlias,
chartId: `liquidlevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
return
}
const el = document.createElement(''div'');
rootEl.innerHTML = '''';
const instance = createVNode(HorizontalDishendsTank, {
name: properties.nodeAlias,
chartId: `liquidLevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
instance.appContext = app._context
render(instance, el)
rootEl.appendChild(el);
this.instance = instance;
}
sameProps(properties) {
const isSame = window._.isEqual(this.oldProperties, properties);
if (isSame) return true;
this.oldProperties = properties;
return false
}
// 生命周期 支持重写内容, 但格式需一致
shouldUpdate() {
const { properties } = this.props.model;
const { normalData } = properties.dynamic || {};
if (normalData && !normalData.dataPoint && !normalData.defaultValue) {
this.realValue = defaultVal;
return true
}
if (normalData) {
const { defaultValue } = normalData || {};
if (defaultValue) {
const realValue = window.resolveScadaNewValue(defaultValue)
if (this.realValue !== Number(realValue)) {
this.realValue = Number(realValue);
return true;
}
}
}
const propertiesBack = window._.cloneDeep(properties);
if (propertiesBack.dynamic.normalData) {
const isSameProps = this.sameProps(propertiesBack);
if (isSameProps && this.chartRendered) {
return false
} else {
if (!this.chartRendered) {
this.chartRendered = true
return true
}
if (!isSameProps) {
return true;
}
}
}
}
updateHtml() {
this.setHtml(this.rootEl);
}
componentDidMount() {
// 防止拖动时候频繁渲染图表
this.updateHtmlDebounced = window._.debounce(this.updateHtml.bind(this), 500);
if (this.shouldUpdate()) {
this.setHtml(this.rootEl);
}
}
componentDidUpdate() {
if (this.shouldUpdate()) {
this.updateHtmlDebounced();
}
}
}
class HorizontalDishendsTankModel extends HtmlResize.model {
initNodeData(data) {
// 自定义组件,需最开始重置一下text 。
data.text = {
value: "",
x: data.x,
y: data.y,
};
super.initNodeData(data);
const { properties } = this;
this.width = properties.width || 80;
this.height = properties.height || 35;
this.text.editable = false; // 不允许文本被编辑
}
setAttributes() {
// 自定义组件需重置 text
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0 } = properties;
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: "",
}
}
}
lf.register({
type: ''horizontal-dishends-tank'',
view: HorizontalDishendsTankNode,
model: HorizontalDishendsTankModel,
})
', NULL, 1001, 1001, 1001, 1067246875800000001, 1706499582161, 1067246875800000001, 1721286641804, 't', '时间', 't', 't', '');
INSERT INTO "public"."iot_section_detail" VALUES (1739102615947448322, 'custom-radios-node', '单选按钮', NULL, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":16,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":16,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:da449a94908a","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:29852d093d9d","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:1b561d652acc","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:dc8c1daed8ed","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:9672575193ac","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"fieldset","title":"未选中外框","collapsable":true,"body":[{"type":"input-color","label":"边框颜色","name":"unselectedBorderColor","id":"u:1e65f3019268","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"外框背景","name":"unselectedBackColor","id":"u:5ec595ff09fa","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"边框宽度","name":"unselectedBorderWidth","keyboard":true,"id":"u:f4ddfdfcd992","step":1,"value":1,"mode":"horizontal","inputClassName":"w-full","className":"m-b"},{"type":"input-number","label":"外框直径","name":"unselectedDiameter","keyboard":true,"id":"u:88b2fa1cd79c","step":1,"value":16,"mode":"horizontal","inputClassName":"w-full","className":"m-b"}],"id":"u:6074abb701a2","bodyClassName":"m-b"},{"type":"fieldset","title":"已选中外框","collapsable":true,"body":[{"type":"input-color","label":"边框颜色","name":"selectedBorderColor","id":"u:f5d425de2baa","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"外框背景","name":"selectedBackColor","id":"u:c8b1d7ecdc6f","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"边框宽度","name":"selectedBorderWidth","keyboard":true,"id":"u:8d4d2889feec","step":1,"value":1,"mode":"horizontal","inputClassName":"w-full","className":"m-b"},{"type":"input-number","label":"边框直径","name":"selectedDiameter","keyboard":true,"id":"u:64f6d1af395f","step":1,"value":16,"mode":"horizontal","inputClassName":"w-full","className":"m-b"}],"id":"u:abbd40293dc1","bodyClassName":"m-b"},{"type":"fieldset","title":"已选中内框","collapsable":true,"body":[{"type":"input-color","label":"边框颜色","name":"selectedInnerBorderColor","id":"u:48d3c1bd1bf6","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"内框背景","name":"selectedInnerBackColor","id":"u:fa877bb5271c","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"边框宽度","name":"selectedInnerBorderWidth","keyboard":true,"id":"u:555d4566b41d","step":1,"value":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"边框直径","name":"selectedInnerDiameter","keyboard":true,"id":"u:eaa412061a52","step":1,"value":10,"mode":"horizontal","inputClassName":"w-full"}],"id":"u:925e078bc179"},{"type":"grid","columns":[],"id":"u:235f153e5ad5","className":"m-b"},{"type":"fieldset","id":"u:2a93d8eee7a9","className":"","title":"字体","collapsable":true,"body":[{"type":"container","id":"u:1606d0ad8360","body":[{"type":"select","id":"u:6f3470628b86","label":"字体类型","name":"fontFamily","mode":"horizontal","horizontal":{"leftFixed":"sm"},"size":"lg","options":[{},{"label":"宋体","value":"SimSun"},{"label":"微软雅黑","value":"Microsoft Yahei"},{"label":"苹方","value":"PingFang SC"},{"label":"Andale Mono","value":"andale mono,monospace"},{"label":"Arial","value":"arial,helvetica,sans-serif"},{"label":"Arial Black","value":"arial black,sans-serif"},{"label":"Book Antiqua","value":"book antiqua,palatino,serif"},{"label":"Comic Sans MS","value":"comic sans ms,sans-serif"},{"label":"Courier New","value":"courier new,courier,monospace"},{"label":"Georgia","value":"georgia,palatino,serif"},{"label":"Helvetica Neue","value":"Helvetica Neue"},{"label":"Helvetica","value":"helvetica,arial,sans-serif"},{"label":"Impact","value":"impact,sans-serif"},{"label":"Symbol","value":"symbol"},{"label":"Tahoma","value":"tahoma,arial,helvetica,sans-serif"},{"label":"Terminal","value":"terminal,monaco,monospace"},{"label":"Times New Roman","value":"times new roman,times,serif"},{"label":"Trebuchet MS","value":"trebuchet ms,geneva,sans-serif"},{"label":"Verdana","value":"verdana,geneva,sans-serif"}],"multiple":false,"className":"m-b","menuTpl":"
${label}","inputClassName":""},{"type":"input-color","label":"字体","name":"fontColor","id":"u:f398c821eda1","mode":"horizontal","size":"lg","className":"m-b","format":"rgba","placeholder":"字体颜色","horizontal":{"leftFixed":"sm"},"inputClassName":""},{"type":"input-number","id":"u:0063eed6ed66","label":"字体大小","name":"fontSize","min":12,"step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"className":"m-b","keyboard":true,"displayMode":"enhance","value":12,"max":100},{"type":"checkboxes","id":"u:b34f4c274416","className":"custom-checkbox-style m-b","label":"文字样式","name":"fontStyle","options":[{"label":"fa-bold fa","value":"bold"},{"label":"fa-italic fa","value":"italic"},{"label":"fa-underline fa","value":"underline"},{"label":"fa fa-strikethrough","value":"line-through"}],"checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","multiple":true},{"type":"input-number","label":"字符间距","name":"fontSpace","keyboard":true,"id":"u:d05b551cf67c","step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"displayMode":"enhance","className":"m-b","min":0,"max":50},{"type":"input-number","label":"文字行高","name":"lineHeight","keyboard":true,"id":"u:0063eed6ed66","step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"displayMode":"enhance","className":"m-b","min":12}],"style":{"position":"static","display":"block"},"wrapperBody":false}],"bodyClassName":"m-b"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"},{"type":"combo","label":"默认选项","name":"defaultOptions","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:08d88a5e111c"},"items":[{"type":"input-text","name":"label","placeholder":"标签","id":"u:b5c4bc1855e7"},{"type":"input-text","name":"value","placeholder":"值","id":"u:ec8ee3ef943e"}],"id":"u:ac8d96e032b9","strictMode":true,"syncFields":[],"tabsMode":false,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-text","label":"数据源api","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"editor","label":"数据过滤","name":"dataFilterFn","id":"u:f9ef754971e0","language":"javascript","value":"return datas","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","content":"入参为下拉框返回数据: datas"},"labelClassName":"text-left","inputClassName":"text-left","options":{"lineNumbers":"off"}}],"name":"normalService","className":"p-none"},{"type":"service","body":[],"id":"u:0dd069ac163f"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"事件","body":[{"type":"service","id":"u:4ec2acc50405","body":[{"type":"combo","label":"","name":"eventCombo","multiple":true,"addable":false,"removable":false,"addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ae1b0a0c0f55"},"items":[{"type":"select","name":"eventType","placeholder":"选择事件","options":[{"label":"改变","value":"change"}],"id":"u:a7b44847011a","label":"名称"},{"type":"checkBox","id":"u:79dadbc61f74","name":"enable","label":"启用"},{"type":"fieldset","id":"u:fbccd2ccc8a3","title":"目标节点发起请求","collapsable":true,"body":[{"type":"input-text","label":"目标节点","name":"targetNode","id":"u:6efb6f120e47","multiple":false,"mode":"horizontal","inputClassName":"w-full","visibleOn":"this.eventType === ''change''","removable":"true","placeholder":"目标节点id"},{"type":"select","label":"入参类型","name":"targetParamsType","options":[{"label":"物实体","value":"entitys"},{"label":"物属性","value":"attrs"},{"label":"时间","value":"times"}],"id":"u:d10a57a9b966","multiple":false,"mode":"horizontal","inputClassName":"w-full","removable":true},{"type":"radios","label":"入参实体","name":"targetParamsEntitys","options":[{"label":"物组","value":"group"},{"label":"列表","value":"list"},{"label":"关系","value":"relation"},{"label":"搜索","value":"search"},{"label":"标签","value":"tag"},{"label":"类型","value":"type"}],"id":"u:26df91ece010","onEvent":{"change":{"actions":[{"actionType":"custom","script":"console.log(''event'', event);"}]}},"checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''entitys''"},{"type":"radios","label":"属性类型","name":"targetParamsAttrsType","options":[{"label":"分属性","value":"split"},{"label":"全部","value":"all"}],"id":"u:26df91ece010","checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''attrs''"},{"type":"radios","label":"入参属性","name":"targetParamsAttrsKeysEntitys","options":[{"label":"物","value":"entitys"},{"label":"属性","value":"keys"}],"id":"u:26df91ece010","checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''attrs''"},{"type":"radios","label":"入参时间","name":"targetParamsTimesType","options":[{"label":"最近","value":"nearest"},{"label":"时间段","value":"range"},{"label":"区间","value":"interval"}],"id":"u:26df91ece010","multiple":false,"checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''times''"},{"type":"input-text","label":"超级api","name":"apiId","id":"u:912394455375","placeholder":"超级apiId"}]},{"type":"fieldset","id":"u:51249df94c65","title":"更多操作","collapsable":true,"body":[{"type":"tpl","tpl":"function (context, service, nodeId, event) {","inline":true,"wrapperComponent":"","id":"u:799cd3277731"},{"type":"editor","id":"u:77aca39f5961","label":"","name":"moreOperation","language":"javascript","className":"my-0"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:cd392cfb6ffb"}],"bodyClassName":"text-left"}],"id":"u:364496dd313b","removableMode":"icon","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:6d4a75088bc2","className":"border-none"},"strictMode":true,"syncFields":[],"labelClassName":""}],"data":{"eventCombo":[{"eventType":"click","enable":false,"config":""},{"eventType":"dblClick","enable":false,"config":""}]},"name":"eventsService"}],"id":"u:14834e895716","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "88cbfa0c-7a9e-4da3-b727-a11eda60a3f0",
"type": "custom-radios-node",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "88cbfa0c-7a9e-4da3-b727-a11eda60a3f0",
"width": 150,
"height": 30,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"unselectedBorderWidth": 1,
"unselectedDiameter": 16,
"selectedBorderWidth": 1,
"selectedDiameter": 16,
"selectedInnerBorderWidth": 0,
"selectedInnerDiameter": 10,
"fontSize": 12,
"nodeAlias": "单选按钮",
"showDefaultValue": false,
"showUnit": false,
"valueColor": "rgba(245, 166, 35, 1)",
"unselectedBorderColor": "rgba(155, 155, 155, 1)",
"unselectedBackColor": "rgba(255, 255, 255, 0)",
"selectedBorderColor": "rgba(74, 144, 226, 1)",
"selectedBackColor": "rgba(255, 255, 255, 0)",
"selectedInnerBorderColor": "rgba(74, 144, 226, 1)",
"selectedInnerBackColor": "rgba(74, 144, 226, 1)",
"fontColor": "rgba(74, 74, 74, 1)",
"fontFamily": "Microsoft Yahei",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "",
"unit": "",
"dataFilterFn": "return datas",
"defaultOptions": [
{
"label": "电",
"value": "A29"
},
{
"label": "水",
"value": "B2"
}
]
},
"eventsData": {
"eventCombo": [
{
"eventType": "change",
"enable": false,
"config": "",
"customEventHandler": false,
"targetParamsType": "entitys",
"targetParamsEntitys": "list"
}
]
}
}
}
}
]
}', '.scada-radio {
position: relative;
width: 16px;
height: 16px;
}
.scada-radio input {
position: absolute;
visibility: hidden
}
.scada-radio label {
position: absolute;
display: inline-block;
width: 16px;
height: 16px;
border: 1px solid #d7d7d7;
border-radius: 9px;
}
/*选中状态*/
.nm-radio input:checked + label {
border: 1px solid #1baede;
}
.nm-radio input:checked + label:before {
content: "";
position: absolute;
top: 3px; left: 3px;
width: 10px;
height: 10px;
border-radius: 5px;
background-color: #1baede;
}', '
const { createApp, createVNode, render } = Vue;
const app = createApp({})
const Radios = {
template: `
`,
props: {
fontColor: {
type: String,
default: ''#ffffff''
},
fontSize: {
type: Number,
default: 14
},
fontFamily: {
type: String,
default: ''宋体''
},
fontStyle: {
type: String,
default: ''normal''
},
width: {
type: Number,
default: 80
},
height: {
type: Number,
default: 35
},
unselectedBorderWidth: {
type: Number,
default: 1,
},
unselectedBorderColor: {
type: String,
default: ''rgba(155, 155, 155, 1)''
},
unselectedBackColor: {
type: String,
default: ''rgba(255, 255, 255, 0)''
},
selectedBorderWidth: {
type: Number,
default: 1
},
selectedBorderColor: {
type: String,
default: ''rgba(74, 144, 226, 1)''
},
selectedBackColor: {
type: String,
default: ''rgba(255, 255, 255, 0)''
},
selectedInnerBorderWidth: {
type: Number,
default: 0
},
selectedInnerBorderColor: {
type: String,
default: ''rgba(74, 144, 226, 1)''
},
selectedInnerBackColor: {
type: String,
default: ''rgba(74, 144, 226, 1)''
},
unselectedDiameter: {
type: Number,
default: 16
},
selectedDiameter: {
type: Number,
default: 16
},
selectedInnerDiameter: {
type: Number,
default: 10
},
radioList: {
type: Array,
default: () => []
},
realValue: {
type: String,
default: ''''
}
},
emits: ["change"],
computed: {
getStyle() {
// const { fontColor, fontSize, fontFamily, fontStyle, width, height, lineHeight, backgroundColor,strokeColor,strokeWidth } = this
const { width, height } = this;
return {
width: width + ''px'',
height: height + ''px'',
display: "flex",
"flex-direction": width > height ? "row" : "column",
"justify-content": "flex-start",
"align-items": width > height ? ''center'' : ''left''
}
},
getRadioOuter() {
const { selectedDiameter } = this;
return {
position: "relative",
width: selectedDiameter + ''px'',
height: selectedDiameter + ''px'',
flex: ''1'',
}
},
getRadioInput() {
return {
position: ''absolute'',
visibility: ''hidden''
}
},
labelStyle() {
const { fontColor, fontSize, fontFamily, fontStyle, selectedDiameter, selectedInnerDiameter } = this;
const pos = (selectedDiameter - selectedInnerDiameter) / 2;
const style = {};
if (fontStyle) {
if (fontStyle.includes(''bold'')) {
style["font-weight"] = ''bolder'';
}
if (fontStyle.includes(''italic'')) {
style["font-style"] = ''italic''
}
if (fontStyle.includes(''underline,line-through'')) {
style["text-decoration"] = ''underline line-through''
} else if (fontStyle.includes(''line-through,underline'')) {
style["text-decoration"] = ''line-through underline''
} else if (fontStyle.includes(''underline'')) {
style["text-decoration"] = ''underline''
} else if (fontStyle.includes(''line-through'')) {
style["text-decoration"] = ''line-through''
}
}
return {
position: ''absolute'',
top: ''0px'',
left: pos + selectedDiameter + 5 + ''px'',
''color'': fontColor,
''font-size'': fontSize + ''px'',
''font-family'': fontFamily,
height: ''100%'',
display: ''flex'',
''align-items'': ''center'',
...style,
}
},
getRadioLabel: () => (item, radioList, unselectedBorderWidth, unselectedBorderColor, unselectedBackColor,
selectedBorderWidth, selectedBorderColor, selectedBackColor,
unselectedDiameter, selectedDiameter) => {
if (radioList.length > 0) {
return {
position: ''absolute'',
left: ''0px'',
display: ''inline-block'',
width: item.checked === ''checked'' ? selectedDiameter + ''px'' : unselectedDiameter + ''px'',
height: item.checked === ''checked'' ? selectedDiameter + ''px'' : unselectedDiameter + ''px'',
"border-width": item.checked === ''checked'' ? selectedBorderWidth + ''px'' : unselectedBorderWidth + ''px'',
"border-color": item.checked === ''checked'' ? selectedBorderColor : unselectedBorderColor,
"border-style": "solid",
''border-radius'': item.checked === ''checked'' ? (selectedDiameter + 2) / 2 + ''px'' : (unselectedDiameter + 2) / 2 + ''px'',
''background-color'': item.checked === ''checked'' ? selectedBackColor : unselectedBackColor,
''box-sizing'': ''content-box'',
''cursor'': ''pointer''
}
}
},
getCheckedInner() {
const {
selectedInnerBorderWidth, selectedInnerBorderColor, selectedInnerBackColor,
selectedDiameter, selectedInnerDiameter } = this
const pos = (selectedDiameter - selectedInnerDiameter) / 2 + ''px''
return {
position: ''absolute'',
top: pos,
left: pos,
width: selectedInnerDiameter + ''px'',
height: selectedInnerDiameter + ''px'',
''border-radius'': selectedInnerDiameter / 2 + ''px'',
''background-color'': selectedInnerBackColor,
''border-width'': selectedInnerBorderWidth + ''px'',
''border-color'': selectedInnerBorderColor,
''border-style'': ''solid'',
''box-sizing'': ''border-box''
}
}
},
setup(props, { emit }) {
const { ref, watch } = Vue
const myRadioList = ref([])
const clickHandler = (item) => {
myRadioList.value.forEach((el) => {
if (el.value === item.value) {
el.checked = ''checked'';
} else {
el.checked = false
}
})
emit("change", item.value);
}
watch(() => props.radioList, (val) => {
myRadioList.value = val
}, {
immediate: true,
})
watch(() => props.realValue, (val) => {
if (val) {
myRadioList.value.forEach((el) => {
if (el.value === String(val)) {
el.checked = ''checked'';
} else {
el.checked = false
}
})
}
}, {
immediate: true,
})
return {
clickHandler,
myRadioList
}
}
}
class CustomRadiosNode extends HtmlResize.view {
oldProperties = {}
setHtml(rootEl) {
const { properties, width, height, } = this.props.model;
const { fontColor, fontSize, fontFamily, fontStyle,
unselectedBorderWidth, unselectedBorderColor, unselectedBackColor,
selectedBorderWidth, selectedBorderColor, selectedBackColor,
selectedInnerBorderWidth, selectedInnerBorderColor, selectedInnerBackColor,
unselectedDiameter, selectedDiameter, selectedInnerDiameter } = properties;
const { model, graphModel } = this.props;
const el = document.createElement(''div'');
rootEl.innerHTML = '''';
const { normalData } = properties.dynamic || {};
const { defaultOptions } = normalData || {};
let list = [];
if (defaultOptions) {
let opts = []
if (typeof defaultOptions !== ''string'') {
opts = defaultOptions
} else {
opts = JSON.parse(defaultOptions);
}
list = window._.cloneDeep(opts).map((el, index) => {
if (index === 0) {
el.checked = ''checked''
} else {
el.checked = false
}
return el;
})
}
let realValue = "";
if (normalData) {
realValue = window.resolveScadaNewValue(normalData.defaultValue);
}
const changeHandler = (e) => {
graphModel.eventCenter.emit("node:change", {
data: this.props.model,
e,
});
}
const instance = createVNode(Radios, {
realValue,
radioList: list,
fontColor,
fontSize, fontFamily, fontStyle, width, height,
unselectedBorderWidth, unselectedBorderColor, unselectedBackColor,
selectedBorderWidth, selectedBorderColor, selectedBackColor,
selectedInnerBorderWidth, selectedInnerBorderColor, selectedInnerBackColor,
unselectedDiameter, selectedDiameter, selectedInnerDiameter,
onChange: changeHandler
})
instance.appContext = app._context
render(instance, el)
rootEl.appendChild(el);
}
sameProps(properties) {
const isSame = window._.isEqual(this.oldProperties, properties);
if (isSame) return true;
this.oldProperties = properties;
return false
}
// 生命周期 支持重写内容, 但格式需一致
shouldUpdate() {
const { properties } = this.props.model;
const propertiesBack = window._.cloneDeep(properties);
// 由于事件change 会给properties 增加一个 event 属性(见目录scadaDashboard/Diagram/useDynamicEventsHandler),会引发属性的改变,导致组件重渲染。
delete propertiesBack.event;
if (this.sameProps(propertiesBack)) {
return false
}
return true;
}
}
class CustomRadiosModel extends HtmlResize.model {
initNodeData(data) {
// 自定义组件,需最开始重置一下text 。
data.text = {
value: "",
x: data.x,
y: data.y,
};
super.initNodeData(data);
const { properties } = this;
this.width = properties.width || 80;
this.height = properties.height || 35;
}
setAttributes() {
// 自定义组件需重置 text
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0 } = properties;
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: "",
}
}
}
lf.register({
type: ''custom-radios-node'',
view: CustomRadiosNode,
model: CustomRadiosModel,
})
', NULL, 1001, NULL, 1699972072580583400, 1067246875800000001, 1703498149264, 1067246875800000001, 1721286641569, 't', '文字', 't', 't', '');
INSERT INTO "public"."iot_section_detail" VALUES (109414855322202112, 'horizontal-cylinder-tank', '水平圆柱水箱', NULL, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:da449a94908a","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:29852d093d9d","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:1b561d652acc","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:dc8c1daed8ed","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:9672575193ac","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"描边颜色","name":"strokeColor","id":"u:7783b65d58a9","mode":"horizontal","format":"rgba","inputClassName":"w-full"},{"type":"input-color","label":"液体颜色","name":"liquidColor","id":"u:76fa4643d6bd","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"switch","label":"显示值","option":"","name":"showValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"select","id":"u:678a2c313b7f","label":"值类型","name":"valueType","options":[{"label":"百分比","value":"ratio"},{"label":"常规值","value":"normal"}],"multiple":false,"mode":"horizontal","inputClassName":"w-full"},{"type":"grid","id":"u:94b0e20f05da","columns":[{"body":[{"type":"input-color","label":"值颜色","name":"valueColor","id":"u:9b5b55cac08a","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"值字体大小","name":"valueFontSize","keyboard":true,"id":"u:06950e120b0a","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"最大值","name":"maxValue","keyboard":true,"id":"u:683b1f856544","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"告警值","name":"warnValue","keyboard":true,"id":"u:a8ad2a11c88b","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"告警颜色","name":"warnColor","id":"u:e99642a0f118","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"严重值","name":"seriousValue","keyboard":true,"id":"u:2401d1c7a03e","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"严重颜色","name":"seriousColor","id":"u:ca0bc3e7cd7b","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"}],"id":"u:ac26ae965c66"}]},{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b m-t"},{"type":"input-text","label":"单位","name":"unit","id":"u:e545f00b0967","mode":"horizontal"},{"type":"input-color","label":"单位颜色","name":"unitColor","id":"u:ba117b6e3f6f","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"单位字体大小","name":"unitFontSize","keyboard":true,"id":"u:73f9e15b38a9","step":1,"mode":"horizontal","inputClassName":"w-full"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "26bc86b7-4cb8-4819-823d-ff6ab145d902",
"type": "horizontal-cylinder-tank",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "26bc86b7-4cb8-4819-823d-ff6ab145d902",
"width": 200,
"height": 200,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"showValue": true,
"valueColor": "rgba(74, 144, 226, 1)",
"warnColor": "rgba(245, 166, 35, 1)",
"seriousColor": "rgba(208, 2, 27, 1)",
"showUnit": false,
"unitColor": "rgba(74, 144, 226, 1)",
"nodeAlias": "水平圆柱水箱",
"showDefaultValue": false,
"fontSize": 12,
"strokeColor": "#242770",
"liquidColor": "#7A8BFF",
"valueType": "ratio",
"valueFontSize": 16,
"maxValue": 100,
"warnValue": 75,
"seriousValue": 90,
"unitFontSize": 12,
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "",
"unit": ""
}
}
}
}
]
}', '', 'const { createApp, createVNode, render } = Vue;
const app = createApp({})
const defaultVal = 62;
const HorizontalCylinderTank = {
template: `
`,
props: {
chartId: {
type: String,
default: ''''
},
currentData: {
type: Number,
default: 100
},
width: {
type: Number,
default: 350
},
height: {
type: Number,
default: 150
},
chartProps: {
type: Object,
default: () => { }
},
thingName: {
type: String,
default: ''''
},
attr: {
type: String,
default: ''''
},
unit: {
type: String,
default: ''''
},
},
computed: {
getTitleStyle() {
return {
position: ''absolute'',
top: ''0px'',
bottom: `0px`,
width: ''100%'',
zIndex: 100,
display: ''flex'',
justifyContent: ''center'',
alignItems: ''center''
}
}
},
setup(props) {
const { computed, ref, watch, toRefs, nextTick } = Vue;
const { chartProps, currentData, thingName, attr, width, height } = toRefs(props);
let valueStr = ref('''');
let unitStr = ref('''');
let finalLiquidColor = ref(''#7A8BFF'');
let finalStrokeColor = ref("#242770");
const updateChart = (realValue, properties) => {
const { warnValue, seriousValue, maxValue, warnColor, seriousColor, showValue, valueType, showUnit, unit, liquidColor, strokeColor } = properties;
const ratio = (realValue / maxValue * 100).toFixed(2);
if (showValue) {
if (valueType === ''ratio'') {
valueStr.value = ratio + ''''
showUnit && (unitStr.value = ''%'')
} else {
valueStr.value = realValue + ''''
showUnit && (unitStr.value = unit)
}
}
finalLiquidColor.value = liquidColor;
finalStrokeColor.value = strokeColor;
if (seriousValue && realValue >= seriousValue) {
finalLiquidColor.value = seriousColor
} else if (warnValue && realValue >= warnValue) {
finalLiquidColor.value = warnColor
}
setTimeout(() => {
const tankNode = document.getElementById(props.chartId);
const liquidLevel = Math.round(23 - (realValue / maxValue * 54));
tankNode.style.transform = `translateY(${liquidLevel}%)`;
}, 50)
}
watch([currentData, chartProps], ([val, properties]) => {
nextTick(() => {
updateChart(val, properties)
})
}, {
immediate: true,
deep: true,
})
const valueStyle = computed(() => {
return {
color: chartProps.value.valueColor,
fontSize: chartProps.value.valueFontSize + ''px''
}
})
const unitStyle = computed(() => {
return {
color: chartProps.value.unitColor,
fontSize: chartProps.value.unitFontSize + ''px'',
marginLeft: ''3px''
}
})
return {
valueStyle,
unitStyle,
valueStr,
unitStr,
finalLiquidColor,
finalStrokeColor,
}
}
}
class HorizontalCylinderTankNode extends HtmlResize.view {
realValue = defaultVal
oldProperties = {}
chartRendered = false
instance = null
setHtml(rootEl) {
if (!rootEl) return;
const { properties, width, height } = this.props.model;
const { normalData } = properties.dynamic || {}
let thingName = ''pressure'';
let attr = ''score'';
if (normalData && normalData.dataPoint) {
const dataPointStrParsed = JSON.parse(normalData.dataPoint || ''{}'')
const { deviceCode, dataPoint } = dataPointStrParsed;
thingName = deviceCode;
attr = dataPoint.split('','')[0];
}
if (this.instance) {
// 实时数据不能推送一次就创建一次图表,可以在原有实例基础之上更改数据。
Object.assign(this.instance.component.props, {
name: properties.nodeAlias,
chartId: `liquidlevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
return
}
const el = document.createElement(''div'');
rootEl.innerHTML = '''';
const instance = createVNode(HorizontalCylinderTank, {
name: properties.nodeAlias,
chartId: `liquidLevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
instance.appContext = app._context
render(instance, el)
rootEl.appendChild(el);
this.instance = instance;
}
sameProps(properties) {
const isSame = window._.isEqual(this.oldProperties, properties);
if (isSame) return true;
this.oldProperties = properties;
return false
}
// 生命周期 支持重写内容, 但格式需一致
shouldUpdate() {
const { properties } = this.props.model;
const { normalData } = properties.dynamic || {};
if (normalData && !normalData.dataPoint && !normalData.defaultValue) {
this.realValue = defaultVal;
return true
}
if (normalData) {
const { defaultValue } = normalData || {};
if (defaultValue) {
const realValue = window.resolveScadaNewValue(defaultValue)
if (this.realValue !== Number(realValue)) {
this.realValue = Number(realValue);
return true;
}
}
}
const propertiesBack = window._.cloneDeep(properties);
if (propertiesBack.dynamic.normalData) {
const isSameProps = this.sameProps(propertiesBack);
if (isSameProps && this.chartRendered) {
return false
} else {
if (!this.chartRendered) {
this.chartRendered = true
return true
}
if (!isSameProps) {
return true;
}
}
}
}
updateHtml() {
this.setHtml(this.rootEl);
}
componentDidMount() {
// 防止拖动时候频繁渲染图表
this.updateHtmlDebounced = window._.debounce(this.updateHtml.bind(this), 500);
if (this.shouldUpdate()) {
this.setHtml(this.rootEl);
}
}
componentDidUpdate() {
if (this.shouldUpdate()) {
this.updateHtmlDebounced();
}
}
}
class HorizontalCylinderTankModel extends HtmlResize.model {
initNodeData(data) {
// 自定义组件,需最开始重置一下text 。
data.text = {
value: "",
x: data.x,
y: data.y,
};
super.initNodeData(data);
const { properties } = this;
this.width = properties.width || 80;
this.height = properties.height || 35;
this.text.editable = false; // 不允许文本被编辑
}
setAttributes() {
// 自定义组件需重置 text
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0 } = properties;
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: "",
}
}
}
lf.register({
type: ''horizontal-cylinder-tank'',
view: HorizontalCylinderTankNode,
model: HorizontalCylinderTankModel,
})
', NULL, 1001, 1001, 1001, 1067246875800000001, 1706498194339, 1067246875800000001, 1721286641632, 't', '时间', 't', 't', '');
INSERT INTO "public"."iot_section_detail" VALUES (1739102613074350081, 'custom-actor-node', '人物', 1, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:1954dc15dd5b","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:656efdb758ad","step":1,"suffix":"px","placeholder":"组件宽度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelClassName":"w-8","labelAlign":"left","precision":2,"inputClassName":"w-full"}],"id":"u:4274c47a4ef5","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:1ed6dcd98c1a","step":1,"suffix":"px","placeholder":"组件高度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelAlign":"left","labelClassName":"w-8","precision":2,"inputClassName":"w-full"}],"id":"u:3e9d1e71a69f","md":6}]},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"填充","name":"fill","id":"u:0d19ed3e2bdc","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:facc5c90e990","md":6},{"body":[{"type":"input-color","label":"描边","name":"strokeColor","id":"u:89afff5fd00d","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:7c903d9d40ab","md":6}],"id":"u:457970dd35bf","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-number","label":"边宽","name":"strokeWidth","id":"u:8dcf62d3dab5","placeholder":"描边宽度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":1,"value":1,"suffix":"px","inputClassName":"w-full"}],"id":"u:d701217b85ef","md":6},{"body":[{"type":"input-text","label":"内容","name":"content","id":"u:bea5a408f98f","mode":"horizontal","size":"full","inputControlClassName":"inputControlClassName-bea5a408f98f"}],"id":"u:afc37bde0156","md":6}],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"switch","label":"显示值","option":"","name":"showDefaultValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"},{"body":[{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:5b89c331fe7e"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"fieldset","id":"u:2a93d8eee7a9","className":"","title":"字体","collapsable":true,"body":[{"type":"container","id":"u:1606d0ad8360","body":[{"type":"select","id":"u:6f3470628b86","label":"字体类型","name":"fontFamily","mode":"horizontal","horizontal":{"leftFixed":"sm"},"size":"lg","options":[{},{"label":"宋体","value":"SimSun"},{"label":"微软雅黑","value":"Microsoft Yahei"},{"label":"苹方","value":"PingFang SC"},{"label":"Andale Mono","value":"andale mono,monospace"},{"label":"Arial","value":"arial,helvetica,sans-serif"},{"label":"Arial Black","value":"arial black,sans-serif"},{"label":"Book Antiqua","value":"book antiqua,palatino,serif"},{"label":"Comic Sans MS","value":"comic sans ms,sans-serif"},{"label":"Courier New","value":"courier new,courier,monospace"},{"label":"Georgia","value":"georgia,palatino,serif"},{"label":"Helvetica Neue","value":"Helvetica Neue"},{"label":"Helvetica","value":"helvetica,arial,sans-serif"},{"label":"Impact","value":"impact,sans-serif"},{"label":"Symbol","value":"symbol"},{"label":"Tahoma","value":"tahoma,arial,helvetica,sans-serif"},{"label":"Terminal","value":"terminal,monaco,monospace"},{"label":"Times New Roman","value":"times new roman,times,serif"},{"label":"Trebuchet MS","value":"trebuchet ms,geneva,sans-serif"},{"label":"Verdana","value":"verdana,geneva,sans-serif"}],"multiple":false,"className":"m-b","menuTpl":"
${label}","inputClassName":""},{"type":"input-color","label":"字体","name":"fontColor","id":"u:f398c821eda1","mode":"horizontal","size":"lg","className":"m-b","format":"rgba","placeholder":"字体颜色","horizontal":{"leftFixed":"sm"},"inputClassName":""},{"type":"input-number","id":"u:0063eed6ed66","label":"字体大小","name":"fontSize","min":12,"step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"className":"m-b","keyboard":true,"displayMode":"enhance","value":12,"max":100},{"type":"checkboxes","id":"u:b34f4c274416","className":"custom-checkbox-style m-b","label":"文字样式","name":"fontStyle","options":[{"label":"fa-bold fa","value":"bold"},{"label":"fa-italic fa","value":"italic"},{"label":"fa-underline fa","value":"underline"},{"label":"fa fa-strikethrough","value":"line-through"}],"checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","multiple":true},{"type":"checkboxes","label":"文字位置","name":"fontAlign","multiple":false,"options":[{"label":"fa fa-align-left","value":"left"},{"label":"fa fa-align-center","value":"center"},{"label":"fa fa-align-right","value":"right"},{"label":"fa fa-align-justify","value":"justify"}],"id":"u:7e80e906ea14","checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","className":"custom-checkbox-style m-b"},{"type":"input-number","label":"文字行高","name":"lineHeight","keyboard":true,"id":"u:0063eed6ed66","step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"displayMode":"enhance","className":"m-b","min":12}],"style":{"position":"static","display":"block"},"wrapperBody":false}],"bodyClassName":"m-b"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","editorState":"default","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"},{"type":"service","body":[],"id":"u:0dd069ac163f"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"事件","body":[{"type":"service","id":"u:4ec2acc50405","body":[{"type":"combo","label":"","name":"eventCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ae1b0a0c0f55"},"items":[{"type":"select","name":"eventType","placeholder":"选择事件","options":[{"label":"单击","value":"click"},{"label":"双击","value":"dblClick"},{"label":"改变","value":"change"},{"label":"鼠标进入","value":"mouseEnter"},{"label":"鼠标离开","value":"mouseLeave"}],"id":"u:a7b44847011a","label":"名称"},{"type":"input-text","name":"config","placeholder":"事件配置","id":"u:d491386a95c2","onEvent":{"focus":{"actions":[{"actionType":"dialog","dialog":{"title":"设置事件","data":{"comboIndex":"${index}","&":"${config | toJson}","nodesList":"${graphDataList}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","evType":"${eventType}"},"body":[{"type":"form","title":"表单","body":[{"type":"radios","label":"事件行为","name":"eventAction","options":[{"label":"打开链接","value":"openLink"},{"label":"打开弹窗","value":"openDialog"},{"label":"下发指令","value":"sendCommand"},{"label":"显示隐藏","value":"showHide"}],"mode":"horizontal","horizontal":{"leftFixed":"sm"},"id":"u:9e7f1220367f","value":"openLink"},{"type":"input-text","label":"链接地址","name":"linkAddress","mode":"horizontal","horizontal":{"leftFixed":"sm"},"inputClassName":"w-full","id":"u:c5bda965ed3c","size":"full","visibleOn":"data.eventAction === ''openLink''"},{"type":"combo","label":"参数","name":"dataPointTable","id":"dataPointTable","addable":true,"strictMode":true,"removable":true,"horizontal":{"leftFixed":"sm"},"multiple":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bf2f6c98dbff"},"items":[{"type":"input-text","name":"dataPoint","id":"u:1eb050ec98d3","label":"","multiple":false,"size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"left":2,"right":10},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"select","label":"设备","name":"devices","id":"u:1cdb908c23a8","multiple":false,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"const selectedItems = event.data.selectedItems;\r\n if(selectedItems) { doAction({actionType: ''setValue'', componentId: ''u:51f0e51abd7c'', args: { value: { attrs: selectedItems.attrs, deviceCode: selectedItems.deviceCode } } }); }"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10}},{"type":"select","label":"数据点","name":"dataPoint","id":"u:8147daea685d","multiple":true,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}"},"submitText":""}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","dataPointTableIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"componentId":"dataPointTable","actionType":"setValue","args":{"value":{"dataPoint":"${event.data | json}"},"index":"${index}"}}]}}}}]}},"horizontal":{"left":1,"right":11}}],"syncFields":[],"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"editor","label":"参数计算","name":"dataPointParamsCalculate","id":"u:4d5e749b7f42","visibleOn":"data.eventAction === ''openLink''","className":"text-left m-b-xs","inputClassName":"w-full","language":"javascript","value":"return [\n {\n key: \"\",\n value: ''''\n }\n]"},{"type":"radios","label":"打开方式","name":"openMethod","id":"u:eec4f8737fe8","options":[{"label":"打开新页面","value":"openNewPage"},{"label":"打开到本页","value":"openLocalPage"}],"horizontal":{"leftFixed":"sm"},"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"radios","label":"下发指令方式","name":"sendCommandMethod","hiddenOn":"data.eventAction !== ''sendCommand''","id":"u:82d9feb7609d","options":[{"label":"配置","value":"config"},{"label":"代码","value":"codes"}],"value":"config"},{"type":"select","label":"选择设备","clearable":"true","name":"selectDevice","id":"u:891bca3a0150","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''device'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","inputClassName":"w-full","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/device","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"}},"labelField":"name","valueField":"id"},{"type":"select","id":"u:42026703278d","label":"选择指令","clearable":"true","name":"selectCommand","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''command'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/${selectDevice}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.selectDevice"},"labelField":"name","valueField":"id","inputClassName":"w-full"},{"type":"tpl","id":"u:f0e9dbf83675","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"function (deviceInfo, command, event){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:14d8542a2066","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left m-b-xs","label":"入参","name":"inputParamsCalculate","inputClassName":"w-full","language":"javascript","onEvent":{"blur":{"actions":[{"actionType":"custom","script":"const func = new Function(''paramsList'', ''command'', event.data.value);\n const newParams = func(event.data.__super.inputParamsTable || [], event.data.__super.selectCommand);\n doAction({actionType: ''setValue'', componentId: ''u:a13b61f23669'', args: { value: { globalInputParamsCalculated: newParams } } });"}]}},"value":"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\nreturn {\n \"condition\": \"\",\n \"controlId\": command.id,\n \"event\": event\n}"},{"type":"grid","id":"u:68833f10e2bf","columns":[{"body":[{"type":"select","label":"请求地址","name":"requestMethod","options":[{"label":"get","value":"get"},{"label":"post","value":"post"},{"label":"put","value":"put"},{"label":"delete","value":"delete"}],"id":"u:7c48788db8af","multiple":false,"hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","mode":"horizontal","size":"full","inputClassName":"w-full","value":"post"}],"id":"u:d9d274b50340"},{"body":[{"type":"input-text","label":false,"name":"requestUrl","id":"u:841b001e3bcd","size":"full","placeholder":"请输入请求地址","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","value":"/thing/device/control/control"}],"id":"u:c8fab8bb0860"},{"body":[{"type":"input-number","label":"","name":"requestIntervalNumber","keyboard":true,"id":"u:69a53fa6dc9f","step":1,"mode":"inline","placeholder":"请求间隔","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"},{"type":"select","label":"","name":"requestIntervalUnit","options":[{"label":"秒","value":"second"},{"label":"分","value":"minute"},{"label":"时","value":"hour"},{"label":"天","value":"day"}],"id":"u:69f93c61c28b","multiple":false,"mode":"inline","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"}],"id":"u:1827f27e041b"}]},{"type":"grid","id":"u:208413b258dc","className":"m-b","columns":[]},{"type":"tpl","id":"u:931d6b4e0374","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","visibleOn":"data.sendCommandMethod === ''codes''","tpl":"function (context, service, command, event ){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:52152e74a360","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left","visibleOn":"data.sendCommandMethod === ''codes''","label":"下发指令","name":"commandContent","inputClassName":"w-full","language":"javascript","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"函数入参为:","content":"''context'': logicflow 上下文实例; \n ''service'': axios 请求实例;"}},{"type":"tpl","id":"u:2bb06db3ddd9","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"}","inline":true,"wrapperComponent":"","visibleOn":"data.sendCommandMethod === ''codes''"},{"type":"input-text","label":"弹框标题","name":"dialogTitle","id":"u:efa5bfe4e760","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"input-text","label":"弹框内容","name":"dialogContent","id":"u:e1ee364f3318","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"list-select","label":"指令下一步","name":"commandNext","id":"u:158bf05d1e6b","multiple":true,"options":[{"label":"显示隐藏","value":"showOrHide"}],"hiddenOn":"data.eventAction !== ''sendCommand''","joinValues":false},{"type":"grid","id":"u:f9985214eb9e","columns":[{"body":[{"type":"editor","name":"showHideNewValue","id":"u:9f2d894d8fc6","mode":"horizontal","label":false,"placeholder":"返回计算后的组件显示和隐藏, 格式为: return { ''组件id xxxxx-xxx-xxx'': ''show'' / ''hide'' } 或 return { ''组件id xxxxx-xxx-xxx'': e ? ''show'' : ''hide'' } , e为事件值。","size":"full","language":"javascript","inputControlClassName":"w-full","remark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top"},"description":"","visibleOn":"data.eventAction === ''showHide''","className":"w-full","inputClassName":"w-full","value":""}],"id":"u:52e0c15d0c8f"}],"className":"m-b"},{"type":"list-select","label":"复制组件ID","name":"allComponentList","id":"u:77a71866967a","mode":"horizontal","visibleOn":"data.eventAction === ''showHide''","multiple":false,"source":"${nodesList || graphDataList}","onEvent":{"change":{"actions":[{"actionType":"copy","args":{"content":"${event.data.value}"}}]}}},{"type":"grid","id":"u:7e8dfba20aee","columns":[]}],"id":"u:a13b61f23669","name":"eventsForm","className":"text-left","data":{"globalInputParamsCalculated":[],"device":"${device}","command":"${command}"}}],"onEvent":{"confirm":{"actions":[{"componentId":"u:364496dd313b","actionType":"custom","script":"const evType = event.data.eventType || event.data.__super.evType; \r\n const index = event.data.__index | event.data.__super.comboIndex; \r\n doAction({''componentId'': ''u:364496dd313b'', ''actionType'': ''setValue'', ''args'': { ''index'': index, ''value'': { ''config'': JSON.stringify(event.data), ''eventType'': evType }} })"}]}},"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:57f536c19373","size":"lg","type":"dialog","bodyClassName":"setting-events-dialog","name":"settingEventsDialog"}}]}},"label":"动作","editorState":"default"},{"type":"checkBox","id":"u:79dadbc61f74","name":"enable","label":"启用"}],"id":"u:364496dd313b","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:6d4a75088bc2","className":"border-none"}}],"data":{"eventCombo":[{"eventType":"click","enable":false,"config":""},{"eventType":"dblClick","enable":false,"config":""}]},"name":"eventsService"}],"id":"u:14834e895716","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"外观","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[]},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"uiDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"combo","name":"conditionVariables","label":"","value":[{"type":"equal"}],"multiLine":false,"multiple":true,"typeSwitchable":false,"conditions":[{"label":"相等","test":"this.type === \"equal\"","scaffold":{"type":"equal","label":"相等","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"数值","name":"value","type":"input-text","id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"真假","test":"this.type === \"boolean\"","scaffold":{"type":"boolean","label":"真假","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"真假","name":"value","type":"input-text","id":"u:32b3714b545b","placeholder":"true/false"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"范围/颜色","test":"this.type === \"rangeColor\"","scaffold":{"type":"rangeColor","label":"范围/颜色","name":""},"items":[{"label":"起始","name":"from","type":"input-number","precision":2,"id":"u:6f9362ce0efb"},{"label":"结束","name":"to","type":"input-number","precision":2,"id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]}],"id":"u:c92fdccb153e","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:4d4df8658829"}}],"name":"uiService","className":"p-none"}],"id":"u:7c5fc82d356f","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"显示/隐藏","body":[{"type":"service","id":"u:fed27a06a9ce","body":[{"type":"combo","id":"hiddenCombo","label":"","name":"hiddenCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"showOrHiddenName","label":"","id":"u:61d49c5acb77","borderMode":"none","value":"${index === 0 ? ''隐藏'' : ''显示''}","readOnly":true}],"id":"u:ea4bc33a4fcb"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:1f58747ec3e6","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:2c37d59dc3fc","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue) }, ''index'': index } }) } else {doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data) }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:d97eb93589c9","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:2cfc36ebe439","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:eb05d4b8ed36","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:d1187ed5b0ca"}],"id":"u:82fb0182df72","className":"flex-auto"}],"id":"u:27d29971018c","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":2}],"data":{"hiddenCombo":[{"dataPoint":"","min":"","max":""}]},"name":"hiddenService"}],"id":"u:fe703d82df8b","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"动效","id":"u:379a620b2bbc","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none","body":[{"type":"service","id":"u:594a746a7e96","body":[{"type":"combo","id":"animationCombo","label":"","name":"animationCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"animationName","label":"","id":"u:1cfdcc5ad7c7","borderMode":"none","value":"${''旋转''}","readOnly":true}],"id":"u:e3990e007f9c"},{"type":"flex","justify":"space-between","items":[{"type":"select","label":"速度","name":"animationTime","visibleOn":"this.index === 0","menuTpl":"
${value}秒","options":[{"label":"0.5","value":"0.5"},{"label":"1","value":"1"},{"label":"2","value":"2"},{"label":"3","value":"3"},{"label":"4","value":"4"},{"label":"5","value":"5"},{"label":"6","value":"6"},{"label":"7","value":"7"},{"label":"8","value":"8"}],"id":"u:f9762c0602ce","marks":{},"mode":"horizontal","multiple":false,"className":"w-full"}],"id":"u:18969f044f61"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:995482efad18","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:04e78b30faf4","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue), ''animationName'': ''旋转'' }, ''index'': index } }) } else {doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data),''animationName'': ''旋转'' }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:9707cde74e11","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:ec526d2df0ee","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:534114ea71cb","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:39bce4d2d60b"}],"id":"u:4a2208febcd4","className":"flex-auto"}],"id":"u:8ec6ca9fe14f","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":1}],"data":{"animationCombo":[{"dataPoint":"","min":"","max":""}]},"name":"animationService"}]}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p-sm"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "7ced8c7f-d9ec-45ab-8e85-cf5eb9ea03ea",
"type": "custom-actor-node",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "7ced8c7f-d9ec-45ab-8e85-cf5eb9ea03ea",
"width": 100,
"height": 100,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"strokeWidth": 1,
"showDefaultValue": false,
"showUnit": false,
"fontSize": 12,
"nodeAlias": "人物",
"lineHeight": 12,
"fontStyle": "bold,italic,underline,line-through",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "[{ \"val\": 0.00 }]",
"unit": ""
},
"eventsData": {
"eventCombo": [
{
"eventType": "click",
"enable": false,
"config": "{\"globalInputParamsCalculated\":[],\"device\":\"\",\"command\":\"\",\"eventAction\":\"sendCommand\",\"dataPointParamsCalculate\":\"return [\\n {\\n key: \\\"\\\",\\n value: ''''\\n }\\n]\",\"sendCommandMethod\":\"config\",\"inputParamsCalculate\":\"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\\nconst condition = {\\n deviceName: deviceInfo.code,\\n attrCode: command.controlDeviceAttr,\\n value: event == 0 ? 1 : event == 1 ? 0 : event\\n}\\nreturn {\\n \\\"condition\\\": JSON.stringify(condition),\\n \\\"controlId\\\": command.id\\n}\",\"requestMethod\":\"post\",\"requestUrl\":\"/thing/device/control/control\"}"
},
{
"eventType": "dblClick",
"enable": false,
"config": ""
}
]
},
"uiData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": []
},
"animationData": {
"animationCombo": [
{
"min": "",
"max": "",
"animationName": "旋转",
"animationTime": 3
}
]
},
"hiddenData": {
"hiddenCombo": [
{
"dataPoint": "",
"min": "",
"max": "",
"showOrHiddenName": "隐藏"
}
]
}
}
}
}
]
}', '', '// 人物
class ActorModel extends RectResize.model {
realValue = ''''
initNodeData(data) {
super.initNodeData(data)
const { properties } = this;
this.width = properties.width || 100;
this.height = properties.height || 100;
this.text.editable = false; // 不允许文本被编辑
window.nodeEventsListeners(this);
}
setAttributes() {
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
const { normalData } = dynamic || {};
let textValue = properties.content || '''';
if (normalData) {
const { defaultValue } = normalData || {}
const realValue = window.resolveScadaNewValue(defaultValue)
this.realValue = realValue
const { showDefaultValue, showUnit } = properties
if(showDefaultValue) {
textValue += '' '' + realValue
}
if (showUnit) {
textValue += '' '' + normalData.unit
}
}
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: textValue,
}
}
getNodeStyle() {
const style = super.getNodeStyle();
const { properties } = this;
style.fill = properties.fill || style.fill;
window.changeBackgroundColor(style, properties);
style.stroke = properties.strokeColor || style.stroke;
style.strokeWidth = properties.strokeWidth || style.strokeWidth;
style.opacity = properties.opacity || 1;
return style;
}
getTextStyle() {
const style = super.getTextStyle();
const { properties } = this;
style.color = properties.fontColor || style.color;
style.fontSize = properties.fontSize || style.fontSize;
const fontStyle = properties.fontStyle;
if(fontStyle) {
if (fontStyle.includes(''bold'')) {
style.fontWeight = ''bolder'';
}
if(fontStyle.includes(''italic'')) {
style.fontStyle = ''italic''
}
if (fontStyle.includes(''underline,line-through'')) {
style.textDecoration = ''underline line-through''
} else if (fontStyle.includes(''line-through,underline'')) {
style.textDecoration = ''line-through underline''
} else if (fontStyle.includes(''underline'')) {
style.textDecoration = ''underline''
} else if (fontStyle.includes(''line-through'')) {
style.textDecoration = ''line-through''
}
}
style.fill = properties.fill || style.fill;
window.changeFontColor(style, properties);
return style;
}
getResizeOutlineStyle() {
return {
stroke: "#00ffff",
strokeWidth: 1,
strokeDasharray: "none",
};
}
}
class ActorView extends RectResize.view {
getResizeShape() {
const { x, y, width, height } = this.props.model
const style = this.props.model.getNodeStyle()
// 人物头部圆形
const ellipseAttrs = {
...style,
cx: x,
cy: y - 3/8 * height,
rx: 1/4 * width,
ry: 1/8 * height,
width,
height
}
// 人物肩膀横线
const pathAAttrs = {
...style,
d: `M ${x - 1/2 * width} ${y - 1/8 * height} L ${x + 1/2 * width} ${y - 1/8 * height}`
}
// 人物身体躯干竖线
const pathBAttrs = {
...style,
d: `M ${x} ${y - 1/4 * height} L ${x} ${y + 1/5 * height}`
}
// 人物左腿斜线
const pathCAttrs = {
...style,
d: `M ${x} ${y + 1/5 * height} L ${x - 1/2 * width} ${y + 1/2 * height}`
}
// 人物右腿斜线
const pathDAttrs = {
...style,
d: `M ${x} ${y + 1/5 * height} L ${x + 1/2 * width} ${y + 1/2 * height}`
}
// 人物透明背景板
const bgAttrs = {
x: x - 1/5 * width,
y: y - 1/2 * height,
width: 2/5 * width,
height,
style: ''fill: transparent''
}
return h(''g'', {}, [
h(''ellipse'', {
...ellipseAttrs,
}),
h(''path'', {
...pathAAttrs,
}),
h(''path'', {
...pathBAttrs
}),
h(''path'', {
...pathCAttrs
}),
h(''path'', {
...pathDAttrs
}),
h(''rect'', {
...bgAttrs
})
]
);
}
}
lf.register({
type: ''custom-actor-node'',
view: ActorView,
model: ActorModel
})', NULL, 1001, NULL, 1001, 1067246875800000001, 1703498148579, 1067246875800000001, 1721286640628, 't', '基础图形', 't', 't', NULL);
INSERT INTO "public"."iot_section_detail" VALUES (109414856106536960, 'vertical-cylinder-tank', '垂直圆柱水箱', NULL, '
', 'svg', '{"id":"u:270584784ce1","type":"page","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:da449a94908a","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:29852d093d9d","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:1b561d652acc","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:dc8c1daed8ed","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:9672575193ac","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"描边颜色","name":"strokeColor","id":"u:7783b65d58a9","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"液体颜色","name":"liquidColor","id":"u:76fa4643d6bd","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"switch","label":"显示值","option":"","name":"showValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"select","label":"值类型","name":"valueType","options":[{"label":"百分比","value":"ratio"},{"label":"常规值","value":"normal"}],"id":"u:678a2c313b7f","multiple":false,"mode":"horizontal","inputClassName":"w-full"},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"值颜色","name":"valueColor","id":"u:9b5b55cac08a","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"值字体大小","name":"valueFontSize","keyboard":true,"id":"u:06950e120b0a","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"最大值","name":"maxValue","keyboard":true,"id":"u:683b1f856544","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"告警值","name":"warnValue","keyboard":true,"id":"u:a8ad2a11c88b","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"告警颜色","name":"warnColor","id":"u:e99642a0f118","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"严重值","name":"seriousValue","keyboard":true,"id":"u:2401d1c7a03e","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"严重颜色","name":"seriousColor","id":"u:ca0bc3e7cd7b","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"}],"id":"u:ac26ae965c66"}],"id":"u:94b0e20f05da"},{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b m-t"},{"type":"input-text","label":"单位","name":"unit","id":"u:e545f00b0967","editorState":"default","mode":"horizontal"},{"type":"input-color","label":"单位颜色","name":"unitColor","id":"u:ba117b6e3f6f","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"单位字体大小","name":"unitFontSize","keyboard":true,"id":"u:73f9e15b38a9","step":1,"mode":"horizontal","inputClassName":"w-full"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "438f6162-0d90-44bc-8504-a3fdc34df80d",
"type": "vertical-cylinder-tank",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "438f6162-0d90-44bc-8504-a3fdc34df80d",
"width": 200,
"height": 200,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"showValue": true,
"valueColor": "rgba(74, 144, 226, 1)",
"warnColor": "rgba(245, 166, 35, 1)",
"seriousColor": "rgba(208, 2, 27, 1)",
"showUnit": true,
"unitColor": "rgba(74, 144, 226, 1)",
"showDefaultValue": false,
"nodeAlias": "垂直圆柱水箱",
"fontSize": 12,
"valueType": "ratio",
"valueFontSize": 16,
"maxValue": 100,
"warnValue": 75,
"seriousValue": 90,
"unitFontSize": 12,
"unit": "",
"strokeColor": "#242770",
"liquidColor": "#7A8BFF",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "",
"unit": ""
}
}
}
}
]
}', '', 'const { createApp, createVNode, render } = Vue;
const app = createApp({})
const defaultVal = 62;
const VerticalCylinderTank = {
template: `
`,
props: {
chartId: {
type: String,
default: ''''
},
currentData: {
type: Number,
default: 100
},
width: {
type: Number,
default: 350
},
height: {
type: Number,
default: 150
},
chartProps: {
type: Object,
default: () => { }
},
thingName: {
type: String,
default: ''''
},
attr: {
type: String,
default: ''''
},
unit: {
type: String,
default: ''''
},
},
computed: {
getTitleStyle() {
return {
position: ''absolute'',
top: ''0px'',
bottom: `0px`,
width: ''100%'',
zIndex: 100,
display: ''flex'',
justifyContent: ''center'',
alignItems: ''center''
}
}
},
setup(props) {
const { computed, ref, watch, toRefs, nextTick } = Vue;
const { chartProps, currentData, thingName, attr, width, height } = toRefs(props);
let valueStr = ref('''');
let unitStr = ref('''');
let finalLiquidColor = ref(''#7A8BFF'');
let finalStrokeColor = ref("#242770");
const updateChart = (realValue, properties) => {
const { warnValue, seriousValue, maxValue, warnColor, seriousColor, showValue, valueType, showUnit, unit, liquidColor, strokeColor } = properties;
const ratio = (realValue / maxValue * 100).toFixed(2);
if (showValue) {
if (valueType === ''ratio'') {
valueStr.value = ratio + ''''
showUnit && (unitStr.value = ''%'')
} else {
valueStr.value = realValue + ''''
showUnit && (unitStr.value = unit)
}
}
finalLiquidColor.value = liquidColor;
finalStrokeColor.value = strokeColor;
if (seriousValue && realValue >= seriousValue) {
finalLiquidColor.value = seriousColor
} else if (warnValue && realValue >= warnValue) {
finalLiquidColor.value = warnColor
}
setTimeout(() => {
const tankNode = document.getElementById(props.chartId);
const liquidLevel = Math.round(42 - (realValue / maxValue * 69));
tankNode.style.transform = `translateY(${liquidLevel}%)`;
}, 50)
}
watch([currentData, chartProps], ([val, properties]) => {
nextTick(() => {
updateChart(val, properties)
})
}, {
immediate: true,
deep: true,
})
const valueStyle = computed(() => {
return {
color: chartProps.value.valueColor,
fontSize: chartProps.value.valueFontSize + ''px''
}
})
const unitStyle = computed(() => {
return {
color: chartProps.value.unitColor,
fontSize: chartProps.value.unitFontSize + ''px'',
marginLeft: ''3px''
}
})
return {
valueStyle,
unitStyle,
valueStr,
unitStr,
finalLiquidColor,
finalStrokeColor,
}
}
}
class VerticalCylinderTankNode extends HtmlResize.view {
realValue = defaultVal
oldProperties = {}
chartRendered = false
instance = null
setHtml(rootEl) {
if (!rootEl) return;
const { properties, width, height } = this.props.model;
const { normalData } = properties.dynamic || {}
let thingName = ''pressure'';
let attr = ''score'';
if (normalData && normalData.dataPoint) {
const dataPointStrParsed = JSON.parse(normalData.dataPoint || ''{}'')
const { deviceCode, dataPoint } = dataPointStrParsed;
thingName = deviceCode;
attr = dataPoint.split('','')[0];
}
if (this.instance) {
// 实时数据不能推送一次就创建一次图表,可以在原有实例基础之上更改数据。
Object.assign(this.instance.component.props, {
name: properties.nodeAlias,
chartId: `liquidlevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
return
}
const el = document.createElement(''div'');
rootEl.innerHTML = '''';
const instance = createVNode(VerticalCylinderTank, {
name: properties.nodeAlias,
chartId: `liquidLevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
instance.appContext = app._context
render(instance, el)
rootEl.appendChild(el);
this.instance = instance;
}
sameProps(properties) {
const isSame = window._.isEqual(this.oldProperties, properties);
if (isSame) return true;
this.oldProperties = properties;
return false
}
// 生命周期 支持重写内容, 但格式需一致
shouldUpdate() {
const { properties } = this.props.model;
const { normalData } = properties.dynamic || {};
if (normalData && !normalData.dataPoint && !normalData.defaultValue) {
this.realValue = defaultVal;
return true
}
if (normalData) {
const { defaultValue } = normalData || {};
if (defaultValue) {
const realValue = window.resolveScadaNewValue(defaultValue)
if (this.realValue !== Number(realValue)) {
this.realValue = Number(realValue);
return true;
}
}
}
const propertiesBack = window._.cloneDeep(properties);
if (propertiesBack.dynamic.normalData) {
const isSameProps = this.sameProps(propertiesBack);
if (isSameProps && this.chartRendered) {
return false
} else {
if (!this.chartRendered) {
this.chartRendered = true
return true
}
if (!isSameProps) {
return true;
}
}
}
}
updateHtml() {
this.setHtml(this.rootEl);
}
componentDidMount() {
// 防止拖动时候频繁渲染图表
this.updateHtmlDebounced = window._.debounce(this.updateHtml.bind(this), 500);
if (this.shouldUpdate()) {
this.setHtml(this.rootEl);
}
}
componentDidUpdate() {
if (this.shouldUpdate()) {
this.updateHtmlDebounced();
}
}
}
class VerticalCylinderTankModel extends HtmlResize.model {
initNodeData(data) {
// 自定义组件,需最开始重置一下text 。
data.text = {
value: "",
x: data.x,
y: data.y,
};
super.initNodeData(data);
const { properties } = this;
this.width = properties.width || 80;
this.height = properties.height || 35;
this.text.editable = false; // 不允许文本被编辑
}
setAttributes() {
// 自定义组件需重置 text
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0 } = properties;
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: "",
}
}
}
lf.register({
type: ''vertical-cylinder-tank'',
view: VerticalCylinderTankNode,
model: VerticalCylinderTankModel,
})
', NULL, 1001, 1001, 1001, 1067246875800000001, 1706498194526, 1067246875800000001, 1721286642002, 't', '时间', 't', 't', '');
INSERT INTO "public"."iot_section_detail" VALUES (1739102612441010177, 'custom-horizontal-arrow-node', '水平箭头', 1, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:1954dc15dd5b","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:656efdb758ad","step":1,"suffix":"px","placeholder":"组件宽度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelClassName":"w-8","labelAlign":"left","precision":2,"inputClassName":"w-full"}],"id":"u:4274c47a4ef5","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:1ed6dcd98c1a","step":1,"suffix":"px","placeholder":"组件高度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelAlign":"left","labelClassName":"w-8","precision":2,"inputClassName":"w-full"}],"id":"u:3e9d1e71a69f","md":6}]},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"填充","name":"fill","id":"u:0d19ed3e2bdc","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:facc5c90e990","md":6},{"body":[{"type":"input-color","label":"描边","name":"strokeColor","id":"u:89afff5fd00d","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:7c903d9d40ab","md":6}],"id":"u:457970dd35bf","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-number","label":"边宽","name":"strokeWidth","id":"u:8dcf62d3dab5","placeholder":"描边宽度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":1,"value":1,"suffix":"px","inputClassName":"w-full"}],"id":"u:d701217b85ef","md":6},{"body":[{"type":"input-text","label":"内容","name":"content","id":"u:bea5a408f98f","mode":"horizontal","size":"full","inputControlClassName":"inputControlClassName-bea5a408f98f"}],"id":"u:afc37bde0156","md":6}],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"switch","label":"显示值","option":"","name":"showDefaultValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"},{"body":[{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:5b89c331fe7e"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"fieldset","id":"u:2a93d8eee7a9","className":"","title":"字体","collapsable":true,"body":[{"type":"container","id":"u:1606d0ad8360","body":[{"type":"select","id":"u:6f3470628b86","label":"字体类型","name":"fontFamily","mode":"horizontal","horizontal":{"leftFixed":"sm"},"size":"lg","options":[{},{"label":"宋体","value":"SimSun"},{"label":"微软雅黑","value":"Microsoft Yahei"},{"label":"苹方","value":"PingFang SC"},{"label":"Andale Mono","value":"andale mono,monospace"},{"label":"Arial","value":"arial,helvetica,sans-serif"},{"label":"Arial Black","value":"arial black,sans-serif"},{"label":"Book Antiqua","value":"book antiqua,palatino,serif"},{"label":"Comic Sans MS","value":"comic sans ms,sans-serif"},{"label":"Courier New","value":"courier new,courier,monospace"},{"label":"Georgia","value":"georgia,palatino,serif"},{"label":"Helvetica Neue","value":"Helvetica Neue"},{"label":"Helvetica","value":"helvetica,arial,sans-serif"},{"label":"Impact","value":"impact,sans-serif"},{"label":"Symbol","value":"symbol"},{"label":"Tahoma","value":"tahoma,arial,helvetica,sans-serif"},{"label":"Terminal","value":"terminal,monaco,monospace"},{"label":"Times New Roman","value":"times new roman,times,serif"},{"label":"Trebuchet MS","value":"trebuchet ms,geneva,sans-serif"},{"label":"Verdana","value":"verdana,geneva,sans-serif"}],"multiple":false,"className":"m-b","menuTpl":"
${label}","inputClassName":""},{"type":"input-color","label":"字体","name":"fontColor","id":"u:f398c821eda1","mode":"horizontal","size":"lg","className":"m-b","format":"rgba","placeholder":"字体颜色","horizontal":{"leftFixed":"sm"},"inputClassName":""},{"type":"input-number","id":"u:0063eed6ed66","label":"字体大小","name":"fontSize","min":12,"step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"className":"m-b","keyboard":true,"displayMode":"enhance","value":12,"max":100},{"type":"checkboxes","id":"u:b34f4c274416","className":"custom-checkbox-style m-b","label":"文字样式","name":"fontStyle","options":[{"label":"fa-bold fa","value":"bold"},{"label":"fa-italic fa","value":"italic"},{"label":"fa-underline fa","value":"underline"},{"label":"fa fa-strikethrough","value":"line-through"}],"checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","multiple":true},{"type":"checkboxes","label":"文字位置","name":"fontAlign","multiple":false,"options":[{"label":"fa fa-align-left","value":"left"},{"label":"fa fa-align-center","value":"center"},{"label":"fa fa-align-right","value":"right"},{"label":"fa fa-align-justify","value":"justify"}],"id":"u:7e80e906ea14","checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","className":"custom-checkbox-style m-b"},{"type":"input-number","label":"文字行高","name":"lineHeight","keyboard":true,"id":"u:0063eed6ed66","step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"displayMode":"enhance","className":"m-b","min":12}],"style":{"position":"static","display":"block"},"wrapperBody":false}],"bodyClassName":"m-b"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","editorState":"default","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"},{"type":"service","body":[],"id":"u:0dd069ac163f"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"事件","body":[{"type":"service","id":"u:4ec2acc50405","body":[{"type":"combo","label":"","name":"eventCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ae1b0a0c0f55"},"items":[{"type":"select","name":"eventType","placeholder":"选择事件","options":[{"label":"单击","value":"click"},{"label":"双击","value":"dblClick"},{"label":"改变","value":"change"},{"label":"鼠标进入","value":"mouseEnter"},{"label":"鼠标离开","value":"mouseLeave"}],"id":"u:a7b44847011a","label":"名称"},{"type":"input-text","name":"config","placeholder":"事件配置","id":"u:d491386a95c2","onEvent":{"focus":{"actions":[{"actionType":"dialog","dialog":{"title":"设置事件","data":{"comboIndex":"${index}","&":"${config | toJson}","nodesList":"${graphDataList}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","evType":"${eventType}"},"body":[{"type":"form","title":"表单","body":[{"type":"radios","label":"事件行为","name":"eventAction","options":[{"label":"打开链接","value":"openLink"},{"label":"打开弹窗","value":"openDialog"},{"label":"下发指令","value":"sendCommand"},{"label":"显示隐藏","value":"showHide"}],"mode":"horizontal","horizontal":{"leftFixed":"sm"},"id":"u:9e7f1220367f","value":"openLink"},{"type":"input-text","label":"链接地址","name":"linkAddress","mode":"horizontal","horizontal":{"leftFixed":"sm"},"inputClassName":"w-full","id":"u:c5bda965ed3c","size":"full","visibleOn":"data.eventAction === ''openLink''"},{"type":"combo","label":"参数","name":"dataPointTable","id":"dataPointTable","addable":true,"strictMode":true,"removable":true,"horizontal":{"leftFixed":"sm"},"multiple":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bf2f6c98dbff"},"items":[{"type":"input-text","name":"dataPoint","id":"u:1eb050ec98d3","label":"","multiple":false,"size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"left":2,"right":10},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"select","label":"设备","name":"devices","id":"u:1cdb908c23a8","multiple":false,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"const selectedItems = event.data.selectedItems;\r\n if(selectedItems) { doAction({actionType: ''setValue'', componentId: ''u:51f0e51abd7c'', args: { value: { attrs: selectedItems.attrs, deviceCode: selectedItems.deviceCode } } }); }"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10}},{"type":"select","label":"数据点","name":"dataPoint","id":"u:8147daea685d","multiple":true,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}"},"submitText":""}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","dataPointTableIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"componentId":"dataPointTable","actionType":"setValue","args":{"value":{"dataPoint":"${event.data | json}"},"index":"${index}"}}]}}}}]}},"horizontal":{"left":1,"right":11}}],"syncFields":[],"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"editor","label":"参数计算","name":"dataPointParamsCalculate","id":"u:4d5e749b7f42","visibleOn":"data.eventAction === ''openLink''","className":"text-left m-b-xs","inputClassName":"w-full","language":"javascript","value":"return [\n {\n key: \"\",\n value: ''''\n }\n]"},{"type":"radios","label":"打开方式","name":"openMethod","id":"u:eec4f8737fe8","options":[{"label":"打开新页面","value":"openNewPage"},{"label":"打开到本页","value":"openLocalPage"}],"horizontal":{"leftFixed":"sm"},"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"radios","label":"下发指令方式","name":"sendCommandMethod","hiddenOn":"data.eventAction !== ''sendCommand''","id":"u:82d9feb7609d","options":[{"label":"配置","value":"config"},{"label":"代码","value":"codes"}],"value":"config"},{"type":"select","label":"选择设备","clearable":"true","name":"selectDevice","id":"u:891bca3a0150","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''device'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","inputClassName":"w-full","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/device","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"}},"labelField":"name","valueField":"id"},{"type":"select","id":"u:42026703278d","label":"选择指令","clearable":"true","name":"selectCommand","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''command'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/${selectDevice}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.selectDevice"},"labelField":"name","valueField":"id","inputClassName":"w-full"},{"type":"tpl","id":"u:f0e9dbf83675","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"function (deviceInfo, command, event){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:14d8542a2066","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left m-b-xs","label":"入参","name":"inputParamsCalculate","inputClassName":"w-full","language":"javascript","onEvent":{"blur":{"actions":[{"actionType":"custom","script":"const func = new Function(''paramsList'', ''command'', event.data.value);\n const newParams = func(event.data.__super.inputParamsTable || [], event.data.__super.selectCommand);\n doAction({actionType: ''setValue'', componentId: ''u:a13b61f23669'', args: { value: { globalInputParamsCalculated: newParams } } });"}]}},"value":"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\nreturn {\n \"condition\": \"\",\n \"controlId\": command.id,\n \"event\": event\n}"},{"type":"grid","id":"u:68833f10e2bf","columns":[{"body":[{"type":"select","label":"请求地址","name":"requestMethod","options":[{"label":"get","value":"get"},{"label":"post","value":"post"},{"label":"put","value":"put"},{"label":"delete","value":"delete"}],"id":"u:7c48788db8af","multiple":false,"hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","mode":"horizontal","size":"full","inputClassName":"w-full","value":"post"}],"id":"u:d9d274b50340"},{"body":[{"type":"input-text","label":false,"name":"requestUrl","id":"u:841b001e3bcd","size":"full","placeholder":"请输入请求地址","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","value":"/thing/device/control/control"}],"id":"u:c8fab8bb0860"},{"body":[{"type":"input-number","label":"","name":"requestIntervalNumber","keyboard":true,"id":"u:69a53fa6dc9f","step":1,"mode":"inline","placeholder":"请求间隔","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"},{"type":"select","label":"","name":"requestIntervalUnit","options":[{"label":"秒","value":"second"},{"label":"分","value":"minute"},{"label":"时","value":"hour"},{"label":"天","value":"day"}],"id":"u:69f93c61c28b","multiple":false,"mode":"inline","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"}],"id":"u:1827f27e041b"}]},{"type":"grid","id":"u:208413b258dc","className":"m-b","columns":[]},{"type":"tpl","id":"u:931d6b4e0374","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","visibleOn":"data.sendCommandMethod === ''codes''","tpl":"function (context, service, command, event ){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:52152e74a360","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left","visibleOn":"data.sendCommandMethod === ''codes''","label":"下发指令","name":"commandContent","inputClassName":"w-full","language":"javascript","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"函数入参为:","content":"''context'': logicflow 上下文实例; \n ''service'': axios 请求实例;"}},{"type":"tpl","id":"u:2bb06db3ddd9","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"}","inline":true,"wrapperComponent":"","visibleOn":"data.sendCommandMethod === ''codes''"},{"type":"input-text","label":"弹框标题","name":"dialogTitle","id":"u:efa5bfe4e760","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"input-text","label":"弹框内容","name":"dialogContent","id":"u:e1ee364f3318","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"list-select","label":"指令下一步","name":"commandNext","id":"u:158bf05d1e6b","multiple":true,"options":[{"label":"显示隐藏","value":"showOrHide"}],"hiddenOn":"data.eventAction !== ''sendCommand''","joinValues":false},{"type":"grid","id":"u:f9985214eb9e","columns":[{"body":[{"type":"editor","name":"showHideNewValue","id":"u:9f2d894d8fc6","mode":"horizontal","label":false,"placeholder":"返回计算后的组件显示和隐藏, 格式为: return { ''组件id xxxxx-xxx-xxx'': ''show'' / ''hide'' } 或 return { ''组件id xxxxx-xxx-xxx'': e ? ''show'' : ''hide'' } , e为事件值。","size":"full","language":"javascript","inputControlClassName":"w-full","remark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top"},"description":"","visibleOn":"data.eventAction === ''showHide''","className":"w-full","inputClassName":"w-full","value":""}],"id":"u:52e0c15d0c8f"}],"className":"m-b"},{"type":"list-select","label":"复制组件ID","name":"allComponentList","id":"u:77a71866967a","mode":"horizontal","visibleOn":"data.eventAction === ''showHide''","multiple":false,"source":"${nodesList || graphDataList}","onEvent":{"change":{"actions":[{"actionType":"copy","args":{"content":"${event.data.value}"}}]}}},{"type":"grid","id":"u:7e8dfba20aee","columns":[]}],"id":"u:a13b61f23669","name":"eventsForm","className":"text-left","data":{"globalInputParamsCalculated":[],"device":"${device}","command":"${command}"}}],"onEvent":{"confirm":{"actions":[{"componentId":"u:364496dd313b","actionType":"custom","script":"const evType = event.data.eventType || event.data.__super.evType; \r\n const index = event.data.__index | event.data.__super.comboIndex; \r\n doAction({''componentId'': ''u:364496dd313b'', ''actionType'': ''setValue'', ''args'': { ''index'': index, ''value'': { ''config'': JSON.stringify(event.data), ''eventType'': evType }} })"}]}},"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:57f536c19373","size":"lg","type":"dialog","bodyClassName":"setting-events-dialog","name":"settingEventsDialog"}}]}},"label":"动作","editorState":"default"},{"type":"checkBox","id":"u:79dadbc61f74","name":"enable","label":"启用"}],"id":"u:364496dd313b","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:6d4a75088bc2","className":"border-none"}}],"data":{"eventCombo":[{"eventType":"click","enable":false,"config":""},{"eventType":"dblClick","enable":false,"config":""}]},"name":"eventsService"}],"id":"u:14834e895716","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"外观","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[]},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"uiDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"combo","name":"conditionVariables","label":"","value":[{"type":"equal"}],"multiLine":false,"multiple":true,"typeSwitchable":false,"conditions":[{"label":"相等","test":"this.type === \"equal\"","scaffold":{"type":"equal","label":"相等","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"数值","name":"value","type":"input-text","id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"真假","test":"this.type === \"boolean\"","scaffold":{"type":"boolean","label":"真假","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"真假","name":"value","type":"input-text","id":"u:32b3714b545b","placeholder":"true/false"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"范围/颜色","test":"this.type === \"rangeColor\"","scaffold":{"type":"rangeColor","label":"范围/颜色","name":""},"items":[{"label":"起始","name":"from","type":"input-number","precision":2,"id":"u:6f9362ce0efb"},{"label":"结束","name":"to","type":"input-number","precision":2,"id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]}],"id":"u:c92fdccb153e","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:4d4df8658829"}}],"name":"uiService","className":"p-none"}],"id":"u:7c5fc82d356f","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"显示/隐藏","body":[{"type":"service","id":"u:fed27a06a9ce","body":[{"type":"combo","id":"hiddenCombo","label":"","name":"hiddenCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"showOrHiddenName","label":"","id":"u:61d49c5acb77","borderMode":"none","value":"${index === 0 ? ''隐藏'' : ''显示''}","readOnly":true}],"id":"u:ea4bc33a4fcb"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:1f58747ec3e6","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:2c37d59dc3fc","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue) }, ''index'': index } }) } else {doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data) }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:d97eb93589c9","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:2cfc36ebe439","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:eb05d4b8ed36","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:d1187ed5b0ca"}],"id":"u:82fb0182df72","className":"flex-auto"}],"id":"u:27d29971018c","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":2}],"data":{"hiddenCombo":[{"dataPoint":"","min":"","max":""}]},"name":"hiddenService"}],"id":"u:fe703d82df8b","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"动效","id":"u:379a620b2bbc","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none","body":[{"type":"service","id":"u:594a746a7e96","body":[{"type":"combo","id":"animationCombo","label":"","name":"animationCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"animationName","label":"","id":"u:1cfdcc5ad7c7","borderMode":"none","value":"${''旋转''}","readOnly":true}],"id":"u:e3990e007f9c"},{"type":"flex","justify":"space-between","items":[{"type":"select","label":"速度","name":"animationTime","visibleOn":"this.index === 0","menuTpl":"
${value}秒","options":[{"label":"0.5","value":"0.5"},{"label":"1","value":"1"},{"label":"2","value":"2"},{"label":"3","value":"3"},{"label":"4","value":"4"},{"label":"5","value":"5"},{"label":"6","value":"6"},{"label":"7","value":"7"},{"label":"8","value":"8"}],"id":"u:f9762c0602ce","marks":{},"mode":"horizontal","multiple":false,"className":"w-full"}],"id":"u:18969f044f61"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:995482efad18","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:04e78b30faf4","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue), ''animationName'': ''旋转'' }, ''index'': index } }) } else {doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data),''animationName'': ''旋转'' }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:9707cde74e11","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:ec526d2df0ee","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:534114ea71cb","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:39bce4d2d60b"}],"id":"u:4a2208febcd4","className":"flex-auto"}],"id":"u:8ec6ca9fe14f","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":1}],"data":{"animationCombo":[{"dataPoint":"","min":"","max":""}]},"name":"animationService"}]}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p-sm"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "389e26f4-f9e4-4a70-831f-c4c0d8aab096",
"type": "custom-horizontal-arrow-node",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "389e26f4-f9e4-4a70-831f-c4c0d8aab096",
"width": 100,
"height": 100,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"strokeWidth": 1,
"showDefaultValue": false,
"showUnit": false,
"fontSize": 12,
"nodeAlias": "水平箭头",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "[{ \"val\": 0.00 }]",
"unit": ""
},
"eventsData": {
"eventCombo": [
{
"eventType": "click",
"enable": false,
"config": "{\"globalInputParamsCalculated\":[],\"device\":\"\",\"command\":\"\",\"eventAction\":\"sendCommand\",\"dataPointParamsCalculate\":\"return [\\n {\\n key: \\\"\\\",\\n value: ''''\\n }\\n]\",\"sendCommandMethod\":\"config\",\"inputParamsCalculate\":\"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\\nconst condition = {\\n deviceName: deviceInfo.code,\\n attrCode: command.controlDeviceAttr,\\n value: event == 0 ? 1 : event == 1 ? 0 : event\\n}\\nreturn {\\n \\\"condition\\\": JSON.stringify(condition),\\n \\\"controlId\\\": command.id\\n}\",\"requestMethod\":\"post\",\"requestUrl\":\"/thing/device/control/control\"}"
},
{
"eventType": "dblClick",
"enable": false,
"config": ""
}
]
},
"uiData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": []
},
"animationData": {
"animationCombo": [
{
"min": "",
"max": "",
"animationName": "旋转",
"animationTime": 3
}
]
},
"hiddenData": {
"hiddenCombo": [
{
"dataPoint": "",
"min": "",
"max": "",
"showOrHiddenName": "隐藏"
}
]
}
}
}
}
]
}', '', '// 水平双箭头
class HorizontalArrowModel extends RectResize.model {
initNodeData(data) {
super.initNodeData(data)
const { properties } = this;
this.width = properties.width || 100;
this.height = properties.height || 100;
this.text.editable = false; // 不允许文本被编辑
window.nodeEventsListeners(this);
}
setAttributes() {
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
const { normalData } = dynamic || {};
let textValue = properties.content || '''';
if (normalData) {
const { defaultValue } = normalData || {}
const realValue = window.resolveScadaNewValue(defaultValue)
this.realValue = realValue
const { showDefaultValue, showUnit } = properties
if(showDefaultValue) {
textValue += '' '' + realValue
}
if (showUnit) {
textValue += '' '' + normalData.unit
}
}
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: textValue,
}
}
getNodeStyle() {
const style = super.getNodeStyle();
const { properties } = this;
style.fill = properties.fill || style.fill;
window.changeBackgroundColor(style, properties);
style.stroke = properties.strokeColor || style.stroke;
style.strokeWidth = properties.strokeWidth || style.strokeWidth;
style.opacity = properties.opacity || 1;
return style;
}
getTextStyle() {
const style = super.getTextStyle();
const { properties } = this;
style.color = properties.fontColor || style.color;
style.fontSize = properties.fontSize || style.fontSize;
const fontStyle = properties.fontStyle;
if(fontStyle) {
if (fontStyle.includes(''bold'')) {
style.fontWeight = ''bolder'';
}
if(fontStyle.includes(''italic'')) {
style.fontStyle = ''italic''
}
if (fontStyle.includes(''underline,line-through'')) {
style.textDecoration = ''underline line-through''
} else if (fontStyle.includes(''line-through,underline'')) {
style.textDecoration = ''line-through underline''
} else if (fontStyle.includes(''underline'')) {
style.textDecoration = ''underline''
} else if (fontStyle.includes(''line-through'')) {
style.textDecoration = ''line-through''
}
}
window.changeFontColor(style, properties);
return style;
}
getResizeOutlineStyle() {
return {
stroke: "#00ffff",
strokeWidth: 1,
strokeDasharray: "none",
};
}
}
class HorizontalArrowView extends RectResize.view {
getResizeShape() {
const { x, y, width, height } = this.props.model
const style = this.props.model.getNodeStyle()
const ArrowHeight = 1/3 * height;
const leftX = x - 1/2 * width;
const leftX2 = x - 1/5 * width;
const rightX = x + 1/2 * width;
const rightX2 = x + 1/5 * width;
const attrs = {
...style,
x,
y,
width,
height,
points: [
// 右箭头
[rightX2, y - 1/2 * ArrowHeight],
[rightX2, y - 1/2 * height],
[rightX, y],
[rightX2, y + 1/2 * height],
[rightX2, y + 1/2 * ArrowHeight],
// 左箭头
[leftX2, y + 1/2 * ArrowHeight],
[leftX2, y + 1/2 * height],
[leftX, y],
[leftX2, y - 1/2 * height],
[leftX2, y - 1/2 * ArrowHeight],
]
}
return h(''g'', {}, [
h(''polygon'', { ...attrs })
]
);
}
}
lf.register({
type: ''custom-horizontal-arrow-node'',
view: HorizontalArrowView,
model: HorizontalArrowModel
})', NULL, 1001, NULL, 1001, 1067246875800000001, 1703498148428, 1067246875800000001, 1721286640735, 't', '基础图形', 't', 't', NULL);
INSERT INTO "public"."iot_section_detail" VALUES (1739102613175013378, 'custom-leftarrow-node', '左箭头', 1, '
', 'svg', '{"id":"u:270584784ce1","type":"page","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:1954dc15dd5b","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:656efdb758ad","step":1,"suffix":"px","placeholder":"组件宽度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelClassName":"w-8","labelAlign":"left","precision":2,"inputClassName":"w-full"}],"id":"u:4274c47a4ef5","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:1ed6dcd98c1a","step":1,"suffix":"px","placeholder":"组件高度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelAlign":"left","labelClassName":"w-8","precision":2,"inputClassName":"w-full"}],"id":"u:3e9d1e71a69f","md":6}]},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"填充","name":"fill","id":"u:0d19ed3e2bdc","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:facc5c90e990","md":6},{"body":[{"type":"input-color","label":"描边","name":"strokeColor","id":"u:89afff5fd00d","placeholder":"","mode":"horizontal","size":"full","className":"m-b","format":"rgba","inputClassName":"w-full"}],"id":"u:7c903d9d40ab","md":6}],"id":"u:457970dd35bf","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-number","label":"边宽","name":"strokeWidth","id":"u:8dcf62d3dab5","placeholder":"描边宽度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":1,"value":1,"suffix":"px","inputClassName":"w-full"}],"id":"u:d701217b85ef","md":6},{"body":[{"type":"input-text","label":"内容","name":"content","id":"u:bea5a408f98f","mode":"horizontal","size":"full","inputControlClassName":"inputControlClassName-bea5a408f98f"}],"id":"u:afc37bde0156","md":6}],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"switch","label":"显示值","option":"","name":"showDefaultValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"},{"body":[{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:5b89c331fe7e"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"fieldset","id":"u:2a93d8eee7a9","className":"","title":"字体","collapsable":true,"body":[{"type":"container","id":"u:1606d0ad8360","body":[{"type":"select","id":"u:6f3470628b86","label":"字体类型","name":"fontFamily","mode":"horizontal","horizontal":{"leftFixed":"sm"},"size":"lg","options":[{},{"label":"宋体","value":"SimSun"},{"label":"微软雅黑","value":"Microsoft Yahei"},{"label":"苹方","value":"PingFang SC"},{"label":"Andale Mono","value":"andale mono,monospace"},{"label":"Arial","value":"arial,helvetica,sans-serif"},{"label":"Arial Black","value":"arial black,sans-serif"},{"label":"Book Antiqua","value":"book antiqua,palatino,serif"},{"label":"Comic Sans MS","value":"comic sans ms,sans-serif"},{"label":"Courier New","value":"courier new,courier,monospace"},{"label":"Georgia","value":"georgia,palatino,serif"},{"label":"Helvetica Neue","value":"Helvetica Neue"},{"label":"Helvetica","value":"helvetica,arial,sans-serif"},{"label":"Impact","value":"impact,sans-serif"},{"label":"Symbol","value":"symbol"},{"label":"Tahoma","value":"tahoma,arial,helvetica,sans-serif"},{"label":"Terminal","value":"terminal,monaco,monospace"},{"label":"Times New Roman","value":"times new roman,times,serif"},{"label":"Trebuchet MS","value":"trebuchet ms,geneva,sans-serif"},{"label":"Verdana","value":"verdana,geneva,sans-serif"}],"multiple":false,"className":"m-b","menuTpl":"
${label}","inputClassName":""},{"type":"input-color","label":"字体","name":"fontColor","id":"u:f398c821eda1","mode":"horizontal","size":"lg","className":"m-b","format":"rgba","placeholder":"字体颜色","horizontal":{"leftFixed":"sm"},"inputClassName":""},{"type":"input-number","id":"u:0063eed6ed66","label":"字体大小","name":"fontSize","min":12,"step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"className":"m-b","keyboard":true,"displayMode":"enhance","value":12,"max":100},{"type":"checkboxes","id":"u:b34f4c274416","className":"custom-checkbox-style m-b","label":"文字样式","name":"fontStyle","options":[{"label":"fa-bold fa","value":"bold"},{"label":"fa-italic fa","value":"italic"},{"label":"fa-underline fa","value":"underline"},{"label":"fa fa-strikethrough","value":"line-through"}],"checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","multiple":true},{"type":"checkboxes","label":"文字位置","name":"fontAlign","multiple":false,"options":[{"label":"fa fa-align-left","value":"left"},{"label":"fa fa-align-center","value":"center"},{"label":"fa fa-align-right","value":"right"},{"label":"fa fa-align-justify","value":"justify"}],"id":"u:7e80e906ea14","checkAll":false,"joinValues":true,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"optionType":"button","menuTpl":"
","inputClassName":"","className":"custom-checkbox-style m-b"},{"type":"input-number","label":"文字行高","name":"lineHeight","keyboard":true,"id":"u:0063eed6ed66","step":1,"mode":"horizontal","horizontal":{"leftFixed":"sm"},"displayMode":"enhance","className":"m-b","min":12}],"style":{"position":"static","display":"block"},"wrapperBody":false}],"bodyClassName":"m-b"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","editorState":"default","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"},{"type":"service","body":[],"id":"u:0dd069ac163f"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"事件","body":[{"type":"service","id":"u:4ec2acc50405","body":[{"type":"combo","label":"","name":"eventCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ae1b0a0c0f55"},"items":[{"type":"select","name":"eventType","placeholder":"选择事件","options":[{"label":"单击","value":"click"},{"label":"双击","value":"dblClick"},{"label":"改变","value":"change"},{"label":"鼠标进入","value":"mouseEnter"},{"label":"鼠标离开","value":"mouseLeave"}],"id":"u:a7b44847011a","label":"名称"},{"type":"input-text","name":"config","placeholder":"事件配置","id":"u:d491386a95c2","onEvent":{"focus":{"actions":[{"actionType":"dialog","dialog":{"title":"设置事件","data":{"comboIndex":"${index}","&":"${config | toJson}","nodesList":"${graphDataList}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","evType":"${eventType}"},"body":[{"type":"form","title":"表单","body":[{"type":"radios","label":"事件行为","name":"eventAction","options":[{"label":"打开链接","value":"openLink"},{"label":"打开弹窗","value":"openDialog"},{"label":"下发指令","value":"sendCommand"},{"label":"显示隐藏","value":"showHide"}],"mode":"horizontal","horizontal":{"leftFixed":"sm"},"id":"u:9e7f1220367f","value":"openLink"},{"type":"input-text","label":"链接地址","name":"linkAddress","mode":"horizontal","horizontal":{"leftFixed":"sm"},"inputClassName":"w-full","id":"u:c5bda965ed3c","size":"full","visibleOn":"data.eventAction === ''openLink''"},{"type":"combo","label":"参数","name":"dataPointTable","id":"dataPointTable","addable":true,"strictMode":true,"removable":true,"horizontal":{"leftFixed":"sm"},"multiple":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bf2f6c98dbff"},"items":[{"type":"input-text","name":"dataPoint","id":"u:1eb050ec98d3","label":"","multiple":false,"size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"left":2,"right":10},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"select","label":"设备","name":"devices","id":"u:1cdb908c23a8","multiple":false,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"const selectedItems = event.data.selectedItems;\r\n if(selectedItems) { doAction({actionType: ''setValue'', componentId: ''u:51f0e51abd7c'', args: { value: { attrs: selectedItems.attrs, deviceCode: selectedItems.deviceCode } } }); }"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10}},{"type":"select","label":"数据点","name":"dataPoint","id":"u:8147daea685d","multiple":true,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}"},"submitText":""}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","dataPointTableIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"componentId":"dataPointTable","actionType":"setValue","args":{"value":{"dataPoint":"${event.data | json}"},"index":"${index}"}}]}}}}]}},"horizontal":{"left":1,"right":11}}],"syncFields":[],"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"editor","label":"参数计算","name":"dataPointParamsCalculate","id":"u:4d5e749b7f42","visibleOn":"data.eventAction === ''openLink''","className":"text-left m-b-xs","inputClassName":"w-full","language":"javascript","value":"return [\n {\n key: \"\",\n value: ''''\n }\n]"},{"type":"radios","label":"打开方式","name":"openMethod","id":"u:eec4f8737fe8","options":[{"label":"打开新页面","value":"openNewPage"},{"label":"打开到本页","value":"openLocalPage"}],"horizontal":{"leftFixed":"sm"},"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"radios","label":"下发指令方式","name":"sendCommandMethod","hiddenOn":"data.eventAction !== ''sendCommand''","id":"u:82d9feb7609d","options":[{"label":"配置","value":"config"},{"label":"代码","value":"codes"}],"value":"config"},{"type":"select","label":"选择设备","clearable":"true","name":"selectDevice","id":"u:891bca3a0150","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''device'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","inputClassName":"w-full","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/device","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"}},"labelField":"name","valueField":"id"},{"type":"select","id":"u:42026703278d","label":"选择指令","clearable":"true","name":"selectCommand","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''command'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/${selectDevice}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.selectDevice"},"labelField":"name","valueField":"id","inputClassName":"w-full"},{"type":"tpl","id":"u:f0e9dbf83675","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"function (deviceInfo, command, event){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:14d8542a2066","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left m-b-xs","label":"入参","name":"inputParamsCalculate","inputClassName":"w-full","language":"javascript","onEvent":{"blur":{"actions":[{"actionType":"custom","script":"const func = new Function(''paramsList'', ''command'', event.data.value);\n const newParams = func(event.data.__super.inputParamsTable || [], event.data.__super.selectCommand);\n doAction({actionType: ''setValue'', componentId: ''u:a13b61f23669'', args: { value: { globalInputParamsCalculated: newParams } } });"}]}},"value":"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\nreturn {\n \"condition\": \"\",\n \"controlId\": command.id,\n \"event\": event\n}"},{"type":"grid","id":"u:68833f10e2bf","columns":[{"body":[{"type":"select","label":"请求地址","name":"requestMethod","options":[{"label":"get","value":"get"},{"label":"post","value":"post"},{"label":"put","value":"put"},{"label":"delete","value":"delete"}],"id":"u:7c48788db8af","multiple":false,"hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","mode":"horizontal","size":"full","inputClassName":"w-full","value":"post"}],"id":"u:d9d274b50340"},{"body":[{"type":"input-text","label":false,"name":"requestUrl","id":"u:841b001e3bcd","size":"full","placeholder":"请输入请求地址","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","value":"/thing/device/control/control"}],"id":"u:c8fab8bb0860"},{"body":[{"type":"input-number","label":"","name":"requestIntervalNumber","keyboard":true,"id":"u:69a53fa6dc9f","step":1,"mode":"inline","placeholder":"请求间隔","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"},{"type":"select","label":"","name":"requestIntervalUnit","options":[{"label":"秒","value":"second"},{"label":"分","value":"minute"},{"label":"时","value":"hour"},{"label":"天","value":"day"}],"id":"u:69f93c61c28b","multiple":false,"mode":"inline","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"}],"id":"u:1827f27e041b"}]},{"type":"grid","id":"u:208413b258dc","className":"m-b","columns":[]},{"type":"tpl","id":"u:931d6b4e0374","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","visibleOn":"data.sendCommandMethod === ''codes''","tpl":"function (context, service, command, event ){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:52152e74a360","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left","visibleOn":"data.sendCommandMethod === ''codes''","label":"下发指令","name":"commandContent","inputClassName":"w-full","language":"javascript","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"函数入参为:","content":"''context'': logicflow 上下文实例; \n ''service'': axios 请求实例;"}},{"type":"tpl","id":"u:2bb06db3ddd9","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"}","inline":true,"wrapperComponent":"","visibleOn":"data.sendCommandMethod === ''codes''"},{"type":"input-text","label":"弹框标题","name":"dialogTitle","id":"u:efa5bfe4e760","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"input-text","label":"弹框内容","name":"dialogContent","id":"u:e1ee364f3318","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"list-select","label":"指令下一步","name":"commandNext","id":"u:158bf05d1e6b","multiple":true,"options":[{"label":"显示隐藏","value":"showOrHide"}],"hiddenOn":"data.eventAction !== ''sendCommand''","joinValues":false},{"type":"grid","id":"u:f9985214eb9e","columns":[{"body":[{"type":"editor","name":"showHideNewValue","id":"u:9f2d894d8fc6","mode":"horizontal","label":false,"placeholder":"返回计算后的组件显示和隐藏, 格式为: return { ''组件id xxxxx-xxx-xxx'': ''show'' / ''hide'' } 或 return { ''组件id xxxxx-xxx-xxx'': e ? ''show'' : ''hide'' } , e为事件值。","size":"full","language":"javascript","inputControlClassName":"w-full","remark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top"},"description":"","visibleOn":"data.eventAction === ''showHide''","className":"w-full","inputClassName":"w-full","value":""}],"id":"u:52e0c15d0c8f"}],"className":"m-b"},{"type":"list-select","label":"复制组件ID","name":"allComponentList","id":"u:77a71866967a","mode":"horizontal","visibleOn":"data.eventAction === ''showHide''","multiple":false,"source":"${nodesList || graphDataList}","onEvent":{"change":{"actions":[{"actionType":"copy","args":{"content":"${event.data.value}"}}]}}},{"type":"grid","id":"u:7e8dfba20aee","columns":[]}],"id":"u:a13b61f23669","name":"eventsForm","className":"text-left","data":{"globalInputParamsCalculated":[],"device":"${device}","command":"${command}"}}],"onEvent":{"confirm":{"actions":[{"componentId":"u:364496dd313b","actionType":"custom","script":"const evType = event.data.eventType || event.data.__super.evType; \r\n const index = event.data.__index | event.data.__super.comboIndex; \r\n doAction({''componentId'': ''u:364496dd313b'', ''actionType'': ''setValue'', ''args'': { ''index'': index, ''value'': { ''config'': JSON.stringify(event.data), ''eventType'': evType }} })"}]}},"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:57f536c19373","size":"lg","type":"dialog","bodyClassName":"setting-events-dialog","name":"settingEventsDialog"}}]}},"label":"动作","editorState":"default"},{"type":"checkBox","id":"u:79dadbc61f74","name":"enable","label":"启用"}],"id":"u:364496dd313b","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:6d4a75088bc2","className":"border-none"}}],"data":{"eventCombo":[{"eventType":"click","enable":false,"config":""},{"eventType":"dblClick","enable":false,"config":""}]},"name":"eventsService"}],"id":"u:14834e895716","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"外观","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[]},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"uiDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"combo","name":"conditionVariables","label":"","value":[{"type":"equal"}],"multiLine":false,"multiple":true,"typeSwitchable":false,"conditions":[{"label":"相等","test":"this.type === \"equal\"","scaffold":{"type":"equal","label":"相等","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"数值","name":"value","type":"input-text","id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"真假","test":"this.type === \"boolean\"","scaffold":{"type":"boolean","label":"真假","name":""},"items":[{"label":"标签","name":"valueLabel","type":"input-text","id":"u:6f9362ce0efb"},{"label":"真假","name":"value","type":"input-text","id":"u:32b3714b545b","placeholder":"true/false"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"范围/颜色","test":"this.type === \"rangeColor\"","scaffold":{"type":"rangeColor","label":"范围/颜色","name":""},"items":[{"label":"起始","name":"from","type":"input-number","precision":2,"id":"u:6f9362ce0efb"},{"label":"结束","name":"to","type":"input-number","precision":2,"id":"u:32b3714b545b"},{"label":"字体","name":"fontColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"},{"label":"背景","name":"backColor","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]}],"id":"u:c92fdccb153e","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:4d4df8658829"}}],"name":"uiService","className":"p-none"}],"id":"u:7c5fc82d356f","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"显示/隐藏","body":[{"type":"service","id":"u:fed27a06a9ce","body":[{"type":"combo","id":"hiddenCombo","label":"","name":"hiddenCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"showOrHiddenName","label":"","id":"u:61d49c5acb77","borderMode":"none","value":"${index === 0 ? ''隐藏'' : ''显示''}","readOnly":true}],"id":"u:ea4bc33a4fcb"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:1f58747ec3e6","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:2c37d59dc3fc","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue) }, ''index'': index } }) } else {doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data) }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:d97eb93589c9","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:2cfc36ebe439","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:eb05d4b8ed36","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:d1187ed5b0ca"}],"id":"u:82fb0182df72","className":"flex-auto"}],"id":"u:27d29971018c","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":2}],"data":{"hiddenCombo":[{"dataPoint":"","min":"","max":""}]},"name":"hiddenService"}],"id":"u:fe703d82df8b","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"动效","id":"u:379a620b2bbc","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none","body":[{"type":"service","id":"u:594a746a7e96","body":[{"type":"combo","id":"animationCombo","label":"","name":"animationCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"animationName","label":"","id":"u:1cfdcc5ad7c7","borderMode":"none","value":"${''旋转''}","readOnly":true}],"id":"u:e3990e007f9c"},{"type":"flex","justify":"space-between","items":[{"type":"select","label":"速度","name":"animationTime","visibleOn":"this.index === 0","menuTpl":"
${value}秒","options":[{"label":"0.5","value":"0.5"},{"label":"1","value":"1"},{"label":"2","value":"2"},{"label":"3","value":"3"},{"label":"4","value":"4"},{"label":"5","value":"5"},{"label":"6","value":"6"},{"label":"7","value":"7"},{"label":"8","value":"8"}],"id":"u:f9762c0602ce","marks":{},"mode":"horizontal","multiple":false,"className":"w-full"}],"id":"u:18969f044f61"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:995482efad18","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:04e78b30faf4","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue), ''animationName'': ''旋转'' }, ''index'': index } }) } else {doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data),''animationName'': ''旋转'' }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:9707cde74e11","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:ec526d2df0ee","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:534114ea71cb","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:39bce4d2d60b"}],"id":"u:4a2208febcd4","className":"flex-auto"}],"id":"u:8ec6ca9fe14f","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":1}],"data":{"animationCombo":[{"dataPoint":"","min":"","max":""}]},"name":"animationService"}]}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p-sm"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "fbdcb5dc-ee53-4468-8d7f-3e19daf04d92",
"type": "custom-leftarrow-node",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "fbdcb5dc-ee53-4468-8d7f-3e19daf04d92",
"width": 100,
"height": 100,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"strokeWidth": 1,
"showDefaultValue": false,
"showUnit": false,
"fontSize": 12,
"nodeAlias": "左箭头",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "[{ \"val\": 0.00 }]",
"unit": ""
},
"eventsData": {
"eventCombo": [
{
"eventType": "click",
"enable": false,
"config": "{\"globalInputParamsCalculated\":[],\"device\":\"\",\"command\":\"\",\"eventAction\":\"sendCommand\",\"dataPointParamsCalculate\":\"return [\\n {\\n key: \\\"\\\",\\n value: ''''\\n }\\n]\",\"sendCommandMethod\":\"config\",\"inputParamsCalculate\":\"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\\nconst condition = {\\n deviceName: deviceInfo.code,\\n attrCode: command.controlDeviceAttr,\\n value: event == 0 ? 1 : event == 1 ? 0 : event\\n}\\nreturn {\\n \\\"condition\\\": JSON.stringify(condition),\\n \\\"controlId\\\": command.id\\n}\",\"requestMethod\":\"post\",\"requestUrl\":\"/thing/device/control/control\"}"
},
{
"eventType": "dblClick",
"enable": false,
"config": ""
}
]
},
"uiData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": []
},
"animationData": {
"animationCombo": [
{
"min": "",
"max": "",
"animationName": "旋转",
"animationTime": 3
}
]
},
"hiddenData": {
"hiddenCombo": [
{
"dataPoint": "",
"min": "",
"max": "",
"showOrHiddenName": "隐藏"
}
]
}
}
}
}
]
}', '', '// 左箭头
class LeftArrowModel extends RectResize.model {
realValue = ''''
initNodeData(data) {
super.initNodeData(data)
const { properties } = this;
this.width = properties.width || 100;
this.height = properties.height || 100;
this.text.editable = false; // 不允许文本被编辑
window.nodeEventsListeners(this);
}
setAttributes() {
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
const { normalData } = dynamic || {};
let textValue = properties.content || '''';
if (normalData) {
const { defaultValue } = normalData || {}
const realValue = window.resolveScadaNewValue(defaultValue)
this.realValue = realValue
const { showDefaultValue, showUnit } = properties
if(showDefaultValue) {
textValue += '' '' + realValue
}
if (showUnit) {
textValue += '' '' + normalData.unit
}
};
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: textValue,
}
}
getNodeStyle() {
const style = super.getNodeStyle();
const { properties } = this;
style.fill = properties.fill || style.fill;
window.changeBackgroundColor(style, properties);
style.stroke = properties.strokeColor || style.stroke;
style.strokeWidth = properties.strokeWidth || style.strokeWidth;
style.opacity = properties.opacity || 1;
return style;
}
getTextStyle() {
const style = super.getTextStyle();
const { properties } = this;
style.color = properties.fontColor || style.color;
style.fontSize = properties.fontSize || style.fontSize;
const fontStyle = properties.fontStyle;
if(fontStyle) {
if (fontStyle.includes(''bold'')) {
style.fontWeight = ''bolder'';
}
if(fontStyle.includes(''italic'')) {
style.fontStyle = ''italic''
}
if (fontStyle.includes(''underline,line-through'')) {
style.textDecoration = ''underline line-through''
} else if (fontStyle.includes(''line-through,underline'')) {
style.textDecoration = ''line-through underline''
} else if (fontStyle.includes(''underline'')) {
style.textDecoration = ''underline''
} else if (fontStyle.includes(''line-through'')) {
style.textDecoration = ''line-through''
}
}
window.changeFontColor(style, properties);
return style;
}
getResizeOutlineStyle() {
return {
stroke: "#00ffff",
strokeWidth: 1,
strokeDasharray: "none",
};
}
}
class LeftArrowView extends RectResize.view {
getResizeShape() {
const { x, y, width, height } = this.props.model
const style = this.props.model.getNodeStyle()
const ArrowHeight = 1 / 3 * height;
const leftX = x - 1 / 2 * width;
const leftX2 = x - 1 / 5 * width;
const rightX = x + 1 / 2 * width;
const attrs = {
...style,
x,
y,
width,
height,
points: [
[leftX2, y - 1 / 2 * ArrowHeight],
[leftX2, y - 1 / 2 * height],
[leftX, y],
[leftX2, y + 1 / 2 * height],
[leftX2, y + 1 / 2 * ArrowHeight],
[rightX, y + 1 / 2 * ArrowHeight],
[rightX, y - 1 / 2 * ArrowHeight],
]
}
return h(''g'', {}, [
h(''polygon'', { ...attrs })
]
);
}
}
lf.register({
type: ''custom-leftarrow-node'',
view: LeftArrowView,
model: LeftArrowModel
})', NULL, 1001, NULL, 1001, 1067246875800000001, 1703498148603, 1067246875800000001, 1721286640977, 't', '基础图形', 't', 't', NULL);
INSERT INTO "public"."iot_section_detail" VALUES (1739102614265532418, 'custom-image-node', '图片', 1, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:fc464664fb93","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:8a3fc64f07f6","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:1954dc15dd5b","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:656efdb758ad","step":1,"suffix":"px","placeholder":"组件宽度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelClassName":"w-8","labelAlign":"left","precision":2,"inputClassName":"w-full"}],"id":"u:4274c47a4ef5","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:1ed6dcd98c1a","step":1,"suffix":"px","placeholder":"组件高度","size":"full","mode":"horizontal","className":"m-b","value":100,"labelAlign":"left","labelClassName":"w-8","precision":2,"inputClassName":"w-full"}],"id":"u:3e9d1e71a69f","md":6}]},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"container","id":"u:26f912c2e955","className":"m-b","body":[{"type":"button","label":"素材库","onEvent":{"click":{"actions":[{"dialog":{"type":"dialog","title":"素材库","body":[{"type":"service","body":[{"type":"tree-select","id":"u:23489352da59","label":"","name":"materialGroup","multiple":false,"placeholder":"选择素材组","className":"","size":"full","inputClassName":"","mode":"inline","source":{"url":"/thing/v1/group/iotgroupinfo/groupList","method":"get","messages":{},"dataType":"json","data":{"name":"","type":"material"},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"payload.data = payload.data.map((item) => {\r\n item.children = item.typeList\r\n return item\r\n}) \r\n\r\nreturn {\r\n ...payload,\r\n status: payload.code === 200 ? 0 : payload.code\r\n};"},"labelField":"name","valueField":"id","menuTpl":"
${name}
","clearable":true,"enableNodePath":false,"showIcon":true,"initiallyOpen":true},{"type":"search-box","label":"","name":"materialName","id":"u:6f40e3a06211","placeholder":"搜索素材名称","mode":"horizontal","size":"lg"},{"type":"pagination-wrapper","id":"u:1111a3e91978","inputName":"list","outputName":"list","perPage":20,"body":[{"type":"list-select","id":"u:f43228a4939a","source":"${list}","onEvent":{"change":{"actions":[{"componentId":"u:2ed59e5324ca","args":{"value":{"selectedPic":"${event.data.value}"}},"actionType":"setValue","stopPropagation":true}]}},"valueField":"image","name":"materialPics","listClassName":"custom-material-pics","multiple":false}],"position":"bottom"}],"id":"u:00abe4516cfa","messages":{},"api":{"url":"/thing/v1/material/page?name=${materialName}&groupIds=${materialGroup}","method":"get","messages":{},"dataType":"json","headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"data":{"order":"desc","orderField":"create_date","limit":9999},"adaptor":""}}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:2ed59e5324ca","closeOnEsc":false,"size":"lg","data":{"selectedPic":"","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"className":"text-left","onEvent":{"confirm":{"actions":[{"actionType":"setValue","args":{"value":"${selectedPic}"},"componentId":"hrefNode"}]}}},"actionType":"dialog"}]}},"id":"u:5091647a1e0b","className":"className-5091647a1e0b"}],"style":{"position":"static","display":"flex","flexDirection":"row","flexWrap":"nowrap","justifyContent":"flex-end","alignItems":"stretch"},"wrapperBody":false,"isFixedHeight":false,"isFixedWidth":false},{"type":"input-text","label":"路径","name":"href","id":"hrefNode","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"switch","label":"显隐包含子节点","option":"","name":"showHideContainChildren","falseValue":false,"trueValue":true,"id":"u:9419f0a3785b","value":false,"mode":"horizontal"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","editorState":"default","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"},{"type":"service","body":[],"id":"u:0dd069ac163f"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"事件","body":[{"type":"service","id":"u:4ec2acc50405","body":[{"type":"combo","label":"","name":"eventCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ae1b0a0c0f55"},"items":[{"type":"select","name":"eventType","placeholder":"选择事件","options":[{"label":"单击","value":"click"},{"label":"双击","value":"dblClick"},{"label":"改变","value":"change"},{"label":"鼠标进入","value":"mouseEnter"},{"label":"鼠标离开","value":"mouseLeave"}],"id":"u:a7b44847011a","label":"名称"},{"type":"input-text","name":"config","placeholder":"事件配置","id":"u:d491386a95c2","onEvent":{"focus":{"actions":[{"actionType":"dialog","dialog":{"title":"设置事件","data":{"comboIndex":"${index}","&":"${config | toJson}","nodesList":"${graphDataList}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","evType":"${eventType}"},"body":[{"type":"form","title":"表单","body":[{"type":"radios","label":"事件行为","name":"eventAction","options":[{"label":"打开链接","value":"openLink"},{"label":"打开弹窗","value":"openDialog"},{"label":"下发指令","value":"sendCommand"},{"label":"显示隐藏","value":"showHide"}],"mode":"horizontal","horizontal":{"leftFixed":"sm"},"id":"u:9e7f1220367f","value":"openLink"},{"type":"input-text","label":"链接地址","name":"linkAddress","mode":"horizontal","horizontal":{"leftFixed":"sm"},"inputClassName":"w-full","id":"u:c5bda965ed3c","size":"full","visibleOn":"data.eventAction === ''openLink''"},{"type":"combo","label":"参数","name":"dataPointTable","id":"dataPointTable","addable":true,"strictMode":true,"removable":true,"horizontal":{"leftFixed":"sm"},"multiple":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bf2f6c98dbff"},"items":[{"type":"input-text","name":"dataPoint","id":"u:1eb050ec98d3","label":"","multiple":false,"size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"left":2,"right":10},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"select","label":"设备","name":"devices","id":"u:1cdb908c23a8","multiple":false,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"const selectedItems = event.data.selectedItems;\r\n if(selectedItems) { doAction({actionType: ''setValue'', componentId: ''u:51f0e51abd7c'', args: { value: { attrs: selectedItems.attrs, deviceCode: selectedItems.deviceCode } } }); }"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10}},{"type":"select","label":"数据点","name":"dataPoint","id":"u:8147daea685d","multiple":true,"mode":"horizontal","size":"md","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}"},"submitText":""}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","dataPointTableIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"componentId":"dataPointTable","actionType":"setValue","args":{"value":{"dataPoint":"${event.data | json}"},"index":"${index}"}}]}}}}]}},"horizontal":{"left":1,"right":11}}],"syncFields":[],"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"editor","label":"参数计算","name":"dataPointParamsCalculate","id":"u:4d5e749b7f42","visibleOn":"data.eventAction === ''openLink''","className":"text-left m-b-xs","inputClassName":"w-full","language":"javascript","value":"return [\n {\n key: \"\",\n value: ''''\n }\n]"},{"type":"radios","label":"打开方式","name":"openMethod","id":"u:eec4f8737fe8","options":[{"label":"打开新页面","value":"openNewPage"},{"label":"打开到本页","value":"openLocalPage"}],"horizontal":{"leftFixed":"sm"},"mode":"horizontal","visibleOn":"data.eventAction === ''openLink''"},{"type":"radios","label":"下发指令方式","name":"sendCommandMethod","hiddenOn":"data.eventAction !== ''sendCommand''","id":"u:82d9feb7609d","options":[{"label":"配置","value":"config"},{"label":"代码","value":"codes"}],"value":"config"},{"type":"select","label":"选择设备","clearable":"true","name":"selectDevice","id":"u:891bca3a0150","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''device'': select }} })"}]}},"hiddenOn":"data.eventAction !== ''sendCommand''","inputClassName":"w-full","multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/device","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"}},"labelField":"name","valueField":"id"},{"type":"select","hiddenOn":"data.eventAction !== ''sendCommand''","id":"u:42026703278d","label":"选择指令","clearable":"true","name":"selectCommand","onEvent":{"change":{"actions":[{"componentId":"u:a13b61f23669","actionType":"custom","script":"const select = event.data.selectedItems; \r\n doAction({''componentId'': ''u:a13b61f23669'', ''actionType'': ''setValue'', ''args'': { ''value'': { ''command'': select }} })"}]}},"multiple":false,"mode":"horizontal","size":"full","source":{"url":"/thing/device/control/list/${selectDevice}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.selectDevice"},"labelField":"name","valueField":"id","inputClassName":"w-full"},{"type":"tpl","hiddenOn":"data.eventAction !== ''sendCommand''","id":"u:f0e9dbf83675","className":"mx-20 text-left","tpl":"function (deviceInfo, command, event){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:14d8542a2066","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left m-b-xs","label":"入参","name":"inputParamsCalculate","inputClassName":"w-full","language":"javascript","onEvent":{"blur":{"actions":[{"actionType":"custom","script":"const func = new Function(''paramsList'', ''command'', event.data.value);\n const newParams = func(event.data.__super.inputParamsTable || [], event.data.__super.selectCommand);\n doAction({actionType: ''setValue'', componentId: ''u:a13b61f23669'', args: { value: { globalInputParamsCalculated: newParams } } });"}]}},"value":"// console.log(''deviceInfo'', deviceInfo, ''command'', command, ''event'', event);\n// 入参提示: deviceInfo -- 设备信息,command -- 指令信息, event -- 事件传参(当前部件所绑定的立即值,或当前部件经过计算后的自定义值), 入参计算。。。然后返回出参\nreturn {\n \"condition\": \"\",\n \"controlId\": command.id,\n \"event\": event\n}"},{"type":"grid","id":"u:68833f10e2bf","columns":[{"body":[{"type":"select","label":"请求地址","name":"requestMethod","options":[{"label":"get","value":"get"},{"label":"post","value":"post"},{"label":"put","value":"put"},{"label":"delete","value":"delete"}],"id":"u:7c48788db8af","multiple":false,"hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","mode":"horizontal","size":"full","inputClassName":"w-full","value":"post"}],"id":"u:d9d274b50340"},{"body":[{"type":"input-text","label":false,"name":"requestUrl","id":"u:841b001e3bcd","size":"full","placeholder":"请输入请求地址","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''","value":"/thing/device/control/control"}],"id":"u:c8fab8bb0860"},{"body":[{"type":"input-number","label":"","name":"requestIntervalNumber","keyboard":true,"id":"u:69a53fa6dc9f","step":1,"mode":"inline","placeholder":"请求间隔","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"},{"type":"select","label":"","name":"requestIntervalUnit","options":[{"label":"秒","value":"second"},{"label":"分","value":"minute"},{"label":"时","value":"hour"},{"label":"天","value":"day"}],"id":"u:69f93c61c28b","multiple":false,"mode":"inline","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''config''"}],"id":"u:1827f27e041b"}]},{"type":"grid","id":"u:208413b258dc","className":"m-b","columns":[]},{"type":"tpl","id":"u:931d6b4e0374","className":"mx-20 text-left","hiddenOn":"data.eventAction !== ''sendCommand''","visibleOn":"data.sendCommandMethod === ''codes''","tpl":"function (context, service, command, event ){","inline":true,"wrapperComponent":""},{"type":"editor","id":"u:52152e74a360","hiddenOn":"data.eventAction !== ''sendCommand''","className":"text-left","visibleOn":"data.sendCommandMethod === ''codes''","label":"下发指令","name":"commandContent","inputClassName":"w-full","language":"javascript","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"函数入参为:","content":"''context'': logicflow 上下文实例; \n ''service'': axios 请求实例;"}},{"type":"tpl","id":"u:2bb06db3ddd9","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","visibleOn":"data.sendCommandMethod === ''codes''","tpl":"}","inline":true,"wrapperComponent":""},{"type":"input-text","id":"u:efa5bfe4e760","hiddenOn":"data.eventAction !== ''openDialog''","label":"弹框标题","name":"dialogTitle"},{"type":"input-text","label":"弹框内容","name":"dialogContent","id":"u:e1ee364f3318","hiddenOn":"data.eventAction !== ''openDialog''"},{"type":"list-select","label":"指令下一步","name":"commandNext","id":"u:158bf05d1e6b","hiddenOn":"data.eventAction !== ''sendCommand''","multiple":true,"options":[{"label":"显示隐藏","value":"showOrHide"}],"joinValues":false},{"type":"combo","label":"选择变量","name":"operateVariables","id":"u:a4352d57fdad","multiple":true,"mode":"horizontal","visibleOn":"data.eventAction === ''operateVariable''","addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:f1307c109572"},"items":[{"type":"select","name":"selectedVariable","placeholder":"选择变量","selectMode":"chained","id":"u:309c8645978d","searchable":true,"multiple":false,"size":"full","source":"${nodesList || graphDataList}","mode":"horizontal","inputClassName":"","className":"","label":false},{"type":"tpl","id":"u:0d7912942b0f","hiddenOn":"data.eventAction !== ''sendCommand''","className":"mx-20 text-left","tpl":"","inline":true,"wrapperComponent":""},{"type":"editor","name":"newValue","id":"u:6811d0fb2211","mode":"horizontal","label":false,"placeholder":"新值","size":"full","language":"javascript","inputControlClassName":"w-full","remark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top"},"description":"此函数入参包括四个, 按照顺序依次为:inputParamsTable:下发指令的入参;globalInputParamsCalculated: 是下发指令的 ”入参计算“ 返回值;response :下发指令请求的返回值; event: 事件。 根据此四个变量,计算需要操作的变量新值"}],"strictMode":true,"syncFields":[],"inputClassName":"w-full","size":"full"},{"type":"grid","id":"u:f9985214eb9e","columns":[{"body":[{"type":"editor","name":"showHideNewValue","id":"u:9f2d894d8fc6","mode":"horizontal","label":false,"placeholder":"返回计算后的组件显示和隐藏, 格式为: return { ''组件id xxxxx-xxx-xxx'': ''show'' / ''hide'' } 或 return { ''组件id xxxxx-xxx-xxx'': e ? ''show'' : ''hide'' } , e为事件值。","size":"full","language":"javascript","inputControlClassName":"w-full","remark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top"},"description":"","visibleOn":"data.eventAction === ''showHide''","className":"w-full","inputClassName":"w-full","value":""}],"id":"u:52e0c15d0c8f"}],"className":"m-b"},{"type":"list-select","id":"u:77a71866967a","label":"复制组件ID","name":"allComponentList","mode":"horizontal","visibleOn":"data.eventAction === ''showHide''","multiple":false,"source":"${nodesList || graphDataList}","onEvent":{"change":{"actions":[{"actionType":"copy","args":{"content":"${event.data.value}"}}]}}},{"type":"grid","id":"u:7e8dfba20aee","columns":[]}],"id":"u:a13b61f23669","name":"eventsForm","className":"text-left","data":{"globalInputParamsCalculated":[],"device":"${device}","command":"${command}"}}],"onEvent":{"confirm":{"actions":[{"componentId":"u:364496dd313b","actionType":"custom","script":"const evType = event.data.eventType || event.data.__super.evType; \r\n const index = event.data.__index | event.data.__super.comboIndex; \r\n doAction({''componentId'': ''u:364496dd313b'', ''actionType'': ''setValue'', ''args'': { ''index'': index, ''value'': { ''config'': JSON.stringify(event.data), ''eventType'': evType }} })"}]}},"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:57f536c19373","size":"lg","type":"dialog","bodyClassName":"setting-events-dialog","name":"settingEventsDialog"}}]}},"label":"动作","editorState":"default"},{"type":"checkBox","id":"u:79dadbc61f74","name":"enable","label":"启用"}],"id":"u:364496dd313b","deleteBtn":{"type":"icon","icon":"fa fa-trash","className":"border-none","id":"u:6d4a75088bc2"}}],"data":{"eventCombo":[{"eventType":"click","enable":false,"config":""},{"eventType":"dblClick","enable":false,"config":""}]},"name":"eventsService"}],"id":"u:14834e895716","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"外观","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[]},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"uiDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''uiDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"combo","name":"conditionVariables","label":"","value":[{"type":"rangeImage"}],"multiLine":false,"multiple":true,"typeSwitchable":false,"conditions":[{"label":"范围/颜色","test":"this.type === \"rangeColor\"","scaffold":{"type":"rangeColor","label":"范围/颜色","name":""},"items":[{"label":"起始","name":"from","type":"input-number","precision":2,"id":"u:6f9362ce0efb"},{"label":"结束","name":"to","type":"input-number","precision":2,"id":"u:32b3714b545b"},{"label":"颜色","name":"color","type":"input-color","id":"u:5148d38928d9","format":"rgba","inputClassName":"myColorPick","static":false,"placeholder":"选择颜色"}]},{"label":"布尔/图片","test":"this.type === \"booleanImage\"","scaffold":{"type":"booleanImage","label":"布尔/图片","name":""},"items":[{"label":"真假","name":"value","type":"input-text","id":"u:32b3714b545b","placeholder":"true/false"},{"type":"static-image","class":"cursor-pointer","width":"50px","height":"50px","mode":"horizontal","canAccessSuperData":true,"name":"imageUrl","clickAction":{"actionType":"dialog","dialog":{"type":"dialog","title":"素材库","body":[{"type":"service","body":[{"type":"tree-select","id":"u:23489352da59","label":"","name":"materialGroup","multiple":false,"placeholder":"选择素材组","className":"","size":"full","inputClassName":"","mode":"inline","source":{"url":"/thing/v1/group/iotgroupinfo/groupList","method":"get","messages":{},"dataType":"json","data":{"name":"","type":"material"},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"payload.data = payload.data.map((item) => {\r\n item.children = item.typeList\r\n return item\r\n}) \r\n\r\nreturn {\r\n ...payload,\r\n status: payload.code === 200 ? 0 : payload.code\r\n};"},"labelField":"name","valueField":"id","menuTpl":"
${name}
","clearable":true,"enableNodePath":false,"showIcon":true,"initiallyOpen":true},{"type":"search-box","label":"","name":"materialName","id":"u:6f40e3a06211","placeholder":"搜索素材名称","mode":"horizontal","size":"lg"},{"type":"pagination-wrapper","id":"u:1111a3e91978","inputName":"list","outputName":"list","perPage":20,"body":[{"type":"list-select","id":"u:f43228a4939a","source":"${list}","onEvent":{"change":{"actions":[{"componentId":"u:c92fdccb153e","actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; \r\n doAction({''componentId'': ''u:c92fdccb153e'', ''actionType'': ''setValue'', ''args'': { ''index'': index, ''value'': { ''type'': ''booleanImage'', ''imageUrl'': event.data.value }} });"}]}},"valueField":"image","name":"materialPics","listClassName":"custom-material-pics","multiple":false}],"position":"bottom","canAccessSuperData":true}],"id":"u:00abe4516cfa","messages":{},"api":{"url":"/thing/v1/material/page?name=${materialName}&groupIds=${materialGroup}","method":"get","messages":{},"dataType":"json","headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"data":{"order":"desc","orderField":"create_date","limit":9999},"adaptor":""},"canAccessSuperData":true}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"materialLib","closeOnEsc":false,"size":"lg","data":{"selectedPic":"","comboIndex":"${index}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"className":"text-left","actions":[]}},"strictMode":false,"syncFields":["imageUrl"],"label":"图片","id":"u:7cfff1959aca"}]},{"label":"范围/图片","test":"this.type === \"rangeImage\"","scaffold":{"type":"rangeImage","label":"范围/图片","name":""},"items":[{"label":"起始","name":"from","type":"input-number","precision":2,"id":"u:6f9362ce0efb"},{"label":"结束","name":"to","type":"input-number","precision":2,"id":"u:32b3714b545b"},{"type":"static-image","class":"cursor-pointer","width":"50px","height":"50px","mode":"horizontal","canAccessSuperData":true,"name":"imageUrl","clickAction":{"actionType":"dialog","dialog":{"type":"dialog","title":"素材库","body":[{"type":"service","body":[{"type":"tree-select","id":"u:23489352da59","label":"","name":"materialGroup","multiple":false,"placeholder":"选择素材组","className":"","size":"full","inputClassName":"","mode":"inline","source":{"url":"/thing/v1/group/iotgroupinfo/groupList","method":"get","messages":{},"dataType":"json","data":{"name":"","type":"material"},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"payload.data = payload.data.map((item) => {\r\n item.children = item.typeList\r\n return item\r\n}) \r\n\r\nreturn {\r\n ...payload,\r\n status: payload.code === 200 ? 0 : payload.code\r\n};"},"labelField":"name","valueField":"id","menuTpl":"
${name}
","clearable":true,"enableNodePath":false,"showIcon":true,"initiallyOpen":true},{"type":"search-box","label":"","name":"materialName","id":"u:6f40e3a06211","placeholder":"搜索素材名称","mode":"horizontal","size":"lg"},{"type":"pagination-wrapper","id":"u:1111a3e91978","inputName":"list","outputName":"list","perPage":20,"body":[{"type":"list-select","id":"u:f43228a4939a","source":"${list}","onEvent":{"change":{"actions":[{"componentId":"u:c92fdccb153e","actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; \r\n doAction({''componentId'': ''u:c92fdccb153e'', ''actionType'': ''setValue'', ''args'': { ''index'': index, ''value'': { ''type'': ''rangeImage'', ''imageUrl'': event.data.value }} });"}]}},"valueField":"image","name":"materialPics","listClassName":"custom-material-pics","multiple":false}],"position":"bottom","canAccessSuperData":true}],"id":"u:00abe4516cfa","messages":{},"api":{"url":"/thing/v1/material/page?name=${materialName}&groupIds=${materialGroup}","method":"get","messages":{},"dataType":"json","headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"data":{"order":"desc","orderField":"create_date","limit":9999},"adaptor":""},"canAccessSuperData":true}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"materialLib","closeOnEsc":false,"size":"lg","data":{"selectedPic":"","comboIndex":"${index}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"className":"text-left","actions":[]}},"strictMode":false,"syncFields":["imageUrl"],"label":"图片","id":"u:7cfff1959aca"}],"canAccessSuperData":true}],"id":"u:c92fdccb153e","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:4d4df8658829"}}],"name":"uiService","className":"p-none"}],"id":"u:7c5fc82d356f","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"显示/隐藏","body":[{"type":"service","id":"u:fed27a06a9ce","body":[{"type":"combo","id":"hiddenCombo","label":"","name":"hiddenCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"showOrHiddenName","label":"","id":"u:61d49c5acb77","borderMode":"none","value":"${index === 0 ? ''隐藏'' : ''显示''}","readOnly":true}],"id":"u:ea4bc33a4fcb"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:1f58747ec3e6","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:2c37d59dc3fc","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue) }, ''index'': index } }) } else {doAction({ ''componentId'': ''hiddenCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data) }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","editorState":"default"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:d97eb93589c9","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:2cfc36ebe439","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:eb05d4b8ed36","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:d1187ed5b0ca"}],"id":"u:82fb0182df72","className":"flex-auto"}],"id":"u:27d29971018c","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"maxLength":2}],"data":{"hiddenCombo":[{"dataPoint":"","min":"","max":""}]},"name":"hiddenService"}],"id":"u:fe703d82df8b","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"动效","id":"u:379a620b2bbc","headingClassName":"p-sm b-b b-light bg-white","className":"m-b r-3x","bodyClassName":"p-none","body":[{"type":"service","id":"u:594a746a7e96","body":[{"type":"combo","id":"animationCombo","label":"","name":"animationCombo","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:bab0356b2e63"},"items":[{"type":"flex","justify":"space-between","items":[{"type":"input-text","name":"animationName","label":"","id":"u:1cfdcc5ad7c7","borderMode":"none","value":"","readOnly":true}],"id":"u:e3990e007f9c"},{"type":"flex","justify":"space-between","items":[{"type":"select","label":"速度","name":"animationTime","visibleOn":"this.index === 0","menuTpl":"
${value}秒","options":[{"label":"0.5","value":"0.5"},{"label":"1","value":"1"},{"label":"2","value":"2"},{"label":"3","value":"3"},{"label":"4","value":"4"},{"label":"5","value":"5"},{"label":"6","value":"6"},{"label":"7","value":"7"},{"label":"8","value":"8"}],"id":"u:f9762c0602ce","marks":{},"mode":"horizontal","multiple":false,"className":"w-full"}],"id":"u:18969f044f61"},{"type":"input-text","label":"数据点","name":"dataPoint","id":"u:995482efad18","clearable":true,"multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","multiple":false,"mode":"horizontal","size":"md","source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"horizontal":{"leftFixed":"sm"},"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:04e78b30faf4","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}","comboIndex":"${index}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const index = event.data.__index | event.data.__super.comboIndex; const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(newValue) }, ''index'': index } }) } else {doAction({ ''componentId'': ''animationCombo'', ''actionType'': ''setValue'', ''args'': { value: { ''dataPoint'': JSON.stringify(event.data) }, ''index'': index } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","editorState":"default"},{"type":"flex","items":[{"type":"tpl","tpl":"范围","id":"u:9707cde74e11","className":"w-28"},{"type":"flex","justify":"space-between","alignItems":"center","items":[{"type":"input-number","precision":2,"name":"min","label":"","id":"u:ec526d2df0ee","keyboard":true,"step":1,"className":"m-none"},{"type":"tpl","tpl":" — ","id":"u:534114ea71cb","className":"mx-2"},{"type":"input-number","precision":2,"name":"max","label":"","id":"u:39bce4d2d60b"}],"id":"u:4a2208febcd4","className":"flex-auto"}],"id":"u:8ec6ca9fe14f","justify":"space-between","alignItems":"center","className":"w-full"}],"deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:502b68dfba77","className":"absolute right-2 border-none"},"canAccessSuperData":true,"maxLength":2}],"data":{"animationCombo":[{"animationName":"闪烁","dataPoint":"","min":"","max":""},{"animationName":"旋转","dataPoint":"","min":"","max":""}]},"name":"animationService"}]}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p-sm"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}],"id":"u:edef8e21c1e3","justify":"flex-end"},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left","messages":{}}],"id":"u:dc8d331cbe5e","className":"h-full"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "c04eb8bb-49d7-46c2-9804-15be1334b01f",
"type": "custom-image-node",
"x": 202,
"y": 200,
"text": {
"value": "",
"x": 202,
"y": 200
},
"properties": {
"id": "c04eb8bb-49d7-46c2-9804-15be1334b01f",
"width": 100,
"height": 100,
"x": 202,
"y": 200,
"rotation": 0,
"opacity": 1,
"showHideContainChildren": false,
"showDefaultValue": false,
"showUnit": false,
"strokeWidth": 1,
"fontSize": 12,
"borderDirection": "border",
"nodeAlias": "图片",
"href": "./defaultPic.svg",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [
{
"type": "rangeImage",
"label": "范围/图片",
"name": ""
}
],
"defaultValue": "[]",
"unit": ""
},
"uiData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [
{
"type": "rangeImage",
"label": "范围/图片",
"name": ""
}
],
"defaultValue": "[]"
},
"animationData": {
"animationCombo": [
{
"min": "",
"max": "",
"animationName": "旋转",
"defaultValue": "[]",
"animationTime": 3,
"dataPoint": ""
},
{
"min": "",
"max": "",
"animationName": "闪烁",
"defaultValue": "[]",
"dataPoint": ""
}
]
},
"hiddenData": {
"hiddenCombo": [
{
"dataPoint": "",
"min": "",
"max": "",
"showOrHiddenName": "隐藏",
"defaultValue": "[]"
},
{
"defaultValue": "[]",
"showOrHiddenName": "显示",
"dataPoint": ""
}
]
},
"eventsData": {
"eventCombo": [
{
"eventType": "click",
"enable": false,
"config": ""
},
{
"eventType": "dblClick",
"enable": false,
"config": ""
}
]
}
}
}
}
]
}', '', 'const isLocal = window.location.origin.includes(''localhost'');
const defaultPic = isLocal ? window.location.origin + ''/defaultPic.svg'' : window.location.origin + ''/scada/defaultPic.svg'';
// 图片-基础节点
class ImageModel extends RectResize.model {
realValue = ''''
initNodeData(data) {
// 自定义组件,需最开始重置一下text 。
data.text = {
value: "",
x: data.x,
y: data.y,
};
super.initNodeData(data)
const { properties } = this;
this.width = properties.width || 150;
this.height = properties.height || 80;
window.nodeEventsListeners(this);
this.text.editable = false; // 不允许文本被编辑
}
setAttributes() {
const { x, y, properties } = this;
const { href, textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
const { normalData } = dynamic || {};
let textValue = properties.content || '''';
if (normalData) {
const { defaultValue } = normalData || {}
const realValue = window.resolveScadaNewValue(defaultValue);
this.realValue = realValue;
}
const img = new Image()
img.onerror = () => {
properties.href = ''''
}
img.src = href
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: textValue,
}
}
getNodeStyle() {
const style = super.getNodeStyle();
const { properties } = this;
style.fill = properties.fill || style.fill;
style.stroke = properties.strokeColor || style.stroke;
style.strokeWidth = properties.strokeWidth || style.strokeWidth;
style.opacity = properties.opacity || 1;
return style;
}
getTextStyle() {
const style = super.getTextStyle();
const { properties } = this;
style.color = properties.fontColor || style.color;
style.fontSize = properties.fontSize || style.fontSize;
const fontStyle = properties.fontStyle;
if(fontStyle) {
if (fontStyle.includes(''bold'')) {
style.fontWeight = ''bolder'';
}
if(fontStyle.includes(''italic'')) {
style.fontStyle = ''italic''
}
if (fontStyle.includes(''underline,line-through'')) {
style.textDecoration = ''underline line-through''
} else if (fontStyle.includes(''line-through,underline'')) {
style.textDecoration = ''line-through underline''
} else if (fontStyle.includes(''underline'')) {
style.textDecoration = ''underline''
} else if (fontStyle.includes(''line-through'')) {
style.textDecoration = ''line-through''
}
}
return style;
}
getResizeOutlineStyle() {
return {
stroke: "#00ffff",
strokeWidth: 1,
strokeDasharray: "none",
};
}
}
class ImageNode extends RectResize.view {
getImageHref(href) {
return href;
}
getResizeShape() {
const { x, y, width, height, properties } = this.props.model
const finalWidth = width <= 10 ? 10 : width
const finalHeight = height <= 10 ? 10 : height
const { opacity, blinkAnimation } = properties;
let href = this.getImageHref(properties.href || defaultPic.replace(null, ''''))
const { uiData } = properties.dynamic || {};
if (uiData) {
const realValue = window.resolveScadaNewValue(uiData.defaultValue)
if(realValue !== '''') {
uiData.conditionVariables.forEach((item) => {
if (item.type === ''rangeImage'') {
let from = item.from;
let to = item.to;
if (item.from >= item.to) {
from = item.to;
to = item.from;
}
if (item.imageUrl && Number(realValue) >= from && Number(realValue) <= to) {
href = item.imageUrl;
}
} else if (item.type === ''booleanImage'') {
const trueFlags = [''true'', true]
const falseFlags = [''false'', false]
const truetrue = trueFlags.includes(item.value) && trueFlags.includes(realValue)
const falsefalse = falseFlags.includes(item.value) && falseFlags.includes(realValue)
if (truetrue || falsefalse) {
href = item.imageUrl;
}
}
})
}
}
const finalX = x - 1 / 2 * finalWidth;
const finalY = y - 1 / 2 * finalHeight
const attrs = {
x: finalX,
y: finalY,
width: finalWidth,
height: finalHeight,
href,
opacity,
className: blinkAnimation ? ''blinkAnim'' : '''',
transformOrigin: `${finalX + finalWidth/2} ${finalY + finalHeight/2}`,
// 根据宽高缩放
preserveAspectRatio: ''none meet''
}
return h(''g'', {}, [
h(''image'', { ...attrs })
]
);
}
}
lf.register({
type: ''custom-image-node'',
view: ImageNode,
model: ImageModel
})', '', 1001, NULL, 1001, 1067246875800000001, 1703498148862, 1067246875800000001, 1721286641570, 't', '基础图形', 't', 't', ' // 数据处理, 返回格式如下
return {
normalData: [],
uiData: [],
animationData: [[]], // 多级
hiddenData: [[]], // 多级
} ');
INSERT INTO "public"."iot_section_detail" VALUES (109414856052011008, 'rectangle-tank', '矩形水箱', NULL, '
', 'svg', '{"type":"page","id":"u:270584784ce1","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:da449a94908a","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:29852d093d9d","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:1b561d652acc","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:dc8c1daed8ed","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:9672575193ac","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"grid","columns":[],"id":"u:235f153e5ad5","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-color","label":"描边颜色","name":"strokeColor","id":"u:7783b65d58a9","mode":"horizontal","format":"rgba","inputClassName":"w-full"},{"type":"input-color","label":"液体颜色","name":"liquidColor","id":"u:76fa4643d6bd","format":"rgba","mode":"horizontal","inputClassName":"w-full"},{"type":"switch","label":"显示值","option":"","name":"showValue","falseValue":false,"trueValue":true,"id":"u:b52d7cc4b201","value":false,"mode":"horizontal","className":"m-b"}],"id":"u:83905272eb76"}],"id":"u:19e1ffafeb70","className":"m-b"},{"type":"select","id":"u:678a2c313b7f","label":"值类型","name":"valueType","options":[{"label":"百分比","value":"ratio"},{"label":"常规值","value":"normal"}],"multiple":false,"mode":"horizontal","inputClassName":"w-full"},{"type":"grid","id":"u:94b0e20f05da","columns":[{"body":[{"type":"input-color","label":"值颜色","name":"valueColor","id":"u:9b5b55cac08a","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"值字体大小","name":"valueFontSize","keyboard":true,"id":"u:06950e120b0a","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"最大值","name":"maxValue","keyboard":true,"id":"u:683b1f856544","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-number","label":"告警值","name":"warnValue","keyboard":true,"id":"u:a8ad2a11c88b","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"告警颜色","name":"warnColor","id":"u:e99642a0f118","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"严重值","name":"seriousValue","keyboard":true,"id":"u:2401d1c7a03e","step":1,"mode":"horizontal","inputClassName":"w-full"},{"type":"input-color","label":"严重颜色","name":"seriousColor","id":"u:ca0bc3e7cd7b","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"}],"id":"u:ac26ae965c66"}]},{"type":"switch","label":"显示单位","option":"","name":"showUnit","falseValue":false,"trueValue":true,"id":"u:92b92507de26","value":false,"mode":"horizontal","className":"m-b m-t"},{"type":"input-text","label":"单位","name":"unit","id":"u:e545f00b0967","mode":"horizontal"},{"type":"input-color","label":"单位颜色","name":"unitColor","id":"u:ba117b6e3f6f","format":"rgba","mode":"horizontal","value":"rgba(245, 166, 35, 1)","className":"m-b","inputClassName":"w-full"},{"type":"input-number","label":"单位字体大小","name":"unitFontSize","keyboard":true,"id":"u:73f9e15b38a9","step":1,"mode":"horizontal","inputClassName":"w-full"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"input-text","label":"数据点","name":"dataPoint","id":"normalDataPoint","multiple":false,"mode":"horizontal","size":"full","onEvent":{"focus":{"weight":0,"actions":[{"actionType":"dialog","dialog":{"type":"dialog","title":"请配置需要绑定的数据点","body":[{"type":"tabs","tabs":[{"title":"常规数据点","body":[{"type":"form","title":"","body":[{"type":"select","label":"数据源","name":"dataSource","id":"u:c273f087b8ed","mode":"horizontal","multiple":false,"size":"md","horizontal":{"leftFixed":"sm"},"source":"${apiDtoList || thingApiDTOList}","labelField":"name","valueField":"id","onEvent":{"change":{"actions":[{"actionType":"reload","componentId":"u:1cdb908c23a8"},{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:1cdb908c23a8'', ''args'': {''value'': ''''} });\r\n doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"clearable":true,"actionType":"change","target":"u:1cdb908c23a8"},{"type":"combo","label":"设备属性","name":"deviceAttrs","id":"u:98559a2dd514","multiple":false,"mode":"horizontal","size":"full","horizontal":{"leftFixed":"sm"},"items":[{"type":"input-table","label":false,"id":"u:41dfc35c368c","name":"table","strictMode":false,"needConfirm":false,"addable":true,"removable":true,"columns":[{"type":"input-text","label":"序号","id":"u:434e22030bc6","name":"num","size":"sm","mode":"horizontal","quickEdit":{"mode":"popOver","id":"u:c6a294f5c93a"},"horizontal":{"left":2,"right":10},"placeholder":"例:A/B/C/AA/BB","width":200},{"type":"select","name":"devices","id":"u:1cdb908c23a8","label":"设备","multiple":false,"mode":"horizontal","quickEdit":true,"size":"sm","source":{"url":"/thing/v2/api/telemetryById?id=${dataSource}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"adaptor":"if (payload && payload.data && payload.data.result) {console.log(''payload.data.result'', payload.data.result); \r\n const list = []\r\n const devices = payload.data.result.info \r\n for (const key in devices) {\r\n const device_info = devices[key] \r\n list.push({\r\n label: device_info.entityName,\r\n value: device_info.entityId,\r\n deviceCode: device_info.entityCode,\r\n deviceInfo: device_info,\r\n attrs: device_info.attrs })\r\n }\r\n payload.data = list;\r\n return payload\r\n}","sendOn":"this.dataSource"},"onEvent":{"change":{"actions":[{"actionType":"custom","script":"if (!event.data.value) { doAction({''actionType'': ''setValue'', ''componentId'': ''u:8147daea685d'', ''args'': {''value'': ''''} }); }"}]}},"responseData":{"&":"$$","list":"${items}"},"clearable":true,"horizontal":{"left":2,"right":10},"checkAll":false},{"type":"select","name":"dataPoint","id":"u:8147daea685d","label":"数据点","multiple":false,"quickEdit":true,"mode":"horizontal","size":"sm","source":{"url":"/thing/v2/api/callDict?id=${dataSource}&entityId=${devices}","method":"get","messages":{},"headers":{"token":"${myToken}","tenantCode":"${myTenantCode}","companyId":"${myCompanyId}"},"sendOn":"this.dataSource && this.devices","adaptor":"const list = payload.data.map(item => {\r\n item.dictName = item.dictName + '' - '' + item.dictCode\r\n return item\r\n})\r\npayload.data = list;\r\nreturn payload"},"labelField":"dictName","valueField":"dictCode","checkAll":false,"horizontal":{"left":2,"right":10},"overlay":{"width":"350px"},"searchable":true}]}],"strictMode":true,"syncFields":[],"tabsMode":false,"canAccessSuperData":true,"inputClassName":"w-full","className":"m-b-sm"},{"type":"checkbox","label":"数据处理","name":"enableDataHandle","id":"u:034ca60f2135","mode":"horizontal","horizontal":{"leftFixed":"normal"},"option":""},{"type":"combo","id":"u:a06125153fa6","name":"calcRules","label":"计算规则","mode":"horizontal","visibleOn":"this.enableDataHandle","multiple":true,"items":[{"name":"formular","label":"计算公式","type":"input-text","id":"u:318a7f0c6449","placeholder":"例: (A + B) / C","width":"50%","size":"full"},{"name":"resultAttr","label":"计算结果属性","type":"input-text","id":"u:1e6e491ccbaa","placeholder":"例:A8、B、C...","width":"50%"}],"strictMode":true,"syncFields":[],"hidden":false,"inputClassName":"w-full","multiLine":false,"className":"calcRules"},{"type":"input-text","label":"唯一数据点","name":"uniquePoint","id":"u:3b257b599c19","mode":"horizontal","visibleOn":"this.enableDataHandle","labelRemark":{"icon":"fa fa-question-circle","trigger":["hover"],"className":"Remark--warning","placement":"top","title":"场景:","content":"当有数据处理,并且只需绑定一个数据点作为 【实时/立即/最新数据】时,请填写所需数据点的序号或计算结果属性。"},"inputControlClassName":"m-b"}],"id":"u:51f0e51abd7c","data":{"attrs":[],"deviceCode":"${deviceCode || ''''}","devices":"${devices || ''''}","dataPoint":"${dataPoint || ''''}","dataSource":"${dataSource || ''''}","deviceAttrs":"${deviceAttrs || []}"},"submitText":"","onEvent":{"inited":{"actions":{"actionType":"custom","script":"if(event.data.devices && event.data.dataPoint && event.data.deviceAttrs.length === 0) { const dataPoints = event.data.dataPoint.split('',''); const newDeviceAttrs = dataPoints.map((point, idx) => ({ num: String.fromCharCode(65+idx), devices: event.data.devices, dataPoint: point }) ); doAction({ ''actionType'': ''setValue'', ''componentId'': ''u:51f0e51abd7c'', ''args'': { value: {deviceAttrs: { table: newDeviceAttrs } }} }); }"}}}}],"id":"u:5505e7ef7cab"},{"title":"虚拟变量","body":[{"type":"tpl","tpl":"暂时无虚拟变量可配置","wrapperComponent":"","inline":false,"id":"u:722592249b31"}],"id":"u:b739cc6a6ed7"}],"id":"u:3b446450d643"}],"showCloseButton":true,"showErrorMsg":true,"showLoading":true,"id":"u:f46c2439c983","data":{"&":"${dataPoint | toJson}","apiDtoList":"${thingApiDTOList}","myToken":"${myToken}","myTenantCode":"${myTenantCode}","myCompanyId":"${myCompanyId}"},"onEvent":{"confirm":{"actions":[{"actionType":"custom","script":"const tableData = event.data.deviceAttrs.table; let devices = ''''; let dataPoint = ''''; if(tableData) { tableData.forEach(item => { devices += (item.devices + '','');dataPoint += (item.dataPoint + '',''); });}; if(tableData && tableData.length > 0) { devices = devices.substring(0, devices.length - 1); dataPoint = dataPoint.substring(0, dataPoint.length - 1); const newValue = {...event.data, devices: devices, dataPoint: dataPoint, dataSource: event.data.dataSource} ; doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(newValue) } }) } else {doAction({ ''componentId'': ''normalDataPoint'', ''actionType'': ''setValue'', ''args'': { value: JSON.stringify(event.data) } }) };"}]}},"closeOnEsc":false,"size":"lg"}}]}},"className":"w-full m-b-sm","inputClassName":"w-full","clearable":true},{"type":"input-text","label":"默认值","placeholder":"[{ \"val\": 0.00 }]","clearable":true,"name":"defaultValue","id":"u:13ccbc565f5e","mode":"horizontal","size":"full","inputControlClassName":"mb-sm","labelClassName":"mb-sm","className":"m-b-sm"},{"type":"input-text","label":"单位   ","name":"unit","id":"u:0f606558e8c7","mode":"horizontal","size":"full","className":"m-b-sm"}],"name":"normalService","className":"p-none"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "f5249efb-9723-4132-8977-91179790ec59",
"type": "rectangle-tank",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "f5249efb-9723-4132-8977-91179790ec59",
"width": 200,
"height": 200,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"showValue": true,
"valueColor": "rgba(74, 144, 226, 1)",
"warnColor": "rgba(245, 166, 35, 1)",
"seriousColor": "rgba(208, 2, 27, 1)",
"showUnit": true,
"unitColor": "rgba(74, 144, 226, 1)",
"nodeAlias": "矩形水箱",
"showDefaultValue": false,
"fontSize": 12,
"strokeColor": "#242770",
"liquidColor": "#7A8BFF",
"valueType": "ratio",
"valueFontSize": 16,
"maxValue": 100,
"warnValue": 75,
"seriousValue": 90,
"unitFontSize": 12,
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "",
"unit": ""
}
}
}
}
]
}', '', 'const { createApp, createVNode, render } = Vue;
const app = createApp({})
const defaultVal = 62;
const RectangleTank = {
template: `
`,
props: {
chartId: {
type: String,
default: ''''
},
currentData: {
type: Number,
default: 100
},
width: {
type: Number,
default: 350
},
height: {
type: Number,
default: 150
},
chartProps: {
type: Object,
default: () => { }
},
thingName: {
type: String,
default: ''''
},
attr: {
type: String,
default: ''''
},
unit: {
type: String,
default: ''''
},
},
computed: {
getTitleStyle() {
return {
position: ''absolute'',
top: ''0px'',
bottom: `0px`,
width: ''100%'',
zIndex: 100,
display: ''flex'',
justifyContent: ''center'',
alignItems: ''center''
}
}
},
setup(props) {
const { computed, ref, watch, toRefs, nextTick } = Vue;
const { chartProps, currentData, thingName, attr, width, height } = toRefs(props);
let valueStr = ref('''');
let unitStr = ref('''');
let finalLiquidColor = ref(''#7A8BFF'');
let finalStrokeColor = ref("#242770");
const updateChart = (realValue, properties) => {
const { warnValue, seriousValue, maxValue, warnColor, seriousColor, showValue, valueType, showUnit, unit, liquidColor, strokeColor } = properties;
const ratio = (realValue / maxValue * 100).toFixed(2);
if (showValue) {
if (valueType === ''ratio'') {
valueStr.value = ratio + ''''
showUnit && (unitStr.value = ''%'')
} else {
valueStr.value = realValue + ''''
showUnit && (unitStr.value = unit)
}
}
finalLiquidColor.value = liquidColor;
finalStrokeColor.value = strokeColor;
if (seriousValue && realValue >= seriousValue) {
finalLiquidColor.value = seriousColor
} else if (warnValue && realValue >= warnValue) {
finalLiquidColor.value = warnColor
}
setTimeout(() => {
const tankNode = document.getElementById(props.chartId);
const liquidLevel = Math.round(25 - (realValue / maxValue * 58));
tankNode.style.transform = `translateY(${liquidLevel}%)`;
}, 50)
}
watch([currentData, chartProps], ([val, properties]) => {
nextTick(() => {
updateChart(val, properties)
})
}, {
immediate: true,
deep: true,
})
const valueStyle = computed(() => {
return {
color: chartProps.value.valueColor,
fontSize: chartProps.value.valueFontSize + ''px''
}
})
const unitStyle = computed(() => {
return {
color: chartProps.value.unitColor,
fontSize: chartProps.value.unitFontSize + ''px'',
marginLeft: ''3px''
}
})
return {
valueStyle,
unitStyle,
valueStr,
unitStr,
finalLiquidColor,
finalStrokeColor,
}
}
}
class RectangleTankNode extends HtmlResize.view {
realValue = defaultVal
oldProperties = {}
chartRendered = false
instance = null
setHtml(rootEl) {
if (!rootEl) return;
const { properties, width, height } = this.props.model;
const { normalData } = properties.dynamic || {}
let thingName = ''pressure'';
let attr = ''score'';
if (normalData && normalData.dataPoint) {
const dataPointStrParsed = JSON.parse(normalData.dataPoint || ''{}'')
const { deviceCode, dataPoint } = dataPointStrParsed;
thingName = deviceCode;
attr = dataPoint.split('','')[0];
}
if (this.instance) {
// 实时数据不能推送一次就创建一次图表,可以在原有实例基础之上更改数据。
Object.assign(this.instance.component.props, {
name: properties.nodeAlias,
chartId: `liquidlevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
return
}
const el = document.createElement(''div'');
rootEl.innerHTML = '''';
const instance = createVNode(RectangleTank, {
name: properties.nodeAlias,
chartId: `liquidLevel-${properties.id}`,
currentData: this.realValue,
width,
height,
chartProps: properties,
thingName,
attr,
})
instance.appContext = app._context
render(instance, el)
rootEl.appendChild(el);
this.instance = instance;
}
sameProps(properties) {
const isSame = window._.isEqual(this.oldProperties, properties);
if (isSame) return true;
this.oldProperties = properties;
return false
}
// 生命周期 支持重写内容, 但格式需一致
shouldUpdate() {
const { properties } = this.props.model;
const { normalData } = properties.dynamic || {};
if (normalData && !normalData.dataPoint && !normalData.defaultValue) {
this.realValue = defaultVal;
return true
}
if (normalData) {
const { defaultValue } = normalData || {};
if (defaultValue) {
const realValue = window.resolveScadaNewValue(defaultValue)
if (this.realValue !== Number(realValue)) {
this.realValue = Number(realValue);
return true;
}
}
}
const propertiesBack = window._.cloneDeep(properties);
if (propertiesBack.dynamic.normalData) {
const isSameProps = this.sameProps(propertiesBack);
if (isSameProps && this.chartRendered) {
return false
} else {
if (!this.chartRendered) {
this.chartRendered = true
return true
}
if (!isSameProps) {
return true;
}
}
}
}
updateHtml() {
this.setHtml(this.rootEl);
}
componentDidMount() {
// 防止拖动时候频繁渲染图表
this.updateHtmlDebounced = window._.debounce(this.updateHtml.bind(this), 500);
if (this.shouldUpdate()) {
this.setHtml(this.rootEl);
}
}
componentDidUpdate() {
if (this.shouldUpdate()) {
this.updateHtmlDebounced();
}
}
}
class RectangleTankModel extends HtmlResize.model {
initNodeData(data) {
// 自定义组件,需最开始重置一下text 。
data.text = {
value: "",
x: data.x,
y: data.y,
};
super.initNodeData(data);
const { properties } = this;
this.width = properties.width || 80;
this.height = properties.height || 35;
this.text.editable = false; // 不允许文本被编辑
}
setAttributes() {
// 自定义组件需重置 text
const { x, y, properties } = this;
const { textHorizontalMove = 0, textVerticalMove = 0 } = properties;
this.text = {
...this.text,
x: x + textHorizontalMove,
y: y + textVerticalMove,
value: "",
}
}
}
lf.register({
type: ''rectangle-tank'',
view: RectangleTankNode,
model: RectangleTankModel,
})', NULL, 1001, 1001, 1001, 1067246875800000001, 1706498194513, 1067246875800000001, 1721286641970, 't', '时间', 't', 't', '');
INSERT INTO "public"."iot_section_detail" VALUES (1739102612969492482, 'custom-iframe-node', '网页', 1, '
', 'svg', '{"id":"u:270584784ce1","type":"page","name":"page1","asideResizor":false,"style":{"boxShadow":" 0px 0px 0px 0px transparent"},"pullRefresh":{"disabled":true},"body":[{"type":"tabs","name":"tab","tabs":[{"title":"样式","icon":"fa fa-th-large","body":[{"type":"form","title":"","name":"basicPropForm","body":[{"type":"input-text","label":"名称","name":"nodeAlias","id":"u:6b126f0520cb","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"input-text","label":"ID ","name":"id","id":"u:6232710ac003","size":"full","mode":"horizontal","inputControlClassName":"w-100","className":"m-b"},{"type":"grid","id":"u:c605398a724c","className":"m-b","columns":[{"body":[{"type":"input-number","label":"宽度","name":"width","keyboard":true,"id":"u:dcc0c21d16f6","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:14cc19d6ffb0","md":6},{"body":[{"type":"input-number","label":"高度","name":"height","keyboard":true,"id":"u:cd6fdff9ca88","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:4931801ca9b8","md":6}]},{"type":"grid","id":"u:da449a94908a","className":"m-b","columns":[{"body":[{"type":"input-number","label":"X 轴","name":"x","keyboard":true,"id":"u:29852d093d9d","step":1,"suffix":"px","placeholder":"组件左边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:1b561d652acc","md":6},{"body":[{"type":"input-number","label":"Y 轴","name":"y","keyboard":true,"id":"u:dc8c1daed8ed","step":1,"suffix":"px","placeholder":"组件上边距","size":"full","mode":"horizontal","className":"m-b","value":200,"labelAlign":"left","precision":2,"inputClassName":"w-full","labelClassName":"w-8"}],"id":"u:9672575193ac","md":6}]},{"type":"grid","id":"u:a332a7bf83c1","className":"m-b","columns":[{"body":[{"type":"input-number","label":"旋转","name":"rotation","id":"u:f6a2dbb518f9","placeholder":"组件旋转角度","mode":"horizontal","size":"full","className":"","keyboard":true,"step":1,"suffix":"deg","value":0,"labelAlign":"left","inputClassName":"w-full"}],"id":"u:646cd98b7955","md":6},{"body":[{"type":"input-number","label":"透明","name":"opacity","id":"u:cf80f59d8d42","placeholder":"组件透明度","mode":"horizontal","size":"full","className":"m-b","keyboard":true,"step":0,"suffix":"","value":1,"inputClassName":"w-full","precision":2}],"id":"u:51ddf54ac749","md":6}],"gap":""},{"type":"input-text","label":"链接地址","name":"linkAddress","id":"u:a447b3de3e1f","mode":"horizontal"},{"type":"switch","label":"禁止点击","option":"","name":"disableClick","falseValue":false,"trueValue":true,"id":"u:dd96c427c877","value":false,"mode":"horizontal"}],"id":"u:a5ebe5f02407","submitText":"","onEvent":{"change":{"weight":0,"actions":[]}},"debug":false,"mode":"normal","panelClassName":"p","labelAlign":"left","className":"","wrapWithPanel":true}],"id":"u:c309ae58472c","className":"p-none no-border"},{"title":"交互","icon":"fa fa-calendar-minus-o","body":[{"type":"service","body":[{"type":"collapse","key":"1","active":true,"header":"常规","body":[{"type":"service","id":"u:6cb6d200ede2","data":{"dataPoint":"","compareType":"","conditionVariables":[],"defaultValue":"","unit":""},"body":[{"type":"fieldset","title":"Iframe 内部脚本","collapsable":true,"body":[{"type":"combo","label":"iframe 内置插件","name":"iframePlugins","multiple":true,"addable":true,"removable":true,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ea5723f0c48c"},"items":[{"type":"input-text","name":"input-text","placeholder":"文本","id":"u:a3d8d02396c2"}],"id":"u:9beaf42b315d","strictMode":true,"syncFields":[]},{"type":"tpl","tpl":"脚本","inline":true,"wrapperComponent":"h3","id":"u:f899a9ccfb53"},{"type":"editor","label":"","name":"iframeScript","id":"u:844ba1d4c384","language":"javascript","inputClassName":"text-left","className":"my-0","description":"可以在脚本里面创建iframe 外链的 js 脚本代码,或动态创建任何信息,包含html. css, svg, 3d canvas 等。如果需要与外部交互,可以通过 window?.parent.postMessage(''任何数据信息xxx'', ''*'');"}],"id":"u:c1bd7dfd2a51","className":"m-b","bodyClassName":"text-left"},{"type":"fieldset","title":"Iframe 外部脚本","collapsable":true,"body":[{"type":"tpl","tpl":"function (context, iframeData ) {","inline":true,"wrapperComponent":"","id":"u:112d81401e0d"},{"type":"editor","label":"","name":"iframeOuterScript","id":"u:4db340521e32","language":"javascript","inputClassName":"text-left","className":"my-0","description":"内部脚本发送的数据默认会触发事件的改变,外部脚本可以不用填,作为备选的与外部交互的方式之一。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:b1f472522670"}],"id":"u:b7894335f3a4","className":"m-b","bodyClassName":"text-left"}],"name":"normalService","className":"p-none"},{"type":"service","body":[],"id":"u:0dd069ac163f"}],"id":"u:7b021709614e","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"},{"type":"collapse","key":"2","header":"事件","body":[{"type":"service","id":"u:4ec2acc50405","body":[{"type":"combo","label":"","name":"eventCombo","multiple":true,"addable":false,"removable":false,"removableMode":"icon","addBtn":{"label":"新增","icon":"fa fa-plus","level":"primary","size":"sm","id":"u:ae1b0a0c0f55"},"items":[{"type":"select","name":"eventType","placeholder":"选择事件","options":[{"label":"改变","value":"change"}],"id":"u:a7b44847011a","label":"名称","multiple":false,"value":"change"},{"type":"checkBox","id":"u:79dadbc61f74","name":"enable","label":"启用"},{"type":"fieldset","title":"目标节点发起请求","collapsable":true,"body":[{"type":"input-text","label":"目标节点","name":"targetNode","id":"u:6efb6f120e47","multiple":false,"mode":"horizontal","inputClassName":"w-full","visibleOn":"this.eventType === ''change''","removable":"true","placeholder":"目标节点id"},{"type":"select","label":"入参类型","name":"targetParamsType","options":[{"label":"物实体","value":"entitys"},{"label":"物属性","value":"attrs"},{"label":"时间","value":"times"}],"id":"u:d10a57a9b966","multiple":false,"mode":"horizontal","inputClassName":"w-full","removable":true},{"type":"radios","label":"入参实体","name":"targetParamsEntitys","options":[{"label":"物组","value":"group"},{"label":"列表","value":"list"},{"label":"关系","value":"relation"},{"label":"搜索","value":"search"},{"label":"标签","value":"tag"},{"label":"类型","value":"type"}],"id":"u:26df91ece010","onEvent":{"change":{"actions":[{"actionType":"custom","script":"console.log(''event'', event);"}]}},"checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''entitys''"},{"type":"radios","label":"属性类型","name":"targetParamsAttrsType","options":[{"label":"分属性","value":"split"},{"label":"全部","value":"all"}],"id":"u:26df91ece010","checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''attrs''"},{"type":"radios","label":"入参属性","name":"targetParamsAttrsKeysEntitys","options":[{"label":"物","value":"entitys"},{"label":"属性","value":"keys"}],"id":"u:26df91ece010","checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''attrs''"},{"type":"radios","label":"入参时间","name":"targetParamsTimesType","options":[{"label":"最近","value":"nearest"},{"label":"时间段","value":"range"},{"label":"区间","value":"interval"}],"id":"u:26df91ece010","multiple":false,"checkAll":false,"joinValues":true,"inputClassName":"w-full text-left","mode":"horizontal","labelClassName":"","visibleOn":"this.targetParamsType === ''times''"},{"type":"input-text","label":"超级api","name":"apiId","id":"u:912394455375","placeholder":"超级apiId"}],"id":"u:fbccd2ccc8a3"},{"type":"fieldset","title":"更多操作","collapsable":true,"body":[{"type":"tpl","tpl":"function (context, service, nodeId, event) {","inline":true,"wrapperComponent":"","id":"u:799cd3277731"},{"type":"editor","id":"u:77aca39f5961","label":"","name":"moreOperation","language":"javascript","className":"my-0"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:cd392cfb6ffb"}],"id":"u:51249df94c65","bodyClassName":"text-left"}],"id":"u:364496dd313b","deleteBtn":{"type":"icon","icon":"fa fa-trash","id":"u:6d4a75088bc2","className":"border-none"},"strictMode":true,"syncFields":[],"labelClassName":""}],"data":{"eventCombo":[{"eventType":"change","enable":false,"config":""}]},"name":"eventsService"}],"id":"u:14834e895716","headingClassName":"p-sm bg-white b-b b-light","className":"m-b r-3x","bodyClassName":"p-none"}],"id":"u:3eb6b9a42dcb","name":"dynamicService"}],"id":"u:043251c106af","className":"p-sm"},{"title":"脚本解析","icon":"fa fa-star","body":[{"type":"flex","id":"u:edef8e21c1e3","justify":"flex-end","items":[{"type":"button","id":"u:f6d8d837a48d","label":"导入","onEvent":{"click":{"actions":[]}},"icon":"fa fa-download","level":"primary","className":"mr-2"},{"type":"button","id":"u:23f988f98a28","label":"保存","onEvent":{"click":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":true}}}]}},"icon":"fa fa-save"}]},{"type":"service","id":"u:6dc2a126004a","body":[{"type":"tpl","id":"u:c77724a2f3b3","tpl":"function (context, service, nodeId) {","inline":true,"wrapperComponent":"","style":{"fontFamily":"","fontSize":16}},{"type":"editor","label":"","name":"script","id":"u:55ceb80e58a7","language":"javascript","size":"xxl","className":"m-b-none","onEvent":{"focus":{"actions":[{"actionType":"setValue","componentId":"u:6dc2a126004a","args":{"value":{"save":false}}}]}},"description":"参数提示:\n1. context 是整个看板上下文,可以获取看板所有元素节点和连线节点,也可以访问 context.globalDatas 获取全局socket 数据。 \n2. service 是 Ajax 请求服务。\n3. nodeId 是节点 id . \n4. 如果返回一个函数,则可以当socket 数据更新时,调用此函数,此函数入参分别是 context, service, nodeId, globalDatas ;,以满足多样化的业务需求。"},{"type":"tpl","tpl":"}","inline":true,"wrapperComponent":"","id":"u:fa21aebb859b","style":{"fontFamily":"","fontSize":16}}],"name":"scriptService","data":{"script":"","save":false},"className":"text-left"}],"id":"u:dc8d331cbe5e"}],"id":"u:178107498966","tabsMode":"radio","className":"p-none w-full","contentClassName":"p-none"}],"className":""}', '[{"url":"./logicflow/core.umd.js","isModule":false,"disabled":true},{"url":"./logicflow/extensionLib/NodeResize.js","isModule":false,"disabled":true}]', '{
"nodes": [
{
"id": "28c1cc50-eecd-4534-afef-bd752f52aaa2",
"type": "custom-iframe-node",
"x": 200,
"y": 200,
"text": {
"value": "",
"x": 200,
"y": 200
},
"properties": {
"id": "28c1cc50-eecd-4534-afef-bd752f52aaa2",
"width": 500,
"height": 300,
"x": 200,
"y": 200,
"rotation": 0,
"opacity": 1,
"disableClick": false,
"nodeAlias": "外链",
"showDefaultValue": false,
"showUnit": false,
"valueColor": "rgba(245, 166, 35, 1)",
"fontSize": 12,
"linkAddress": "",
"dynamic": {
"normalData": {
"dataPoint": "",
"compareType": "",
"conditionVariables": [],
"defaultValue": "",
"unit": "",
"iframeScript": "",
"iframeOuterScript": "",
"iframePlugins": [
{
"input-text": "./plugins/vue.min.js"
},
{
"input-text": "./plugins/axios.min.js"
},
{
"input-text": "./plugins/lodash.js"
},
{
"input-text": "./plugins/dayjs.min.js"
},
{
"input-text": "./plugins/service.js"
},
{
"input-text": "./iconfonts/iconfont.css"
},
{
"input-text": "./plugins/layui/css/layui.css"
},
{
"input-text": "./plugins/layui/layui.js"
}
]
},
"eventsData": {
"eventCombo": [
{
"eventType": "change",
"enable": false,
"config": ""
}
]
}
}
}
}
]
}', '', 'const { createApp, createVNode, render } = Vue;
const app = createApp({})
const timeArr = new Array(24).fill('''');
const totals = [];
timeArr.forEach((i, index) => { const t = window.dayjs().hour(index).valueOf(); totals.push({ val: Math.random(1000) * 100, ts: t, attrKey: "A29" }) });
const defaultSocketValue = []
const generateHTML = (innerPage, plugins, iframeScript) => {
return `
${innerPage}