refactor: workspace api
This commit is contained in:
parent
0e339701da
commit
58dde6629b
@ -162,6 +162,7 @@ import { isAppIcon } from '@/utils/common'
|
|||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
|
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
||||||
|
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
|
|
||||||
@ -192,7 +193,7 @@ function filterWorkspaceChange(val: string) {
|
|||||||
}
|
}
|
||||||
async function getWorkspaceList() {
|
async function getWorkspaceList() {
|
||||||
if (user.isEE()) {
|
if (user.isEE()) {
|
||||||
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
|
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
|
||||||
workspaceOptions.value = res.data.map((item: any) => ({
|
workspaceOptions.value = res.data.map((item: any) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
|||||||
@ -151,6 +151,7 @@ import { isAppIcon } from '@/utils/common'
|
|||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
|
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
||||||
|
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ function filterWorkspaceChange(val: string) {
|
|||||||
}
|
}
|
||||||
async function getWorkspaceList() {
|
async function getWorkspaceList() {
|
||||||
if (user.isEE()) {
|
if (user.isEE()) {
|
||||||
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
|
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
|
||||||
workspaceOptions.value = res.data.map((item: any) => ({
|
workspaceOptions.value = res.data.map((item: any) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
|||||||
@ -175,6 +175,7 @@ import { t } from '@/locales'
|
|||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
|
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
||||||
|
|
||||||
const { user, model } = useStore()
|
const { user, model } = useStore()
|
||||||
|
|
||||||
@ -219,7 +220,7 @@ function filterWorkspaceChange(val: string) {
|
|||||||
}
|
}
|
||||||
async function getWorkspaceList() {
|
async function getWorkspaceList() {
|
||||||
if (user.isEE()) {
|
if (user.isEE()) {
|
||||||
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
|
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
|
||||||
workspaceOptions.value = res.data.map((item: any) => ({
|
workspaceOptions.value = res.data.map((item: any) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
|||||||
@ -171,6 +171,7 @@ import { ToolType } from '@/enums/tool'
|
|||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
||||||
import { datetimeFormat } from '@/utils/time'
|
import { datetimeFormat } from '@/utils/time'
|
||||||
|
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
||||||
|
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
|
|
||||||
@ -201,7 +202,7 @@ function filterWorkspaceChange(val: string) {
|
|||||||
}
|
}
|
||||||
async function getWorkspaceList() {
|
async function getWorkspaceList() {
|
||||||
if (user.isEE()) {
|
if (user.isEE()) {
|
||||||
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
|
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
|
||||||
workspaceOptions.value = res.data.map((item: any) => ({
|
workspaceOptions.value = res.data.map((item: any) => ({
|
||||||
label: item.name,
|
label: item.name,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
|||||||
@ -106,6 +106,7 @@ import { hasPermission } from '@/utils/permission/index'
|
|||||||
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
import WorkspaceApi from '@/api/workspace/workspace.ts'
|
||||||
import type { WorkspaceItem } from '@/api/type/workspace'
|
import type { WorkspaceItem } from '@/api/type/workspace'
|
||||||
import { ComplexPermission } from '@/utils/permission/type'
|
import { ComplexPermission } from '@/utils/permission/type'
|
||||||
|
import {loadPermissionApi} from "@/utils/dynamics-api/permission-api.ts";
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
@ -390,7 +391,7 @@ const currentWorkspace = computed(() => {
|
|||||||
return workspaceList.value.find((w) => w.id == currentWorkspaceId.value)
|
return workspaceList.value.find((w) => w.id == currentWorkspaceId.value)
|
||||||
})
|
})
|
||||||
async function getWorkspaceList() {
|
async function getWorkspaceList() {
|
||||||
const res = await WorkspaceApi.getSystemWorkspaceList(loading)
|
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
|
||||||
workspaceList.value = res.data
|
workspaceList.value = res.data
|
||||||
currentWorkspaceId.value = 'default'
|
currentWorkspaceId.value = 'default'
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user