Commit db6541f24974eaecbaf1d9aa95f5d9650cd65f40

Authored by ww
1 parent 3a8530bf

fix: switch page not ininial chart component

@@ -993,6 +993,16 @@ EditorUi.prototype.selectPage = function(page, quiet, viewState) @@ -993,6 +993,16 @@ EditorUi.prototype.selectPage = function(page, quiet, viewState)
993 catch (e) 993 catch (e)
994 { 994 {
995 this.handleError(e); 995 this.handleError(e);
  996 + } finally {
  997 + console.log(arguments)
  998 + // TODO thingskit instance chart
  999 + Sidebar.prototype.chartsInstanceMapping.forEach(item => {
  1000 + item.dispose()
  1001 + })
  1002 + Sidebar.prototype.chartsInstanceMapping.clear()
  1003 + const graph = this.editor.graph
  1004 + Sidebar.prototype.initChartInstance(graph)
  1005 + console.log(Sidebar.prototype.chartsInstanceMapping)
996 } 1006 }
997 }; 1007 };
998 1008
@@ -2079,4 +2089,4 @@ EditorUi.prototype.createPageMenu = function(page, label) @@ -2079,4 +2089,4 @@ EditorUi.prototype.createPageMenu = function(page, label)
2079 }; 2089 };
2080 2090
2081 mxCodecRegistry.register(codec); 2091 mxCodecRegistry.register(codec);
2082 -})();  
  2092 +})();
@@ -377,5 +377,17 @@ @@ -377,5 +377,17 @@
377 Sidebar.prototype.initChartInstance(this) 377 Sidebar.prototype.initChartInstance(this)
378 } 378 }
379 } 379 }
  380 +
  381 + // const selectPage = EditorUi.prototype.selectPage
  382 + // EditorUi.prototype.selectPage = function () {
  383 + // try {
  384 + // selectPage.apply(this, arguments)
  385 +
  386 + // } finally {
  387 + // Sidebar.prototype.chartsInstanceMapping.clear()
  388 + // const graph = this.editor.graph
  389 + // Sidebar.prototype.initChartInstance(graph)
  390 + // }
  391 + // }
380 })(); 392 })();
381 393
@@ -3379,6 +3379,8 @@ EditorUi.prototype.lightboxFit = function(maxHeight) @@ -3379,6 +3379,8 @@ EditorUi.prototype.lightboxFit = function(maxHeight)
3379 this.editor.graph.maxFitScale = this.lightboxMaxFitScale; 3379 this.editor.graph.maxFitScale = this.lightboxMaxFitScale;
3380 this.editor.graph.fit(border, null, null, null, null, null, maxHeight); 3380 this.editor.graph.fit(border, null, null, null, null, null, maxHeight);
3381 this.editor.graph.maxFitScale = null; 3381 this.editor.graph.maxFitScale = null;
  3382 + // TODO thingsKit lightbox 默认缩放为1
  3383 + this.editor.graph.view.setScale(1);
3382 } 3384 }
3383 }; 3385 };
3384 3386
@@ -6383,10 +6383,8 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6383,10 +6383,8 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6383 function echoOrgTree(id) { 6383 function echoOrgTree(id) {
6384 orgId = id 6384 orgId = id
6385 const node = UseLayUi.findTreeObjectByField(treeList, id) 6385 const node = UseLayUi.findTreeObjectByField(treeList, id)
6386 - orgId = id  
6387 - $(`#${enumActionEl.ORG_EL}`)  
6388 - .find(`input[name="${enumConst.ORG_ID}"]`).val(orgId).parent()  
6389 - .find('span').html(node?.name) 6386 +
  6387 + UseLayUi.nextTick(() => $(`#${enumActionEl.ORG_EL} input[name="${enumConst.ORG_ID}"]`).val(orgId).parent().find('span').html(node?.name))
6390 } 6388 }
6391 6389
6392 /** 6390 /**
@@ -6539,6 +6537,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6539,6 +6537,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6539 } 6537 }
6540 generatorEventListen() 6538 generatorEventListen()
6541 form.render() 6539 form.render()
  6540 + echoOrgTree(orgId)
6542 }, 6541 },
6543 }) 6542 })
6544 } 6543 }
@@ -6940,6 +6939,7 @@ DataFormatPanel.prototype.addDataFont = function (container) { @@ -6940,6 +6939,7 @@ DataFormatPanel.prototype.addDataFont = function (container) {
6940 contentId: currentPageId.id, 6939 contentId: currentPageId.id,
6941 ...formVal, 6940 ...formVal,
6942 id: graphId, 6941 id: graphId,
  6942 + orgId: 'b4dd6e2b-6e0f-413c-bf5a-70133bd571e8',
6943 condition: tableData, 6943 condition: tableData,
6944 type: event.data.type, 6944 type: event.data.type,
6945 } 6945 }
@@ -11573,7 +11573,7 @@ class UseLayUi { @@ -11573,7 +11573,7 @@ class UseLayUi {
11573 <div class="layui-input-block"> 11573 <div class="layui-input-block">
11574 <div class="layui-unselect layui-form-select ${SELECT_CLS}"> 11574 <div class="layui-unselect layui-form-select ${SELECT_CLS}">
11575 <div class="layui-select-title"> 11575 <div class="layui-select-title">
11576 - <span class="layui-input layui-unselect">请选择</span> 11576 + <span class="layui-input layui-unselect tree-select__label">请选择</span>
11577 <input ${this.dynamicAttr('lay-verify', layVerify)} ${this.dynamicAttr('lay-verType', layVerType)} type="text" style="visibility: hidden; position: absolute; top: 0" name="${layFilter}"> 11577 <input ${this.dynamicAttr('lay-verify', layVerify)} ${this.dynamicAttr('lay-verType', layVerType)} type="text" style="visibility: hidden; position: absolute; top: 0" name="${layFilter}">
11578 <i class="layui-edge"></i> 11578 <i class="layui-edge"></i>
11579 </div> 11579 </div>
@@ -12566,6 +12566,7 @@ class HandleDataSource { @@ -12566,6 +12566,7 @@ class HandleDataSource {
12566 const { attr } = this.getBindData(subscriptionId) 12566 const { attr } = this.getBindData(subscriptionId)
12567 node && this.updatePage(() => { 12567 node && this.updatePage(() => {
12568 const { data } = message 12568 const { data } = message
  12569 + if (!data) return
12569 const [[timespan, value]] = data[attr] 12570 const [[timespan, value]] = data[attr]
12570 node.setValue(value) 12571 node.setValue(value)
12571 }, node) 12572 }, node)
@@ -12661,7 +12662,7 @@ class HandleDataSource { @@ -12661,7 +12662,7 @@ class HandleDataSource {
12661 dataZoom: [ 12662 dataZoom: [
12662 { 12663 {
12663 xAxisIndex: 0, 12664 xAxisIndex: 0,
12664 - show: realDataList.length ? true : false, 12665 + show: realDataList.length ? true : false,
12665 type: 'slider', 12666 type: 'slider',
12666 startValue: 0, 12667 startValue: 0,
12667 endValue: 4 12668 endValue: 4