fix(用例管理): 修复用例管理模块下拉框查询无数据问题

--bug=1040015 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001040015
This commit is contained in:
guoyuqi 2024-04-24 17:25:51 +08:00 committed by 刘瑞斌
parent 2ed4628d04
commit cc22096cd4
3 changed files with 21 additions and 4 deletions

View File

@ -169,6 +169,7 @@
:data="caseTree"
class="w-full"
:allow-search="true"
:filter-tree-node="filterTreeNode"
:field-names="{
title: 'name',
key: 'id',
@ -247,7 +248,7 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Message } from '@arco-design/web-vue';
import { Message, TreeNodeData } from '@arco-design/web-vue';
import dayjs from 'dayjs';
import MsButton from '@/components/pure/ms-button/index.vue';
@ -561,6 +562,10 @@
tabDetailRef.value.handleOK();
}
function filterTreeNode(searchValue: string, nodeValue: TreeNodeData) {
return (nodeValue as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
function getTotal(key: string) {
switch (key) {
case 'detail':

View File

@ -224,7 +224,7 @@
<template #moduleId="{ record }">
<a-tree-select
v-if="record.showModuleTree"
v-model="record.moduleId"
v-model:modelValue="record.moduleId"
:data="caseTreeData"
:allow-search="true"
:field-names="{
@ -238,6 +238,7 @@
},
}"
size="mini"
:filter-tree-node="filterTreeNode"
@click.stop
@change="(value) => handleChangeModule(record, value)"
>
@ -405,7 +406,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Message, TableChangeExtra, TableData } from '@arco-design/web-vue';
import { Message, TableChangeExtra, TableData, TreeNodeData } from '@arco-design/web-vue';
import { CustomTypeMaps, MsAdvanceFilter } from '@/components/pure/ms-advance-filter';
import { FilterFormItem, FilterResult, FilterType } from '@/components/pure/ms-advance-filter/type';
@ -460,6 +461,7 @@
DragCase,
} from '@/models/caseManagement/featureCase';
import type { TableQueryParams } from '@/models/common';
import { ModuleTreeNode } from '@/models/common';
import { LastExecuteResults } from '@/enums/caseEnum';
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
@ -995,6 +997,10 @@
tableSelected.value = selectArr;
}
function filterTreeNode(searchValue: string, nodeValue: TreeNodeData) {
return (nodeValue as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
const searchParams = ref<TableQueryParams>({
projectId: currentProjectId.value,
moduleIds: [],

View File

@ -33,6 +33,7 @@
:field-names="{ title: 'name', key: 'id', children: 'children' }"
:loading="moduleLoading"
allow-search
:filter-tree-node="filterTreeNode"
>
<template #tree-slot-title="node">
<a-tooltip :content="`${node.name}`" position="tl">
@ -205,7 +206,7 @@
*/
import { onBeforeMount } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Message, SelectOptionData } from '@arco-design/web-vue';
import { Message, SelectOptionData, TreeNodeData } from '@arco-design/web-vue';
import MsAvatar from '@/components/pure/ms-avatar/index.vue';
import MsButton from '@/components/pure/ms-button/index.vue';
@ -226,6 +227,7 @@
import useAppStore from '@/store/modules/app';
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';
@ -309,6 +311,10 @@
selectedAssociateCasesParams.value = { ...param };
}
function filterTreeNode(searchValue: string, nodeValue: TreeNodeData) {
return (nodeValue as ModuleTreeNode).name.toLowerCase().indexOf(searchValue.toLowerCase()) > -1;
}
function clearSelectedCases() {
selectedAssociateCasesParams.value = {
excludeIds: [],