Commit ac12636f34f0e52cee984323d7799902614607f6
1 parent
1520b27d
动态图片加载
Showing
4 changed files
with
23 additions
and
5 deletions
src/views/bigscreenDesigner/designer/components/dynamicForm.vue
src/views/bigscreenDesigner/designer/widget/div/widgetDtImage.vue
| ... | ... | @@ -13,7 +13,8 @@ export default { |
| 13 | 13 | components: {}, |
| 14 | 14 | props: { |
| 15 | 15 | value: Object, |
| 16 | - ispreview: Boolean | |
| 16 | + ispreview: Boolean, | |
| 17 | + staticData: Object | |
| 17 | 18 | }, |
| 18 | 19 | data() { |
| 19 | 20 | return { |
| ... | ... | @@ -64,7 +65,17 @@ export default { |
| 64 | 65 | this.initData(); |
| 65 | 66 | }, |
| 66 | 67 | deep: true |
| 67 | - } | |
| 68 | + }, | |
| 69 | + staticData: { | |
| 70 | + handler(newVal) { | |
| 71 | + if (newVal && Object.keys(newVal).length > 0) { | |
| 72 | + this.getEchartData(); | |
| 73 | + } | |
| 74 | + }, | |
| 75 | + deep: true, | |
| 76 | + immediate: true // 立即执行一次 | |
| 77 | + }, | |
| 78 | + | |
| 68 | 79 | }, |
| 69 | 80 | created() { |
| 70 | 81 | this.options = this.value; |
| ... | ... | @@ -73,6 +84,7 @@ export default { |
| 73 | 84 | this.options = this.value; |
| 74 | 85 | this.optionsData = this.value.data; |
| 75 | 86 | this.setPicValue(); |
| 87 | + | |
| 76 | 88 | }, |
| 77 | 89 | methods: { |
| 78 | 90 | // vue hack 之强制刷新组件 |
| ... | ... | @@ -98,6 +110,7 @@ export default { |
| 98 | 110 | this.getEchartData(); |
| 99 | 111 | } |
| 100 | 112 | }, |
| 113 | + | |
| 101 | 114 | dynamicDataFn(refreshTime) { |
| 102 | 115 | if (this.ispreview) { |
| 103 | 116 | this.flagInter = setInterval(() => { |
| ... | ... | @@ -111,17 +124,20 @@ export default { |
| 111 | 124 | const imageAdressOld =this.imageAdress; |
| 112 | 125 | const imageAdressNew =this.getShowPic(); |
| 113 | 126 | //this.imageAdress = this.getShowPic(); |
| 114 | - this.imageAdressShow = this.isNotBlank(this.imageAdress); | |
| 127 | + | |
| 115 | 128 | // console.log("this.imageAdress",imageAdressOld, imageAdressNew,(imageAdressOld!==imageAdressNew) ) |
| 116 | 129 | if(imageAdressOld!==imageAdressNew){ |
| 117 | 130 | this.imageAdress = imageAdressNew; |
| 118 | 131 | this.reload(); |
| 119 | 132 | } |
| 133 | + this.imageAdressShow = this.isNotBlank(this.imageAdress); | |
| 134 | + | |
| 120 | 135 | }, |
| 121 | 136 | getShowPic() { |
| 122 | 137 | const {textPic, slectedDataType} = this.transStyle; |
| 123 | 138 | const key = this.staticData[slectedDataType] || textPic; |
| 124 | 139 | const dataPic = this.value.setup.dynamicAddPicAdress; |
| 140 | + console.log("🚀 ~ dataPic:", dataPic, this.staticData) | |
| 125 | 141 | // if(this.isBlank(key) || this.isBlankArray(dataPic)){ |
| 126 | 142 | // return this.transStyle.imageAdress; |
| 127 | 143 | // } | ... | ... |
src/views/bigscreenDesigner/designer/widget/widget.vue
| ... | ... | @@ -34,7 +34,7 @@ import WidgetFunnel from "./funnel/widgetFunnel.vue"; |
| 34 | 34 | import WidgetGauge from "./percent/widgetGauge.vue"; |
| 35 | 35 | import WidgetPieNightingaleRoseArea from "./pie/widgetPieNightingaleRose"; |
| 36 | 36 | import widgetTable from "./table/widgetTable.vue"; |
| 37 | -import widgetRotateRanking from "./table/WidgetRotateRanking.vue"; | |
| 37 | +// import widgetRotateRanking from "./table/WidgetRotateRanking.vue"; | |
| 38 | 38 | import widgetLineMap from "./map/widgetLineMap.vue"; |
| 39 | 39 | import widgetPiePercentageChart from "./percent/widgetPiePercentageChart"; |
| 40 | 40 | import widgetAirBubbleMap from "./map/widgetAirBubbleMap"; | ... | ... |
src/views/bigscreenDesigner/viewer/index.vue
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | v-model="widget.value" |
| 11 | 11 | :index="index" |
| 12 | 12 | :type="widget.type" |
| 13 | + :value="widget.value" | |
| 13 | 14 | /> |
| 14 | 15 | </div> |
| 15 | 16 | </div> |
| ... | ... | @@ -36,6 +37,7 @@ export default { |
| 36 | 37 | }, |
| 37 | 38 | mounted() { |
| 38 | 39 | this.getData(); |
| 40 | + | |
| 39 | 41 | }, |
| 40 | 42 | methods: { |
| 41 | 43 | ...mapMutations('dataSource', ['SET_STATIC_DATA','SET_REFRESHTIME']), |
| ... | ... | @@ -63,6 +65,7 @@ export default { |
| 63 | 65 | }; |
| 64 | 66 | // 赋值到全局变量 |
| 65 | 67 | this.setMasterData(data.dashboard); |
| 68 | + | |
| 66 | 69 | data.dashboard.widgets.forEach((item, index) => { |
| 67 | 70 | item.value.widgetId = item.value.setup.widgetId |
| 68 | 71 | item.value.widgetCode = item.value.setup.widgetCode | ... | ... |