Commit d1ed8df0 authored by leon's avatar leon

feat: data request support view config

parent 81d9e507
......@@ -20,6 +20,12 @@ const install = (Vue, vm) => {
loading: false
}
})
// 视图
const buildChart = params => postHttp(`${reportUrl}/report/dataview/buildChart`, params, {
custom: {
loading: false
}
})
// 检查授权状态
const getAuthorized = params => getHttp(`${baseUrl}/report/user/getAuthorized`, params)
// 获取用户数据
......@@ -41,6 +47,7 @@ const install = (Vue, vm) => {
getReportList,
getReportCharts,
dataSetPreview,
buildChart,
getAuthorized,
getUserListCount,
changePassword,
......
......@@ -70,6 +70,23 @@ export default {
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() {
clearInterval(this.timer)
this.timer = null
......@@ -102,8 +119,7 @@ export default {
if(that.elementInfo.hide) return false
if (newVal.dataType === 'static') {
that.handleStaticData(newVal)
}
else if (newVal.dataType === 'dynamic') {
} else if (newVal.dataType === 'dynamic') {
that.handleDynamicData(newVal)
if (newVal.dataPolling) {
that.timer = setInterval(() => {
......@@ -112,11 +128,9 @@ export default {
} else {
clearInterval(that.timer)
}
}
else if (newVal.dataType === 'public') {
} else if (newVal.dataType === 'public') {
that.handlePublicData(newVal)
}
else if (newVal.dataType === 'dataSet') {
} else if (newVal.dataType === 'dataSet') {
that.handleDataSet(newVal)
if (newVal.dataPolling) {
that.timer = setInterval(() => {
......@@ -125,6 +139,15 @@ export default {
} else {
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,
......
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