fix(全局): bugFix

This commit is contained in:
baiqi 2024-06-24 18:43:21 +08:00 committed by Craftsman
parent af3a64689c
commit 0eadb3cb93
7 changed files with 69 additions and 40 deletions

View File

@ -23,7 +23,6 @@
import { SettingRouteEnum } from '@/enums/routeEnum';
import useMenuTree from './use-menu-tree';
import type { RouteMeta } from 'vue-router';
export default defineComponent({
emit: ['collapse'],
@ -50,7 +49,8 @@
const openKeys = ref<string[]>([]);
const selectedKey = ref<string[]>([]);
const goto = (item: RouteRecordRaw | null) => {
const goto = debounce(
(item: RouteRecordRaw | null) => {
if (item) {
//
if (regexUrl.test(item.path)) {
@ -59,8 +59,10 @@
return;
}
//
const { hideInMenu, activeMenu } = item.meta as RouteMeta;
if (route.name === item.name && !hideInMenu && !activeMenu) {
if (
route.name === item.name ||
((route.name as string).includes(item.name as string) && route.meta?.hideChildrenInMenu)
) {
selectedKey.value = [item.name as string];
return;
}
@ -80,7 +82,10 @@
name: 'notFound',
});
}
};
},
500,
{ leading: true, trailing: false, maxWait: 500 }
);
/**
* 查找激活的菜单项
* @param target 目标菜单名
@ -407,7 +412,7 @@
//
const renderMenuItem = (element: RouteRecordRaw | null, icon: (() => any) | null) =>
element?.name === SettingRouteEnum.SETTING_ORGANIZATION ? (
<a-menu-item key={element?.name} v-slots={{ icon }} onClick={debounce(() => goto(element), 100)}>
<a-menu-item key={element?.name} v-slots={{ icon }} onClick={() => goto(element)}>
<div class="inline-flex w-[calc(100%-34px)] items-center justify-between !bg-transparent">
{collapsed.value ? (
<div class="text-center text-[12px] leading-[16px]">
@ -436,7 +441,7 @@
</div>
</a-menu-item>
) : (
<a-menu-item key={element?.name} v-slots={{ icon }} onClick={debounce(() => goto(element), 100)}>
<a-menu-item key={element?.name} v-slots={{ icon }} onClick={() => goto(element)}>
{collapsed.value ? (
<div class="text-center text-[12px] leading-[16px]">
{t(element?.meta?.collapsedLocale || element?.meta?.locale || '')}

View File

@ -1483,6 +1483,7 @@
Message.success(t('common.saveSuccess'));
handleSaveCaseCancel();
saveCaseLoading.value = false;
done(true);
}
} catch (error) {
// eslint-disable-next-line no-console

View File

@ -301,7 +301,9 @@
* @param isModule 是否是删除模块
*/
function handleDeleteApiFromModuleTree(id: string, isModule = false) {
if (isModule) {
if (activeApiTab.value.id === 'all') {
apiRef.value?.refreshTable();
} else if (isModule) {
//
apiTabs.value = apiTabs.value.filter((item) => {
if (activeApiTab.value.id === item.id) {

View File

@ -33,11 +33,13 @@
</template>
<template #operation="{ record }">
<div class="flex flex-row flex-nowrap">
<MsButton class="!mr-0" @click="handleRecover(record)">{{ t('bugManagement.recycle.recover') }}</MsButton>
<MsButton v-permission="['PROJECT_BUG:READ+DELETE']" class="!mr-0" @click="handleRecover(record)">
{{ t('bugManagement.recycle.recover') }}
</MsButton>
<a-divider direction="vertical" />
<MsButton class="!mr-0" @click="handleDelete(record)">{{
t('bugManagement.recycle.permanentlyDelete')
}}</MsButton>
<MsButton v-permission="['PROJECT_BUG:READ+DELETE']" class="!mr-0" @click="handleDelete(record)">
{{ t('bugManagement.recycle.permanentlyDelete') }}
</MsButton>
</div>
</template>
@ -307,7 +309,7 @@
{
eventTag: 'recover',
label: t('bugManagement.recycle.recover'),
permission: ['PROJECT_BUG:READ+UPDATE'],
permission: ['PROJECT_BUG:READ+DELETE'],
},
{
eventTag: 'delete',

View File

@ -134,7 +134,13 @@
modulesCount?: Record<string, number>; //
isExpandAll?: boolean; //
}>();
const emit = defineEmits(['init', 'folderNodeSelect', 'create']);
const emit = defineEmits<{
(e: 'init', data: ModuleTreeNode[], nodePathObj: Record<string, any>): void;
(e: 'folderNodeSelect', selectedKeys: string[], offspringIds: string[]): void;
(e: 'create'): void;
(e: 'nodeDelete'): void;
(e: 'nodeDrop'): void;
}>();
const appStore = useAppStore();
const { t } = useI18n();
@ -263,6 +269,7 @@
await deleteReviewModule(node.id);
Message.success(t('caseManagement.caseReview.deleteSuccess'));
initModules(selectedKeys.value[0] === node.id);
emit('nodeDelete');
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
@ -334,6 +341,7 @@
dropPosition,
});
Message.success(t('caseManagement.caseReview.moduleMoveSuccess'));
emit('nodeDrop');
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);

View File

@ -502,7 +502,6 @@
];
const selectedModuleKeys = ref<string[]>([]);
const tableStore = useTableStore();
await tableStore.initColumn(TableKeyEnum.CASE_MANAGEMENT_REVIEW, columns, 'drawer', true);
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, resetFilterParams } = useTable(
getReviewList,
{
@ -769,6 +768,12 @@
},
});
}
defineExpose({
searchReview,
});
await tableStore.initColumn(TableKeyEnum.CASE_MANAGEMENT_REVIEW, columns, 'drawer', true);
</script>
<style lang="less" scoped></style>

View File

@ -11,11 +11,14 @@
@folder-node-select="handleFolderNodeSelect"
@init="initModuleTree"
@create="goCreateReview"
@node-delete="handleModuleTreeChange"
@node-drop="handleModuleTreeChange"
/>
</div>
</template>
<template #second>
<ReviewTable
ref="reviewTableRef"
v-model:show-type="showType"
:active-folder="activeFolderId"
:module-tree="moduleTree"
@ -41,14 +44,12 @@
import ReviewTable from './components/index/reviewTable.vue';
import { reviewModuleCount } from '@/api/modules/case-management/caseReview';
import { useI18n } from '@/hooks/useI18n';
import { ReviewListQueryParams } from '@/models/caseManagement/caseReview';
import { ModuleTreeNode } from '@/models/common';
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
const router = useRouter();
const { t } = useI18n();
type ShowType = 'all' | 'reviewByMe' | 'createByMe';
@ -60,6 +61,7 @@
const moduleTree = ref<ModuleTreeNode[]>([]);
const moduleTreePathMap = ref<Record<string, any>>({});
const modulesCount = ref<Record<string, number>>({});
const reviewTableRef = ref<InstanceType<typeof ReviewTable>>();
function initModuleTree(tree: ModuleTreeNode[], pathMap: Record<string, any>) {
moduleTree.value = unref(tree);
@ -81,6 +83,10 @@
}
}
function handleModuleTreeChange() {
reviewTableRef.value?.searchReview();
}
function goCreateReview() {
router.push({
name: CaseManagementRouteEnum.CASE_MANAGEMENT_REVIEW_CREATE,