From 66807217c1c22605fdd08ce70de338b1f162e77a Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Mon, 7 Jul 2025 21:03:42 +0800 Subject: [PATCH] fix: bugs --- ui/src/components/model-select/index.vue | 7 ++- ui/src/router/modules/application-detail.ts | 6 +- .../component/AddKnowledgeDialog.vue | 6 +- .../system/resource-authorization/index.vue | 62 ++++++++++--------- ui/src/workflow/common/EditFormCollect.vue | 2 +- .../workflow/nodes/condition-node/index.vue | 47 +++++++------- 6 files changed, 66 insertions(+), 64 deletions(-) diff --git a/ui/src/components/model-select/index.vue b/ui/src/components/model-select/index.vue index 1c42916b..e38f1fb7 100644 --- a/ui/src/components/model-select/index.vue +++ b/ui/src/components/model-select/index.vue @@ -19,9 +19,10 @@ class="model-icon mr-8" > {{ item.name }} - + + + {{ t('views.shared.title') }} + diff --git a/ui/src/router/modules/application-detail.ts b/ui/src/router/modules/application-detail.ts index 6373892a..a5288a53 100644 --- a/ui/src/router/modules/application-detail.ts +++ b/ui/src/router/modules/application-detail.ts @@ -25,7 +25,7 @@ const ApplicationDetailRouter = { () => { const to: any = get_next_route() return new ComplexPermission([RoleConst.USER],[PermissionConst.APPLICATION.getApplicationWorkspaceResourcePermission( to ? to.params.id : '',)],[],'AND')}, - + RoleConst.WORKSPACE_MANAGE.getWorkspaceRole, PermissionConst.APPLICATION_OVERVIEW_READ.getWorkspacePermissionWorkspaceManageRole, () => { @@ -83,7 +83,7 @@ const ApplicationDetailRouter = { const to: any = get_next_route() return PermissionConst.APPLICATION_ACCESS_READ.getApplicationWorkspaceResourcePermission( to ? to.params.id : '',) - }],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'), + }],[EditionConst.IS_EE, EditionConst.IS_PE],'OR'), ] }, component: () => import('@/views/application/ApplicationAccess.vue'), @@ -108,7 +108,7 @@ const ApplicationDetailRouter = { () => { const to: any = get_next_route() return new ComplexPermission([],[PermissionConst.APPLICATION_CHAT_USER_READ.getApplicationWorkspaceResourcePermission( - to ? to.params.id : '',)],[EditionConst.IS_EE, EditionConst.IS_PE],'OR') + to ? to.params.id : '',)],[EditionConst.IS_EE, EditionConst.IS_PE],'OR') } ] }, diff --git a/ui/src/views/application/component/AddKnowledgeDialog.vue b/ui/src/views/application/component/AddKnowledgeDialog.vue index c1c60681..843d83cc 100644 --- a/ui/src/views/application/component/AddKnowledgeDialog.vue +++ b/ui/src/views/application/component/AddKnowledgeDialog.vue @@ -49,7 +49,7 @@ :treeStyle="{ height: 'calc(100vh - 320px)' }" /> -
+
@@ -111,7 +111,7 @@ const props = defineProps({ loading: Boolean, }) -const emit = defineEmits(['addData', 'refresh']) +const emit = defineEmits(['addData']) const { folder, user } = useStore() const apiType = computed(() => { if (route.path.includes('shared')) { @@ -190,7 +190,7 @@ const submitHandle = () => { } const refresh = () => { - emit('refresh') + getList() } const folderList = ref([]) diff --git a/ui/src/views/system/resource-authorization/index.vue b/ui/src/views/system/resource-authorization/index.vue index b0472d18..54976154 100644 --- a/ui/src/views/system/resource-authorization/index.vue +++ b/ui/src/views/system/resource-authorization/index.vue @@ -354,12 +354,7 @@ const dfsFolder = (arr: any[] = [], folderIdMap: any) => { function getFolder() { const workspaceId = currentWorkspaceId.value || user.getWorkspaceId() || 'default' - return AuthorizationApi.getSystemFolder( - workspaceId, - activeData.value.type, - {}, - loading, - ) + return AuthorizationApi.getSystemFolder(workspaceId, activeData.value.type, {}, loading) } function getResourcePermissions(user_id: string) { const workspaceId = currentWorkspaceId.value || user.getWorkspaceId() || 'default' @@ -372,31 +367,38 @@ function getResourcePermissions(user_id: string) { } const getWholeTree = async (user_id: string) => { const [parentRes, childrenRes] = await Promise.all([getFolder(), getResourcePermissions(user_id)]) - if (!childrenRes.data || Object.keys(childrenRes.data).length > 0) { - settingTags.map((item: any) => { - let folderIdMap = [] - const folderTree = cloneDeep((parentRes as unknown as any).data) - if (Object.keys(childrenRes.data).indexOf(item.type) !== -1) { - item.isRole = - childrenRes.data[item.type].length > 0 && - hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR') - ? childrenRes.data[item.type][0].auth_type == 'ROLE' - : false - folderIdMap = getFolderIdMap(childrenRes.data[item.type]) - dfsFolder(folderTree, folderIdMap) - const permissionHalf = { - VIEW: [], - MANAGE: [], - ROLE: [], - } - Object.keys(permissionHalf).forEach((ele) => { - dfsPermissionIndeterminateTrue(folderTree, ele) - dfsPermissionIndeterminate(folderTree, ele, cloneDeep(permissionHalf), {}, 'default') - }) - item.data = folderTree - } + // if (!childrenRes.data || Object.keys(childrenRes.data).length > 0) { + // settingTags.map((item: any) => { + let folderIdMap = [] + const folderTree = cloneDeep((parentRes as unknown as any).data) + if (Object.keys(childrenRes.data).indexOf(activeData.value.type) !== -1) { + activeData.value.isRole = + childrenRes.data[activeData.value.type].length > 0 && + hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR') + ? childrenRes.data[activeData.value.type][0].auth_type == 'ROLE' + : false + folderIdMap = getFolderIdMap(childrenRes.data[activeData.value.type]) + dfsFolder(folderTree, folderIdMap) + const permissionHalf = { + VIEW: [], + MANAGE: [], + ROLE: [], + } + Object.keys(permissionHalf).forEach((ele) => { + dfsPermissionIndeterminateTrue(folderTree, ele) + dfsPermissionIndeterminate(folderTree, ele, cloneDeep(permissionHalf), {}, 'default') }) + + if (activeData.value.type === AuthorizationEnum.MODEL) { + activeData.value.data = folderTree[0].children + } else { + activeData.value.data = folderTree + } + } else { + activeData.value.data = [] } + // }) + // } } const refreshData = () => { @@ -433,7 +435,7 @@ const currentWorkspace = computed(() => { async function getWorkspaceList() { const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading) workspaceList.value = res.data - currentWorkspaceId.value = user.getWorkspaceId() as string || 'default' + currentWorkspaceId.value = (user.getWorkspaceId() as string) || 'default' } function changeWorkspace(item: WorkspaceItem) { diff --git a/ui/src/workflow/common/EditFormCollect.vue b/ui/src/workflow/common/EditFormCollect.vue index 935d5924..4369782a 100644 --- a/ui/src/workflow/common/EditFormCollect.vue +++ b/ui/src/workflow/common/EditFormCollect.vue @@ -30,7 +30,7 @@ import DynamicsFormConstructor from '@/components/dynamics-form/constructor/inde import { t } from '@/locales' const props = withDefaults( defineProps<{ title?: string; editFormField: (form_data: any, index: number) => void }>(), - { title: t('views.model.form.title.editParam') } + { title: t('common.param.editParam') } ) const dialogVisible = ref(false) const dynamicsFormConstructorRef = ref>() diff --git a/ui/src/workflow/nodes/condition-node/index.vue b/ui/src/workflow/nodes/condition-node/index.vue index 1e4d6e2e..f9ebd0df 100644 --- a/ui/src/workflow/nodes/condition-node/index.vue +++ b/ui/src/workflow/nodes/condition-node/index.vue @@ -12,7 +12,6 @@ ref="el" v-bind:modelValue="form_data.branch" :disabled="form_data.branch === 2" - :filter="'.no-drag'" handle=".handle" :animation="150" ghostClass="ghost" @@ -24,7 +23,7 @@ shadow="never" class="drag-card card-never mb-8" :class="{ - 'no-drag': index === form_data.branch.length - 1 || form_data.branch.length === 2 + 'no-drag': index === form_data.branch.length - 1 || form_data.branch.length === 2, }" style="--el-card-padding: 12px" > @@ -61,7 +60,7 @@ type: 'array', required: true, message: $t('views.applicationWorkflow.variable.placeholder'), - trigger: 'change' + trigger: 'change', }" > { @@ -206,7 +205,7 @@ const resizeCondition = (wh: any, row: any, index: number) => { const branch_condition_list = cloneDeep( props.nodeModel.properties.branch_condition_list ? props.nodeModel.properties.branch_condition_list - : [] + : [], ) const new_branch_condition_list = branch_condition_list.map((item: any) => { if (item.id === row.id) { @@ -229,7 +228,7 @@ const form_data = computed({ }, set: (value) => { set(props.nodeModel.properties, 'node_data', value) - } + }, }) const ConditionNodeFormRef = ref() @@ -237,7 +236,7 @@ const nodeCascaderRef = ref() const validate = () => { const v_list = [ ConditionNodeFormRef.value?.validate(), - ...nodeCascaderRef.value.map((item: any) => item.validate()) + ...nodeCascaderRef.value.map((item: any) => item.validate()), ] return Promise.all(v_list).catch((err) => { return Promise.reject({ node: props.nodeModel, errMessage: err }) @@ -265,12 +264,12 @@ function addBranch() { { field: [], compare: '', - value: '' - } + value: '', + }, ], type: 'ELSE IF ' + (list.length - 1), id: randomId(), - condition: 'and' + condition: 'and', } list.splice(list.length - 1, 0, obj) refreshBranchAnchor(list, true) @@ -280,7 +279,7 @@ function refreshBranchAnchor(list: Array, is_add: boolean) { const branch_condition_list = cloneDeep( props.nodeModel.properties.branch_condition_list ? props.nodeModel.properties.branch_condition_list - : [] + : [], ) const new_branch_condition_list = list .map((item, index) => { @@ -304,7 +303,7 @@ function addCondition(index: number) { list[index]['conditions'].push({ field: [], compare: '', - value: '' + value: '', }) set(props.nodeModel.properties.node_data, 'branch', list) } @@ -315,14 +314,14 @@ function deleteCondition(index: number, cIndex: number) { if (list[index]['conditions'].length === 0) { const delete_edge = list.splice(index, 1) const delete_target_anchor_id_list = delete_edge.map( - (item: any) => props.nodeModel.id + '_' + item.id + '_right' + (item: any) => props.nodeModel.id + '_' + item.id + '_right', ) props.nodeModel.graphModel.eventCenter.emit( 'delete_edge', props.nodeModel.outgoing.edges .filter((item: any) => delete_target_anchor_id_list.includes(item.sourceAnchorId)) - .map((item: any) => item.id) + .map((item: any) => item.id), ) refreshBranchAnchor(list, false)