fix: 修复消息管理未读切换已读问题&统一修改替换下拉树无法检索问题

This commit is contained in:
xinxin.wu 2024-06-25 18:32:01 +08:00 committed by Craftsman
parent 90d20de060
commit e8124a7d75
21 changed files with 76 additions and 64 deletions

View File

@ -88,6 +88,9 @@ export function queryMessageHistoryCount(data: historyQueryParams) {
export function getMessageReadAll(resourceType?: string) {
return MSR.get<number>({ url: '/notification/read/all', params: { resourceType } });
}
export function getMessageRead(id: number) {
return MSR.get<number>({ url: `/notification/read/${id}` });
}
export function getMessageUnReadCount(projectId: string) {
return MSR.get<number>({ url: '/notification/un-read', params: projectId }, { ignoreCancelToken: true });

View File

@ -56,4 +56,5 @@ export const ReportShareScenarioUrlGetDetail = '/test-plan/report/share/detail/s
// 测试计划-报告明细-场景报告
export const ReportScenarioUrl = '/test-plan/api/scenario/report/get';
export const ReportDetailScenarioUrl = '/test-plan/api/scenario/report/get/detail';
// 测试计划-报告-报告富文本预览压缩图
export const ReportPlanPreviewImageUrl = '/test-plan/report/preview/md';

View File

@ -34,6 +34,7 @@
threshold: 200,
},
}"
:filter-tree-node="filterTreeNode"
allow-search
>
<template #tree-slot-title="node">
@ -63,6 +64,7 @@
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import { filterTreeNode } from '@/utils';
import { ModuleTreeNode, TransferFileParams } from '@/models/common';

View File

