forked from github/dataease
Merge pull request #11253 from dataease/pr@dev-v2@refactor_auth
Pr@dev v2@refactor auth
This commit is contained in:
commit
5b11b3ea12
@ -31,6 +31,7 @@ import DbMoreComGroup from '@/custom-component/component-group/DbMoreComGroup.vu
|
|||||||
import { useCache } from '@/hooks/web/useCache'
|
import { useCache } from '@/hooks/web/useCache'
|
||||||
import DeFullscreen from '@/components/visualization/common/DeFullscreen.vue'
|
import DeFullscreen from '@/components/visualization/common/DeFullscreen.vue'
|
||||||
import DeAppApply from '@/views/common/DeAppApply.vue'
|
import DeAppApply from '@/views/common/DeAppApply.vue'
|
||||||
|
import {useUserStoreWithOut} from "@/store/modules/user";
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const dvMainStore = dvMainStoreWithOut()
|
const dvMainStore = dvMainStoreWithOut()
|
||||||
const snapshotStore = snapshotStoreWithOut()
|
const snapshotStore = snapshotStoreWithOut()
|
||||||
@ -62,6 +63,7 @@ const state = reactive({
|
|||||||
const resourceGroupOpt = ref(null)
|
const resourceGroupOpt = ref(null)
|
||||||
const outerParamsSetRef = ref(null)
|
const outerParamsSetRef = ref(null)
|
||||||
const { wsCache } = useCache('localStorage')
|
const { wsCache } = useCache('localStorage')
|
||||||
|
const userStore = useUserStoreWithOut()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
createType: {
|
createType: {
|
||||||
@ -155,6 +157,19 @@ const resourceOptFinish = param => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const saveCanvasWithCheck = () => {
|
const saveCanvasWithCheck = () => {
|
||||||
|
if (userStore.getOid && wsCache.get('user.oid') && userStore.getOid !== wsCache.get('user.oid')) {
|
||||||
|
ElMessageBox.confirm('已切换至新组织,无权保存其他组织的资源', {
|
||||||
|
confirmButtonType: 'primary',
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: '关闭页面',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
autofocus: false,
|
||||||
|
showClose: false
|
||||||
|
}).then(() => {
|
||||||
|
window.close()
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
if (dvInfo.value.dataState === 'prepare') {
|
if (dvInfo.value.dataState === 'prepare') {
|
||||||
if (appData.value) {
|
if (appData.value) {
|
||||||
// 应用保存
|
// 应用保存
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
|
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
|
||||||
import eventBus from '@/utils/eventBus'
|
import eventBus from '@/utils/eventBus'
|
||||||
import { ref, nextTick, computed, toRefs } from 'vue'
|
import { ref, nextTick, computed, toRefs, onMounted } from 'vue'
|
||||||
import { useEmbedded } from '@/store/modules/embedded'
|
import { useEmbedded } from '@/store/modules/embedded'
|
||||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||||
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
|
||||||
@ -27,6 +27,7 @@ import ComponentButtonLabel from '@/components/visualization/ComponentButtonLabe
|
|||||||
import DeFullscreen from '@/components/visualization/common/DeFullscreen.vue'
|
import DeFullscreen from '@/components/visualization/common/DeFullscreen.vue'
|
||||||
import DeAppApply from '@/views/common/DeAppApply.vue'
|
import DeAppApply from '@/views/common/DeAppApply.vue'
|
||||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||||
|
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||||
let nameEdit = ref(false)
|
let nameEdit = ref(false)
|
||||||
let inputName = ref('')
|
let inputName = ref('')
|
||||||
let nameInput = ref(null)
|
let nameInput = ref(null)
|
||||||
@ -43,6 +44,7 @@ const { wsCache } = useCache('localStorage')
|
|||||||
const dvModel = 'dataV'
|
const dvModel = 'dataV'
|
||||||
const outerParamsSetRef = ref(null)
|
const outerParamsSetRef = ref(null)
|
||||||
const fullScreeRef = ref(null)
|
const fullScreeRef = ref(null)
|
||||||
|
const userStore = useUserStoreWithOut()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
createType: {
|
createType: {
|
||||||
@ -103,6 +105,19 @@ const resourceOptFinish = param => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const saveCanvasWithCheck = () => {
|
const saveCanvasWithCheck = () => {
|
||||||
|
if (userStore.getOid && wsCache.get('user.oid') && userStore.getOid !== wsCache.get('user.oid')) {
|
||||||
|
ElMessageBox.confirm('已切换至新组织,无权保存其他组织的资源', {
|
||||||
|
confirmButtonType: 'primary',
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: '关闭页面',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
autofocus: false,
|
||||||
|
showClose: false
|
||||||
|
}).then(() => {
|
||||||
|
window.close()
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
if (dvInfo.value.dataState === 'prepare') {
|
if (dvInfo.value.dataState === 'prepare') {
|
||||||
if (appData.value) {
|
if (appData.value) {
|
||||||
// 应用保存
|
// 应用保存
|
||||||
|
@ -349,6 +349,15 @@ const editCursor = () => {
|
|||||||
if (myDiv.focus) {
|
if (myDiv.focus) {
|
||||||
myDiv.focus()
|
myDiv.focus()
|
||||||
}
|
}
|
||||||
|
tinymce.init({
|
||||||
|
selector: tinymceId,
|
||||||
|
plugins: 'table',
|
||||||
|
setup: function (editor) {
|
||||||
|
editor.on('init', function () {
|
||||||
|
console.log('====init====')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,11 @@ import _ from 'lodash'
|
|||||||
import { getDatasetTree, getDatasourceList } from '@/api/dataset'
|
import { getDatasetTree, getDatasourceList } from '@/api/dataset'
|
||||||
import { ElFormItem, FormInstance } from 'element-plus-secondary'
|
import { ElFormItem, FormInstance } from 'element-plus-secondary'
|
||||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||||
|
import { useCache } from '@/hooks/web/useCache'
|
||||||
|
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||||
|
|
||||||
|
const { wsCache } = useCache('localStorage')
|
||||||
|
const userStore = useUserStoreWithOut()
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
@ -28,6 +33,8 @@ const datasetSelector = ref(null)
|
|||||||
|
|
||||||
const loadingDatasetTree = ref(false)
|
const loadingDatasetTree = ref(false)
|
||||||
|
|
||||||
|
const orgCheck = ref(true)
|
||||||
|
|
||||||
const datasetTree = ref<Tree[]>([])
|
const datasetTree = ref<Tree[]>([])
|
||||||
const toolTip = computed(() => {
|
const toolTip = computed(() => {
|
||||||
return props.themes === 'dark' ? 'ndark' : 'dark'
|
return props.themes === 'dark' ? 'ndark' : 'dark'
|
||||||
@ -82,11 +89,17 @@ watch(searchStr, val => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const showTree = computed(() => {
|
const showTree = computed(() => {
|
||||||
return datasetTree.value && datasetTree.value.length > 0 && !loadingDatasetTree.value
|
return (
|
||||||
|
datasetTree.value && datasetTree.value.length > 0 && !loadingDatasetTree.value && orgCheck.value
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
const emptyMsg = computed(() => {
|
||||||
|
return orgCheck.value ? '暂无' + sourceName.value : '已切换至新组织,无权访问其他组织的资源'
|
||||||
})
|
})
|
||||||
|
|
||||||
const showEmptyInfo = computed(() => {
|
const showEmptyInfo = computed(() => {
|
||||||
return !showTree.value && !loadingDatasetTree.value
|
return !showTree.value && !loadingDatasetTree.value && !orgCheck.value
|
||||||
})
|
})
|
||||||
|
|
||||||
const computedTree = computed(() => {
|
const computedTree = computed(() => {
|
||||||
@ -187,6 +200,18 @@ function onPopoverHide() {
|
|||||||
function getNode(nodeId: number) {
|
function getNode(nodeId: number) {
|
||||||
return datasetSelector?.value?.getNode(nodeId)
|
return datasetSelector?.value?.getNode(nodeId)
|
||||||
}
|
}
|
||||||
|
const handleFocus = () => {
|
||||||
|
if (
|
||||||
|
props.sourceType === 'dataset' &&
|
||||||
|
userStore.getOid &&
|
||||||
|
wsCache.get('user.oid') &&
|
||||||
|
userStore.getOid !== wsCache.get('user.oid')
|
||||||
|
) {
|
||||||
|
orgCheck.value = false
|
||||||
|
} else {
|
||||||
|
orgCheck.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({ getNode })
|
defineExpose({ getNode })
|
||||||
const appStore = useAppStoreWithOut()
|
const appStore = useAppStoreWithOut()
|
||||||
@ -223,6 +248,7 @@ onMounted(() => {
|
|||||||
v-model="selectedNodeName"
|
v-model="selectedNodeName"
|
||||||
readonly
|
readonly
|
||||||
class="data-set-dark"
|
class="data-set-dark"
|
||||||
|
@focus="handleFocus"
|
||||||
:placeholder="'请选择' + sourceName"
|
:placeholder="'请选择' + sourceName"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
@ -255,7 +281,7 @@ onMounted(() => {
|
|||||||
<el-main :class="{ dark: themes === 'dark' }">
|
<el-main :class="{ dark: themes === 'dark' }">
|
||||||
<el-scrollbar max-height="252px" always>
|
<el-scrollbar max-height="252px" always>
|
||||||
<div class="m-loading" v-if="loadingDatasetTree" v-loading="loadingDatasetTree"></div>
|
<div class="m-loading" v-if="loadingDatasetTree" v-loading="loadingDatasetTree"></div>
|
||||||
<div class="empty-info" v-if="showEmptyInfo">暂无{{ sourceName }}</div>
|
<div class="empty-info" v-if="showEmptyInfo">{{ emptyMsg }}</div>
|
||||||
<!-- <div class="empty-info" v-if="showEmptySearchInfo">暂无相关数据</div>-->
|
<!-- <div class="empty-info" v-if="showEmptySearchInfo">暂无相关数据</div>-->
|
||||||
<el-tree
|
<el-tree
|
||||||
:class="{ dark: themes === 'dark' }"
|
:class="{ dark: themes === 'dark' }"
|
||||||
@ -426,6 +452,7 @@ onMounted(() => {
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m-loading {
|
.m-loading {
|
||||||
|
Loading…
Reference in New Issue
Block a user