物管理前端
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.

199 lines
66 KiB

  1. const e="ebb0c741-8183-456d-92d1-ad6b730910cc",a="custom-parallelogram-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="1687768249254" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27656" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M353.7 378.4h-47.1L93 651.8h47.1z" fill="#707070" p-id="27657"></path><path d="M913.1 341.3H335.6l-29 37.1h577.5L670.6 651.8H93l-29 37.1h624.6l27-34.6 215.6-275.9 29-37.1z" fill="#707070" p-id="27658"></path></svg>',l="svg",i="基础",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}],"id":"u:457970dd35bf","className":"m-b"},{"type":"grid","columns":[{"body":[{"type":"input-number","label":"边��
  2. "nodes": [
  3. {
  4. "id": "6977c672-4c56-4983-8774-9d9f72161495",
  5. "type": "custom-parallelogram-node",
  6. "x": 200,
  7. "y": 200,
  8. "text": {
  9. "value": "",
  10. "x": 200,
  11. "y": 200
  12. },
  13. "properties": {
  14. "id": "6977c672-4c56-4983-8774-9d9f72161495",
  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. "dataPoint": ""
  61. }
  62. ]
  63. },
  64. "hiddenData": {
  65. "hiddenCombo": [
  66. {
  67. "dataPoint": "",
  68. "min": "",
  69. "max": "",
  70. "showOrHiddenName": "隐藏"
  71. }
  72. ]
  73. }
  74. }
  75. }
  76. }
  77. ]
  78. }`,javascript:`// 平行四边形
  79. class ParallelogramModel extends RectResize.model {
  80. realValue = ''
  81. initNodeData(data) {
  82. super.initNodeData(data)
  83. const { properties } = this;
  84. this.width = properties.width || 100;
  85. this.height = properties.height || 100;
  86. this.text.editable = false; // 不允许文本被编辑
  87. window.nodeEventsListeners(this);
  88. }
  89. setAttributes() {
  90. const { x, y, properties } = this;
  91. const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
  92. const { normalData } = dynamic || {};
  93. let textValue = properties.content || '';
  94. if (normalData) {
  95. const { defaultValue } = normalData || {}
  96. const realValue = window.resolveScadaNewValue(defaultValue)
  97. this.realValue = realValue
  98. const { showDefaultValue, showUnit } = properties
  99. if(showDefaultValue) {
  100. textValue += ' ' + realValue
  101. }
  102. if (showUnit) {
  103. textValue += ' ' + normalData.unit
  104. }
  105. }
  106. this.text = {
  107. ...this.text,
  108. x: x + textHorizontalMove,
  109. y: y + textVerticalMove,
  110. value: textValue,
  111. }
  112. }
  113. getNodeStyle() {
  114. const style = super.getNodeStyle();
  115. const { properties } = this;
  116. style.fill = properties.fill || style.fill;
  117. window.changeBackgroundColor(style, properties);
  118. style.stroke = properties.strokeColor || style.stroke;
  119. style.strokeWidth = properties.strokeWidth || style.strokeWidth;
  120. style.opacity = properties.opacity || 1;
  121. return style;
  122. }
  123. getTextStyle() {
  124. const style = super.getTextStyle();
  125. const { properties } = this;
  126. style.color = properties.fontColor || style.color;
  127. style.fontSize = properties.fontSize || style.fontSize;
  128. const fontStyle = properties.fontStyle;
  129. if(fontStyle) {
  130. if (fontStyle.includes('bold')) {
  131. style.fontWeight = 'bolder';
  132. }
  133. if(fontStyle.includes('italic')) {
  134. style.fontStyle = 'italic'
  135. }
  136. if (fontStyle.includes('underline,line-through')) {
  137. style.textDecoration = 'underline line-through'
  138. } else if (fontStyle.includes('line-through,underline')) {
  139. style.textDecoration = 'line-through underline'
  140. } else if (fontStyle.includes('underline')) {
  141. style.textDecoration = 'underline'
  142. } else if (fontStyle.includes('line-through')) {
  143. style.textDecoration = 'line-through'
  144. }
  145. }
  146. window.changeFontColor(style, properties);
  147. return style;
  148. }
  149. getResizeOutlineStyle() {
  150. return {
  151. stroke: "#00ffff",
  152. strokeWidth: 1,
  153. strokeDasharray: "none",
  154. };
  155. }
  156. }
  157. class ParallelogramView extends RectResize.view {
  158. getResizeShape() {
  159. const { x, y, width, height } = this.props.model;
  160. const style = this.props.model.getNodeStyle();
  161. const pointList = [
  162. [x - width / 2, y + height / 2],
  163. [x - width / 5, y - height / 2],
  164. [x + width / 2, y - height / 2],
  165. [x + width / 5, y + height / 2]
  166. ];
  167. const points = pointList.map(item => {
  168. return \`\${item[0]},\${item[1]}\`
  169. })
  170. const attrs = {
  171. ...style,
  172. x,
  173. y,
  174. width,
  175. height,
  176. points: points.join(' ')
  177. }
  178. return h('g', {}, [
  179. h('polygon', { ...attrs })
  180. ]
  181. )
  182. }
  183. }
  184. lf.register({
  185. type: 'custom-parallelogram-node',
  186. view: ParallelogramView,
  187. model: ParallelogramModel
  188. })`,css:""},m={id:e,name:a,aliasName:t,image:n,imageType:l,groupName:i,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,i as groupName,o as groupType,e as id,n as image,l as imageType,u as isDefault,r as isRemote,a as name,d as sectionType};