fix(全局): bug 修复

This commit is contained in:
baiqi 2024-05-29 11:47:03 +08:00 committed by 刘瑞斌
parent 557b542ec9
commit 5be8bcd6df
16 changed files with 66 additions and 57 deletions

View File

@ -147,7 +147,7 @@
Message.success(t('personal.switchOrgSuccess'));
personalMenusVisible.value = false;
orgKeyword.value = '';
await userStore.checkIsLogin();
await userStore.checkIsLogin(true);
appStore.hideLoading();
router.replace({
name: getFirstRouteNameByPermission(router.getRoutes()),

View File

@ -345,7 +345,7 @@
(e: 'pageSizeChange', value: number): void;
(e: 'rowNameChange', value: TableData, cb: (v: boolean) => void): void;
(e: 'rowSelectChange', key: string): void;
(e: 'selectAllChange', value: SelectAllEnum): void;
(e: 'selectAllChange', value: SelectAllEnum, onlyCurrent: boolean): void;
(e: 'dragChange', value: DragSortParams): void;
(e: 'sorterChange', value: { [key: string]: string }): void;
(e: 'expand', record: TableData): void | Promise<any>;
@ -485,8 +485,8 @@
}
// change
const handleSelectAllChange = (v: SelectAllEnum) => {
emit('selectAllChange', v);
const handleSelectAllChange = (v: SelectAllEnum, onlyCurrent: boolean) => {
emit('selectAllChange', v, onlyCurrent);
};
// change
const rowSelectChange = (key: string) => {

View File

@ -36,7 +36,7 @@
const { t } = useI18n();
const emit = defineEmits<{
(e: 'change', value: SelectAllEnum): void;
(e: 'change', value: SelectAllEnum, onlyCurrent: boolean): void;
}>();
const props = withDefaults(
@ -81,20 +81,20 @@
);
});
const handleSelect = (v: SelectAllEnum) => {
const handleSelect = (v: SelectAllEnum, onlyCurrent = true) => {
if (
(selectAllStatus.value === SelectAllEnum.ALL &&
v === SelectAllEnum.NONE &&
props.excludeKeys.length < props.total) ||
(selectAllStatus.value === SelectAllEnum.ALL && v === SelectAllEnum.CURRENT)
(selectAllStatus.value === SelectAllEnum.ALL && v === SelectAllEnum.CURRENT && !onlyCurrent)
) {
//
//
// ()
selectAllStatus.value = SelectAllEnum.ALL;
} else {
selectAllStatus.value = v;
}
emit('change', v);
emit('change', v, onlyCurrent);
};
function hasUnselectedChildren(
@ -113,7 +113,7 @@
const handleCheckChange = () => {
if (hasUnselectedChildren(props.currentData, props.selectedKeys, props.rowKey)) {
//
handleSelect(SelectAllEnum.CURRENT);
handleSelect(SelectAllEnum.CURRENT, false);
} else {
//
handleSelect(SelectAllEnum.NONE);

View File

@ -419,7 +419,7 @@ export default function useTableProps<T>(
},
// 表格SelectAll change
selectAllChange: (v: SelectAllEnum) => {
selectAllChange: (v: SelectAllEnum, onlyCurrent: boolean) => {
const { data, rowKey } = propsRes.value;
if (v === SelectAllEnum.NONE) {
// 清空选中项
@ -437,10 +437,10 @@ export default function useTableProps<T>(
v === SelectAllEnum.NONE &&
propsRes.value.msPagination &&
propsRes.value.excludeKeys.size < propsRes.value.msPagination.total) ||
(propsRes.value.selectorStatus === SelectAllEnum.ALL && v === SelectAllEnum.CURRENT)
(propsRes.value.selectorStatus === SelectAllEnum.ALL && v === SelectAllEnum.CURRENT && !onlyCurrent)
) {
// 如果当前是全选所有页状态,且是取消选中当前页操作,且排除项小于总数,则保持跨页全选状态
// 如果当前是全选所有页状态,且是选中当前页操作,则保持跨页全选状态
// 如果当前是全选所有页状态,且是选中当前页操作(是点击全选的多选框,非下拉菜单全选当前页),则保持跨页全选状态
propsRes.value.selectorStatus = SelectAllEnum.ALL;
} else {
propsRes.value.selectorStatus = v;

View File

@ -228,7 +228,7 @@
// eslint-disable-next-line no-console
console.log(error);
} finally {
await userStore.checkIsLogin();
await userStore.checkIsLogin(true);
appStore.hideLoading();
router.replace({
name: getFirstRouteNameByPermission(router.getRoutes()),

View File

@ -209,11 +209,11 @@ const useUserStore = defineStore('user', {
console.log(error);
}
},
async checkIsLogin() {
async checkIsLogin(forceSet = false) {
const { isLoginPage } = useUser();
const router = useRouter();
const appStore = useAppStore();
const isLogin = await this.isLogin(true);
const isLogin = await this.isLogin(forceSet);
if (isLogin && appStore.currentProjectId !== 'no_such_project') {
// 当前为登陆状态,且已经选择了项目,初始化当前项目配置
try {

View File

@ -42,7 +42,7 @@
<a-form-item :label="t('apiTestManagement.belongModule')">
<a-tree-select
v-model:modelValue="importForm.moduleId"
:data="props.moduleTree"
:data="innerModuleTree"
class="w-[436px]"
:field-names="{ title: 'name', key: 'id', children: 'children' }"
:draggable="false"
@ -248,7 +248,7 @@
<a-form-item :label="t('apiTestManagement.belongModule')">
<a-tree-select
v-model:modelValue="importForm.moduleId"
:data="props.moduleTree"
:data="innerModuleTree"
class="w-[500px]"
:field-names="{ title: 'name', key: 'id', children: 'children' }"
allow-search
@ -361,6 +361,7 @@
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import useUserStore from '@/store/modules/user';
import { filterTree, TreeNode } from '@/utils';
import type { ImportApiDefinitionParams, ImportApiDefinitionRequest } from '@/models/apiTest/management';
import type { ModuleTreeNode } from '@/models/common';
@ -381,6 +382,7 @@
const userStore = useUserStore();
const visible = useVModel(props, 'visible', emit);
const innerModuleTree = ref<TreeNode<ModuleTreeNode>[]>([]);
const importType = ref<'file' | 'time'>('file');
const platformList = [
{
@ -415,6 +417,7 @@
(val) => {
if (val) {
importForm.value.moduleId = props.activeModule !== 'all' ? props.activeModule : '';
innerModuleTree.value = filterTree(props.moduleTree, (node) => node.type === 'MODULE');
}
},
{

View File

@ -394,6 +394,13 @@
filterSlotName: FilterSlotNameEnum.API_TEST_API_REQUEST_METHODS,
},
},
{
title: 'apiTestManagement.path',
dataIndex: 'path',
showTooltip: true,
width: 200,
showDrag: true,
},
{
title: 'apiTestManagement.apiStatus',
dataIndex: 'status',
@ -405,13 +412,6 @@
width: 130,
showDrag: true,
},
{
title: 'apiTestManagement.path',
dataIndex: 'path',
showTooltip: true,
width: 200,
showDrag: true,
},
{
title: 'apiTestManagement.belongModule',
dataIndex: 'moduleName',

View File

@ -225,7 +225,7 @@
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
import useAppStore from '@/store/modules/app';
import { operationWidth } from '@/utils';
import { characterLimit, operationWidth } from '@/utils';
import { hasAnyPermission } from '@/utils/permission';
import { ApiDefinitionMockDetail } from '@/models/apiTest/management';
@ -441,7 +441,7 @@
* 删除接口
*/
function removeMock(record?: ApiDefinitionMockDetail, isBatch?: boolean, params?: BatchActionQueryParams) {
let title = t('apiTestManagement.confirmDelete', { name: record?.name });
let title = t('apiTestManagement.confirmDelete', { name: characterLimit(record?.name) });
let selectIds = [record?.id || ''];
if (isBatch) {
title = t('mockManagement.batchDeleteMockTip', {

View File

@ -220,6 +220,13 @@
width: 140,
showDrag: true,
},
{
title: 'apiTestManagement.path',
dataIndex: 'path',
showTooltip: true,
width: 200,
showDrag: true,
},
{
title: 'apiTestManagement.apiStatus',
dataIndex: 'status',
@ -228,13 +235,6 @@
width: 130,
showDrag: true,
},
{
title: 'apiTestManagement.path',
dataIndex: 'path',
showTooltip: true,
width: 200,
showDrag: true,
},
{
title: 'common.tag',
dataIndex: 'tags',

View File

@ -235,6 +235,12 @@
titleSlotName: 'methodFilter',
width: 140,
},
{
title: 'apiTestManagement.path',
dataIndex: 'path',
showTooltip: true,
width: 200,
},
{
title: 'apiTestManagement.apiStatus',
dataIndex: 'status',
@ -242,12 +248,6 @@
titleSlotName: 'statusFilter',
width: 130,
},
{
title: 'apiTestManagement.path',
dataIndex: 'path',
showTooltip: true,
width: 200,
},
{
title: 'common.tag',
dataIndex: 'tags',

View File

@ -878,6 +878,7 @@
const realStep = findNodeByKey<ScenarioStepItem>(steps.value, step.uniqueId, 'uniqueId');
if (id && realStep) {
realStep.csvIds = realStep.csvIds.filter((item: string) => item !== id);
scenario.value.unSaved = true;
}
}

View File

@ -26,8 +26,10 @@
@stop-debug="handleStopExecute"
/>
<a-button
v-permission="
activeScenarioTab.isNew ? ['PROJECT_API_SCENARIO:READ+ADD'] : ['PROJECT_API_SCENARIO:READ+UPDATE']
v-if="
activeScenarioTab.isNew
? hasAnyPermission(['PROJECT_API_SCENARIO:READ+ADD'])
: hasAnyPermission(['PROJECT_API_SCENARIO:READ+UPDATE'])
"
type="primary"
:loading="saveLoading"
@ -132,6 +134,7 @@
import router from '@/router';
import useAppStore from '@/store/modules/app';
import { filterTree, getGenerateId, mapTree } from '@/utils';
import { hasAnyPermission } from '@/utils/permission';
import { RequestResult } from '@/models/apiTest/common';
import {

View File

@ -71,7 +71,7 @@
// eslint-disable-next-line no-console
console.log(error);
} finally {
await userStore.checkIsLogin();
await userStore.checkIsLogin(true);
appStore.hideLoading();
router.replace({
name: getFirstRouteNameByPermission(router.getRoutes()),

View File

@ -18,13 +18,13 @@
>
<div ref="robotListRef" class="robot-list">
<div v-for="robot of botList" :key="robot.id" class="robot-card">
<div class="flex items-center">
<div class="flex">
<MsIcon
:type="IconMap[robot.platform]"
class="mr-[8px] h-[40px] w-[40px] bg-[var(--color-text-n9)] p-[8px] text-[rgb(var(--primary-5))]"
/>
<div class="flex flex-col">
<div class="font-medium text-[var(--color-text-1)]">{{ robot.name }}</div>
<div class="flex flex-1 flex-col">
<div class="break-all font-medium text-[var(--color-text-1)]">{{ robot.name }}</div>
<div
v-if="['IN_SITE', 'MAIL'].includes(robot.platform)"
class="text-[12px] leading-[16px] text-[var(--color-text-4)]"
@ -38,22 +38,24 @@
mini
:content="robot.createUser"
>
<span class="one-line-text" style="max-width: 200px">{{ robot.createUser }}</span></a-tooltip
>
<span class="one-line-text" style="max-width: 200px">{{ robot.createUser }}</span>
</a-tooltip>
<span v-else class="one-line-text" style="max-width: 200px">{{ robot.createUser }}</span>
<span class="mr-[16px]">{{
`${t('project.messageManagement.createAt')} ${dayjs(robot.createTime).format(
'YYYY-MM-DD HH:mm:ss'
)}`
}}</span>
<span class="mr-[16px]">
{{
`${t('project.messageManagement.createAt')} ${dayjs(robot.createTime).format(
'YYYY-MM-DD HH:mm:ss'
)}`
}}
</span>
<a-tooltip
v-if="translateTextToPX(robot.updateUser) > 200"
position="tl"
mini
:content="robot.updateUser"
>
<span class="one-line-text" style="max-width: 200px">{{ robot.updateUser }}</span></a-tooltip
>
<span class="one-line-text" style="max-width: 200px">{{ robot.updateUser }}</span>
</a-tooltip>
<span v-else class="one-line-text" style="max-width: 200px">{{ robot.updateUser }}</span>
{{
` ${t('project.messageManagement.updateAt')} ${dayjs(robot.updateTime).format(
@ -475,7 +477,7 @@
function delRobot(robot: RobotItem) {
openModal({
type: 'error',
title: t('project.messageManagement.deleteTitle', { name: robot.name }),
title: t('project.messageManagement.deleteTitle', { name: characterLimit(robot.name) }),
content: t('project.messageManagement.deleteContent'),
okText: t('common.confirmDelete'),
cancelText: t('common.cancel'),

View File

@ -36,7 +36,7 @@ export async function enterProject(projectId: string, organizationId?: string) {
projectId,
userId: userStore.id || '',
});
await userStore.checkIsLogin();
await userStore.checkIsLogin(true);
// 跳转到项目页面
router.replace({
name: getFirstRouteNameByPermission(router.getRoutes()),