From ae198793df6f96acaf31c28c60e1b32b9f7abba8 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 13 Apr 2010 11:38:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=BF=87=E6=BB=A4=E5=99=A8):=20=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=97=B6=E9=97=B4=E8=BF=87=E6=BB=A4=E5=99=A8=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/widget/deWidget/DeDate.vue | 62 ++++++++++++++----- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/widget/deWidget/DeDate.vue b/frontend/src/components/widget/deWidget/DeDate.vue index 6984086ed7..d50ac2a3fd 100644 --- a/frontend/src/components/widget/deWidget/DeDate.vue +++ b/frontend/src/components/widget/deWidget/DeDate.vue @@ -27,7 +27,7 @@ import { ApplicationContext } from '@/utils/ApplicationContext' import { timeSection } from '@/utils' import bus from '@/utils/bus' import customInput from '@/components/widget/deWidget/customInput' - +import { mapState } from 'vuex' export default { mixins: [customInput], props: { @@ -59,7 +59,8 @@ export default { operator: 'between', values: null, onFocus: false, - show: true + show: true, + timer: null } }, computed: { @@ -126,10 +127,19 @@ export default { return ['00:00:00', '23:59:59'] } return null - } + }, + ...mapState([ + 'canvasStyleData' + ]) }, watch: { + canvasStyleData: { + handler(newVal, oldVla) { + this.canvasStyleDataInit() + }, + deep: true + }, 'viewIds': function(value, old) { if (typeof value === 'undefined' || value === old) return this.setCondition() @@ -163,18 +173,8 @@ export default { } }, created() { - if (this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) { - if (this.element.options.attrs.default) { - const widget = ApplicationContext.getService(this.element.serviceName) - this.values = widget.dynamicDateFormNow(this.element) - this.dateChange(this.values) - } - return - } - if (this.element.options.value) { - this.values = this.fillValueDerfault() - this.dateChange(this.values) - } + this.loadInit() + this.canvasStyleDataInit() }, mounted() { bus.$on('onScroll', this.onScroll) @@ -187,6 +187,38 @@ export default { bus.$off('reset-default-value', this.resetDefaultValue) }, methods: { + loadInit() { + if (this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) { + if (this.element.options.attrs.default) { + const widget = ApplicationContext.getService(this.element.serviceName) + this.values = widget.dynamicDateFormNow(this.element) + this.dateChange(this.values) + } + return + } + if (this.element.options.value) { + this.values = this.fillValueDerfault() + this.dateChange(this.values) + } + }, + canvasStyleDataInit() { + if (this.inDraw && this.canvasStyleData.refreshViewEnable && this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) { + this.searchCount = 0 + this.timer && clearInterval(this.timer) + let refreshTime = 300000 + if (this.canvasStyleData.refreshTime && this.canvasStyleData.refreshTime > 0) { + if (this.canvasStyleData.refreshUnit === 'second') { + refreshTime = this.canvasStyleData.refreshTime * 1000 + } else { + refreshTime = this.canvasStyleData.refreshTime * 60000 + } + } + this.timer = setInterval(() => { + this.loadInit() + this.searchCount++ + }, refreshTime) + } + }, clearHandler() { this.values = null },