提交 b85bd443 authored 作者: wangjiahao's avatar wangjiahao

feat: 增加默认刷新时间

上级 a205bf46
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
:style="getComponentStyleDefault(config.style)" :style="getComponentStyleDefault(config.style)"
:prop-value="config.propValue" :prop-value="config.propValue"
:element="config" :element="config"
:search-count="searchCount"
/> />
</div> </div>
</template> </template>
...@@ -42,6 +43,11 @@ export default { ...@@ -42,6 +43,11 @@ export default {
type: Object, type: Object,
require: false, require: false,
default: null default: null
},
searchCount: {
type: Number,
required: false,
default: 0
} }
}, },
computed: { computed: {
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
v-for="(item, index) in componentDataInfo" v-for="(item, index) in componentDataInfo"
:key="index" :key="index"
:config="item" :config="item"
:search-count="searchCount"
/> />
</div> </div>
</template> </template>
...@@ -57,7 +58,8 @@ export default { ...@@ -57,7 +58,8 @@ export default {
timer: null, timer: null,
componentDataShow: [], componentDataShow: [],
mainWidth: '100%', mainWidth: '100%',
mainHeight: '100%' mainHeight: '100%',
searchCount: -1
} }
}, },
computed: { computed: {
...@@ -108,10 +110,17 @@ export default { ...@@ -108,10 +110,17 @@ export default {
_this.restore() _this.restore()
}) })
}) })
// 数据刷新计时器
let refreshTime = 60000
if (this.canvasStyleData.refreshTime && this.canvasStyleData.refreshTime > 0) {
refreshTime = this.canvasStyleData.refreshTime * 1000
}
this.timer = setInterval(() => {
this.searchCount++
}, refreshTime)
}, },
created() { beforeDestroy() {
// 先清除查询条件 clearInterval(this.timer)
// this.$store.dispatch('conditions/clear')
}, },
methods: { methods: {
changeStyleWithScale, changeStyleWithScale,
......
...@@ -54,6 +54,11 @@ export default { ...@@ -54,6 +54,11 @@ export default {
default: function() { default: function() {
return {} return {}
} }
},
searchCount: {
type: Number,
required: false,
default: 0
} }
}, },
data() { data() {
...@@ -123,6 +128,12 @@ export default { ...@@ -123,6 +128,12 @@ export default {
} }
}, },
deep: true deep: true
},
// 监听外部计时器变化
searchCount: function(val1) {
if (val1 > 0) {
this.getData(this.element.propValue.viewId)
}
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论