@ -107,7 +107,7 @@
{{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}
</div>
</div>
<div v-else class="ms-message-item">
<div v-else class="ms-message-item" @click.stop="setReadMessage(item)">
<MSAvatar v-if="item.avatar" :avatar="item.avatar" :word="item.userName" />
<div class="ml-[8px] flex flex-col">
<div class="flex items-center">
@ -183,6 +183,7 @@
import MsList from '@/components/pure/ms-list/index.vue';
import {
getMessageRead,
getMessageReadAll,
MessageHistoryItem,
OptionItem,
@ -268,7 +269,7 @@
current: pageNation.value.current || 1,
pageSize: pageNation.value.pageSize,
});
res.list.forEach((item) => messageHistoryList.value.push(item));
messageHistoryList.value = res.list || [];
pageNation.value.total = res.total;
}
@ -435,6 +436,18 @@
await loadMessageHistoryList(position.value, currentResourceType.value);
}
async function setReadMessage(item: MessageHistoryItem) {
if (item.status === 'READ') {
return;
}
try {
await getMessageRead(item.id);
loadMessageHistoryList(position.value, currentResourceType.value);
} catch (error) {
console.log(error);
}
}
watch(
() => props.visible,
(val) => {

View File

@ -2,6 +2,7 @@ import { cloneDeep } from 'lodash-es';
import JSEncrypt from 'jsencrypt';
import { BatchActionQueryParams, MsTableColumnData } from '@/components/pure/ms-table/type';
import type { MsTreeNodeData } from '@/components/business/ms-tree/types';
import { BugEditCustomField, CustomFieldItem } from '@/models/bug-management';
@ -1043,3 +1044,12 @@ export function formatDuration(ms: number) {
export const operationWidth = (enWidth: number, zhWidth: number) =>
localStorage.getItem('MS-locale') === 'en-US' ? enWidth : zhWidth;
/**
*
* @param searchValue
* @param nodeData
*/
export function filterTreeNode(searchValue: string, nodeData: MsTreeNodeData, nameKey = 'name') {
return nodeData[nameKey].toLowerCase().includes(searchValue.toLowerCase());
}

View File

@ -354,6 +354,7 @@
threshold: 200,
},
}"
:filter-tree-node="filterTreeNode"
allow-search
>
<template #tree-slot-title="node">
@ -451,7 +452,7 @@
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import useUserStore from '@/store/modules/user';
import { filterTree, getGenerateId, parseQueryParams } from '@/utils';
import { filterTree, filterTreeNode, getGenerateId, parseQueryParams } from '@/utils';
import { scrollIntoView } from '@/utils/dom';
import { registerCatchSaveShortcut, removeCatchSaveShortcut } from '@/utils/event';
import { hasAllPermission, hasAnyPermission } from '@/utils/permission';

View File

@ -35,6 +35,7 @@
<a-form-item :label="t('apiTestDebug.requestModule')" class="mb-0">
<a-tree-select
v-model:modelValue="saveModalForm.moduleId"
:filter-tree-node="filterTreeNode"
:data="apiModuleTree"
:field-names="{ title: 'name', key: 'id', children: 'children' }"
:tree-props="{
@ -72,6 +73,7 @@
import { addCase, addDefinition, getModuleTreeOnlyModules } from '@/api/modules/api-test/management';
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import { filterTreeNode } from '@/utils';
import { AddApiCaseParams } from '@/models/apiTest/management';
import { RequestCaseStatus, RequestDefinitionStatus } from '@/enums/apiEnum';

View File

@ -48,6 +48,7 @@
:draggable="false"
allow-search
allow-clear
:filter-tree-node="filterTreeNode"
>
<template #tree-slot-title="node">
<a-tooltip :content="`${node.name}`" position="tl">
@ -252,6 +253,7 @@
class="w-[500px]"
:field-names="{ title: 'name', key: 'id', children: 'children' }"
allow-search
:filter-tree-node="filterTreeNode"
>
<template #tree-slot-title="node">
<a-tooltip :content="`${node.name}`" position="tl">
@ -361,7 +363,7 @@
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import useUserStore from '@/store/modules/user';
import { filterTree, TreeNode } from '@/utils';
import { filterTree, filterTreeNode, TreeNode } from '@/utils';
import type { ImportApiDefinitionParams, ImportApiDefinitionRequest } from '@/models/apiTest/management';
import type { ModuleTreeNode } from '@/models/common';

View File

@ -115,11 +115,12 @@
import { RequestParam } from '@/views/api-test/components/requestComposition/index.vue';
import { useI18n } from '@/hooks/useI18n';
import { filterTreeNode } from '@/utils';
import { ModuleTreeNode } from '@/models/common';
import { RequestDefinitionStatus } from '@/enums/apiEnum';
import type { FormInstance, TreeNodeData } from '@arco-design/web-vue';
import type { FormInstance } from '@arco-design/web-vue';
const props = defineProps<{
selectTree?: ModuleTreeNode[];
@ -136,10 +137,6 @@
}
}
function filterTreeNode(searchValue: string, nodeData: TreeNodeData) {
return (nodeData as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
defineExpose({
formRef,
});

View File

@ -25,6 +25,7 @@
threshold: 200,
},
}"
:filter-tree-node="filterTreeNode"
allow-search
@change="() => emit('change')"
>
@ -99,6 +100,7 @@
import apiStatus from '@/views/api-test/components/apiStatus.vue';
import { useI18n } from '@/hooks/useI18n';
import { filterTreeNode } from '@/utils';
import { Scenario, ScenarioDetail } from '@/models/apiTest/scenario';
import { ModuleTreeNode } from '@/models/common';

View File

