Commit d1ed8df0 authored by leon's avatar leon

feat: data request support view config

parent 81d9e507
...@@ -20,6 +20,12 @@ const install = (Vue, vm) => { ...@@ -20,6 +20,12 @@ const install = (Vue, vm) => {
loading: false loading: false
} }
}) })
// 视图
const buildChart = params => postHttp(`${reportUrl}/report/dataview/buildChart`, params, {
custom: {
loading: false
}
})
// 检查授权状态 // 检查授权状态
const getAuthorized = params => getHttp(`${baseUrl}/report/user/getAuthorized`, params) const getAuthorized = params => getHttp(`${baseUrl}/report/user/getAuthorized`, params)
// 获取用户数据 // 获取用户数据
...@@ -41,6 +47,7 @@ const install = (Vue, vm) => { ...@@ -41,6 +47,7 @@ const install = (Vue, vm) => {
getReportList, getReportList,
getReportCharts, getReportCharts,
dataSetPreview, dataSetPreview,
buildChart,
getAuthorized, getAuthorized,
getUserListCount, getUserListCount,
changePassword, changePassword,
......
...@@ -70,6 +70,23 @@ export default { ...@@ -70,6 +70,23 @@ export default {
that.$u.toast(Msg) that.$u.toast(Msg)
} }
}, },
/**
* 视图配置
*/
async handleViewConfig (value) {
const { viewConfig } = value
if (!viewConfig.dataSetId) return
const that = this
const res = await that.$u.api.buildChart(viewConfig)
const { Status, Msg, Result } = res.data
if (Status === 'true') {
that.elementData.dataList = Result
}else {
message.warning(Msg)
}
},
clearTimer() { clearTimer() {
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null this.timer = null
...@@ -102,8 +119,7 @@ export default { ...@@ -102,8 +119,7 @@ export default {
if(that.elementInfo.hide) return false if(that.elementInfo.hide) return false
if (newVal.dataType === 'static') { if (newVal.dataType === 'static') {
that.handleStaticData(newVal) that.handleStaticData(newVal)
} } else if (newVal.dataType === 'dynamic') {
else if (newVal.dataType === 'dynamic') {
that.handleDynamicData(newVal) that.handleDynamicData(newVal)
if (newVal.dataPolling) { if (newVal.dataPolling) {
that.timer = setInterval(() => { that.timer = setInterval(() => {
...@@ -112,11 +128,9 @@ export default { ...@@ -112,11 +128,9 @@ export default {
} else { } else {
clearInterval(that.timer) clearInterval(that.timer)
} }
} } else if (newVal.dataType === 'public') {
else if (newVal.dataType === 'public') {
that.handlePublicData(newVal) that.handlePublicData(newVal)
} } else if (newVal.dataType === 'dataSet') {
else if (newVal.dataType === 'dataSet') {
that.handleDataSet(newVal) that.handleDataSet(newVal)
if (newVal.dataPolling) { if (newVal.dataPolling) {
that.timer = setInterval(() => { that.timer = setInterval(() => {
...@@ -125,6 +139,15 @@ export default { ...@@ -125,6 +139,15 @@ export default {
} else { } else {
clearInterval(that.timer) clearInterval(that.timer)
} }
} else if (newVal.dataType === 'viewConfig') {
that.handleViewConfig(newVal)
if (newVal.dataPolling) {
that.timer = setInterval(() => {
that.handleViewConfig(newVal)
}, newVal.dataPollingInterval * 1000)
} else {
clearInterval(that.timer)
}
} }
}, },
deep: true, deep: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment