feat: tool
This commit is contained in:
parent
77295d2c13
commit
bb0ad0a27b
@ -39,20 +39,34 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, computed, watch} from 'vue'
|
import { ref, computed, watch } from 'vue'
|
||||||
import {Codemirror} from 'vue-codemirror'
|
import { useRoute } from 'vue-router'
|
||||||
import {python} from '@codemirror/lang-python'
|
import { Codemirror } from 'vue-codemirror'
|
||||||
import {oneDark} from '@codemirror/theme-one-dark'
|
import { python } from '@codemirror/lang-python'
|
||||||
import {linter, type Diagnostic} from '@codemirror/lint'
|
import { oneDark } from '@codemirror/theme-one-dark'
|
||||||
import ToolApi from '@/api/system-shared/tool'
|
import { linter, type Diagnostic } from '@codemirror/lint'
|
||||||
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
|
|
||||||
defineOptions({name: 'CodemirrorEditor'})
|
defineOptions({ name: 'CodemirrorEditor' })
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
title: string
|
title: string
|
||||||
modelValue: any
|
modelValue: any
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits(['update:modelValue', 'submitDialog'])
|
const emit = defineEmits(['update:modelValue', 'submitDialog'])
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const type = computed(() => {
|
||||||
|
if (route.path.includes('shared')) {
|
||||||
|
return 'systemShare'
|
||||||
|
} else if (route.path.includes('resource-management')) {
|
||||||
|
return 'systemManage'
|
||||||
|
} else {
|
||||||
|
return 'workspace'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const data = computed({
|
const data = computed({
|
||||||
set: (value) => {
|
set: (value) => {
|
||||||
emit('update:modelValue', value)
|
emit('update:modelValue', value)
|
||||||
@ -74,23 +88,25 @@ function getRangeFromLineAndColumn(state: any, line: number, column: number, end
|
|||||||
|
|
||||||
const regexpLinter = linter(async (view) => {
|
const regexpLinter = linter(async (view) => {
|
||||||
const diagnostics: Diagnostic[] = []
|
const diagnostics: Diagnostic[] = []
|
||||||
await ToolApi.postPylint(view.state.doc.toString()).then((ok) => {
|
await loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
ok.data.forEach((element: any) => {
|
.postPylint(view.state.doc.toString())
|
||||||
const range = getRangeFromLineAndColumn(
|
.then((ok: any) => {
|
||||||
view.state,
|
ok.data.forEach((element: any) => {
|
||||||
element.line,
|
const range = getRangeFromLineAndColumn(
|
||||||
element.column,
|
view.state,
|
||||||
element.endColumn,
|
element.line,
|
||||||
)
|
element.column,
|
||||||
|
element.endColumn,
|
||||||
|
)
|
||||||
|
|
||||||
diagnostics.push({
|
diagnostics.push({
|
||||||
from: range.form,
|
from: range.form,
|
||||||
to: range.to,
|
to: range.to,
|
||||||
severity: element.type,
|
severity: element.type,
|
||||||
message: element.message,
|
message: element.message,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
return diagnostics
|
return diagnostics
|
||||||
})
|
})
|
||||||
const extensions = [python(), regexpLinter, oneDark]
|
const extensions = [python(), regexpLinter, oneDark]
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
<div class="flex-between w-full" @mouseenter.stop="handleMouseEnter(data)">
|
<div class="flex-between w-full" @mouseenter.stop="handleMouseEnter(data)">
|
||||||
<div class="flex align-center">
|
<div class="flex align-center">
|
||||||
<AppIcon iconName="app-folder" style="font-size: 16px"></AppIcon>
|
<AppIcon iconName="app-folder" style="font-size: 16px"></AppIcon>
|
||||||
<span class="ml-8">{{ node.label }}</span>
|
<span class="ml-8 ellipsis" style="max-width:110px" :label="node.label">{{ node.label }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@ -109,7 +109,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
shareTitle: {
|
shareTitle: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'views.system.shared.shared_knowledge',
|
default: '',
|
||||||
},
|
},
|
||||||
canOperation: {
|
canOperation: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
|||||||
@ -11,11 +11,12 @@
|
|||||||
<slot name="search"> </slot>
|
<slot name="search"> </slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-scrollbar>
|
|
||||||
<div class="content-container__main p-16">
|
<div class="content-container__main">
|
||||||
|
<el-scrollbar class="p-16" style="padding-right: 0;">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</el-scrollbar>
|
||||||
</el-scrollbar>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<TopMenu></TopMenu>
|
<TopMenu></TopMenu>
|
||||||
<TopAbout></TopAbout>
|
<TopAbout class="mt-4 mr-12"></TopAbout>
|
||||||
</div>
|
</div>
|
||||||
<Avatar></Avatar>
|
<Avatar></Avatar>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -115,7 +115,7 @@ export default {
|
|||||||
shared_resources: '共享资源',
|
shared_resources: '共享资源',
|
||||||
shared_tool: '共享工具',
|
shared_tool: '共享工具',
|
||||||
shared_model: '共享模型',
|
shared_model: '共享模型',
|
||||||
shared_knowledge: '共享知识',
|
shared_knowledge: '共享知识库',
|
||||||
authorized_workspace: '授权工作区',
|
authorized_workspace: '授权工作区',
|
||||||
},
|
},
|
||||||
resource_management: {
|
resource_management: {
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
const DocumentRouter = {
|
|
||||||
path: '/knowledge/system/:id/',
|
|
||||||
name: 'KnowledgeDetailSharedSystem',
|
|
||||||
meta: { title: 'common.fileUpload.document', activeMenu: '/knowledge', breadcrumb: true },
|
|
||||||
component: () => import('@/layout/layout-template/MainLayout.vue'),
|
|
||||||
hidden: true,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'documentShared',
|
|
||||||
name: 'DocumentSharedSystem',
|
|
||||||
meta: {
|
|
||||||
icon: 'app-document',
|
|
||||||
iconActive: 'app-document-active',
|
|
||||||
title: 'common.fileUpload.document',
|
|
||||||
active: 'documentShared',
|
|
||||||
parentPath: '/knowledge/system/:id/',
|
|
||||||
parentName: 'KnowledgeDetailSharedSystem',
|
|
||||||
},
|
|
||||||
component: () => import('@/views/shared/document-shared/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'problemShared',
|
|
||||||
name: 'ProblemSharedSystem',
|
|
||||||
meta: {
|
|
||||||
icon: 'app-problems',
|
|
||||||
iconActive: 'QuestionFilled',
|
|
||||||
title: 'views.problem.title',
|
|
||||||
active: 'problemShared',
|
|
||||||
parentPath: '/knowledge/system/:id/',
|
|
||||||
parentName: 'KnowledgeDetailSharedSystem',
|
|
||||||
},
|
|
||||||
component: () => import('@/views/shared/problem-shared/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'hit-test-shared',
|
|
||||||
name: 'KnowledgeHitTestSharedSystem',
|
|
||||||
meta: {
|
|
||||||
icon: 'app-hit-test',
|
|
||||||
title: 'views.application.hitTest.title',
|
|
||||||
active: 'hit-test-shared',
|
|
||||||
parentPath: '/knowledge/system/:id/',
|
|
||||||
parentName: 'KnowledgeDetailSharedSystem',
|
|
||||||
},
|
|
||||||
component: () => import('@/views/shared/hit-test-shared/index.vue'),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'settingShared',
|
|
||||||
name: 'settingSharedSystem',
|
|
||||||
meta: {
|
|
||||||
icon: 'app-setting',
|
|
||||||
iconActive: 'app-setting-active',
|
|
||||||
title: 'common.setting',
|
|
||||||
active: 'settingShared',
|
|
||||||
parentPath: '/knowledge/system/:id/',
|
|
||||||
parentName: 'KnowledgeDetailSharedSystem',
|
|
||||||
},
|
|
||||||
component: () => import('@/views/shared/knowledge-shared/KnowledgeSetting.vue'),
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export default DocumentRouter
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
const ModelRouter = {
|
|
||||||
path: '/knowledge/system',
|
|
||||||
name: 'knowledgeSharedSystem',
|
|
||||||
meta: { title: 'views.knowledge.title', permission: 'KNOWLEDGE:READ' },
|
|
||||||
hidden: true,
|
|
||||||
redirect: '/knowledge',
|
|
||||||
component: () => import('@/layout/layout-template/SimpleLayout.vue'),
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/knowledge/system/document/upload/shared',
|
|
||||||
name: 'UploadDocumentSharedSystem',
|
|
||||||
meta: { activeMenu: '/knowledge/system' },
|
|
||||||
component: () => import('@/views/shared/document-shared/UploadDocument.vue'),
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/knowledge/system/import/shared',
|
|
||||||
name: 'ImportLarkDocumentShared',
|
|
||||||
meta: { activeMenu: '/knowledge' },
|
|
||||||
component: () => import('@/views/shared/document-shared/ImportLarkDocument.vue'),
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ModelRouter
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
const ParagraphRouter = {
|
|
||||||
path: '/paragraph/system/:id/:documentId/shared',
|
|
||||||
name: 'ParagraphSharedSystem',
|
|
||||||
meta: { title: 'common.fileUpload.document', activeMenu: '/knowledge', breadcrumb: true },
|
|
||||||
component: () => import('@/layout/layout-template/SimpleLayout.vue'),
|
|
||||||
hidden: true,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '/paragraph/system/:id/:documentId/shared',
|
|
||||||
name: 'ParagraphIndexSharedSystem',
|
|
||||||
meta: { activeMenu: '/knowledge' },
|
|
||||||
component: () => import('@/views/shared/paragraph-shared/index.vue'),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ParagraphRouter
|
|
||||||
@ -157,7 +157,7 @@ const systemRouter = {
|
|||||||
parentPath: '/system',
|
parentPath: '/system',
|
||||||
parentName: 'system',
|
parentName: 'system',
|
||||||
},
|
},
|
||||||
component: () => import('@/views/shared/model-shared/index.vue'),
|
component: () => import('@/views/system-shared/ModelSharedIndex.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
import { defineStore } from 'pinia'
|
|
||||||
import { DeviceType, ValidType } from '@/enums/common'
|
|
||||||
// import type { Ref } from 'vue'
|
|
||||||
// import userApi from '@/api/user/user'
|
|
||||||
|
|
||||||
export interface commonTypes {
|
|
||||||
breadcrumb: any
|
|
||||||
paginationConfig: any | null
|
|
||||||
search: any
|
|
||||||
device: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const useCommonStore = defineStore('commo',{
|
|
||||||
state: (): commonTypes => ({
|
|
||||||
breadcrumb: null,
|
|
||||||
// 搜索和分页缓存
|
|
||||||
paginationConfig: {},
|
|
||||||
search: {},
|
|
||||||
device: DeviceType.Desktop
|
|
||||||
}),
|
|
||||||
actions: {
|
|
||||||
saveBreadcrumb(data: any) {
|
|
||||||
this.breadcrumb = data
|
|
||||||
},
|
|
||||||
savePage(val: string, data: any) {
|
|
||||||
this.paginationConfig[val] = data
|
|
||||||
},
|
|
||||||
saveCondition(val: string, data: any) {
|
|
||||||
this.search[val] = data
|
|
||||||
},
|
|
||||||
toggleDevice(value: DeviceType) {
|
|
||||||
this.device = value
|
|
||||||
},
|
|
||||||
isMobile() {
|
|
||||||
return this.device === DeviceType.Mobile
|
|
||||||
},
|
|
||||||
// async asyncGetValid(valid_type: ValidType, valid_count: number, loading?: Ref<boolean>) {
|
|
||||||
// return new Promise((resolve, reject) => {
|
|
||||||
// userApi
|
|
||||||
// .getValid(valid_type, valid_count, loading)
|
|
||||||
// .then((data) => {
|
|
||||||
// resolve(data)
|
|
||||||
// })
|
|
||||||
// .catch((error) => {
|
|
||||||
// reject(error)
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useCommonStore
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
import { defineStore } from 'pinia'
|
|
||||||
import documentApi from '@/api/system-shared/document'
|
|
||||||
import { type Ref } from 'vue'
|
|
||||||
|
|
||||||
const useDocumentStore = defineStore('documen', {
|
|
||||||
state: () => ({}),
|
|
||||||
actions: {
|
|
||||||
async asyncGetAllDocument(id: string, loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
documentApi
|
|
||||||
.getAllDocument(id, loading)
|
|
||||||
.then((res) => {
|
|
||||||
resolve(res)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncPutDocument(knowledgeId: string, data: any, loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
documentApi
|
|
||||||
.putMulDocument(knowledgeId, data, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useDocumentStore
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
import {defineStore} from 'pinia'
|
|
||||||
import {type Ref} from 'vue'
|
|
||||||
import folderApi from '@/api/folder'
|
|
||||||
|
|
||||||
const useFolderStore = defineStore('folde', {
|
|
||||||
state: () => ({}),
|
|
||||||
actions: {
|
|
||||||
async asyncGetFolder(source: string, data: any, loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
folderApi
|
|
||||||
.getFolder(source, data, loading)
|
|
||||||
.then((res) => {
|
|
||||||
resolve(res)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useFolderStore
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
import useCommonStore from './common'
|
|
||||||
import useLoginStore from './login'
|
|
||||||
import useFolderStore from './folder'
|
|
||||||
import useKnowledgeStore from './knowledge'
|
|
||||||
import useModelStore from './model'
|
|
||||||
import usePromptStore from './prompt'
|
|
||||||
import useProblemStore from './problem'
|
|
||||||
import useParagraphStore from './paragraph'
|
|
||||||
import useDocumentStore from './document'
|
|
||||||
|
|
||||||
const useStore = () => ({
|
|
||||||
common: useCommonStore(),
|
|
||||||
login: useLoginStore(),
|
|
||||||
folder: useFolderStore(),
|
|
||||||
knowledge: useKnowledgeStore(),
|
|
||||||
model: useModelStore(),
|
|
||||||
prompt: usePromptStore(),
|
|
||||||
problem: useProblemStore(),
|
|
||||||
paragraph: useParagraphStore(),
|
|
||||||
document: useDocumentStore(),
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useStore
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
import { defineStore } from 'pinia'
|
|
||||||
import type { knowledgeData } from '@/api/type/knowledge'
|
|
||||||
import type { UploadUserFile } from 'element-plus'
|
|
||||||
import knowledgeApi from '@/api/system-shared/knowledge'
|
|
||||||
import { type Ref } from 'vue'
|
|
||||||
|
|
||||||
export interface knowledgeStateTypes {
|
|
||||||
baseInfo: knowledgeData | null
|
|
||||||
webInfo: any
|
|
||||||
documentsType: string
|
|
||||||
documentsFiles: UploadUserFile[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const useKnowledgeStore = defineStore('knowledg', {
|
|
||||||
state: (): knowledgeStateTypes => ({
|
|
||||||
baseInfo: null,
|
|
||||||
webInfo: null,
|
|
||||||
documentsType: '',
|
|
||||||
documentsFiles: [],
|
|
||||||
}),
|
|
||||||
actions: {
|
|
||||||
saveBaseInfo(info: knowledgeData | null) {
|
|
||||||
this.baseInfo = info
|
|
||||||
},
|
|
||||||
saveWebInfo(info: any) {
|
|
||||||
this.webInfo = info
|
|
||||||
},
|
|
||||||
saveDocumentsType(val: string) {
|
|
||||||
this.documentsType = val
|
|
||||||
},
|
|
||||||
saveDocumentsFile(file: UploadUserFile[]) {
|
|
||||||
this.documentsFiles = file
|
|
||||||
},
|
|
||||||
async asyncGetFolderKnowledge(loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const params = {
|
|
||||||
folder_id: 'default',
|
|
||||||
}
|
|
||||||
knowledgeApi
|
|
||||||
.getKnowledgeList(params, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncGetKnowledgeDetail(knowledge_id: string, loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
knowledgeApi
|
|
||||||
.getKnowledgeDetail(knowledge_id, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useKnowledgeStore
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
import {defineStore} from 'pinia'
|
|
||||||
import {type Ref} from 'vue'
|
|
||||||
import loginApi from '@/api/user/login'
|
|
||||||
import type { LoginRequest } from '@/api/type/login'
|
|
||||||
|
|
||||||
import useUserStore from '@/stores/modules/user'
|
|
||||||
|
|
||||||
const useLoginStore = defineStore('logi', {
|
|
||||||
state: () => ({
|
|
||||||
token: '',
|
|
||||||
userAccessToken: '',
|
|
||||||
}),
|
|
||||||
actions: {
|
|
||||||
getToken(): string | null {
|
|
||||||
if (this.token) {
|
|
||||||
return this.token
|
|
||||||
}
|
|
||||||
const user = useUserStore()
|
|
||||||
return user.userType === 1 ? localStorage.getItem('token') : this.getAccessToken()
|
|
||||||
},
|
|
||||||
getAccessToken() {
|
|
||||||
const token = sessionStorage.getItem(`${this.userAccessToken}-accessToken`)
|
|
||||||
if (token) {
|
|
||||||
return token
|
|
||||||
}
|
|
||||||
const local_token = localStorage.getItem(`${token}-accessToken`)
|
|
||||||
if (local_token) {
|
|
||||||
return local_token
|
|
||||||
}
|
|
||||||
return localStorage.getItem(`accessToken`)
|
|
||||||
},
|
|
||||||
|
|
||||||
async asyncLogin(data: LoginRequest, loading?: Ref<boolean>) {
|
|
||||||
return loginApi.login(data).then((ok) => {
|
|
||||||
this.token = ok?.data?.token
|
|
||||||
localStorage.setItem('token', ok?.data?.token)
|
|
||||||
const user = useUserStore()
|
|
||||||
return user.profile(loading)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncLdapLogin(data: LoginRequest, loading?: Ref<boolean>) {
|
|
||||||
return loginApi.ldapLogin(data).then((ok) => {
|
|
||||||
this.token = ok?.data?.token
|
|
||||||
localStorage.setItem('token', ok?.data?.token)
|
|
||||||
const user = useUserStore()
|
|
||||||
return user.profile(loading)
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useLoginStore
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
import {defineStore} from 'pinia'
|
|
||||||
import {type Ref} from 'vue'
|
|
||||||
import ModelApi from '@/api/system-shared/model'
|
|
||||||
import ProviderApi from '@/api/model/provider'
|
|
||||||
import type {ListModelRequest} from '@/api/type/model'
|
|
||||||
|
|
||||||
const useModelStore = defineStore('mode', {
|
|
||||||
state: () => ({}),
|
|
||||||
actions: {
|
|
||||||
async asyncGetModel(data?: ListModelRequest, loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
ModelApi.getModel(data, loading)
|
|
||||||
.then((res) => {
|
|
||||||
resolve(res)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncGetProvider(loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
ProviderApi.getProvider(loading)
|
|
||||||
.then((res) => {
|
|
||||||
resolve(res)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useModelStore
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
import { defineStore } from 'pinia'
|
|
||||||
import paragraphApi from '@/api/system-shared/paragraph'
|
|
||||||
import type { Ref } from 'vue'
|
|
||||||
|
|
||||||
const useParagraphStore = defineStore('paragrap', {
|
|
||||||
state: () => ({}),
|
|
||||||
actions: {
|
|
||||||
async asyncPutParagraph(
|
|
||||||
knowledgeId: string,
|
|
||||||
documentId: string,
|
|
||||||
paragraphId: string,
|
|
||||||
data: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
paragraphApi
|
|
||||||
.putParagraph(knowledgeId, documentId, paragraphId, data, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async asyncDelParagraph(
|
|
||||||
knowledgeId: string,
|
|
||||||
documentId: string,
|
|
||||||
paragraphId: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
paragraphApi
|
|
||||||
.delParagraph(knowledgeId, documentId, paragraphId, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncDisassociationProblem(
|
|
||||||
knowledgeId: string,
|
|
||||||
documentId: string,
|
|
||||||
paragraphId: string,
|
|
||||||
problemId: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const obj = {
|
|
||||||
paragraphId,
|
|
||||||
problemId,
|
|
||||||
}
|
|
||||||
paragraphApi
|
|
||||||
.putDisassociationProblem(knowledgeId, documentId, obj, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncAssociationProblem(
|
|
||||||
knowledgeId: string,
|
|
||||||
documentId: string,
|
|
||||||
paragraphId: string,
|
|
||||||
problemId: string,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const obj = {
|
|
||||||
paragraphId,
|
|
||||||
problemId,
|
|
||||||
}
|
|
||||||
paragraphApi
|
|
||||||
.putAssociationProblem(knowledgeId, documentId, obj, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useParagraphStore
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
import { defineStore } from 'pinia'
|
|
||||||
import { type Ref } from 'vue'
|
|
||||||
import problemApi from '@/api/system-shared/problem'
|
|
||||||
import type { pageRequest } from '@/api/type/common'
|
|
||||||
|
|
||||||
const useProblemStore = defineStore('proble', {
|
|
||||||
state: () => ({}),
|
|
||||||
actions: {
|
|
||||||
async asyncPostProblem(knowledgeId: string, data: any, loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
problemApi
|
|
||||||
.postProblems(knowledgeId, data, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async asyncGetProblem(
|
|
||||||
knowledgeId: string,
|
|
||||||
page: pageRequest,
|
|
||||||
param: any,
|
|
||||||
loading?: Ref<boolean>,
|
|
||||||
) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
problemApi
|
|
||||||
.getProblemsPage(knowledgeId, page, param, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default useProblemStore
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
import { defineStore } from 'pinia'
|
|
||||||
import { t } from '@/locales'
|
|
||||||
export interface promptTypes {
|
|
||||||
user: string
|
|
||||||
formValue: { model_id: string; prompt: string }
|
|
||||||
}
|
|
||||||
|
|
||||||
const usePromptStore = defineStore('promp', {
|
|
||||||
state: (): promptTypes[] => JSON.parse(localStorage.getItem('PROMPT_CACHE') || '[]'),
|
|
||||||
actions: {
|
|
||||||
save(user: string, formValue: any) {
|
|
||||||
this.$state.forEach((item: any, index: number) => {
|
|
||||||
if (item.user === user) {
|
|
||||||
this.$state.splice(index, 1)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.$state.push({ user, formValue })
|
|
||||||
localStorage.setItem('PROMPT_CACHE', JSON.stringify(this.$state))
|
|
||||||
},
|
|
||||||
get(user: string) {
|
|
||||||
for (let i = 0; i < this.$state.length; i++) {
|
|
||||||
if (this.$state[i].user === user) {
|
|
||||||
return this.$state[i].formValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
model_id: '',
|
|
||||||
prompt:
|
|
||||||
t('views.document.generateQuestion.prompt1', { data: '{data}' }) +
|
|
||||||
'<question></question>' +
|
|
||||||
t('views.document.generateQuestion.prompt2'),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
export default usePromptStore
|
|
||||||
@ -4,12 +4,6 @@
|
|||||||
--el-text-color-primary: #1f2329;
|
--el-text-color-primary: #1f2329;
|
||||||
--el-border-radius-base: 6px;
|
--el-border-radius-base: 6px;
|
||||||
--el-menu-item-height: 45px;
|
--el-menu-item-height: 45px;
|
||||||
// --el-box-shadow-light: 0px 2px 4px 0px rgba(31, 35, 41, 0.12);
|
|
||||||
// --el-border-color: #dee0e3;
|
|
||||||
// --el-color-info: #8f959e !important;
|
|
||||||
// --el-disabled-bg-color: #eff0f1 !important;
|
|
||||||
|
|
||||||
// --el-font-line-height-primary: 22px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-avatar {
|
.el-avatar {
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
:currentNodeKey="currentFolder?.id"
|
:currentNodeKey="currentFolder?.id"
|
||||||
@handleNodeClick="folderClickHandel"
|
@handleNodeClick="folderClickHandel"
|
||||||
class="p-8"
|
class="p-8"
|
||||||
:shareTitle="$t('views.system.share_knowledge')"
|
:shareTitle="$t('views.system.shared.shared_knowledge')"
|
||||||
:showShared="permissionPrecise['is_share']()"
|
:showShared="permissionPrecise['is_share']()"
|
||||||
@refreshTree="refreshFolder"
|
@refreshTree="refreshFolder"
|
||||||
/>
|
/>
|
||||||
@ -46,11 +46,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown trigger="click" v-if="!isShared">
|
<el-dropdown trigger="click" v-if="!isShared">
|
||||||
<el-button
|
<el-button type="primary" class="ml-8" v-if="permissionPrecise.create()">
|
||||||
type="primary"
|
|
||||||
class="ml-8"
|
|
||||||
v-if="permissionPrecise.create()"
|
|
||||||
>
|
|
||||||
{{ $t('common.create') }}
|
{{ $t('common.create') }}
|
||||||
<el-icon class="el-icon--right">
|
<el-icon class="el-icon--right">
|
||||||
<arrow-down />
|
<arrow-down />
|
||||||
@ -156,7 +152,7 @@
|
|||||||
@load="getList"
|
@load="getList"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
>
|
>
|
||||||
<el-row v-if="knowledgeList.length > 0" :gutter="15">
|
<el-row v-if="knowledgeList.length > 0" :gutter="15" class="w-full">
|
||||||
<template v-for="(item, index) in knowledgeList" :key="index">
|
<template v-for="(item, index) in knowledgeList" :key="index">
|
||||||
<el-col
|
<el-col
|
||||||
v-if="item.resource_type === 'folder'"
|
v-if="item.resource_type === 'folder'"
|
||||||
@ -239,16 +235,12 @@
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="Refresh"
|
icon="Refresh"
|
||||||
@click.stop="syncKnowledge(item)"
|
@click.stop="syncKnowledge(item)"
|
||||||
v-if="item.type === 1 &&
|
v-if="item.type === 1 && permissionPrecise.sync(item.id)"
|
||||||
permissionPrecise.sync(item.id)
|
|
||||||
"
|
|
||||||
>{{ $t('views.knowledge.setting.sync') }}
|
>{{ $t('views.knowledge.setting.sync') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@click.stop="reEmbeddingKnowledge(item)"
|
@click.stop="reEmbeddingKnowledge(item)"
|
||||||
v-if="
|
v-if="permissionPrecise.vector(item.id)"
|
||||||
permissionPrecise.vector(item.id)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<AppIcon iconName="app-vectorization"></AppIcon>
|
<AppIcon iconName="app-vectorization"></AppIcon>
|
||||||
{{ $t('views.knowledge.setting.vectorization') }}
|
{{ $t('views.knowledge.setting.vectorization') }}
|
||||||
@ -257,9 +249,7 @@
|
|||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
icon="Connection"
|
icon="Connection"
|
||||||
@click.stop="openGenerateDialog(item)"
|
@click.stop="openGenerateDialog(item)"
|
||||||
v-if="
|
v-if="permissionPrecise.doc_generate(item.id)"
|
||||||
permissionPrecise.doc_generate(item.id)
|
|
||||||
"
|
|
||||||
>{{ $t('views.document.generateQuestion.title') }}
|
>{{ $t('views.document.generateQuestion.title') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@ -269,26 +259,20 @@
|
|||||||
path: `/knowledge/${item.id}/${currentFolder.value}/setting`,
|
path: `/knowledge/${item.id}/${currentFolder.value}/setting`,
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
v-if="
|
v-if="permissionPrecise.setting(item.id)"
|
||||||
permissionPrecise.setting(item.id)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('common.setting') }}
|
{{ $t('common.setting') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@click.stop="exportKnowledge(item)"
|
@click.stop="exportKnowledge(item)"
|
||||||
v-if="
|
v-if="permissionPrecise.export(item.id)"
|
||||||
permissionPrecise.export(item.id)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<AppIcon iconName="app-export"></AppIcon
|
<AppIcon iconName="app-export"></AppIcon
|
||||||
>{{ $t('views.document.setting.export') }} Excel
|
>{{ $t('views.document.setting.export') }} Excel
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
@click.stop="exportZipKnowledge(item)"
|
@click.stop="exportZipKnowledge(item)"
|
||||||
v-if="
|
v-if="permissionPrecise.export(item.id)"
|
||||||
permissionPrecise.export(item.id)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<AppIcon iconName="app-export"></AppIcon
|
<AppIcon iconName="app-export"></AppIcon
|
||||||
>{{ $t('views.document.setting.export') }} ZIP</el-dropdown-item
|
>{{ $t('views.document.setting.export') }} ZIP</el-dropdown-item
|
||||||
@ -297,9 +281,7 @@
|
|||||||
icon="Delete"
|
icon="Delete"
|
||||||
type="danger"
|
type="danger"
|
||||||
@click.stop="deleteKnowledge(item)"
|
@click.stop="deleteKnowledge(item)"
|
||||||
v-if="
|
v-if="permissionPrecise.delete(item.id)"
|
||||||
permissionPrecise.delete(item.id)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('common.delete') }}</el-dropdown-item
|
{{ $t('common.delete') }}</el-dropdown-item
|
||||||
>
|
>
|
||||||
@ -337,15 +319,14 @@ import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
|||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import { numberFormat } from '@/utils/common'
|
import { numberFormat } from '@/utils/common'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import { FolderSource } from '@/enums/common'
|
import { FolderSource } from '@/enums/common'
|
||||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
||||||
import { hasPermission } from '@/utils/permission/index'
|
import { hasPermission } from '@/utils/permission/index'
|
||||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
import { useRoute } from 'vue-router'
|
|
||||||
import permissionMap from '@/permission'
|
import permissionMap from '@/permission'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { folder, user } = useStore()
|
const { folder, user } = useStore()
|
||||||
|
|
||||||
@ -362,8 +343,6 @@ const permissionPrecise = computed(() => {
|
|||||||
return permissionMap['knowledge'][type.value]
|
return permissionMap['knowledge'][type.value]
|
||||||
})
|
})
|
||||||
|
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
const search_type = ref('name')
|
const search_type = ref('name')
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<div
|
<div
|
||||||
@click="handleSharedNodeClick"
|
@click="handleSharedNodeClick"
|
||||||
class="shared-model"
|
class="shared-model"
|
||||||
v-if="isShared && hasPermission(EditionConst.IS_EE, 'OR')"
|
v-if="showShared && hasPermission(EditionConst.IS_EE, 'OR')"
|
||||||
:class="active?.provider === 'share' && 'active'"
|
:class="active?.provider === 'share' && 'active'"
|
||||||
>
|
>
|
||||||
<AppIcon iconName="app-folder-share-active" style="font-size: 18px"></AppIcon>
|
<AppIcon iconName="app-folder-share-active" style="font-size: 18px"></AppIcon>
|
||||||
@ -108,7 +108,7 @@ import { t } from '@/locales'
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
data: Array<Provider>
|
data: Array<Provider>
|
||||||
loading: boolean
|
loading: boolean
|
||||||
isShared?: boolean
|
showShared?: boolean
|
||||||
active?: Provider
|
active?: Provider
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits(['click'])
|
const emit = defineEmits(['click'])
|
||||||
|
|||||||
@ -6,12 +6,15 @@
|
|||||||
:data="provider_list"
|
:data="provider_list"
|
||||||
@click="clickListHandle"
|
@click="clickListHandle"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
shareTitle="views.system.shared.shared_tool"
|
|
||||||
:showShared="permissionPrecise['is_share']()"
|
:showShared="permissionPrecise['is_share']()"
|
||||||
:active="active_provider"
|
:active="active_provider"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<ContentContainer :header="active_provider?.name" v-loading="list_model_loading">
|
<ContentContainer
|
||||||
|
:header="active_provider?.name"
|
||||||
|
v-loading="list_model_loading"
|
||||||
|
style="padding: 0"
|
||||||
|
>
|
||||||
<template #search>
|
<template #search>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="flex-between complex-search">
|
<div class="flex-between complex-search">
|
||||||
@ -55,9 +58,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!isShared &&
|
v-if="!isShared && permissionPrecise.addModel()"
|
||||||
permissionPrecise.addModel()
|
|
||||||
"
|
|
||||||
class="ml-16"
|
class="ml-16"
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="openCreateModel(active_provider)"
|
@click="openCreateModel(active_provider)"
|
||||||
@ -68,32 +69,30 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="model-list-height">
|
<div class="model-list-height">
|
||||||
<el-scrollbar>
|
<el-row v-if="model_split_list.length > 0" :gutter="15" class="w-full">
|
||||||
<el-row v-if="model_split_list.length > 0" :gutter="15" class="w-full">
|
<template v-for="(row, index) in model_split_list" :key="index">
|
||||||
<template v-for="(row, index) in model_split_list" :key="index">
|
<el-col
|
||||||
<el-col
|
:xs="24"
|
||||||
:xs="24"
|
:sm="12"
|
||||||
:sm="12"
|
:md="12"
|
||||||
:md="12"
|
:lg="8"
|
||||||
:lg="8"
|
:xl="6"
|
||||||
:xl="6"
|
class="mb-16"
|
||||||
class="mb-16"
|
v-for="(model, i) in row"
|
||||||
v-for="(model, i) in row"
|
:key="i"
|
||||||
:key="i"
|
>
|
||||||
|
<ModelCard
|
||||||
|
@change="list_model"
|
||||||
|
:updateModelById="updateModelById"
|
||||||
|
:model="model"
|
||||||
|
:provider_list="provider_list"
|
||||||
|
:isShared="isShared"
|
||||||
>
|
>
|
||||||
<ModelCard
|
</ModelCard>
|
||||||
@change="list_model"
|
</el-col>
|
||||||
:updateModelById="updateModelById"
|
</template>
|
||||||
:model="model"
|
</el-row>
|
||||||
:provider_list="provider_list"
|
<el-empty :description="$t('common.noData')" v-else />
|
||||||
:isShared="isShared"
|
|
||||||
>
|
|
||||||
</ModelCard>
|
|
||||||
</el-col>
|
|
||||||
</template>
|
|
||||||
</el-row>
|
|
||||||
<el-empty :description="$t('common.noData')" v-else />
|
|
||||||
</el-scrollbar>
|
|
||||||
</div>
|
</div>
|
||||||
</ContentContainer>
|
</ContentContainer>
|
||||||
|
|
||||||
@ -129,7 +128,6 @@ import { useRoute } from 'vue-router'
|
|||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import permissionMap from '@/permission'
|
import permissionMap from '@/permission'
|
||||||
|
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { folder, user } = useStore()
|
const { folder, user } = useStore()
|
||||||
|
|
||||||
@ -231,6 +229,7 @@ onMounted(() => {
|
|||||||
.model-manage {
|
.model-manage {
|
||||||
.model-list-height {
|
.model-list-height {
|
||||||
height: calc(var(--app-main-height));
|
height: calc(var(--app-main-height));
|
||||||
|
padding-right: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,239 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentContainer>
|
<ContentContainer>
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="shared-header">
|
<el-breadcrumb separator-icon="ArrowRight">
|
||||||
<span class="title">{{ t('views.system.shared.shared_resources') }}</span>
|
<el-breadcrumb-item>{{ t('views.system.shared.shared_resources') }}</el-breadcrumb-item>
|
||||||
<el-icon size="12">
|
<el-breadcrumb-item>
|
||||||
<rightOutlined></rightOutlined>
|
<h5 class="ml-4 color-text-primary">{{ t('views.model.title') }}</h5>
|
||||||
</el-icon>
|
</el-breadcrumb-item>
|
||||||
<span class="sub-title">{{ t('views.model.title') }}</span>
|
</el-breadcrumb>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<el-card style="--el-card-padding: 0">
|
<el-card style="--el-card-padding: 0">
|
||||||
<LayoutContainer class="model-manage">
|
<modelListContainer />
|
||||||
<template #left>
|
|
||||||
<h4 class="p-16 mb-8 pb-0">{{ $t('views.model.provider') }}</h4>
|
|
||||||
<ProviderComponent
|
|
||||||
:data="provider_list"
|
|
||||||
@click="clickListHandle"
|
|
||||||
:loading="loading"
|
|
||||||
:shareTitle="$t('views.system.shared.shared_tool')"
|
|
||||||
isShared
|
|
||||||
:active="active_provider"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<ContentContainer :header="active_provider?.name" v-loading="list_model_loading">
|
|
||||||
<template #search>
|
|
||||||
<div class="flex">
|
|
||||||
<div class="flex-between complex-search">
|
|
||||||
<el-select
|
|
||||||
class="complex-search__left"
|
|
||||||
v-model="search_type"
|
|
||||||
style="width: 120px"
|
|
||||||
@change="search_type_change"
|
|
||||||
>
|
|
||||||
<el-option :label="$t('common.creator')" value="create_user" />
|
|
||||||
<el-option
|
|
||||||
:label="$t('views.model.modelForm.model_type.label')"
|
|
||||||
value="model_type"
|
|
||||||
/>
|
|
||||||
<el-option :label="$t('views.model.modelForm.modeName.label')" value="name" />
|
|
||||||
</el-select>
|
|
||||||
<el-input
|
|
||||||
v-if="search_type === 'name'"
|
|
||||||
v-model="model_search_form.name"
|
|
||||||
@change="list_model"
|
|
||||||
:placeholder="$t('common.searchBar.placeholder')"
|
|
||||||
style="width: 220px"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
<el-select
|
|
||||||
v-else-if="search_type === 'create_user'"
|
|
||||||
v-model="model_search_form.create_user"
|
|
||||||
@change="list_model"
|
|
||||||
clearable
|
|
||||||
style="width: 220px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="u in user_options"
|
|
||||||
:key="u.id"
|
|
||||||
:value="u.id"
|
|
||||||
:label="u.username"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
<el-select
|
|
||||||
v-else-if="search_type === 'model_type'"
|
|
||||||
v-model="model_search_form.model_type"
|
|
||||||
clearable
|
|
||||||
@change="list_model"
|
|
||||||
style="width: 220px"
|
|
||||||
>
|
|
||||||
<template v-for="item in modelTypeList" :key="item.value">
|
|
||||||
<el-option :label="item.text" :value="item.value" />
|
|
||||||
</template>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
|
||||||
<el-button
|
|
||||||
v-if="!isShared"
|
|
||||||
class="ml-16"
|
|
||||||
type="primary"
|
|
||||||
@click="openCreateModel(active_provider)"
|
|
||||||
v-hasPermission="[
|
|
||||||
RoleConst.WORKSPACE_MANAGE.getWorkspaceRole,
|
|
||||||
RoleConst.USER.getWorkspaceRole,
|
|
||||||
PermissionConst.MODEL_CREATE.getWorkspacePermission,
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
{{ $t('views.model.addModel') }}
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div class="model-list-height">
|
|
||||||
<el-scrollbar>
|
|
||||||
<el-row v-if="model_split_list.length > 0" :gutter="15" class="w-full">
|
|
||||||
<template v-for="(row, index) in model_split_list" :key="index">
|
|
||||||
<el-col
|
|
||||||
:xs="24"
|
|
||||||
:sm="12"
|
|
||||||
:md="12"
|
|
||||||
:lg="12"
|
|
||||||
:xl="8"
|
|
||||||
class="mb-16"
|
|
||||||
v-for="(model, i) in row"
|
|
||||||
:key="i"
|
|
||||||
>
|
|
||||||
<ModelCard
|
|
||||||
@change="list_model"
|
|
||||||
:updateModelById="updateModelById"
|
|
||||||
:model="model"
|
|
||||||
:provider_list="provider_list"
|
|
||||||
:isShared="isShared"
|
|
||||||
>
|
|
||||||
</ModelCard>
|
|
||||||
</el-col>
|
|
||||||
</template>
|
|
||||||
</el-row>
|
|
||||||
<el-empty :description="$t('common.noData')" v-else />
|
|
||||||
</el-scrollbar>
|
|
||||||
</div>
|
|
||||||
</ContentContainer>
|
|
||||||
|
|
||||||
<CreateModelDialog
|
|
||||||
ref="createModelRef"
|
|
||||||
@submit="list_model"
|
|
||||||
@change="openCreateModel($event)"
|
|
||||||
v-if="!isShared"
|
|
||||||
></CreateModelDialog>
|
|
||||||
|
|
||||||
<SelectProviderDialog
|
|
||||||
ref="selectProviderRef"
|
|
||||||
@change="(provider, modelType) => openCreateModel(provider, modelType)"
|
|
||||||
v-if="!isShared"
|
|
||||||
></SelectProviderDialog>
|
|
||||||
</LayoutContainer>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</ContentContainer>
|
</ContentContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, computed } from 'vue'
|
import { onMounted, ref, computed } from 'vue'
|
||||||
import ProviderApi from '@/api/model/provider'
|
|
||||||
import ModelApi from '@/api/system-shared/model'
|
|
||||||
import type { Provider, Model } from '@/api/type/model'
|
|
||||||
import ModelCard from '@/views/model/component/ModelCard.vue'
|
|
||||||
import ProviderComponent from '@/views/model/component/Provider.vue'
|
|
||||||
import { splitArray } from '@/utils/common'
|
|
||||||
import { modelTypeList, allObj } from '@/views/model/component/data'
|
|
||||||
import CreateModelDialog from '@/views/model/component/CreateModelDialog.vue'
|
|
||||||
import SelectProviderDialog from '@/views/model/component/SelectProviderDialog.vue'
|
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
import modelListContainer from '@/views/model/index.vue'
|
||||||
const commonList1 = ref()
|
|
||||||
const commonList2 = ref()
|
|
||||||
const loading = ref<boolean>(false)
|
|
||||||
|
|
||||||
const active_provider = ref<Provider>()
|
onMounted(() => {})
|
||||||
const search_type = ref('name')
|
|
||||||
const model_search_form = ref<{
|
|
||||||
name: string
|
|
||||||
create_user: string
|
|
||||||
model_type: string
|
|
||||||
}>({
|
|
||||||
name: '',
|
|
||||||
create_user: '',
|
|
||||||
model_type: '',
|
|
||||||
})
|
|
||||||
const user_options = ref<any[]>([])
|
|
||||||
const list_model_loading = ref<boolean>(false)
|
|
||||||
const provider_list = ref<Array<Provider>>([])
|
|
||||||
|
|
||||||
const model_list = ref<Array<Model>>([])
|
|
||||||
|
|
||||||
const isShared = computed(() => {
|
|
||||||
return active_provider.value && active_provider.value.provider === 'share'
|
|
||||||
})
|
|
||||||
const updateModelById = (model_id: string, model: Model) => {
|
|
||||||
model_list.value
|
|
||||||
.filter((m) => m.id == model_id)
|
|
||||||
.forEach((m) => {
|
|
||||||
m.status = model.status
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const model_split_list = computed(() => {
|
|
||||||
return splitArray(model_list.value, 2)
|
|
||||||
})
|
|
||||||
const createModelRef = ref<InstanceType<typeof CreateModelDialog>>()
|
|
||||||
const selectProviderRef = ref<InstanceType<typeof SelectProviderDialog>>()
|
|
||||||
|
|
||||||
const clickListHandle = (item: Provider) => {
|
|
||||||
active_provider.value = item
|
|
||||||
list_model()
|
|
||||||
if (active_provider.value.provider === '') {
|
|
||||||
commonList1.value.clearCurrent()
|
|
||||||
commonList2.value.clearCurrent()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const openCreateModel = (provider?: Provider, model_type?: string) => {
|
|
||||||
if (provider && provider.provider) {
|
|
||||||
createModelRef.value?.open(provider, model_type)
|
|
||||||
} else {
|
|
||||||
selectProviderRef.value?.open()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const list_model = () => {
|
|
||||||
const params = active_provider.value?.provider ? { provider: active_provider.value.provider } : {}
|
|
||||||
ModelApi.getModel({ ...model_search_form.value, ...params }, list_model_loading).then(
|
|
||||||
(ok: any) => {
|
|
||||||
model_list.value = ok.data
|
|
||||||
const v = model_list.value.map((m) => ({ id: m.user_id, username: m.username }))
|
|
||||||
if (user_options.value.length === 0) {
|
|
||||||
user_options.value = Array.from(new Map(v.map((item) => [item.id, item])).values())
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const search_type_change = () => {
|
|
||||||
model_search_form.value = { name: '', create_user: '', model_type: '' }
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
ProviderApi.getProvider(loading).then((ok) => {
|
|
||||||
active_provider.value = allObj
|
|
||||||
provider_list.value = [allObj, ...ok.data]
|
|
||||||
|
|
||||||
list_model()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped></style>
|
||||||
.model-manage {
|
|
||||||
.model-list-height {
|
|
||||||
height: calc(var(--app-main-height));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<el-breadcrumb separator-icon="ArrowRight">
|
<el-breadcrumb separator-icon="ArrowRight">
|
||||||
<el-breadcrumb-item>{{ t('views.system.shared.shared_resources') }}</el-breadcrumb-item>
|
<el-breadcrumb-item>{{ t('views.system.shared.shared_resources') }}</el-breadcrumb-item>
|
||||||
<el-breadcrumb-item>
|
<el-breadcrumb-item>
|
||||||
{{ t('views.tool.title') }}
|
<h5 class="ml-4 color-text-primary">{{ t('views.tool.title') }}</h5>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
</template>
|
</template>
|
||||||
@ -23,24 +23,4 @@ import { t } from '@/locales'
|
|||||||
onMounted(() => {})
|
onMounted(() => {})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped></style>
|
||||||
.tool-shared {
|
|
||||||
padding-left: 8px;
|
|
||||||
.shared-header {
|
|
||||||
color: #646a73;
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 22px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
:deep(.el-icon i) {
|
|
||||||
height: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sub-title {
|
|
||||||
color: #1f2329;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@ -109,11 +109,23 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, watch } from 'vue'
|
import { ref, reactive, watch, computed } from 'vue'
|
||||||
import ToolApi from '@/api/tool/tool'
|
|
||||||
import type { FormInstance } from 'element-plus'
|
import type { FormInstance } from 'element-plus'
|
||||||
|
import { useRoute } from 'vue-router'
|
||||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||||
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const type = computed(() => {
|
||||||
|
if (route.path.includes('shared')) {
|
||||||
|
return 'systemShare'
|
||||||
|
} else if (route.path.includes('resource-management')) {
|
||||||
|
return 'systemManage'
|
||||||
|
} else {
|
||||||
|
return 'workspace'
|
||||||
|
}
|
||||||
|
})
|
||||||
const FormRef = ref()
|
const FormRef = ref()
|
||||||
const dynamicsFormRef = ref()
|
const dynamicsFormRef = ref()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@ -148,17 +160,19 @@ watch(debugVisible, (bool) => {
|
|||||||
const submit = async (formEl: FormInstance | undefined) => {
|
const submit = async (formEl: FormInstance | undefined) => {
|
||||||
const validate = formEl ? formEl.validate() : Promise.resolve()
|
const validate = formEl ? formEl.validate() : Promise.resolve()
|
||||||
Promise.all([dynamicsFormRef.value?.validate(), validate]).then(() => {
|
Promise.all([dynamicsFormRef.value?.validate(), validate]).then(() => {
|
||||||
ToolApi.postToolDebug(form.value, loading).then((res) => {
|
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
if (res.code === 500) {
|
.postToolDebug(form.value, loading)
|
||||||
showResult.value = true
|
.then((res: any) => {
|
||||||
isSuccess.value = false
|
if (res.code === 500) {
|
||||||
result.value = res.message
|
showResult.value = true
|
||||||
} else {
|
isSuccess.value = false
|
||||||
showResult.value = true
|
result.value = res.message
|
||||||
isSuccess.value = true
|
} else {
|
||||||
result.value = res.data
|
showResult.value = true
|
||||||
}
|
isSuccess.value = true
|
||||||
})
|
result.value = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
@mouseenter="showEditIcon = true"
|
@mouseenter="showEditIcon = true"
|
||||||
@mouseleave="showEditIcon = false"
|
@mouseleave="showEditIcon = false"
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-Avatar
|
<el-Avatar
|
||||||
v-if="isAppIcon(form.icon)"
|
v-if="isAppIcon(form.icon)"
|
||||||
:id="form.id"
|
:id="form.id"
|
||||||
@ -32,10 +31,10 @@
|
|||||||
:size="32"
|
:size="32"
|
||||||
style="background: none"
|
style="background: none"
|
||||||
>
|
>
|
||||||
<img :src="String(form.icon)" alt=""/>
|
<img :src="String(form.icon)" alt="" />
|
||||||
</el-Avatar>
|
</el-Avatar>
|
||||||
<el-avatar v-else class="avatar-green" shape="square" :size="32">
|
<el-avatar v-else class="avatar-green" shape="square" :size="32">
|
||||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt=""/>
|
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-Avatar
|
<el-Avatar
|
||||||
v-if="showEditIcon"
|
v-if="showEditIcon"
|
||||||
@ -46,12 +45,12 @@
|
|||||||
@click="openEditAvatar"
|
@click="openEditAvatar"
|
||||||
>
|
>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<EditPen/>
|
<EditPen />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-Avatar>
|
</el-Avatar>
|
||||||
</div>
|
</div>
|
||||||
<el-avatar v-else class="avatar-green" shape="square" :size="32">
|
<el-avatar v-else class="avatar-green" shape="square" :size="32">
|
||||||
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt=""/>
|
<img src="@/assets/node/icon_tool.svg" style="width: 58%" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.name"
|
v-model="form.name"
|
||||||
@ -81,7 +80,7 @@
|
|||||||
</h4>
|
</h4>
|
||||||
<el-button link type="danger" @click="openAddInitDialog()">
|
<el-button link type="danger" @click="openAddInitDialog()">
|
||||||
<el-icon class="mr-4">
|
<el-icon class="mr-4">
|
||||||
<Plus/>
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
{{ $t('common.add') }}
|
{{ $t('common.add') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
@ -94,44 +93,36 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('dynamicsForm.paramForm.input_type.label')">
|
<el-table-column :label="$t('dynamicsForm.paramForm.input_type.label')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'TextInput'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'TextInput'"
|
||||||
$t('dynamicsForm.input_type_list.TextInput')
|
>{{ $t('dynamicsForm.input_type_list.TextInput') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'PasswordInput'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'PasswordInput'"
|
||||||
$t('dynamicsForm.input_type_list.PasswordInput')
|
>{{ $t('dynamicsForm.input_type_list.PasswordInput') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'Slider'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'Slider'"
|
||||||
$t('dynamicsForm.input_type_list.Slider')
|
>{{ $t('dynamicsForm.input_type_list.Slider') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'SwitchInput'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'SwitchInput'"
|
||||||
$t('dynamicsForm.input_type_list.SwitchInput')
|
>{{ $t('dynamicsForm.input_type_list.SwitchInput') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'SingleSelect'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'SingleSelect'"
|
||||||
$t('dynamicsForm.input_type_list.SingleSelect')
|
>{{ $t('dynamicsForm.input_type_list.SingleSelect') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'MultiSelect'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'MultiSelect'"
|
||||||
$t('dynamicsForm.input_type_list.MultiSelect')
|
>{{ $t('dynamicsForm.input_type_list.MultiSelect') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'RadioCard'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'RadioCard'"
|
||||||
$t('dynamicsForm.input_type_list.RadioCard')
|
>{{ $t('dynamicsForm.input_type_list.RadioCard') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag type="info" class="info-tag" v-if="row.input_type === 'DatePicker'">{{
|
<el-tag type="info" class="info-tag" v-if="row.input_type === 'DatePicker'"
|
||||||
$t('dynamicsForm.input_type_list.DatePicker')
|
>{{ $t('dynamicsForm.input_type_list.DatePicker') }}
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('common.required')">
|
<el-table-column :label="$t('common.required')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div @click.stop>
|
<div @click.stop>
|
||||||
<el-switch disabled size="small" v-model="row.required"/>
|
<el-switch disabled size="small" v-model="row.required" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -140,14 +131,14 @@
|
|||||||
<span class="mr-4">
|
<span class="mr-4">
|
||||||
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">
|
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">
|
||||||
<el-button type="primary" text @click.stop="openAddInitDialog(row, $index)">
|
<el-button type="primary" text @click.stop="openAddInitDialog(row, $index)">
|
||||||
<el-icon><EditPen/></el-icon>
|
<el-icon><EditPen /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
||||||
<el-button type="primary" text @click="deleteInitField($index)">
|
<el-button type="primary" text @click="deleteInitField($index)">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Delete/>
|
<Delete />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@ -163,14 +154,14 @@
|
|||||||
</h4>
|
</h4>
|
||||||
<el-button link type="primary" @click="openAddDialog()">
|
<el-button link type="primary" @click="openAddDialog()">
|
||||||
<el-icon class="mr-4">
|
<el-icon class="mr-4">
|
||||||
<Plus/>
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
{{ $t('common.add') }}
|
{{ $t('common.add') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table ref="inputFieldTableRef" :data="form.input_field_list" class="mb-16">
|
<el-table ref="inputFieldTableRef" :data="form.input_field_list" class="mb-16">
|
||||||
<el-table-column prop="name" :label="$t('views.tool.form.paramName.label')"/>
|
<el-table-column prop="name" :label="$t('views.tool.form.paramName.label')" />
|
||||||
<el-table-column :label="$t('views.tool.form.dataType.label')">
|
<el-table-column :label="$t('views.tool.form.dataType.label')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag type="info" class="info-tag">{{ row.type }}</el-tag>
|
<el-tag type="info" class="info-tag">{{ row.type }}</el-tag>
|
||||||
@ -179,7 +170,7 @@
|
|||||||
<el-table-column :label="$t('common.required')">
|
<el-table-column :label="$t('common.required')">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div @click.stop>
|
<div @click.stop>
|
||||||
<el-switch size="small" v-model="row.is_required"/>
|
<el-switch size="small" v-model="row.is_required" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -197,14 +188,14 @@
|
|||||||
<span class="mr-4">
|
<span class="mr-4">
|
||||||
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">
|
<el-tooltip effect="dark" :content="$t('common.modify')" placement="top">
|
||||||
<el-button type="primary" text @click.stop="openAddDialog(row, $index)">
|
<el-button type="primary" text @click.stop="openAddDialog(row, $index)">
|
||||||
<el-icon><EditPen/></el-icon>
|
<el-icon><EditPen /></el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</span>
|
</span>
|
||||||
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
<el-tooltip effect="dark" :content="$t('common.delete')" placement="top">
|
||||||
<el-button type="primary" text @click="deleteField($index)">
|
<el-button type="primary" text @click="deleteField($index)">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Delete/>
|
<Delete />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@ -240,44 +231,38 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<div>
|
<div>
|
||||||
<el-button :loading="loading" @click="visible = false">{{ $t('common.cancel') }}</el-button>
|
<el-button :loading="loading" @click="visible = false">{{ $t('common.cancel') }}</el-button>
|
||||||
<el-button :loading="loading" @click="openDebug"
|
<el-button :loading="loading" @click="openDebug" v-if="permissionPrecise.debug()">{{
|
||||||
v-if="permissionPrecise.debug()"
|
$t('common.debug')
|
||||||
>{{ $t('common.debug') }}</el-button>
|
}}</el-button>
|
||||||
<el-button type="primary" @click="submit(FormRef)" :loading="loading"
|
<el-button type="primary" @click="submit(FormRef)" :loading="loading">
|
||||||
>
|
|
||||||
{{ isEdit ? $t('common.save') : $t('common.create') }}
|
{{ isEdit ? $t('common.save') : $t('common.create') }}
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<ToolDebugDrawer ref="ToolDebugDrawerRef"/>
|
<ToolDebugDrawer ref="ToolDebugDrawerRef" />
|
||||||
<FieldFormDialog ref="FieldFormDialogRef" @refresh="refreshFieldList"/>
|
<FieldFormDialog ref="FieldFormDialogRef" @refresh="refreshFieldList" />
|
||||||
<UserFieldFormDialog ref="UserFieldFormDialogRef" @refresh="refreshInitFieldList"/>
|
<UserFieldFormDialog ref="UserFieldFormDialogRef" @refresh="refreshInitFieldList" />
|
||||||
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshTool"/>
|
<EditAvatarDialog ref="EditAvatarDialogRef" @refresh="refreshTool" />
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, reactive, watch, nextTick, computed} from 'vue'
|
import { ref, reactive, watch, nextTick, computed } from 'vue'
|
||||||
import FieldFormDialog from '@/views/tool/component/FieldFormDialog.vue'
|
import FieldFormDialog from '@/views/tool/component/FieldFormDialog.vue'
|
||||||
import ToolDebugDrawer from './ToolDebugDrawer.vue'
|
import ToolDebugDrawer from './ToolDebugDrawer.vue'
|
||||||
import UserFieldFormDialog from '@/views/tool/component/UserFieldFormDialog.vue'
|
import UserFieldFormDialog from '@/views/tool/component/UserFieldFormDialog.vue'
|
||||||
import EditAvatarDialog from '@/views/tool/component/EditAvatarDialog.vue'
|
import EditAvatarDialog from '@/views/tool/component/EditAvatarDialog.vue'
|
||||||
import type {toolData} from '@/api/type/tool'
|
import type { toolData } from '@/api/type/tool'
|
||||||
import ToolApi from '@/api/tool/tool'
|
import type { FormInstance } from 'element-plus'
|
||||||
import type {FormInstance} from 'element-plus'
|
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||||
import {MsgSuccess, MsgConfirm} from '@/utils/message'
|
import { cloneDeep } from 'lodash'
|
||||||
import {cloneDeep} from 'lodash'
|
import { t } from '@/locales'
|
||||||
import {PermissionType, PermissionDesc} from '@/enums/model'
|
import { isAppIcon } from '@/utils/common'
|
||||||
import {t} from '@/locales'
|
|
||||||
import {isAppIcon} from '@/utils/common'
|
|
||||||
import { PermissionConst, RoleConst } from '@/utils/permission/data'
|
|
||||||
import { hasPermission } from '@/utils/permission/index'
|
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
import permissionMap from '@/permission'
|
import permissionMap from '@/permission'
|
||||||
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const { folder, user } = useStore()
|
const { folder, user } = useStore()
|
||||||
@ -367,8 +352,7 @@ function close() {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
visible.value = false
|
visible.value = false
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,17 +424,25 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
await formEl.validate((valid: any) => {
|
await formEl.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (isEdit.value) {
|
if (isEdit.value) {
|
||||||
ToolApi.putTool(form.value?.id as string, form.value, loading).then((res) => {
|
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
MsgSuccess(t('common.editSuccess'))
|
.putTool(form.value?.id as string, form.value, loading)
|
||||||
emit('refresh', res.data)
|
.then((res: any) => {
|
||||||
visible.value = false
|
MsgSuccess(t('common.editSuccess'))
|
||||||
})
|
emit('refresh', res.data)
|
||||||
|
visible.value = false
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
ToolApi.postTool(form.value, loading).then((res) => {
|
const obj = {
|
||||||
MsgSuccess(t('common.createSuccess'))
|
folder_id: folder.currentFolder?.id,
|
||||||
emit('refresh')
|
...form.value,
|
||||||
visible.value = false
|
}
|
||||||
})
|
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
|
.postTool(obj, loading)
|
||||||
|
.then((res: any) => {
|
||||||
|
MsgSuccess(t('common.createSuccess'))
|
||||||
|
emit('refresh')
|
||||||
|
visible.value = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -27,15 +27,28 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, watch} from 'vue'
|
import { ref, watch, computed } from 'vue'
|
||||||
import ToolApi from '@/api/tool/tool'
|
import { useRoute } from 'vue-router'
|
||||||
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
import DynamicsForm from '@/components/dynamics-form/index.vue'
|
||||||
import {MsgSuccess} from '@/utils/message'
|
import { MsgSuccess } from '@/utils/message'
|
||||||
import {t} from '@/locales'
|
import { t } from '@/locales'
|
||||||
import {cloneDeep} from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
const type = computed(() => {
|
||||||
|
if (route.path.includes('shared')) {
|
||||||
|
return 'systemShare'
|
||||||
|
} else if (route.path.includes('resource-management')) {
|
||||||
|
return 'systemManage'
|
||||||
|
} else {
|
||||||
|
return 'workspace'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const dynamicsFormRef = ref()
|
const dynamicsFormRef = ref()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const debugVisible = ref(false)
|
const debugVisible = ref(false)
|
||||||
@ -55,11 +68,13 @@ watch(debugVisible, (bool) => {
|
|||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
dynamicsFormRef.value.validate().then(() => {
|
dynamicsFormRef.value.validate().then(() => {
|
||||||
ToolApi.putTool(form.value?.id as string, form.value, loading).then((res) => {
|
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
MsgSuccess(t('common.editSuccess'))
|
.putTool(form.value?.id as string, form.value, loading)
|
||||||
emit('refresh')
|
.then((res: any) => {
|
||||||
debugVisible.value = false
|
MsgSuccess(t('common.editSuccess'))
|
||||||
})
|
emit('refresh')
|
||||||
|
debugVisible.value = false
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,12 +86,12 @@ const open = (data: any, is_active: boolean) => {
|
|||||||
const init_params = form.value.init_field_list
|
const init_params = form.value.init_field_list
|
||||||
.map((item: any) => {
|
.map((item: any) => {
|
||||||
if (item.show_default_value === false) {
|
if (item.show_default_value === false) {
|
||||||
return {[item.field]: undefined}
|
return { [item.field]: undefined }
|
||||||
}
|
}
|
||||||
return {[item.field]: item.default_value}
|
return { [item.field]: item.default_value }
|
||||||
})
|
})
|
||||||
.reduce((x: any, y: any) => ({...x, ...y}), {})
|
.reduce((x: any, y: any) => ({ ...x, ...y }), {})
|
||||||
form.value.init_params = {...init_params, ...form.value.init_params}
|
form.value.init_params = { ...init_params, ...form.value.init_params }
|
||||||
debugVisible.value = true
|
debugVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@
|
|||||||
@load="getList"
|
@load="getList"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
>
|
>
|
||||||
<el-row v-if="tool.toolList.length > 0" :gutter="15">
|
<el-row v-if="tool.toolList.length > 0" :gutter="15" class="w-full">
|
||||||
<template v-for="(item, index) in tool.toolList" :key="index">
|
<template v-for="(item, index) in tool.toolList" :key="index">
|
||||||
<el-col
|
<el-col
|
||||||
v-if="item.resource_type === 'folder'"
|
v-if="item.resource_type === 'folder'"
|
||||||
@ -304,7 +304,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, reactive, computed, watch } from 'vue'
|
import { onMounted, ref, reactive, computed, watch } from 'vue'
|
||||||
import { cloneDeep, get } from 'lodash'
|
import { cloneDeep, get } from 'lodash'
|
||||||
import ToolApi from '@/api/tool/tool'
|
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import InitParamDrawer from '@/views/tool/component/InitParamDrawer.vue'
|
import InitParamDrawer from '@/views/tool/component/InitParamDrawer.vue'
|
||||||
import ToolFormDrawer from '@/views/tool/ToolFormDrawer.vue'
|
import ToolFormDrawer from '@/views/tool/ToolFormDrawer.vue'
|
||||||
@ -407,7 +406,8 @@ async function changeState(row: any) {
|
|||||||
const obj = {
|
const obj = {
|
||||||
is_active: !row.is_active,
|
is_active: !row.is_active,
|
||||||
}
|
}
|
||||||
ToolApi.putTool(row.id, obj, changeStateloading)
|
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
|
.putTool(row.id, obj, changeStateloading)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const list = cloneDeep(tool.toolList)
|
const list = cloneDeep(tool.toolList)
|
||||||
const index = list.findIndex((v) => v.id === row.id)
|
const index = list.findIndex((v) => v.id === row.id)
|
||||||
@ -513,7 +513,7 @@ function deleteTool(row: any) {
|
|||||||
function configInitParams(item: any) {
|
function configInitParams(item: any) {
|
||||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
.getToolById(item?.id, changeStateloading)
|
.getToolById(item?.id, changeStateloading)
|
||||||
.then((res) => {
|
.then((res: any) => {
|
||||||
InitParamDrawerRef.value.open(res.data)
|
InitParamDrawerRef.value.open(res.data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -532,7 +532,7 @@ function confirmAddInternalFunction(data?: any, isEdit?: boolean) {
|
|||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||||
.putTool(data?.id as string, { name: data.name }, loading)
|
.putTool(data?.id as string, { name: data.name }, loading)
|
||||||
.then((res) => {
|
.then((res: any) => {
|
||||||
MsgSuccess(t('common.saveSuccess'))
|
MsgSuccess(t('common.saveSuccess'))
|
||||||
refresh()
|
refresh()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -24,12 +24,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, ref, reactive, computed } from 'vue'
|
import { onMounted, ref, reactive, computed } from 'vue'
|
||||||
import ToolListContainer from '@/views/tool/component/ToolListContainer.vue'
|
import ToolListContainer from '@/views/tool/component/ToolListContainer.vue'
|
||||||
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
|
|
||||||
import { FolderSource } from '@/enums/common'
|
import { FolderSource } from '@/enums/common'
|
||||||
import { ComplexPermission } from '@/utils/permission/type'
|
|
||||||
import ToolStoreDialog from './toolStore/ToolStoreDialog.vue'
|
|
||||||
import AddInternalFunctionDialog from './toolStore/AddInternalFunctionDialog.vue'
|
|
||||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
|
||||||
import permissionMap from '@/permission'
|
import permissionMap from '@/permission'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user