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

209 lines
67 KiB

  1. const e="8876fd00-4027-4502-8523-e9894c418f0f",a="custom-cross-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="1687772506947" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="74707" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M1024 592V432c0-8.8-7.2-16-16-16H624c-8.8 0-16-7.2-16-16V16c0-8.8-7.2-16-16-16H432c-8.8 0-16 7.2-16 16v384c0 8.8-7.2 16-16 16H16c-8.8 0-16 7.2-16 16v160c0 8.8 7.2 16 16 16h384c8.8 0 16 7.2 16 16v384c0 8.8 7.2 16 16 16h160c8.8 0 16-7.2 16-16V624c0-8.8 7.2-16 16-16h384c8.8 0 16-7.2 16-16zM536 960h-48c-4.4 0-8-3.6-8-8V560c0-8.8-7.2-16-16-16H72c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h392c8.8 0 16-7.2 16-16V72c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v392c0 8.8 7.2 16 16 16h392c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H560c-8.8 0-16 7.2-16 16v392c0 4.4-3.6 8-8 8z" p-id="74708" fill="#707070"></path></svg>',i="svg",l="基础",o="基础图形",r=!1,u=!0,d="基础图形",s=`{"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&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:facc5
  2. "nodes": [
  3. {
  4. "id": "0db47794-ee89-44b6-b50e-6fcc85089fd9",
  5. "type": "custom-cross-node",
  6. "x": 200,
  7. "y": 200,
  8. "text": {
  9. "value": "",
  10. "x": 200,
  11. "y": 200
  12. },
  13. "properties": {
  14. "id": "0db47794-ee89-44b6-b50e-6fcc85089fd9",
  15. "width": 100,
  16. "height": 100,
  17. "x": 200,
  18. "y": 200,
  19. "rotation": 0,
  20. "opacity": "",
  21. "strokeWidth": 1,
  22. "showDefaultValue": false,
  23. "showUnit": false,
  24. "fontSize": 12,
  25. "nodeAlias": "加号",
  26. "fill": "",
  27. "fontStyle": "",
  28. "dynamic": {
  29. "normalData": {
  30. "dataPoint": "",
  31. "compareType": "",
  32. "conditionVariables": [],
  33. "defaultValue": "[{ \\"val\\": 0.00 }]",
  34. "unit": ""
  35. },
  36. "eventsData": {
  37. "eventCombo": [
  38. {
  39. "eventType": "click",
  40. "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\\"}"
  41. }
  42. ]
  43. },
  44. "uiData": {
  45. "dataPoint": "",
  46. "compareType": "",
  47. "conditionVariables": [
  48. {
  49. "type": "equal",
  50. "label": "相等",
  51. "name": ""
  52. }
  53. ]
  54. },
  55. "animationData": {
  56. "animationCombo": [
  57. {
  58. "min": "",
  59. "max": "",
  60. "animationName": "旋转",
  61. "animationTime": 3
  62. }
  63. ]
  64. },
  65. "hiddenData": {
  66. "hiddenCombo": [
  67. {
  68. "dataPoint": "",
  69. "min": "",
  70. "max": "",
  71. "showOrHiddenName": "隐藏"
  72. }
  73. ]
  74. }
  75. }
  76. }
  77. }
  78. ]
  79. }`,javascript:`// 加号
  80. class CrossModel extends RectResize.model {
  81. realValue = ''
  82. initNodeData(data) {
  83. super.initNodeData(data)
  84. const { properties } = this;
  85. this.width = properties.width || 100;
  86. this.height = properties.height || 100;
  87. this.text.editable = false; // 不允许文本被编辑
  88. window.nodeEventsListeners(this);
  89. }
  90. setAttributes() {
  91. const { x, y, properties } = this;
  92. const { textHorizontalMove = 0, textVerticalMove = 0, dynamic } = properties;
  93. const { normalData } = dynamic || {};
  94. let textValue = properties.content || '';
  95. if (normalData) {
  96. const { defaultValue } = normalData || {}
  97. const realValue = window.resolveScadaNewValue(defaultValue)
  98. this.realValue = realValue
  99. const { showDefaultValue, showUnit } = properties
  100. if(showDefaultValue) {
  101. textValue += ' ' + realValue
  102. }
  103. if (showUnit) {
  104. textValue += ' ' + normalData.unit
  105. }
  106. }
  107. this.text = {
  108. ...this.text,
  109. x: x + textHorizontalMove,
  110. y: y + textVerticalMove,
  111. value: textValue,
  112. }
  113. }
  114. getNodeStyle() {
  115. const style = super.getNodeStyle();
  116. const { properties } = this;
  117. style.fill = properties.fill || style.fill;
  118. window.changeBackgroundColor(style, properties);
  119. style.stroke = properties.strokeColor || style.stroke;
  120. style.strokeWidth = properties.strokeWidth || style.strokeWidth;
  121. style.opacity = properties.opacity || 1;
  122. return style;
  123. }
  124. getTextStyle() {
  125. const style = super.getTextStyle();
  126. const { properties } = this;
  127. style.color = properties.fontColor || style.color;
  128. style.fontSize = properties.fontSize || style.fontSize;
  129. const fontStyle = properties.fontStyle;
  130. if(fontStyle) {
  131. if (fontStyle.includes('bold')) {
  132. style.fontWeight = 'bolder';
  133. }
  134. if(fontStyle.includes('italic')) {
  135. style.fontStyle = 'italic'
  136. }
  137. if (fontStyle.includes('underline,line-through')) {
  138. style.textDecoration = 'underline line-through'
  139. } else if (fontStyle.includes('line-through,underline')) {
  140. style.textDecoration = 'line-through underline'
  141. } else if (fontStyle.includes('underline')) {
  142. style.textDecoration = 'underline'
  143. } else if (fontStyle.includes('line-through')) {
  144. style.textDecoration = 'line-through'
  145. }
  146. }
  147. window.changeFontColor(style, properties);
  148. return style;
  149. }
  150. getResizeOutlineStyle() {
  151. return {
  152. stroke: "#00ffff",
  153. strokeWidth: 1,
  154. strokeDasharray: "none",
  155. };
  156. }
  157. }
  158. class CrossView extends RectResize.view {
  159. getResizeShape() {
  160. const { x, y, width, height } = this.props.model
  161. const style = this.props.model.getNodeStyle()
  162. const pointList = [
  163. [x - 1/2 * width, y - 1/6 * height],
  164. [x - 1/6 * width, y - 1/6 * height],
  165. [x - 1/6 * width, y - 1/2 * height],
  166. [x + 1/6 * width, y - 1/2 * height],
  167. [x + 1/6 * width, y - 1/6 * height],
  168. [x + 1/2 * width, y - 1/6 * height],
  169. [x + 1/2 * width, y + 1/6 * height],
  170. [x + 1/6 * width, y + 1/6 * height],
  171. [x + 1/6 * width, y + 1/2 * height],
  172. [x - 1/6 * width, y + 1/2 * height],
  173. [x - 1/6 * width, y + 1/6 * height],
  174. [x - 1/2 * width, y + 1/6 * height],
  175. ]
  176. const points = pointList.map(item => {
  177. return \`\${item[0]},\${item[1]}\`
  178. })
  179. const attrs = {
  180. ...style,
  181. x,
  182. y,
  183. width,
  184. height,
  185. points: points.join(' ')
  186. }
  187. return h('g', {}, [
  188. h('polygon', { ...attrs })
  189. ])
  190. }
  191. }
  192. lf.register({
  193. type: 'custom-cross-node',
  194. view: CrossView,
  195. model: CrossModel
  196. })`,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};