Merge pull request #13392 from dataease/pr@dev-v2_st

feat(系统设置): 系统设置的基础设置中添加页面打开方式选项
This commit is contained in:
xuwei-fit2cloud 2024-11-18 17:55:33 +08:00 committed by GitHub
commit e74aa6ba11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 86 additions and 45 deletions

View File

@ -139,7 +139,8 @@ const previewOuter = () => {
}
canvasSave(() => {
const url = '#/preview?dvId=' + dvInfo.value.id + '&ignoreParams=true'
const newWindow = window.open(url, '_blank')
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const newWindow = window.open(url, openType)
initOpenHandler(newWindow)
})
}

View File

@ -7,6 +7,7 @@ import { downloadCanvas2, imgUrlTrans } from '@/utils/imgUtils'
import ComponentEditBar from '@/components/visualization/ComponentEditBar.vue'
import ComponentSelector from '@/components/visualization/ComponentSelector.vue'
import { useEmitt } from '@/hooks/web/useEmitt'
import { useCache } from '@/hooks/web/useCache'
import Board from '@/components/de-board/Board.vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { activeWatermarkCheckUser, removeActiveWatermark } from '@/components/watermark/watermark'
@ -15,7 +16,7 @@ const componentWrapperInnerRef = ref(null)
const componentEditBarRef = ref(null)
const dvMainStore = dvMainStoreWithOut()
const downLoading = ref(false)
const { wsCache } = useCache('localStorage')
const commonFilterAttrs = ['width', 'height', 'top', 'left', 'rotate']
const commonFilterAttrsFilterBorder = [
'width',
@ -316,9 +317,10 @@ const onWrapperClick = e => {
try {
let newWindow
if ('newPop' === jumpType) {
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
window.open(
url,
'_blank',
openType,
'width=800,height=600,left=200,top=100,toolbar=no,scrollbars=yes,resizable=yes,location=no'
)
} else {

View File

@ -1777,8 +1777,12 @@ const sortSave = list => {
const handleCustomClick = async () => {
if (sortComputed.value || curComponent.value.sort !== 'customSort') return
const list = await enumValueObj({ queryId: curComponent.value.sortId, searchText: '' })
customSortFilterRef.value.sortInit([...new Set(list.map(ele => ele[curComponent.value.sortId]))])
let list = cloneDeep(curComponent.value.sortList || [])
if (!list.length) {
const arr = await enumValueObj({ queryId: curComponent.value.sortId, searchText: '' })
list = arr.map(ele => ele[curComponent.value.sortId])
}
customSortFilterRef.value.sortInit([...new Set(list)])
}
const sortComputed = computed(() => {

View File

@ -65,7 +65,8 @@ const showOverlayCopilot = ref(true)
const handleSelect = (index: string) => {
//
if (isExternal(index)) {
window.open(index, '_blank')
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
window.open(index, openType)
} else {
push(index)
}

View File

@ -3,6 +3,7 @@ import { computed } from 'vue'
import { ElMenu } from 'element-plus-secondary'
import { useRoute, useRouter } from 'vue-router'
import { isExternal } from '@/utils/validate'
import { useCache } from '@/hooks/web/useCache'
import MenuItem from './MenuItem.vue'
import { useAppearanceStoreWithOut } from '@/store/modules/appearance'
const appearanceStore = useAppearanceStoreWithOut()
@ -17,6 +18,7 @@ defineProps({
})
const route = useRoute()
const { wsCache } = useCache('localStorage')
const { push } = useRouter()
const menuList = computed(() => route.matched[0]?.children || [])
const path = computed(() => route.matched[0]?.path)
@ -28,7 +30,8 @@ const activeIndex = computed(() => {
const menuSelect = (index: string, indexPath: string[]) => {
//
if (isExternal(index)) {
window.open(index)
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
window.open(index, openType)
} else {
push(`${path.value}/${indexPath.join('/')}`)
}

View File

@ -1,6 +1,8 @@
<script lang="ts" setup>
import { toRefs } from 'vue'
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache('localStorage')
const props = defineProps({
cardInfo: {
type: Object,
@ -17,7 +19,8 @@ const { cardInfo } = toRefs(props)
const openBlank = () => {
if (cardInfo.value.url) {
window.open(cardInfo.value.url)
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
window.open(cardInfo.value.url, openType)
}
}
</script>

View File

@ -121,6 +121,7 @@ const setupAll = async (
const defaultSort = await getDefaultSort.getDefaultSettings()
const { wsCache } = useCache()
wsCache.set('TreeSort-backend', defaultSort['basic.defaultSort'] ?? '1')
wsCache.set('open-backend', defaultSort['basic.defaultOpen'] ?? '0')
app.mount(dom)
return app
}

View File

@ -61,6 +61,7 @@ router.beforeEach(async (to, from, next) => {
await appearanceStore.setFontList()
const defaultSort = await getDefaultSettings()
wsCache.set('TreeSort-backend', defaultSort['basic.defaultSort'] ?? '1')
wsCache.set('open-backend', defaultSort['basic.defaultOpen'] ?? '0')
if ((wsCache.get('user.token') || isDesktop) && !to.path.startsWith('/de-link/')) {
if (!userStore.getUid) {
await userStore.setUser()

View File

@ -15,7 +15,10 @@ import {
import { ElMessage, ElMessageBox, Action } from 'element-plus-secondary'
import { useI18n } from '@/hooks/web/useI18n'
import { useEmitt } from '@/hooks/web/useEmitt'
import { useCache } from '@/hooks/web/useCache'
const dialogVisible = ref(false)
const { wsCache } = useCache('localStorage')
const { t } = useI18n()
const userStore = useUserStoreWithOut()
const license: F2CLicense = reactive({
@ -59,7 +62,8 @@ const beforeUpload = file => {
const support = () => {
const url = 'https://support.fit2cloud.com/'
window.open(url, '_blank')
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
window.open(url, openType)
}
const getLicenseInfo = () => {

View File

@ -71,6 +71,9 @@ import {
iconFieldCalculatedMap,
iconFieldCalculatedQMap
} from '@/components/icon-group/field-calculated-list'
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache('localStorage')
const embeddedStore = useEmbedded()
const snapshotStore = snapshotStoreWithOut()
const dvMainStore = dvMainStoreWithOut()
@ -1399,7 +1402,8 @@ const addDsWindow = () => {
const path =
embeddedStore.getToken && appStore.getIsIframe ? 'dataset-embedded-form' : '/dataset-form'
let routeData = router.resolve(path)
const newWindow = window.open(routeData.href, '_blank')
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const newWindow = window.open(routeData.href, openType)
initOpenHandler(newWindow)
}
const editDs = () => {
@ -1411,7 +1415,8 @@ const editDs = () => {
id: view.value.tableId
}
})
const newWindow = window.open(routeData.href, '_blank')
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const newWindow = window.open(routeData.href, openType)
initOpenHandler(newWindow)
}

View File

@ -410,9 +410,10 @@ const windowsJump = (url, jumpType, size = 'middle') => {
const width = screen.width * sizeX
const left = screen.width * ((1 - sizeX) / 2)
const top = screen.height * ((1 - sizeY) / 2)
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
newWindow = window.open(
url,
'_blank',
openType,
`width=${width},height=${height},left=${left},top=${top},toolbar=no,scrollbars=yes,resizable=yes,location=no`
)
} else if ('_self' === jumpType) {

View File

@ -148,6 +148,9 @@ import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import { deepCopy } from '@/utils/utils'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache('localStorage')
const { t } = useI18n()
const emits = defineEmits(['closeDraw', 'saveAppCanvas'])
const appSaveForm = ref(null)
@ -182,8 +185,9 @@ const dvPreName = computed(() =>
)
const addDsWindow = () => {
// do addDsWindow
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const url = '#/data/datasource?opt=create'
window.open(url, '_blank')
window.open(url, openType)
}
const state = reactive({

View File

@ -3,6 +3,7 @@ import dvFolder from '@/assets/svg/dv-folder.svg'
import icon_searchOutline_outlined from '@/assets/svg/icon_search-outline_outlined.svg'
import { ref, reactive, computed, watch, toRefs, nextTick } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { useCache } from '@/hooks/web/useCache'
import nothingTree from '@/assets/img/nothing-tree.png'
import { BusiTreeNode } from '@/models/tree/TreeNode'
import {
@ -24,7 +25,7 @@ const props = defineProps({
})
const { curCanvasType } = toRefs(props)
const { wsCache } = useCache('localStorage')
const { t } = useI18n()
const state = reactive({
@ -286,11 +287,12 @@ const saveResource = () => {
emits('finish')
ElMessage.success('保存成功')
if (cmd.value === 'copy') {
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const baseUrl =
curCanvasType.value === 'dataV'
? '#/dvCanvas?opt=copy&dvId='
: '#/dashboard?opt=copy&resourceId='
window.open(baseUrl + data.data, '_blank')
window.open(baseUrl + data.data, openType)
}
})
.finally(() => {

View File

@ -281,7 +281,7 @@ const afterTreeInit = () => {
}
const copyLoading = ref(false)
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const emit = defineEmits(['nodeClick'])
const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
@ -337,7 +337,7 @@ const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
)
return
}
const newWindow = window.open(baseUrl, '_blank')
const newWindow = window.open(baseUrl, openType)
initOpenHandler(newWindow)
})
.finally(() => {
@ -372,9 +372,9 @@ const addOperation = (
return
}
if (data?.id) {
newWindow = window.open(baseUrl + `&pid=${data.id}`, '_blank')
newWindow = window.open(baseUrl + `&pid=${data.id}`, openType)
} else {
newWindow = window.open(baseUrl, '_blank')
newWindow = window.open(baseUrl, openType)
}
initOpenHandler(newWindow)
} else if (cmd === 'newFromTemplate') {
@ -409,7 +409,7 @@ const resourceEdit = resourceId => {
return
}
const newWindow = window.open(baseUrl + resourceId, '_blank')
const newWindow = window.open(baseUrl + resourceId, openType)
initOpenHandler(newWindow)
}
@ -440,9 +440,9 @@ const resourceCreateFinish = templateData => {
}
if (state.templateCreatePid) {
newWindow = window.open(baseUrl + `&pid=${state.templateCreatePid}`, '_blank')
newWindow = window.open(baseUrl + `&pid=${state.templateCreatePid}`, openType)
} else {
newWindow = window.open(baseUrl, '_blank')
newWindow = window.open(baseUrl, openType)
}
initOpenHandler(newWindow)
}

View File

@ -19,20 +19,22 @@ import { XpackComponent } from '@/components/plugin'
import { useEmitt } from '@/hooks/web/useEmitt'
import { useShareStoreWithOut } from '@/store/modules/share'
import { exportPermission } from '@/utils/utils'
const shareStore = useShareStoreWithOut()
import { useCache } from '@/hooks/web/useCache'
const shareStore = useShareStoreWithOut()
const { wsCache } = useCache('localStorage')
const dvMainStore = dvMainStoreWithOut()
const appStore = useAppStoreWithOut()
const { dvInfo } = storeToRefs(dvMainStore)
const emit = defineEmits(['reload', 'download', 'downloadAsAppTemplate'])
const { t } = useI18n()
const embeddedStore = useEmbedded()
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const favorited = ref(false)
const preview = () => {
const baseUrl = isDataEaseBi.value ? embeddedStore.baseUrl : ''
const url = baseUrl + '#/preview?dvId=' + dvInfo.value.id + '&ignoreParams=true'
const newWindow = window.open(url, '_blank')
const newWindow = window.open(url, openType)
initOpenHandler(newWindow)
}
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
@ -67,7 +69,7 @@ const dvEdit = () => {
return
}
const baseUrl = dvInfo.value.type === 'dataV' ? '#/dvCanvas?dvId=' : '#/dashboard?resourceId='
const newWindow = window.open(baseUrl + dvInfo.value.id, '_blank')
const newWindow = window.open(baseUrl + dvInfo.value.id, openType)
initOpenHandler(newWindow)
}

View File

@ -14,10 +14,13 @@ import dayjs from 'dayjs'
import { propTypes } from '@/utils/propTypes'
import ShareHandler from './ShareHandler.vue'
import { interactiveStoreWithOut } from '@/store/modules/interactive'
import { useCache } from '@/hooks/web/useCache'
const props = defineProps({
activeName: propTypes.string.def('')
})
const { wsCache } = useCache('localStorage')
const { t } = useI18n()
const interactiveStore = interactiveStoreWithOut()
@ -44,7 +47,8 @@ const triggerFilterPanel = () => {
}
const preview = id => {
const routeUrl = `/#/preview?dvId=${id}`
window.open(routeUrl, '_blank')
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
window.open(routeUrl, openType)
}
const formatterTime = (_, _column, cellValue) => {
if (!cellValue) {

View File

@ -495,10 +495,11 @@ const apply = template => {
)
return
}
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
if (state.pid) {
newWindow = window.open(baseUrl + `&pid=${state.pid}`, '_blank')
newWindow = window.open(baseUrl + `&pid=${state.pid}`, openType)
} else {
newWindow = window.open(baseUrl, '_blank')
newWindow = window.open(baseUrl, openType)
}
initOpenHandler(newWindow)
}

View File

@ -60,6 +60,7 @@ const handleClose = () => {
clearInterval(timer)
}
const { wsCache } = useCache()
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const xpack = wsCache.get('xpack-model-distributed')
onUnmounted(() => {
@ -242,12 +243,12 @@ const callbackExportSuc = () => {
const downLoadAll = () => {
if (multipleSelection.value.length === 0) {
tableData.value.forEach(item => {
window.open(PATH_URL + '/exportCenter/download/' + item.id)
window.open(PATH_URL + '/exportCenter/download/' + item.id, openType)
})
return
}
multipleSelection.value.map(ele => {
window.open(PATH_URL + '/exportCenter/download/' + ele.id)
window.open(PATH_URL + '/exportCenter/download/' + ele.id, openType)
})
}
const showMsg = item => {
@ -263,7 +264,7 @@ const timestampFormatDate = value => {
}
import { PATH_URL } from '@/config/axios/service'
const downloadClick = item => {
window.open(PATH_URL + '/exportCenter/download/' + item.id)
window.open(PATH_URL + '/exportCenter/download/' + item.id, openType)
}
const retry = item => {

View File

@ -219,7 +219,6 @@ const handleChange = () => {
box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.1);
border-right: none;
&:nth-child(2) {
margin-top: 20px;
> div {
height: 210px;
}

View File

@ -140,13 +140,13 @@ const state = reactive({
const resourceGroupOpt = ref()
const curCanvasType = ref('')
const mounted = ref(false)
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
const isIframe = computed(() => appStore.getIsIframe)
const exportPermissions = computed(() => exportPermission(nodeInfo.weight, nodeInfo.ext))
const createPanel = path => {
const baseUrl = `#/${path}?opt=create&id=${nodeInfo.id}`
window.open(baseUrl, '_blank')
window.open(baseUrl, openType)
}
const resourceOptFinish = param => {
@ -187,7 +187,7 @@ const resourceCreate = (pid, name) => {
}
save(canvasInfo).then(() => {
const baseUrl = curCanvasType.value === 'dataV' ? '#/dvCanvas?dvId=' : '#/dashboard?resourceId='
window.open(baseUrl + newResourceId, '_blank')
window.open(baseUrl + newResourceId, openType)
})
}

View File

@ -97,12 +97,13 @@ const getBusiListWithPermission = () => {
const triggerFilterPanel = () => {
loadTableData()
}
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const preview = id => {
const routeUrl = resolve({
path: '/preview',
query: { dvId: id }
})
window.open(routeUrl.href, '_blank')
window.open(routeUrl.href, openType)
}
const openDataset = id => {
@ -110,7 +111,7 @@ const openDataset = id => {
path: '/dataset-form',
query: { id: id }
})
window.open(routeUrl.href, '_blank')
window.open(routeUrl.href, openType)
}
const formatterTime = (_, _column, cellValue) => {
return dayjs(new Date(cellValue)).format('YYYY-MM-DD HH:mm:ss')

View File

@ -40,7 +40,7 @@ const router = useRouter()
const resourceCreateOpt = ref(null)
const embeddedStore = useEmbedded()
const appStore = useAppStoreWithOut()
const openType = wsCache.get('open-backend') === '0' ? '_self' : '_blank'
const quickCreationList = shallowRef([
{
icon: icon_dashboard_outlined,
@ -192,24 +192,25 @@ const quickCreate = (flag: number, hasAuth: boolean) => {
break
}
}
const createPanel = () => {
const baseUrl = '#/dashboard?opt=create'
window.open(baseUrl, '_blank')
window.open(baseUrl, openType)
}
const createScreen = () => {
const baseUrl = '#/dvCanvas?opt=create'
window.open(baseUrl, '_blank')
window.open(baseUrl, openType)
}
const createDataset = () => {
let routeData = router.resolve({
path: '/dataset-form'
})
window.open(routeData.href, '_blank')
window.open(routeData.href, openType)
}
const createDatasource = () => {
const baseUrl = '#/data/datasource?opt=create'
window.open(baseUrl, '_blank')
window.open(baseUrl, openType)
}
const templatePreview = previewId => {
@ -255,9 +256,9 @@ const apply = () => {
embeddedBaseUrl = embeddedStore.baseUrl
}
if (state.pid) {
newWindow = window.open(embeddedBaseUrl + baseUrl + `&pid=${state.pid}`, '_blank')
newWindow = window.open(embeddedBaseUrl + baseUrl + `&pid=${state.pid}`, openType)
} else {
newWindow = window.open(embeddedBaseUrl + baseUrl, '_blank')
newWindow = window.open(embeddedBaseUrl + baseUrl, openType)
}
initOpenHandler(newWindow)
}