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

149 lines
20 KiB

  1. const e="12c27a03-dac1-453a-9613-7b968809a6e4",t="custom-video-node",a="视频",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="1698736153051" class="icon" viewBox="0 0 1039 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4941" xmlns:xlink="http://www.w3.org/1999/xlink" width="202.9296875" height="200"><path d="M808.015066 752.090395h-539.962335c-84.851224 0-154.274953-69.423729-154.274953-154.274952v-308.549906c0-84.851224 69.423729-154.274953 154.274953-154.274953h539.962335c84.851224 0 154.274953 69.423729 154.274953 154.274953v308.549906c0 84.851224-69.423729 154.274953-154.274953 154.274952z m-539.962335-539.962335c-42.425612 0-77.137476 34.711864-77.137477 77.137477v308.549906c0 42.425612 34.711864 77.137476 77.137477 77.137476h539.962335c42.425612 0 77.137476-34.711864 77.137476-77.137476v-308.549906c0-42.425612-34.711864-77.137476-77.137476-77.137477h-539.962335z" fill="#388CEB" p-id="4942"></path><path d="M499.46516 617.099812c-23.141243 0-44.354049-5.785311-61.709981-17.355933-40.497175-26.998117-59.781544-80.99435-53.996234-161.9887 3.856874-82.922787 26.998117-133.062147 71.352166-156.20339 44.354049-23.141243 100.278719-11.570621 171.630885 32.783428s104.135593 90.636535 102.207157 140.775894c-1.928437 50.13936-40.497175 90.636535-115.706215 129.205273-42.425612 23.141243-80.99435 32.783427-113.777778 32.783428z m5.785311-269.981168c-7.713748 0-11.570621 1.928437-13.499059 1.928437-17.355932 7.713748-26.998117 42.425612-30.85499 90.636535-3.856874 71.352166 13.499058 88.708098 19.284369 94.493408 7.713748 5.785311 32.783427 13.499058 98.350282-19.284369 67.495292-32.783427 73.280603-57.853107 73.280603-63.638418 0-5.785311-3.856874-30.854991-65.566855-71.352165-40.497175-25.06968-65.566855-32.783427-80.99435-32.783428z" fill="#E78E00" p-id="4943"></path><path d="M750.161959 906.365348h-424.256121c-21.212806 0-38.568738-17.355932-38.568738-38.568738s17.355932-38.568738 38.568738-38.568738h424.256121c21.212806 0 38.568738 17.355932 38.568738 38.568738s-17.355932 38.568738-38.568738 38.568738z" fill="#388CEB" p-id="4944"></path></svg>',i="svg",l="动态",o="数据展示",r=!1,u=!0,s="时间",d=`{"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: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"
  2. "nodes": [
  3. {
  4. "id": "8d19f781-13fc-4aa4-877f-dce151430b80",
  5. "type": "custom-video-node",
  6. "x": 200,
  7. "y": 200,
  8. "text": {
  9. "value": "",
  10. "x": 200,
  11. "y": 200
  12. },
  13. "properties": {
  14. "id": "8d19f781-13fc-4aa4-877f-dce151430b80",
  15. "width": 600,
  16. "height": 300,
  17. "x": 200,
  18. "y": 200,
  19. "rotation": 0,
  20. "opacity": 1,
  21. "nodeAlias": "视频",
  22. "showDefaultValue": false,
  23. "showUnit": false,
  24. "valueColor": "rgba(245, 166, 35, 1)",
  25. "fontSize": 12,
  26. "linkAddress": "https://vjs.zencdn.net/v/oceans.mp4",
  27. "fitStyle": "fill",
  28. "dynamic": {}
  29. }
  30. }
  31. ]
  32. }`,javascript:`const { createApp, createVNode, render } = Vue;
  33. const app = createApp({})
  34. const timeArr = new Array(24).fill('');
  35. const totals = [];
  36. timeArr.forEach((i, index) => { const t = window.dayjs().hour(index).valueOf(); totals.push({ val: Math.random(1000) * 100, ts: t, attrKey: "A29" }) });
  37. const defaultSocketValue = []
  38. const VideoNode = {
  39. template: \`<div style="width: 100%; height: 100%;" draggable="false">
  40. <video v-if="linkAddress" controls="" autoplay="" loop="" preload="auto" crossorigin="anonymous" playsinline="" :style="getStyle" :width="width" :height="height">
  41. <source :src="linkAddress">
  42. </video>
  43. <div v-if="!linkAddress" style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; border: 1px solid #00ffff; box-sizing: border-box;color: #F5A623">暂无内容</div>
  44. </div>
  45. \`,
  46. props: {
  47. chartId: {
  48. type: String,
  49. default: ''
  50. },
  51. width: {
  52. type: Number,
  53. default: 350
  54. },
  55. height: {
  56. type: Number,
  57. default: 150
  58. },
  59. codeConfig: {
  60. type: String,
  61. default: ''
  62. },
  63. linkAddress: {
  64. type: String,
  65. default: ''
  66. },
  67. fitStyle: {
  68. type: String,
  69. default: ''
  70. }
  71. },
  72. computed: {
  73. getStyle() {
  74. const fit = this.fitStyle;
  75. return \`display: block; object-fit: \${fit};\`
  76. }
  77. }
  78. }
  79. class CustomVideoNode extends HtmlResize.view {
  80. setHtml(rootEl) {
  81. if (!rootEl) return;
  82. const { properties, width, height, } = this.props.model;
  83. const { nodeAlias,codeConfig, linkAddress, fitStyle } = properties;
  84. const el = document.createElement('div');
  85. el.style.width = "100%";
  86. el.style.height = "100%";
  87. rootEl.innerHTML = '';
  88. const instance = createVNode(VideoNode, {
  89. name: nodeAlias,
  90. chartId: \`horibar-\${properties.id}\`,
  91. width,
  92. height,
  93. codeConfig,
  94. linkAddress,
  95. fitStyle,
  96. })
  97. instance.appContext = app._context
  98. render(instance, el)
  99. rootEl.appendChild(el);
  100. }
  101. }
  102. class CustomVideoModel extends HtmlResize.model {
  103. initNodeData(data) {
  104. // 自定义组件,需最开始重置一下text 。
  105. data.text = {
  106. value: "",
  107. x: data.x,
  108. y: data.y,
  109. };
  110. super.initNodeData(data);
  111. const { properties } = this;
  112. this.width = properties.width || 80;
  113. this.height = properties.height || 35;
  114. this.text.editable = false; // 不允许文本被编辑
  115. }
  116. setAttributes() {
  117. // 自定义组件需重置 text
  118. const { x, y, properties } = this;
  119. const { textHorizontalMove = 0, textVerticalMove = 0 } = properties;
  120. this.text = {
  121. ...this.text,
  122. x: x + textHorizontalMove,
  123. y: y + textVerticalMove,
  124. value: "",
  125. }
  126. }
  127. getResizeOutlineStyle() {
  128. return {
  129. stroke: "#00ffff",
  130. strokeWidth: 1,
  131. strokeDasharray: "none",
  132. };
  133. }
  134. }
  135. lf.register({
  136. type: 'custom-video-node',
  137. view: CustomVideoNode,
  138. model: CustomVideoModel,
  139. })`,css:"",fakeData:""},p={id:e,name:t,aliasName:a,image:n,imageType:i,groupName:l,groupType:o,isRemote:!1,isDefault:!0,sectionType:s,config:d,files:c};export{a as aliasName,d as config,p 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,t as name,s as sectionType};