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

fix: 防止新建视图一直loading

上级 aa2a44da
...@@ -118,9 +118,10 @@ export default { ...@@ -118,9 +118,10 @@ export default {
}, },
data() { data() {
return { return {
filterInit: false, // 标记是否已经通过watch.filters 进行初始化,如果filterInit=true 则create放弃数据初始化防止数据覆盖
refId: null, refId: null,
chart: BASE_CHART_STRING, chart: BASE_CHART_STRING,
requestStatus: 'waiting', requestStatus: 'success',
message: null, message: null,
drillClickDimensionList: [], drillClickDimensionList: [],
drillFilters: [], drillFilters: [],
...@@ -242,7 +243,10 @@ export default { ...@@ -242,7 +243,10 @@ export default {
watch: { watch: {
'filters': function(val1, val2) { 'filters': function(val1, val2) {
isChange(val1, val2) && this.getData(this.element.propValue.viewId) if (isChange(val1, val2)) {
this.filterInit = true
this.getData(this.element.propValue.viewId)
}
}, },
linkageFilters: { linkageFilters: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
...@@ -313,8 +317,8 @@ export default { ...@@ -313,8 +317,8 @@ export default {
created() { created() {
this.refId = uuid.v1 this.refId = uuid.v1
if (this.element && this.element.propValue && this.element.propValue.viewId) { if (this.element && this.element.propValue && this.element.propValue.viewId) {
const hasFilter = this.componentData.filter(item => item.type === 'custom').some(item => item.options.value && !(item.options.value instanceof Object) || (item.options.attrs && item.options.attrs.default && item.options.attrs.default.isDynamic)) // 如果watch.filters 已经进行数据初始化时候,此处放弃数据初始化
if (!hasFilter || this.filters.length > 0) { this.getData(this.element.propValue.viewId, false) } !this.filterInit && this.getData(this.element.propValue.viewId, false)
} }
}, },
methods: { methods: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论