diff --git a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue index 285c7ed2d8..83ce904b80 100644 --- a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue @@ -20,6 +20,7 @@ :style="getComponentStyleDefault(config.style)" :prop-value="config.propValue" :element="config" + :search-count="searchCount" /> @@ -42,6 +43,11 @@ export default { type: Object, require: false, default: null + }, + searchCount: { + type: Number, + required: false, + default: 0 } }, computed: { diff --git a/frontend/src/components/canvas/components/Editor/Preview.vue b/frontend/src/components/canvas/components/Editor/Preview.vue index 7234cf5eab..8377a46b6a 100644 --- a/frontend/src/components/canvas/components/Editor/Preview.vue +++ b/frontend/src/components/canvas/components/Editor/Preview.vue @@ -7,6 +7,7 @@ v-for="(item, index) in componentDataInfo" :key="index" :config="item" + :search-count="searchCount" /> @@ -57,7 +58,8 @@ export default { timer: null, componentDataShow: [], mainWidth: '100%', - mainHeight: '100%' + mainHeight: '100%', + searchCount: -1 } }, computed: { @@ -108,10 +110,17 @@ export default { _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() { - // 先清除查询条件 - // this.$store.dispatch('conditions/clear') + beforeDestroy() { + clearInterval(this.timer) }, methods: { changeStyleWithScale, diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 092a9669c9..b4bc2cc4bb 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -54,6 +54,11 @@ export default { default: function() { return {} } + }, + searchCount: { + type: Number, + required: false, + default: 0 } }, data() { @@ -123,6 +128,12 @@ export default { } }, deep: true + }, + // 监听外部计时器变化 + searchCount: function(val1) { + if (val1 > 0) { + this.getData(this.element.propValue.viewId) + } } },