物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
66 KiB

  1. const e="d21c044c-53a5-428d-9ff2-bbccf9e44c66",a="custom-horizontal-arrow-node",t="水平箭头",n='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1687770363659" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="53520" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M775.8 648.7V564c0-2.2-1.8-4-4-4H252.2c-2.2 0-4 1.8-4 4v84.7c0 3.1-3.3 5-6 3.5L11.5 518.9c-5.3-3.1-5.3-10.8 0-13.9l230.7-133.2c2.7-1.5 6 0.4 6 3.5V460c0 2.2 1.8 4 4 4h519.6c2.2 0 4-1.8 4-4v-84.7c0-3.1 3.3-5 6-3.5L1012.5 505c5.3 3.1 5.3 10.8 0 13.9L781.8 652.1c-2.7 1.6-6-0.3-6-3.4z" p-id="53521" fill="#707070"></path></svg>',i="svg",l="基础",o="基础图形",r=!1,u=!0,d="基础图形",s=`{"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&nbsp;&nbsp;&nbsp;&nbsp;","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
  2. "nodes": [
  3. {
  4. "id": "389e26f4-f9e4-4a70-831f-c4c0d8aab096",
  5. "type": "custom-horizontal-arrow-node",
  6. "x": 200,
  7. "y": 200,
  8. "text": {
  9. "value": "",
  10. "x": 200,
  11. "y": 200
  12. },
  13. "properties": {
  14. "id": "389e26f4-f9e4-4a70-831f-c4c0d8aab096",
  15. "width": 100,
  16. "height": 100,
  17. "x": 200,
  18. "y": 200,
  19. "rotation": 0,
  20. "opacity": 1,
  21. "strokeWidth": 1,
  22. "showDefaultValue": false,
  23. "showUnit": false,
  24. "fontSize": 12,
  25. "nodeAlias": "水平箭头",
  26. "dynamic": {
  27. "normalData": {
  28. "dataPoint": "",
  29. "compareType": "",
  30. "conditionVariables": [],
  31. "defaultValue": "[{ \\"val\\": 0.00 }]",
  32. "unit": ""
  33. },
  34. "eventsData": {
  35. "eventCombo": [
  36. {
  37. "eventType": "click",
  38. "enable": false,
  39. "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\\"}"
  40. },
  41. {
  42. "eventType": "dblClick",
  43. "enable": false,
  44. "config": ""
  45. }
  46. ]
  47. },
  48. "uiData": {
  49. "dataPoint": "",
  50. "compareType": "",
  51. "conditionVariables": []
  52. },
  53. "animationData": {
  54. "animationCombo": [
  55. {
  56. "min": "",
  57. "max": "",
  58. "animationName": "旋转",
  59. "animationTime": 3
  60. }
  61. ]
  62. },
  63. "hiddenData": {
  64. "hiddenCombo": [
  65. {
  66. "dataPoint": "",
  67. "min": "",
  68. "max": "",
  69. "showOrHiddenName": "隐藏"
  70. }
  71. ]
  72. }
  73. }
  74. }
  75. }
  76. ]
  77. }`,javascript:`// 水平双箭头
  78. class HorizontalArrowModel extends RectResize.model {
  79. initNodeData(data) {
  80. super.initNodeData(data)
  81. const { properties } = this;
  82. this.width = properties.width || 100;
  83. this.height = properties.height || 100;
  84. this.text.editable = false; // 不允许文本被编辑
  85. window.nodeEventsListeners(this);
  86. }
  87. setAttributes() {
  88. const { x, y, properties } = this;
  89. const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
  90. const { normalData } = dynamic || {};
  91. let textValue = properties.content || '';
  92. if (normalData) {
  93. const { defaultValue } = normalData || {}
  94. const realValue = window.resolveScadaNewValue(defaultValue)
  95. this.realValue = realValue
  96. const { showDefaultValue, showUnit } = properties
  97. if(showDefaultValue) {
  98. textValue += ' ' + realValue
  99. }
  100. if (showUnit) {
  101. textValue += ' ' + normalData.unit
  102. }
  103. }
  104. this.text = {
  105. ...this.text,
  106. x: x + textHorizontalMove,
  107. y: y + textVerticalMove,
  108. value: textValue,
  109. }
  110. }
  111. getNodeStyle() {
  112. const style = super.getNodeStyle();
  113. const { properties } = this;
  114. style.fill = properties.fill || style.fill;
  115. window.changeBackgroundColor(style, properties);
  116. style.stroke = properties.strokeColor || style.stroke;
  117. style.strokeWidth = properties.strokeWidth || style.strokeWidth;
  118. style.opacity = properties.opacity || 1;
  119. return style;
  120. }
  121. getTextStyle() {
  122. const style = super.getTextStyle();
  123. const { properties } = this;
  124. style.color = properties.fontColor || style.color;
  125. style.fontSize = properties.fontSize || style.fontSize;
  126. const fontStyle = properties.fontStyle;
  127. if(fontStyle) {
  128. if (fontStyle.includes('bold')) {
  129. style.fontWeight = 'bolder';
  130. }
  131. if(fontStyle.includes('italic')) {
  132. style.fontStyle = 'italic'
  133. }
  134. if (fontStyle.includes('underline,line-through')) {
  135. style.textDecoration = 'underline line-through'
  136. } else if (fontStyle.includes('line-through,underline')) {
  137. style.textDecoration = 'line-through underline'
  138. } else if (fontStyle.includes('underline')) {
  139. style.textDecoration = 'underline'
  140. } else if (fontStyle.includes('line-through')) {
  141. style.textDecoration = 'line-through'
  142. }
  143. }
  144. window.changeFontColor(style, properties);
  145. return style;
  146. }
  147. getResizeOutlineStyle() {
  148. return {
  149. stroke: "#00ffff",
  150. strokeWidth: 1,
  151. strokeDasharray: "none",
  152. };
  153. }
  154. }
  155. class HorizontalArrowView extends RectResize.view {
  156. getResizeShape() {
  157. const { x, y, width, height } = this.props.model
  158. const style = this.props.model.getNodeStyle()
  159. const ArrowHeight = 1/3 * height;
  160. const leftX = x - 1/2 * width;
  161. const leftX2 = x - 1/5 * width;
  162. const rightX = x + 1/2 * width;
  163. const rightX2 = x + 1/5 * width;
  164. const attrs = {
  165. ...style,
  166. x,
  167. y,
  168. width,
  169. height,
  170. points: [
  171. // 右箭头
  172. [rightX2, y - 1/2 * ArrowHeight],
  173. [rightX2, y - 1/2 * height],
  174. [rightX, y],
  175. [rightX2, y + 1/2 * height],
  176. [rightX2, y + 1/2 * ArrowHeight],
  177. // 左箭头
  178. [leftX2, y + 1/2 * ArrowHeight],
  179. [leftX2, y + 1/2 * height],
  180. [leftX, y],
  181. [leftX2, y - 1/2 * height],
  182. [leftX2, y - 1/2 * ArrowHeight],
  183. ]
  184. }
  185. return h('g', {}, [
  186. h('polygon', { ...attrs })
  187. ]
  188. );
  189. }
  190. }
  191. lf.register({
  192. type: 'custom-horizontal-arrow-node',
  193. view: HorizontalArrowView,
  194. model: HorizontalArrowModel
  195. })`,css:""},m={id:e,name:a,aliasName:t,image:n,imageType:i,groupName:l,groupType:o,isRemote:!1,isDefault:!0,sectionType:d,config:s,files:c};export{t as aliasName,s as config,m as default,c as files,l as groupName,o as groupType,e as id,n as image,i as imageType,u as isDefault,r as isRemote,a as name,d as sectionType};