fix:图表组件,表格组件添加数据加载状态

main
liu.shiyi 2 years ago
parent af3e00e163
commit e42a4d07da

@ -1,5 +1,7 @@
<template> <template>
<div <div
v-loading="config.loading"
element-loading-text="数据加载中"
style="width: 100%;height: 100%" style="width: 100%;height: 100%"
class="bs-design-wrap" class="bs-design-wrap"
> >

@ -32,7 +32,8 @@ const customConfig = {
type: 'screenScrollBoard', type: 'screenScrollBoard',
root: { root: {
version: '2023071001', version: '2023071001',
contribution: false contribution: false,
loading: false
}, },
customize: { customize: {
rowNum: 5, rowNum: 5,

@ -1,5 +1,7 @@
<template> <template>
<div <div
v-loading="config.loading"
element-loading-text="数据加载中"
style="width: 100%;height: 100%" style="width: 100%;height: 100%"
class="bs-design-wrap" class="bs-design-wrap"
> >

@ -26,7 +26,8 @@ const customConfig = {
type: 'screenScrollRanking', type: 'screenScrollRanking',
root: { root: {
version: '2023071001', version: '2023071001',
contribution: false contribution: false,
loading: false
}, },
customize: { customize: {
rowNum: 5, rowNum: 5,

@ -1,5 +1,7 @@
<template> <template>
<div <div
v-loading="config.loading"
element-loading-text="数据加载中"
style="width: 100%;height: 100%" style="width: 100%;height: 100%"
class="bs-design-wrap " class="bs-design-wrap "
> >

@ -34,8 +34,10 @@ const customConfig = {
type: 'tables', type: 'tables',
root: { root: {
version: '2023071001', version: '2023071001',
contribution: false contribution: false,
loading: false
}, },
customize: { customize: {
theme: 'dark', // 'light'、'dark' theme: 'dark', // 'light'、'dark'
// 表格头部背景颜色 // 表格头部背景颜色

@ -99,7 +99,8 @@ export default {
dataSource: cloneDeep(this.config.dataSource), dataSource: cloneDeep(this.config.dataSource),
linkage: cloneDeep(this.config?.linkage), linkage: cloneDeep(this.config?.linkage),
dataHandler: this.config?.dataHandler, dataHandler: this.config?.dataHandler,
dataSourceSetting: cloneDeep(this.config?.setting?.filter(item => item.tabName === 'data')) || [] dataSourceSetting: cloneDeep(this.config?.setting?.filter(item => item.tabName === 'data')) || [],
code: this.config?.code
} }
}, },
configStyle () { configStyle () {
@ -131,6 +132,7 @@ export default {
// //
configDataSource: { configDataSource: {
handler (val, oldValue) { handler (val, oldValue) {
console.log('oldValue', oldValue)
this.handleConfigChange(val, oldValue, 'configDataSource') this.handleConfigChange(val, oldValue, 'configDataSource')
}, },
deep: true deep: true
@ -150,17 +152,19 @@ export default {
}, delay) }, delay)
}, },
handleConfigChange (val, oldValue, type) { handleConfigChange (val, oldValue, type) {
if (!isEqual(val, oldValue)) { if (val.code === oldValue.code) {
if (type === 'configStyle') { if (!isEqual(val, oldValue)) {
if (this.config.type === 'iframeChart') { if (type === 'configStyle') {
this.debounce(500, { ...val, type: this.config.type, code: this.config.code, parentCode: this.config?.parentCode }) if (this.config.type === 'iframeChart') {
this.debounce(500, { ...val, type: this.config.type, code: this.config.code, parentCode: this.config?.parentCode })
} else {
this.$emit('updateSetting', { ...val, type: this.config.type, code: this.config.code, theme: this.config.theme, parentCode: this.config?.parentCode })
}
} else { } else {
this.$emit('updateSetting', { ...val, type: this.config.type, code: this.config.code, theme: this.config.theme, parentCode: this.config?.parentCode }) this.$emit('updateDataSetting', this.config)
} }
} else { this.saveTimeLine(`更新${val?.title ?? this.config.title}组件属性`)
this.$emit('updateDataSetting', this.config)
} }
this.saveTimeLine(`更新${val?.title ?? this.config.title}组件属性`)
} }
}, },
close () { close () {

@ -43,6 +43,7 @@ function getPlotList (files) {
y: 0, y: 0,
type: 'customComponent', type: 'customComponent',
chartType: config.chartType, chartType: config.chartType,
loading: false,
option: { option: {
...config.option, ...config.option,
...cloneDeep(settingConfig) ...cloneDeep(settingConfig)

@ -1,5 +1,7 @@
<template> <template>
<div <div
v-loading="config.loading"
element-loading-text="图表加载中"
style="width: 100%;height: 100%" style="width: 100%;height: 100%"
class="bs-design-wrap bs-custom-component" class="bs-design-wrap bs-custom-component"
:class="{'light-theme':customTheme === 'light','auto-theme':customTheme !=='light'}" :class="{'light-theme':customTheme === 'light','auto-theme':customTheme !=='light'}"
@ -8,6 +10,7 @@
:id="chatId" :id="chatId"
style="width: 100%;height: 100%" style="width: 100%;height: 100%"
/> />
<!-- <span style="color:#ffffff">{{config.option.data}}</span>-->
</div> </div>
</template> </template>
<script> <script>
@ -80,7 +83,7 @@ export default {
} }
}, },
methods: { methods: {
...mapMutations('bigScreen', ['changeChartConfig', 'changeActiveItemConfig']), ...mapMutations('bigScreen', ['changeChartConfig', 'changeActiveItemConfig', 'changeChartLoading']),
chartInit () { chartInit () {
let config = this.config let config = this.config
// keycodelist // keycodelist
@ -88,14 +91,22 @@ export default {
// //
config = this.changeStyle(config) config = this.changeStyle(config)
// //
config.loading = true
this.changeChartLoading(config)
this.changeDataByCode(config).then((res) => { this.changeDataByCode(config).then((res) => {
// //
config.loading = false
this.changeChartLoading(config)
this.newChart(res) this.newChart(res)
}).catch(() => { }).catch(() => {
}) })
} else { } else {
config.loading = true
this.changeChartLoading(config)
// changeStylekey,chart // changeStylekey,chart
this.changeData(config).then((res) => { this.changeData(config).then((res) => {
config.loading = false
this.changeChartLoading(config)
// //
this.newChart(res) this.newChart(res)
}) })

@ -7,15 +7,18 @@
<template> <template>
<div class="content"> <div class="content">
<component <component
v-if="config.border&&config.border.type"
:is="resolveComponentType(config.border.type)" :is="resolveComponentType(config.border.type)"
v-if="config.border&&config.border.type"
:id="`border${config.code}`" :id="`border${config.code}`"
:ref="`border${config.code}`" :ref="`border${config.code}`"
:key="`border${config.key}`" :key="`border${config.key}`"
:config="config" :config="config"
/> />
<div class="render-item-wrap" :style="`height:calc(100% - ${(config.border&&config.border.type)?config.border.titleHeight:0}px)`"> <div
<component class="render-item-wrap"
:style="`height:calc(100% - ${(config.border&&config.border.type)?config.border.titleHeight:0}px)`"
>
<component
:is="resolveComponentType(config.type)" :is="resolveComponentType(config.type)"
:id="`${config.code}`" :id="`${config.code}`"
:ref="config.code" :ref="config.code"
@ -25,7 +28,6 @@
/> />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
// import commonMixins from 'data-room-ui/js/mixins/commonMixins' // import commonMixins from 'data-room-ui/js/mixins/commonMixins'
@ -65,7 +67,7 @@ export default {
}, },
data () { data () {
return { return {
height:0 height: 0
} }
}, },
computed: { computed: {

@ -70,6 +70,7 @@ export default {
size = config.option.pagination.pageSize size = config.option.pagination.pageSize
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
config.loading = true
getChatInfo({ getChatInfo({
// innerChartCode: this.pageCode ? config.code : undefined, // innerChartCode: this.pageCode ? config.code : undefined,
chartCode: config.code, chartCode: config.code,
@ -78,6 +79,7 @@ export default {
size: size, size: size,
type: config.type type: config.type
}).then(async (res) => { }).then(async (res) => {
config.loading = false
let _res = cloneDeep(res) let _res = cloneDeep(res)
// 如果是http数据集的前端代理则需要调封装的axios请求 // 如果是http数据集的前端代理则需要调封装的axios请求
if (res.executionByFrontend) { if (res.executionByFrontend) {
@ -139,7 +141,9 @@ export default {
filterList: filterList || this.filterList filterList: filterList || this.filterList
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
config.loading = true
getUpdateChartInfo(params).then(async (res) => { getUpdateChartInfo(params).then(async (res) => {
config.loading = false
let _res = cloneDeep(res) let _res = cloneDeep(res)
// 如果是http数据集的前端代理则需要调封装的axios请求 // 如果是http数据集的前端代理则需要调封装的axios请求
if (res.executionByFrontend) { if (res.executionByFrontend) {
@ -177,6 +181,7 @@ export default {
}).catch(err => { }).catch(err => {
console.info(err) console.info(err)
}).finally(() => { }).finally(() => {
config.loading = false
resolve(config) resolve(config)
}) })
}) })

@ -84,6 +84,15 @@ export default {
// 改变loading状态 // 改变loading状态
state.pageLoading = booleanValue state.pageLoading = booleanValue
}, },
// 改变当前组件的加载状态
changeChartLoading (state, itemConfig) {
// 改变loading状态
state.pageInfo.chartList.forEach((chart, index) => {
if (chart.code === itemConfig.code) {
chart.loading = itemConfig.loading
}
})
},
// 改变当前组件配置 // 改变当前组件配置
changeChartConfig (state, itemConfig) { changeChartConfig (state, itemConfig) {
// 如果存在parentCode的组件则是tab中的组件 // 如果存在parentCode的组件则是tab中的组件

Loading…
Cancel
Save