mirror of
https://github.com/dataease/dataease.git
synced 2026-05-23 22:08:34 +08:00
Merge remote-tracking branch 'origin/v1.8' into v1.8
This commit is contained in:
53
frontend/src/api/panel/shareProxy.js
Normal file
53
frontend/src/api/panel/shareProxy.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
import { panelInit } from '@/components/canvas/utils/utils'
|
||||
import store from '@/store'
|
||||
|
||||
export function proxyInitPanelData(panelId, proxy, callback) {
|
||||
// 加载视图数据
|
||||
findOne(panelId, proxy).then(response => {
|
||||
// 初始化视图data和style 数据
|
||||
panelInit(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle))
|
||||
// 设置当前仪表板全局信息
|
||||
store.dispatch('panel/setPanelInfo', {
|
||||
id: response.data.id,
|
||||
name: response.data.name,
|
||||
privileges: response.data.privileges,
|
||||
proxy: proxy.userId
|
||||
})
|
||||
// 刷新联动信息
|
||||
getPanelAllLinkageInfo(panelId, proxy).then(rsp => {
|
||||
store.commit('setNowPanelTrackInfo', rsp.data)
|
||||
})
|
||||
// 刷新跳转信息
|
||||
queryPanelJumpInfo(panelId, proxy).then(rsp => {
|
||||
store.commit('setNowPanelJumpInfo', rsp.data)
|
||||
})
|
||||
callback(response)
|
||||
})
|
||||
}
|
||||
|
||||
export function findOne(id, data) {
|
||||
return request({
|
||||
url: '/panel/group/proxy/findOne/' + id,
|
||||
method: 'post',
|
||||
loading: true,
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getPanelAllLinkageInfo(panelId, data) {
|
||||
return request({
|
||||
url: '/linkage/proxy/getPanelAllLinkageInfo/' + panelId,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function queryPanelJumpInfo(panelId, data) {
|
||||
return request({
|
||||
url: '/linkJump/proxy/queryPanelJumpInfo/' + panelId,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
@@ -433,6 +433,10 @@ export default {
|
||||
...this.filter,
|
||||
cache: cache
|
||||
}
|
||||
if (this.panelInfo.proxy) {
|
||||
// method = viewInfo
|
||||
requestInfo.proxy = { userId: this.panelInfo.proxy }
|
||||
}
|
||||
method(id, this.panelInfo.id, requestInfo).then(response => {
|
||||
// 将视图传入echart组件
|
||||
if (response.success) {
|
||||
|
||||
@@ -73,6 +73,9 @@ export default {
|
||||
},
|
||||
manualModify() {
|
||||
return !!this.element.options.manualModify
|
||||
},
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
}
|
||||
},
|
||||
|
||||
@@ -96,9 +99,13 @@ export default {
|
||||
if (!token && linkToken) {
|
||||
method = linkMultFieldValues
|
||||
}
|
||||
const param = { fieldIds: this.element.options.attrs.fieldId.split(',') }
|
||||
if (this.panelInfo.proxy) {
|
||||
param.userId = this.panelInfo.proxy
|
||||
}
|
||||
this.element.options.attrs.fieldId &&
|
||||
this.element.options.attrs.fieldId.length > 0 &&
|
||||
method({ fieldIds: this.element.options.attrs.fieldId.split(',') }).then(res => {
|
||||
method(param).then(res => {
|
||||
this.datas = this.optionDatas(res.data)
|
||||
}) || (this.element.options.value = '')
|
||||
},
|
||||
|
||||
@@ -93,6 +93,9 @@ export default {
|
||||
},
|
||||
manualModify() {
|
||||
return !!this.element.options.manualModify
|
||||
},
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -119,9 +122,13 @@ export default {
|
||||
if (!token && linkToken) {
|
||||
method = linkMultFieldValues
|
||||
}
|
||||
const param = { fieldIds: this.element.options.attrs.fieldId.split(',') }
|
||||
if (this.panelInfo.proxy) {
|
||||
param.userId = this.panelInfo.proxy
|
||||
}
|
||||
this.element.options.attrs.fieldId &&
|
||||
this.element.options.attrs.fieldId.length > 0 &&
|
||||
method({ fieldIds: this.element.options.attrs.fieldId.split(',') }).then(res => {
|
||||
method(param).then(res => {
|
||||
this.datas = this.optionDatas(res.data)
|
||||
}) || (this.element.options.value = '')
|
||||
},
|
||||
|
||||
@@ -5,7 +5,8 @@ const getDefaultState = () => {
|
||||
panelInfo: {
|
||||
id: null,
|
||||
name: '',
|
||||
preStyle: null
|
||||
preStyle: null,
|
||||
proxy: null
|
||||
},
|
||||
canvasStyleDataTemp: null, // 页面全局临时存储数据
|
||||
componentDataTemp: null, // 画布组件临时存储数据
|
||||
|
||||
@@ -208,9 +208,7 @@ export default {
|
||||
},
|
||||
|
||||
queryShareNodeIds(callBack) {
|
||||
const conditionResourceId = { field: 'panel_group_id', operator: 'eq', value: this.resourceId }
|
||||
const conditionType = { field: 'type', operator: 'eq', value: this.type }
|
||||
const param = { conditions: [conditionResourceId, conditionType] }
|
||||
const param = { resourceId: this.resourceId, type: this.type }
|
||||
loadShares(param).then(res => {
|
||||
const shares = res.data
|
||||
const nodeIds = shares.map(share => share.targetId)
|
||||
|
||||
@@ -93,9 +93,7 @@ export default {
|
||||
},
|
||||
|
||||
queryShareNodeIds(callBack) {
|
||||
const conditionResourceId = { field: 'panel_group_id', operator: 'eq', value: this.resourceId }
|
||||
const conditionType = { field: 'type', operator: 'eq', value: this.type }
|
||||
const param = { conditions: [conditionResourceId, conditionType] }
|
||||
const param = { resourceId: this.resourceId, type: this.type }
|
||||
loadShares(param).then(res => {
|
||||
const shares = res.data
|
||||
const nodeIds = shares.map(share => share.targetId)
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
<script>
|
||||
import { loadTree, loadShareOutTree, removeShares } from '@/api/panel/share'
|
||||
import { uuid } from 'vue-uuid'
|
||||
import { get, initPanelData } from '@/api/panel/panel'
|
||||
import { initPanelData } from '@/api/panel/panel'
|
||||
import { proxyInitPanelData } from '@/api/panel/shareProxy'
|
||||
import bus from '@/utils/bus'
|
||||
export default {
|
||||
name: 'ShareTree',
|
||||
@@ -103,7 +104,11 @@ export default {
|
||||
return loadShareOutTree()
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
initPanelData(data.id, function() {
|
||||
if (!data || !data.userId || !data.id) {
|
||||
return
|
||||
}
|
||||
const param = { userId: data.userId }
|
||||
proxyInitPanelData(data.id, param, function() {
|
||||
bus.$emit('set-panel-show-type', 1)
|
||||
})
|
||||
this.$refs['botTree'].setCurrentKey(null)
|
||||
|
||||
@@ -100,9 +100,7 @@ export default {
|
||||
},
|
||||
|
||||
queryShareNodeIds(callBack) {
|
||||
const conditionResourceId = { field: 'panel_group_id', operator: 'eq', value: this.resourceId }
|
||||
const conditionType = { field: 'type', operator: 'eq', value: this.type }
|
||||
const param = { conditions: [conditionResourceId, conditionType] }
|
||||
const param = { resourceId: this.resourceId, type: this.type }
|
||||
loadShares(param).then(res => {
|
||||
const shares = res.data
|
||||
const nodeIds = shares.map(share => share.targetId)
|
||||
|
||||
@@ -413,7 +413,7 @@ export default {
|
||||
},
|
||||
{name: 'ck', label: 'ClickHouse', type: 'jdbc', extraParams: ''},
|
||||
{name: 'redshift', label: 'AWS Redshift', type: 'jdbc'},
|
||||
{name: 'mongo', label: 'MongoDB', type: 'jdbc', extraParams: ''},
|
||||
{name: 'mongo', label: 'MongoDB', type: 'jdbc', extraParams: 'rebuildschema=true'},
|
||||
{name: 'db2', label: 'Db2', type: 'jdbc', extraParams: ''},
|
||||
{name: 'api', label: 'API', type: 'api', extraParams: ''}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user