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

233 lines
68 KiB

  1. const e="1345a30b-48f0-429a-8b80-e16627d8752a",a="custom-cylinde-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="1687767218740" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3382" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M843.1864 216.860073c-8.723685-41.122583-43.780109-78.319763-100.925621-106.317421-61.84658-30.297027-143.617955-46.985104-230.265384-46.985104-86.641289 0-168.412664 16.687054-230.259244 46.985104-57.155744 27.998681-92.201935 65.195861-100.925621 106.317421h-2.166339v590.273714h2.166339c8.723685 41.12463 43.769876 78.326926 100.925621 106.323561 61.84658 30.29498 143.617955 46.986127 230.259244 46.986127 86.647429 0 168.417781-16.691147 230.265384-46.986127 57.155744-27.996634 92.201935-65.199954 100.925621-106.323561h2.166339v-590.273714h-2.166339zM724.283336 876.765681c-56.356542 27.608801-131.74965 42.821271-212.286918 42.821271-80.533175 0-155.925259-15.211447-212.282824-42.821271-50.975998-24.974811-80.213903-57.795311-80.213903-90.057085 0-32.259728 29.236881-65.080228 80.213903-90.055039 56.357566-27.608801 131.74965-42.823318 212.282824-42.823318 80.537268 0 155.930375 15.213493 212.286918 42.823318 50.977022 24.974811 80.213903 57.795311 80.213903 90.055039 0 32.262798-29.236881 65.082274-80.213903 90.057085z m80.213903-174.960801c-16.229636-15.431457-37.09178-29.526477-62.235437-41.844013-61.84658-30.29498-143.617955-46.984081-230.265384-46.984081-86.641289 0-168.412664 16.689101-230.259244 46.984081-25.143657 12.317537-46.0058 26.412556-62.236459 41.844013V322.193073c16.23066 15.427364 37.092803 29.53057 62.236459 41.848107 61.84658 30.29498 143.617955 46.985104 230.259244 46.985104 86.637196 0 168.417781-16.689101 230.265384-46.985104 25.143657-12.317537 46.0058-26.420743 62.235437-41.848107v379.611807z m-80.213903-374.45946c-56.356542 27.611871-131.74965 42.819225-212.286918 42.819224-80.533175 0-155.925259-15.207353-212.282824-42.819224-50.975998-24.971741-80.213903-57.796334-80.213903-90.055039 0-32.258705 29.236881-65.084321 80.213903-90.056062 56.357566-27.611871 131.74965-42.819225 212.282824-42.819224 80.537268 0 155.930375 15.207353 212.286918 42.819224 50.977022 24.971741 80.213903 57.796334 80.213903 90.056062 0 32.257681-29.236881 65.081251-80.213903 90.055039z" fill="#707070" p-id="3383"></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:dcc0c21d16
  2. "nodes": [
  3. {
  4. "id": "086fff82-e8bf-42d5-83d7-cc111b7696cb",
  5. "type": "custom-cylinde-node",
  6. "x": 200,
  7. "y": 200,
  8. "text": {
  9. "value": "",
  10. "x": 200,
  11. "y": 200
  12. },
  13. "properties": {
  14. "id": "086fff82-e8bf-42d5-83d7-cc111b7696cb",
  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 CylindeModel extends RectResize.model {
  79. realValue = ''
  80. initNodeData(data) {
  81. super.initNodeData(data)
  82. const { properties } = this;
  83. this.width = properties.width || 100;
  84. this.height = properties.height || 100;
  85. this.text.editable = false; // 不允许文本被编辑
  86. window.nodeEventsListeners(this);
  87. }
  88. setAttributes() {
  89. const { x, y, properties } = this;
  90. const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
  91. const { normalData } = dynamic || {};
  92. let textValue = properties.content || '';
  93. if (normalData) {
  94. const { defaultValue } = normalData || {}
  95. const realValue = window.resolveScadaNewValue(defaultValue)
  96. this.realValue = realValue
  97. const { showDefaultValue, showUnit } = properties
  98. if(showDefaultValue) {
  99. textValue += ' ' + realValue
  100. }
  101. if (showUnit) {
  102. textValue += ' ' + normalData.unit
  103. }
  104. }
  105. this.text = {
  106. ...this.text,
  107. x: x + textHorizontalMove,
  108. y: y + textVerticalMove,
  109. value: textValue,
  110. }
  111. }
  112. getNodeStyle() {
  113. const style = super.getNodeStyle();
  114. const { properties } = this;
  115. style.fill = properties.fill || style.fill;
  116. window.changeBackgroundColor(style, properties);
  117. style.stroke = properties.strokeColor || style.stroke;
  118. style.strokeWidth = properties.strokeWidth || style.strokeWidth;
  119. style.opacity = properties.opacity || 1;
  120. return style;
  121. }
  122. getTextStyle() {
  123. const style = super.getTextStyle();
  124. const { properties } = this;
  125. style.color = properties.fontColor || style.color;
  126. style.fontSize = properties.fontSize || style.fontSize;
  127. const fontStyle = properties.fontStyle;
  128. if(fontStyle) {
  129. if (fontStyle.includes('bold')) {
  130. style.fontWeight = 'bolder';
  131. }
  132. if(fontStyle.includes('italic')) {
  133. style.fontStyle = 'italic'
  134. }
  135. if (fontStyle.includes('underline,line-through')) {
  136. style.textDecoration = 'underline line-through'
  137. } else if (fontStyle.includes('line-through,underline')) {
  138. style.textDecoration = 'line-through underline'
  139. } else if (fontStyle.includes('underline')) {
  140. style.textDecoration = 'underline'
  141. } else if (fontStyle.includes('line-through')) {
  142. style.textDecoration = 'line-through'
  143. }
  144. }
  145. window.changeFontColor(style, properties);
  146. return style;
  147. }
  148. getResizeOutlineStyle() {
  149. return {
  150. stroke: "#00ffff",
  151. strokeWidth: 1,
  152. strokeDasharray: "none",
  153. };
  154. }
  155. }
  156. class CylindeView extends RectResize.view {
  157. getResizeShape () {
  158. const { x, y, width, height } = this.props.model
  159. const style = this.props.model.getNodeStyle()
  160. // 圆柱体顶部椭圆
  161. const ellipseAAttrs = {
  162. ...style,
  163. cx: x,
  164. cy: y - 1/3 * height,
  165. rx: 1/2 * width,
  166. ry: 1/6 * height,
  167. width,
  168. height
  169. }
  170. // 圆柱体左直线
  171. const pathAAttrs = {
  172. ...style,
  173. d: \`M \${x - 1/2 * width} \${y - 1/3 * height} L \${x - 1/2 * width} \${y + 1/3 * height}\`
  174. }
  175. // 圆柱体右直线
  176. const pathBAttrs = {
  177. ...style,
  178. d: \`M \${x + 1/2 * width} \${y - 1/3 * height} L \${x + 1/2 * width} \${y + 1/3 * height}\`
  179. }
  180. // 圆柱体下椭圆
  181. const ellipseBAttrs = {
  182. ...style,
  183. cx: x,
  184. cy: y + 1/3 * height,
  185. rx: 1/2 * width,
  186. ry: 1/6 * height,
  187. width,
  188. height
  189. }
  190. // 圆柱体中间填充部分
  191. const rectAttrs = {
  192. ...style,
  193. x: x - 1/2 * width,
  194. y: y - 1/3 * height,
  195. width,
  196. height: 2/3 * height,
  197. stroke: 'transparent'
  198. }
  199. return h('g', {}, [
  200. h('ellipse', {
  201. ...ellipseBAttrs
  202. }),
  203. h('rect', {
  204. ...rectAttrs
  205. }),
  206. h('path', {
  207. ...pathAAttrs
  208. }),
  209. h('path', {
  210. ...pathBAttrs
  211. }),
  212. h('ellipse', {
  213. ...ellipseAAttrs
  214. })
  215. ])
  216. }
  217. }
  218. lf.register({
  219. type: 'custom-cylinde-node',
  220. model: CylindeModel,
  221. view: CylindeView
  222. })`,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};