Merge pull request #11253 from dataease/pr@dev-v2@refactor_auth

Pr@dev v2@refactor auth
This commit is contained in:
王嘉豪 2024-07-30 11:55:59 +08:00 committed by GitHub
commit 5b11b3ea12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 70 additions and 4 deletions

View File

@ -31,6 +31,7 @@ import DbMoreComGroup from '@/custom-component/component-group/DbMoreComGroup.vu
import { useCache } from '@/hooks/web/useCache'
import DeFullscreen from '@/components/visualization/common/DeFullscreen.vue'
import DeAppApply from '@/views/common/DeAppApply.vue'
import {useUserStoreWithOut} from "@/store/modules/user";
const { t } = useI18n()
const dvMainStore = dvMainStoreWithOut()
const snapshotStore = snapshotStoreWithOut()
@ -62,6 +63,7 @@ const state = reactive({
const resourceGroupOpt = ref(null)
const outerParamsSetRef = ref(null)
const { wsCache } = useCache('localStorage')
const userStore = useUserStoreWithOut()
const props = defineProps({
createType: {
@ -155,6 +157,19 @@ const resourceOptFinish = param => {
}
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 (appData.value) {
//

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus-secondary'
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 { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
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 DeAppApply from '@/views/common/DeAppApply.vue'
import { useEmitt } from '@/hooks/web/useEmitt'
import { useUserStoreWithOut } from '@/store/modules/user'
let nameEdit = ref(false)
let inputName = ref('')
let nameInput = ref(null)
@ -43,6 +44,7 @@ const { wsCache } = useCache('localStorage')
const dvModel = 'dataV'
const outerParamsSetRef = ref(null)
const fullScreeRef = ref(null)
const userStore = useUserStoreWithOut()
const props = defineProps({
createType: {
@ -103,6 +105,19 @@ const resourceOptFinish = param => {
}
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 (appData.value) {
//

View File

@ -349,6 +349,15 @@ const editCursor = () => {
if (myDiv.focus) {
myDiv.focus()
}
tinymce.init({
selector: tinymceId,
plugins: 'table',
setup: function (editor) {
editor.on('init', function () {
console.log('====init====')
})
}
})
}, 100)
}

View File

@ -8,6 +8,11 @@ import _ from 'lodash'
import { getDatasetTree, getDatasourceList } from '@/api/dataset'
import { ElFormItem, FormInstance } from 'element-plus-secondary'
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(
defineProps<{
@ -28,6 +33,8 @@ const datasetSelector = ref(null)
const loadingDatasetTree = ref(false)
const orgCheck = ref(true)
const datasetTree = ref<Tree[]>([])
const toolTip = computed(() => {
return props.themes === 'dark' ? 'ndark' : 'dark'
@ -82,11 +89,17 @@ watch(searchStr, val => {
})
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(() => {
return !showTree.value && !loadingDatasetTree.value
return !showTree.value && !loadingDatasetTree.value && !orgCheck.value
})
const computedTree = computed(() => {
@ -187,6 +200,18 @@ function onPopoverHide() {
function getNode(nodeId: number) {
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 })
const appStore = useAppStoreWithOut()
@ -223,6 +248,7 @@ onMounted(() => {
v-model="selectedNodeName"
readonly
class="data-set-dark"
@focus="handleFocus"
:placeholder="'请选择' + sourceName"
>
<template #suffix>
@ -255,7 +281,7 @@ onMounted(() => {
<el-main :class="{ dark: themes === 'dark' }">
<el-scrollbar max-height="252px" always>
<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>-->
<el-tree
:class="{ dark: themes === 'dark' }"
@ -426,6 +452,7 @@ onMounted(() => {
font-style: normal;
font-weight: 400;
line-height: 20px;
text-align: center;
}
.m-loading {