@ -106,6 +106,7 @@
key: 'id',
children: 'children',
}"
:filter-tree-node="filterTreeNode"
:tree-props="{
virtualListProps: {
height: 200,
@ -357,7 +358,7 @@
import { useAppStore, useTableStore } from '@/store';
import useFeatureCaseStore from '@/store/modules/case/featureCase';
import useMinderStore from '@/store/modules/components/minder-editor';
import { characterLimit, findNodeByKey, findNodePathByKey, mapTree } from '@/utils';
import { characterLimit, filterTreeNode, findNodeByKey, findNodePathByKey, mapTree } from '@/utils';
import { hasAnyPermission } from '@/utils/permission';
import type {
@ -876,11 +877,11 @@
async function initTableParams() {
let moduleIds: string[] = [];
if (props.activeFolder && props.activeFolder !== 'all') {
moduleIds = [props.activeFolder];
if (props.activeFolder) {
const activeModuleIds = props.activeFolder === 'all' ? [] : [props.activeFolder];
const getAllChildren = await tableStore.getSubShow(TableKeyEnum.CASE_MANAGEMENT_TABLE);
if (getAllChildren) {
moduleIds = [props.activeFolder, ...props.offspringIds];
moduleIds = [...activeModuleIds, ...props.offspringIds];
}
}
@ -919,10 +920,6 @@
tableSelected.value = selectArr;
}
function filterTreeNode(searchValue: string, nodeValue: TreeNodeData) {
return (nodeValue as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
const caseLevelFields = ref<Record<string, any>>({});
const caseLevelList = computed(() => {

View File

@ -201,6 +201,7 @@
height: 200,
},
}"
:filter-tree-node="filterTreeNode"
>
<template #tree-slot-title="node">
<a-tooltip :content="`${node.name}`" position="tl">
@ -287,7 +288,7 @@
import useAppStore from '@/store/modules/app';
import useFeatureCaseStore from '@/store/modules/case/featureCase';
import useUserStore from '@/store/modules/user';
import { downloadByteFile, getGenerateId } from '@/utils';
import { downloadByteFile, filterTreeNode, getGenerateId } from '@/utils';
import type {
AssociatedList,

View File

@ -228,11 +228,6 @@
try {
await deleteCaseModuleTree(node.id);
initModules();
if (selectedNodeKeys.value[0] === node.id) {
selectedNodeKeys.value = ['all'];
emits('update:selectedKeys', selectedNodeKeys.value);
emits('caseNodeSelect', selectedNodeKeys.value, []);
}
emits('deleteNode');
Message.success(t('caseManagement.featureCase.deleteSuccess'));
} catch (error) {

View File

@ -443,7 +443,13 @@
}
function deleteNode() {
caseTableRef.value.initData();
nextTick(() => {
if (activeFolder.value !== 'all') {
setActiveFolder('all');
} else {
caseTableRef.value?.initData();
}
});
}
function dragUpdate() {

View File

@ -206,7 +206,7 @@
*/
import { onBeforeMount } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Message, SelectOptionData, TreeNodeData } from '@arco-design/web-vue';
import { Message, SelectOptionData } from '@arco-design/web-vue';
import MsAvatar from '@/components/pure/ms-avatar/index.vue';
import MsButton from '@/components/pure/ms-button/index.vue';
@ -225,9 +225,9 @@
} from '@/api/modules/case-management/caseReview';
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import { filterTreeNode } from '@/utils';
import type { BaseAssociateCaseRequest, ReviewPassRule } from '@/models/caseManagement/caseReview';
import { ModuleTreeNode } from '@/models/common';
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import type { FormInstance } from '@arco-design/web-vue';
@ -311,10 +311,6 @@
selectedAssociateCasesParams.value = { ...param };
}
function filterTreeNode(searchValue: string, nodeValue: TreeNodeData) {
return (nodeValue as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
function clearSelectedCases() {
selectedAssociateCasesParams.value = {
excludeIds: [],

View File

@ -128,12 +128,13 @@
:data="envTree"
class="w-full"
:tree-checkable="true"
:allow-search="true"
allow-search
:field-names="{
title: 'name',
key: 'id',
children: 'children',
}"
:filter-tree-node="filterTreeNode"
tree-checked-strategy="child"
:tree-props="{
virtualListProps: {
@ -232,7 +233,7 @@
import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store';
import useProjectEnvStore from '@/store/modules/setting/useProjectEnvStore';
import { getGenerateId } from '@/utils';
import { filterTreeNode, getGenerateId } from '@/utils';
import type { ModuleTreeNode } from '@/models/common';
import { HttpForm } from '@/models/projectManagement/environmental';

View File

@ -8,7 +8,7 @@
v-model:raw="innerSummary.summary"
v-model:filedIds="innerSummary.richTextTmpFileIds"
:upload-image="handleUploadImage"
:preview-url="PreviewEditorImageUrl"
:preview-url="ReportPlanPreviewImageUrl"
class="mt-[8px] w-full"
:editable="!!shareId"
/>
@ -39,7 +39,7 @@
import MsFormItemSub from '@/components/business/ms-form-item-sub/index.vue';
import { editorUploadFile } from '@/api/modules/test-plan/report';
import { PreviewEditorImageUrl } from '@/api/requrls/case-management/featureCase';
import { ReportPlanPreviewImageUrl } from '@/api/requrls/test-plan/report';
import { useI18n } from '@/hooks/useI18n';
import { hasAnyPermission } from '@/utils/permission';

View File

@ -208,11 +208,6 @@
try {
await deletePlanModuleTree(node.id);
initModules();
if (selectedNodeKeys.value[0] === node.id) {
selectedNodeKeys.value = ['all'];
emits('update:selectedKeys', selectedNodeKeys.value);
emits('planTreeNodeSelect', selectedNodeKeys.value, []);
}
emits('deleteNode');
Message.success(t('common.deleteSuccess'));
} catch (error) {
@ -359,15 +354,6 @@
};
});
watch(
() => props.activeFolder,
(val) => {
if (val === 'all') {
initModules();
}
}
);
/**
* 初始化模块文件数量
*/

View File

@ -137,7 +137,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { FormInstance, Message, SelectOptionData, TreeNodeData, ValidatedError } from '@arco-design/web-vue';
import { FormInstance, Message, SelectOptionData, ValidatedError } from '@arco-design/web-vue';
import { cloneDeep } from 'lodash-es';
import dayjs from 'dayjs';
@ -153,6 +153,7 @@
} from '@/api/modules/test-plan/testPlan';
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import { filterTreeNode } from '@/utils';
import { ModuleTreeNode } from '@/models/common';
import type { AddTestPlanParams, SwitchListModel } from '@/models/testPlan/testPlan';
@ -203,10 +204,6 @@
};
const form = ref<AddTestPlanParams>(cloneDeep(initForm));
function filterTreeNode(searchValue: string, nodeData: TreeNodeData) {
return (nodeData as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
const tempRange = ref<(Date | string | number)[]>(['00:00:00', '00:00:00']);
function makeLessNumbers(value: number, isSecond = false) {

View File

@ -228,12 +228,9 @@
*/
const rootModulesName = ref<string[]>([]);
const folderTree = ref<ModuleTreeNode[]>([]);
function setRootModules(treeNode: ModuleTreeNode[], isSetDefaultKey: boolean) {
function setRootModules(treeNode: ModuleTreeNode[]) {
folderTree.value = treeNode;
rootModulesName.value = treeNode.map((e) => e.name);
if (isSetDefaultKey) {
activeFolder.value = 'all';
}
}
const showPlanDrawer = ref<boolean>(false);
@ -274,7 +271,13 @@
}
function deleteNode() {
planTableRef.value?.fetchData();
nextTick(() => {
if (activeFolder.value !== 'all') {
setActiveFolder('all');
} else {
planTableRef.value?.fetchData();
}
});
}
function createTestPlan(type: string) {

View File

@ -61,7 +61,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import { FormInstance, Message, TreeNodeData } from '@arco-design/web-vue';
import { FormInstance, Message } from '@arco-design/web-vue';
import { cloneDeep } from 'lodash-es';
import MsTagsInput from '@/components/pure/ms-tags-input/index.vue';
@ -69,6 +69,7 @@
import { addTestPlan, getTestPlanDetail, updateTestPlan } from '@/api/modules/test-plan/testPlan';
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import { filterTreeNode } from '@/utils';
import { ModuleTreeNode } from '@/models/common';
import type { AddTestPlanParams } from '@/models/testPlan/testPlan';
@ -167,10 +168,6 @@
}
}
function filterTreeNode(searchValue: string, nodeData: TreeNodeData) {
return (nodeData as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
const okText = computed(() => {
return props.planGroupId ? t('common.update') : t('common.create');
});