Commit 08602c0dd7fe7b116ce08e5d20782700144ebd45
1 parent
51eb5277
feat: implement socket push message to update variable image
Showing
4 changed files
with
102 additions
and
37 deletions
| ... | ... | @@ -158,6 +158,31 @@ | 
| 158 | 158 | } | 
| 159 | 159 | } | 
| 160 | 160 | |
| 161 | + /** | |
| 162 | + * @description 枚举cell的基本属性 | |
| 163 | + */ | |
| 164 | + Sidebar.prototype.enumCellBasicAttribute = { | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * @description 组件类型 | |
| 168 | + */ | |
| 169 | + COMPONENT_TYPE: 'componentType' | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 173 | + * @description 枚举组件类型 | |
| 174 | + */ | |
| 175 | + Sidebar.prototype.enumComponentType = { | |
| 176 | + /** | |
| 177 | + * @description 变量图片类型 | |
| 178 | + */ | |
| 179 | + VAR_IMAGE: 'variableImage', | |
| 180 | + | |
| 181 | + /** | |
| 182 | + * @description 图表类型 | |
| 183 | + */ | |
| 184 | + CHARTS: 'charts' | |
| 185 | + } | |
| 161 | 186 | |
| 162 | 187 | |
| 163 | 188 | /** | ... | ... | 
| ... | ... | @@ -14,8 +14,22 @@ | 
| 14 | 14 | cell.vertex = true; | 
| 15 | 15 | this.graph.setAttributeForCell(cell, 'placeholders', '1'); | 
| 16 | 16 | this.graph.setAttributeForCell(cell, 'currentDate', currentDate); | 
| 17 | - return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, 'realTime'); | |
| 17 | + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '实时时间'); | |
| 18 | 18 | })), | 
| 19 | + this.addEntry(this.getTagsForStencil('mxgraph.basic', '变量图片', 'basic').join(' '), mxUtils.bind(this, function () { | |
| 20 | + const cell = new mxCell('', new mxGeometry(0, 0, 194, 95), 'image;image=images/thingskit/img-placeholder.png;imageAspect=0;'); | |
| 21 | + cell.setVertex(true) | |
| 22 | + this.setCellAttributes(cell, { componentType: 'variableImage' }) | |
| 23 | + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '变量图片'); | |
| 24 | + })) | |
| 25 | + // this.addEntry('variableImage', mxUtils.bind(this, function () { | |
| 26 | + // const imagePlaceholder = '/thingskit-drawio/images/thingskit/img-placeholder.png'; | |
| 27 | + // const template = `<div><img src="${imagePlaceholder}" alt=""></div>`; | |
| 28 | + // const cell = new mxCell(template, new mxGeometry(0, 0, 194, 195), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;'); | |
| 29 | + // cell.vertex = true; | |
| 30 | + // this.graph.setAttributeForCell(cell, 'componentType', 'variableImage'); | |
| 31 | + // return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '变量图片'); | |
| 32 | + // })) | |
| 19 | 33 | ]; | 
| 20 | 34 | |
| 21 | 35 | this.addPaletteFunctions('component', '基础元件', true, fns); | ... | ... | 
| ... | ... | @@ -21,12 +21,12 @@ | 
| 21 | 21 | this.addEntry('line chart', mxUtils.bind(this, function () { | 
| 22 | 22 | const id = self.generatorChartsId() | 
| 23 | 23 | const cell = self.generatorCell(id, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumChartType.LINE_CHART) | 
| 24 | - return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, '折线图'); | |
| 24 | + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '折线图'); | |
| 25 | 25 | })), | 
| 26 | 26 | this.addEntry('bar chart', mxUtils.bind(this, function () { | 
| 27 | 27 | const id = self.generatorChartsId() | 
| 28 | 28 | const cell = self.generatorCell(id, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumConst.CHART_IMG_PLACEHOLDER_SIZE, enumChartType.BAR_CHART, '/thingskit-drawio/images/thingskit/bar-chart.png') | 
| 29 | - return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, '柱状图'); | |
| 29 | + return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '柱状图'); | |
| 30 | 30 | })), | 
| 31 | 31 | ]; | 
| 32 | 32 | |
| ... | ... | @@ -43,7 +43,7 @@ | 
| 43 | 43 | |
| 44 | 44 | /** | 
| 45 | 45 | * @description Sidebar 类型枚举 | 
| 46 | - * @type {{CHART_CELL_DEFAULT_WIDTH: number, CHART_CELL_HEIGHT: string, CHART_CELL_DEFAULT_HEIGHT: number, CHART_TYPE_KEY: string, CHART_CELL_WIDTH: string, CHART_COMP: string, CHART_CELL_ID: string, CHART_CONTAINER_ID_PREFIX: string, CHART_IMG_PLACEHOLDER_SIZE: number, COMPONENTS_TYPE_KEY: string, CHART_CONTAINER_CLS: string}} | |
| 46 | + * @type {{CHART_CELL_DEFAULT_WIDTH: number, CHART_CELL_HEIGHT: string, CHART_CELL_DEFAULT_HEIGHT: number, CHART_TYPE_KEY: string, CHART_CELL_WIDTH: string, CHART_COMP: string, CHART_CELL_ID: string, CHART_CONTAINER_ID_PREFIX: string, CHART_IMG_PLACEHOLDER_SIZE: number, COMPONENT_TYPE_KEY: string, CHART_CONTAINER_CLS: string}} | |
| 47 | 47 | */ | 
| 48 | 48 | Sidebar.prototype.enumConst = { | 
| 49 | 49 | |
| ... | ... | @@ -70,7 +70,7 @@ | 
| 70 | 70 | /** | 
| 71 | 71 | * @description cell 类型是否为 charts | 
| 72 | 72 | */ | 
| 73 | - CHART_COMP: 'charts', | |
| 73 | + CHART_COMP: Sidebar.prototype.enumComponentType.CHARTS, | |
| 74 | 74 | |
| 75 | 75 | /** | 
| 76 | 76 | * @description cell id key | 
| ... | ... | @@ -80,7 +80,7 @@ | 
| 80 | 80 | /** | 
| 81 | 81 | * @description 组件类型 key | 
| 82 | 82 | */ | 
| 83 | - COMPONENTS_TYPE_KEY: 'componentsType', | |
| 83 | + COMPONENT_TYPE_KEY: Sidebar.prototype.enumCellBasicAttribute.COMPONENT_TYPE, | |
| 84 | 84 | |
| 85 | 85 | /** | 
| 86 | 86 | * @description 图表容器 class name | 
| ... | ... | @@ -121,14 +121,14 @@ | 
| 121 | 121 | return { | 
| 122 | 122 | xAxis: { | 
| 123 | 123 | type: 'category', | 
| 124 | - data: [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ], | |
| 124 | + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], | |
| 125 | 125 | }, | 
| 126 | 126 | yAxis: { | 
| 127 | 127 | type: 'value', | 
| 128 | 128 | }, | 
| 129 | 129 | series: [ | 
| 130 | 130 | { | 
| 131 | - data: [ 150, 230, 224, 218, 135, 147, 260 ], | |
| 131 | + data: [150, 230, 224, 218, 135, 147, 260], | |
| 132 | 132 | type: 'line', | 
| 133 | 133 | }, | 
| 134 | 134 | ], | 
| ... | ... | @@ -138,14 +138,14 @@ | 
| 138 | 138 | return { | 
| 139 | 139 | xAxis: { | 
| 140 | 140 | type: 'category', | 
| 141 | - data: [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ], | |
| 141 | + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], | |
| 142 | 142 | }, | 
| 143 | 143 | yAxis: { | 
| 144 | 144 | type: 'value', | 
| 145 | 145 | }, | 
| 146 | 146 | series: [ | 
| 147 | 147 | { | 
| 148 | - data: [ 120, 200, 150, 80, 70, 110, 130 ], | |
| 148 | + data: [120, 200, 150, 80, 70, 110, 130], | |
| 149 | 149 | type: 'bar', | 
| 150 | 150 | showBackground: true, | 
| 151 | 151 | backgroundStyle: { | 
| ... | ... | @@ -170,7 +170,7 @@ | 
| 170 | 170 | const enumConst = this.enumConst | 
| 171 | 171 | const cell = new mxCell(this.createChartsNode(id, width, height, placeholderPath), new mxGeometry(0, 0, width, height), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;'); | 
| 172 | 172 | cell.setVertex(true) | 
| 173 | - this.graph.setAttributeForCell(cell, enumConst.COMPONENTS_TYPE_KEY, 'charts'); | |
| 173 | + this.graph.setAttributeForCell(cell, enumConst.COMPONENT_TYPE_KEY, 'charts'); | |
| 174 | 174 | this.graph.setAttributeForCell(cell, enumConst.CHART_CELL_ID, id); | 
| 175 | 175 | this.graph.setAttributeForCell(cell, enumConst.CHART_CELL_WIDTH, width) | 
| 176 | 176 | this.graph.setAttributeForCell(cell, enumConst.CHART_CELL_HEIGHT, height) | 
| ... | ... | @@ -185,7 +185,7 @@ | 
| 185 | 185 | */ | 
| 186 | 186 | Sidebar.prototype.generatorChartsId = function () { | 
| 187 | 187 | const enumConst = Sidebar.prototype.enumConst | 
| 188 | - return `${ enumConst.CHART_CONTAINER_ID_PREFIX }${ Date.now() }` | |
| 188 | + return `${enumConst.CHART_CONTAINER_ID_PREFIX}${Date.now()}` | |
| 189 | 189 | } | 
| 190 | 190 | |
| 191 | 191 | /** | 
| ... | ... | @@ -197,7 +197,7 @@ | 
| 197 | 197 | * @returns {string} | 
| 198 | 198 | */ | 
| 199 | 199 | Sidebar.prototype.createChartsNode = function (id, width = 400, height = 400, placeholderPath = '/thingskit-drawio/images/thingskit/line-chart.png') { | 
| 200 | - return `<div class="echarts__instance" style="width: ${ width }px; height: ${ height }px" id="${ id }"><img src="${ placeholderPath }" alt=""></div>` | |
| 200 | + return `<div class="echarts__instance" style="width: ${width}px; height: ${height}px" id="${id}"><img src="${placeholderPath}" alt=""></div>` | |
| 201 | 201 | } | 
| 202 | 202 | |
| 203 | 203 | /** | 
| ... | ... | @@ -207,8 +207,8 @@ | 
| 207 | 207 | */ | 
| 208 | 208 | Sidebar.prototype.isChartCell = function (cell) { | 
| 209 | 209 | const enumConst = Sidebar.prototype.enumConst | 
| 210 | - const componentsType = cell.getAttribute(enumConst.COMPONENTS_TYPE_KEY) | |
| 211 | - return !!(componentsType && componentsType === enumConst.CHART_COMP) | |
| 210 | + const componentType = cell.getAttribute(enumConst.COMPONENT_TYPE_KEY) | |
| 211 | + return !!(componentType && componentType === enumConst.CHART_COMP) | |
| 212 | 212 | } | 
| 213 | 213 | |
| 214 | 214 | /** | 
| ... | ... | @@ -222,8 +222,8 @@ | 
| 222 | 222 | const chartOptionMapping = this.chartOptionMapping | 
| 223 | 223 | const chartsInstanceMapping = this.chartsInstanceMapping | 
| 224 | 224 | const chartDom = document.getElementById(id); | 
| 225 | - chartDom.style.width = `${ width }px` | |
| 226 | - chartDom.style.height = `${ height }px` | |
| 225 | + chartDom.style.width = `${width}px` | |
| 226 | + chartDom.style.height = `${height}px` | |
| 227 | 227 | const myChart = echarts.init(chartDom); | 
| 228 | 228 | const option = chartOptionMapping[chartType] ? chartOptionMapping[chartType]() : {} | 
| 229 | 229 | option && myChart.setOption(option); | 
| ... | ... | @@ -304,8 +304,8 @@ | 
| 304 | 304 | const { width, height } = rect | 
| 305 | 305 | const id = self.getCellId(cell) | 
| 306 | 306 | const chartDom = document.getElementById(id) | 
| 307 | - chartDom.style.width = `${ width }px` | |
| 308 | - chartDom.style.height = `${ height }px` | |
| 307 | + chartDom.style.width = `${width}px` | |
| 308 | + chartDom.style.height = `${height}px` | |
| 309 | 309 | self.graph.setAttributeForCell(cell, enumConst.CHART_CELL_WIDTH, width) | 
| 310 | 310 | self.graph.setAttributeForCell(cell, enumConst.CHART_CELL_HEIGHT, height) | 
| 311 | 311 | const instance = chartsInstanceMapping.get(id) | 
| ... | ... | @@ -338,7 +338,7 @@ | 
| 338 | 338 | if (validateFlag) { | 
| 339 | 339 | const cell = self.generatorCell(id, enumConst.CHART_CELL_DEFAULT_WIDTH, enumConst.CHART_CELL_DEFAULT_HEIGHT, chartType) | 
| 340 | 340 | const _arguments = Array.prototype.slice.call(arguments, 0) | 
| 341 | - _arguments.splice(1, 1, [ cell ]) | |
| 341 | + _arguments.splice(1, 1, [cell]) | |
| 342 | 342 | createTooltip.apply(this, _arguments) | 
| 343 | 343 | } else { | 
| 344 | 344 | createTooltip.apply(this, arguments) | 
| ... | ... | @@ -366,7 +366,7 @@ | 
| 366 | 366 | domIdMapping.set(chartInstanceId, { width, height, chartType }) | 
| 367 | 367 | } | 
| 368 | 368 | } | 
| 369 | - const chartsDomList = document.querySelectorAll(`.${ enumConst.CHART_CONTAINER_CLS }`) | |
| 369 | + const chartsDomList = document.querySelectorAll(`.${enumConst.CHART_CONTAINER_CLS}`) | |
| 370 | 370 | for (const chartDom of chartsDomList) { | 
| 371 | 371 | const id = chartDom.getAttribute('id') | 
| 372 | 372 | if (!domIdMapping.has(id)) { | ... | ... | 
| ... | ... | @@ -5657,7 +5657,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 5657 | 5657 | /** | 
| 5658 | 5658 | * @description 图表图形路径 | 
| 5659 | 5659 | */ | 
| 5660 | - IMAGE_GALLERY_IMG_PATH: 'imgPath', | |
| 5660 | + IMAGE_GALLERY_IMAGE_PATH: 'imagePath', | |
| 5661 | 5661 | } | 
| 5662 | 5662 | |
| 5663 | 5663 | const enumImageOriginType = { | 
| ... | ... | @@ -5719,7 +5719,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 5719 | 5719 | form.val(rowFilter, { | 
| 5720 | 5720 | [enumConst.IMAGE_ORIGIN]: null, | 
| 5721 | 5721 | [enumConst.IMAGE_GALLERY_CATEGORY]: null, | 
| 5722 | - [enumConst.IMAGE_GALLERY_IMG_PATH]: null, | |
| 5722 | + [enumConst.IMAGE_GALLERY_IMAGE_PATH]: null, | |
| 5723 | 5723 | }) | 
| 5724 | 5724 | }) | 
| 5725 | 5725 | } | 
| ... | ... | @@ -5760,7 +5760,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 5760 | 5760 | $(`.${enumActionEl.IMAGE_DEL_PREVIEW_EL}`).on('click', (event) => { | 
| 5761 | 5761 | event.stopPropagation() | 
| 5762 | 5762 | $(`#${enumActionEl.IMAGE_PREVIEW_EL}`).attr('src', '') | 
| 5763 | - imageState[enumConst.IMAGE_GALLERY_IMG_PATH] = null | |
| 5763 | + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = null | |
| 5764 | 5764 | }) | 
| 5765 | 5765 | const uploadInst = upload.render({ | 
| 5766 | 5766 | elem: `#${enumActionEl.UPLOAD_LOCAL_FILE_EL}`, | 
| ... | ... | @@ -5776,7 +5776,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 5776 | 5776 | if (!err) { | 
| 5777 | 5777 | $(`#${enumActionEl.IMAGE_PREVIEW_EL}`).attr('src', result) | 
| 5778 | 5778 | const { fileStaticUri = '' } = res | 
| 5779 | - imageState[enumConst.IMAGE_GALLERY_IMG_PATH] = fileStaticUri | |
| 5779 | + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = fileStaticUri | |
| 5780 | 5780 | } | 
| 5781 | 5781 | }); | 
| 5782 | 5782 | }, | 
| ... | ... | @@ -5817,12 +5817,12 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 5817 | 5817 | function generatorSelectImgEventListener() { | 
| 5818 | 5818 | $(`#${enumActionEl.VAR_IMG_CONTAINER_CONTENT}`).on('click', event => { | 
| 5819 | 5819 | setImageSelectedStyle(event, enumActionEl.VAR_IMG_ITEM, enumActionEl.VAR_IMG_ITEM_CHECKED) | 
| 5820 | - imageState[enumConst.IMAGE_GALLERY_IMG_PATH] = $(event.target).find('img').attr('src') | |
| 5820 | + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = $(event.target).find('img').attr('src') | |
| 5821 | 5821 | }) | 
| 5822 | 5822 | $(`#${enumActionEl.VAR_IMG_CONTAINER_SIDEBAR}`).on('click', event => { | 
| 5823 | 5823 | setImageSelectedStyle(event, enumActionEl.VAR_IMG_CATEGORY, enumActionEl.VAR_IMG_CATEGORY_CHECKED) | 
| 5824 | 5824 | imageState[enumConst.IMAGE_GALLERY_CATEGORY] = $(event.target).attr(enumConst.IMAGE_GALLERY_CATEGORY) | 
| 5825 | - imageState[enumConst.IMAGE_GALLERY_IMG_PATH] = null | |
| 5825 | + imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH] = null | |
| 5826 | 5826 | switchGalleryLib(event) | 
| 5827 | 5827 | }) | 
| 5828 | 5828 | } | 
| ... | ... | @@ -5874,13 +5874,14 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 5874 | 5874 | function setCheckedImg(rowFilter) { | 
| 5875 | 5875 | $(`#${enumActionEl.TABLE_BODY_EL}`) | 
| 5876 | 5876 | .find(`tr[lay-filter="${rowFilter}"]`) | 
| 5877 | - .find('img').attr('src', imageState[enumConst.IMAGE_GALLERY_IMG_PATH]) | |
| 5877 | + .find('img').attr('src', imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH]) | |
| 5878 | 5878 | |
| 5879 | 5879 | form.val(rowFilter, { | 
| 5880 | 5880 | [enumConst.IMAGE_ORIGIN]: imageState[enumConst.IMAGE_ORIGIN], | 
| 5881 | 5881 | [enumConst.IMAGE_GALLERY_CATEGORY]: imageState[enumConst.IMAGE_GALLERY_CATEGORY], | 
| 5882 | - [enumConst.IMAGE_GALLERY_IMG_PATH]: imageState[enumConst.IMAGE_GALLERY_IMG_PATH], | |
| 5882 | + [enumConst.IMAGE_GALLERY_IMAGE_PATH]: imageState[enumConst.IMAGE_GALLERY_IMAGE_PATH], | |
| 5883 | 5883 | }) | 
| 5884 | + | |
| 5884 | 5885 | } | 
| 5885 | 5886 | |
| 5886 | 5887 | /** | 
| ... | ... | @@ -5984,7 +5985,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 5984 | 5985 | <td> | 
| 5985 | 5986 | <div class="${enumActionEl.SET_IMG_EL}"> | 
| 5986 | 5987 | <input name="${enumConst.IMAGE_GALLERY_CATEGORY}" type="text" style="display: none"> | 
| 5987 | - <input name="${enumConst.IMAGE_GALLERY_IMG_PATH}" type="text" style="display: none"> | |
| 5988 | + <input name="${enumConst.IMAGE_GALLERY_IMAGE_PATH}" type="text" style="display: none"> | |
| 5988 | 5989 | <input name="${enumConst.IMAGE_ORIGIN}" type="text" style="display: none"> | 
| 5989 | 5990 | <div class="${enumActionEl.PREVIEW_IMG_CONTAINER}"> | 
| 5990 | 5991 | <img src="" alt=""> | 
| ... | ... | @@ -6025,7 +6026,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 6025 | 6026 | condition.forEach((item, index) => { | 
| 6026 | 6027 | addRecord() | 
| 6027 | 6028 | const rowFilter = getRowFilter(index) | 
| 6028 | - $(`#${enumActionEl.TABLE_BODY_EL}`).find(`.${enumActionEl.PREVIEW_IMG_CONTAINER}>img`).attr('src', item[enumConst.IMAGE_GALLERY_IMG_PATH]) | |
| 6029 | + $(`#${enumActionEl.TABLE_BODY_EL}`).find(`tr[lay-filter="${rowFilter}"] .${enumActionEl.PREVIEW_IMG_CONTAINER}>img`).attr('src', item[enumConst.IMAGE_GALLERY_IMAGE_PATH]) | |
| 6029 | 6030 | form.val(rowFilter, { ...item }) | 
| 6030 | 6031 | }) | 
| 6031 | 6032 | } | 
| ... | ... | @@ -6123,9 +6124,9 @@ DataFormatPanel.prototype.addDataFont = function (container) { | 
| 6123 | 6124 | const { component, echoDataSource, getValue } = generatorDataSourceComponent() | 
| 6124 | 6125 | getDataSourceValue = getValue | 
| 6125 | 6126 | $(`#${enumActionEl.DATA_SOURCE_COMP_EL}`).append(component) | 
| 6126 | - const info = getLayerBindInfo('act', type) | |
| 6127 | + const info = getLayerBindInfo('act', type) || {} | |
| 6127 | 6128 | const { condition = [] } = info | 
| 6128 | - if (!info && !condition.length) { | |
| 6129 | + if (!condition.length) { | |
| 6129 | 6130 | addRecord() | 
| 6130 | 6131 | } else { | 
| 6131 | 6132 | echoDataSource(info) | 
| ... | ... | @@ -12138,6 +12139,7 @@ class DispatchCenter { | 
| 12138 | 12139 | * @description 分发事件 | 
| 12139 | 12140 | */ | 
| 12140 | 12141 | publishEvent(eventName, data, message, event, ws) { | 
| 12142 | + data = data ? data : {} | |
| 12141 | 12143 | Object.keys(data).forEach(() => { | 
| 12142 | 12144 | this.eventBus.emit(eventName, message, event, ws) | 
| 12143 | 12145 | }) | 
| ... | ... | @@ -12401,6 +12403,9 @@ class HandleDataInteraction { | 
| 12401 | 12403 | } | 
| 12402 | 12404 | } | 
| 12403 | 12405 | |
| 12406 | +/** | |
| 12407 | + * @description 处理数据 | |
| 12408 | + */ | |
| 12404 | 12409 | class HandleDynamicEffect { | 
| 12405 | 12410 | |
| 12406 | 12411 | /** | 
| ... | ... | @@ -12441,6 +12446,7 @@ class HandleDynamicEffect { | 
| 12441 | 12446 | FLASH: 'FLASH', | 
| 12442 | 12447 | DISPLAY: 'DISPLAY', | 
| 12443 | 12448 | ROTATE: 'ROTATE', | 
| 12449 | + IMAGE: 'IMAGE', | |
| 12444 | 12450 | } | 
| 12445 | 12451 | |
| 12446 | 12452 | static enumDisplayType = { | 
| ... | ... | @@ -12510,7 +12516,7 @@ class HandleDynamicEffect { | 
| 12510 | 12516 | |
| 12511 | 12517 | tsSubCmds.push(this.generatorMessage(slaveDeviceId ? slaveDeviceId : deviceId, cmdId, attr)) | 
| 12512 | 12518 | |
| 12513 | - this.subscribeEvent(cmdId, this.dispatch(type), attr) | |
| 12519 | + this.subscribeEvent(cmdId, this.dispatch(type)) | |
| 12514 | 12520 | }) | 
| 12515 | 12521 | this.sendMsg({ tsSubCmds }) | 
| 12516 | 12522 | } | 
| ... | ... | @@ -12567,6 +12573,9 @@ class HandleDynamicEffect { | 
| 12567 | 12573 | case HandleDynamicEffect.enumActType.FLASH: | 
| 12568 | 12574 | invoke = this.flash.bind(this) | 
| 12569 | 12575 | break | 
| 12576 | + case HandleDynamicEffect.enumActType.IMAGE: | |
| 12577 | + invoke = this.varImage.bind(this) | |
| 12578 | + break | |
| 12570 | 12579 | } | 
| 12571 | 12580 | return invoke | 
| 12572 | 12581 | } | 
| ... | ... | @@ -12576,7 +12585,7 @@ class HandleDynamicEffect { | 
| 12576 | 12585 | * @param message | 
| 12577 | 12586 | * @param attr | 
| 12578 | 12587 | */ | 
| 12579 | - rotate(message, attr) { | |
| 12588 | + rotate(message) { | |
| 12580 | 12589 | const { subscriptionId, data } = message | 
| 12581 | 12590 | const node = this.getNodeByCmdId(subscriptionId) | 
| 12582 | 12591 | const { flag } = this.validate(subscriptionId, DispatchCenter.enumDynamicEffectType.ROTATE, data) | 
| ... | ... | @@ -12603,7 +12612,7 @@ class HandleDynamicEffect { | 
| 12603 | 12612 | * @param message | 
| 12604 | 12613 | * @param attr | 
| 12605 | 12614 | */ | 
| 12606 | - display(message, attr) { | |
| 12615 | + display(message) { | |
| 12607 | 12616 | const { subscriptionId, data = {} } = message | 
| 12608 | 12617 | const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.DISPLAY, data) | 
| 12609 | 12618 | if (!flag) return | 
| ... | ... | @@ -12627,7 +12636,7 @@ class HandleDynamicEffect { | 
| 12627 | 12636 | * @param message | 
| 12628 | 12637 | * @param attr | 
| 12629 | 12638 | */ | 
| 12630 | - flash(message, attr) { | |
| 12639 | + flash(message) { | |
| 12631 | 12640 | const { subscriptionId, data } = message | 
| 12632 | 12641 | const node = this.getNodeByCmdId(subscriptionId) | 
| 12633 | 12642 | const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.FLASH, data) | 
| ... | ... | @@ -12647,6 +12656,23 @@ class HandleDynamicEffect { | 
| 12647 | 12656 | } | 
| 12648 | 12657 | |
| 12649 | 12658 | /** | 
| 12659 | + * @description 处理变量图片 | |
| 12660 | + */ | |
| 12661 | + varImage(message) { | |
| 12662 | + const { subscriptionId, data } = message | |
| 12663 | + const node = this.getNodeByCmdId(subscriptionId) | |
| 12664 | + const { flag, condition } = this.validate(subscriptionId, HandleDynamicEffect.enumActType.IMAGE, data) | |
| 12665 | + if (flag && node) { | |
| 12666 | + const { imagePath } = condition | |
| 12667 | + this.insertOnceUpdateFn( | |
| 12668 | + node, | |
| 12669 | + () => { | |
| 12670 | + node.setStyle(`image;image=${imagePath};imageAspect=0;`) | |
| 12671 | + }) | |
| 12672 | + } | |
| 12673 | + } | |
| 12674 | + | |
| 12675 | + /** | |
| 12650 | 12676 | * @description 验证是否满足条件列表中的任意一条 | 
| 12651 | 12677 | * @param subscriptionId | 
| 12652 | 12678 | * @param type | ... | ... |