fix: 高级搜索清空&无项目组件跳转

This commit is contained in:
RubyLiu 2024-02-05 16:19:52 +08:00 committed by Craftsman
parent 48a1e03477
commit fb0b297234
4 changed files with 15 additions and 11 deletions

View File

@ -79,7 +79,9 @@
const res = await getProjectInfo(appStore.currentProjectId);
if (res && (res.deleted || !res.enable)) {
//
router.push(NO_PROJECT_ROUTE_NAME);
router.push({
name: NO_PROJECT_ROUTE_NAME,
});
return;
}
appStore.setCurrentMenuConfig(res?.moduleIds || []);

View File

@ -3,14 +3,14 @@
<slot name="left"></slot>
<div class="flex flex-row gap-[8px]">
<a-input-search
v-model="innerKeyword"
v-model:modelValue="innerKeyword"
size="small"
:placeholder="props.searchPlaceholder"
class="w-[240px]"
allow-clear
@press-enter="emit('keywordSearch', innerKeyword, filterResult)"
@search="emit('keywordSearch', innerKeyword, filterResult)"
@clear="emit('keywordSearch', innerKeyword, filterResult)"
@clear="handleClear"
></a-input-search>
<MsTag
:type="visible ? 'primary' : 'default'"
@ -49,8 +49,6 @@
</template>
<script setup lang="ts">
import { useVModel } from '@vueuse/core';
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
import MsTag from '../ms-tag/ms-tag.vue';
import FilterForm from './FilterForm.vue';
@ -64,11 +62,9 @@
filterConfigList: FilterFormItem[]; //
customFieldsConfigList?: FilterFormItem[]; //
searchPlaceholder?: string;
keyword?: string;
}>();
const emit = defineEmits<{
(e: 'update:keyword', value: string): void;
(e: 'keywordSearch', value: string | undefined, combine: FilterResult): void; // innerKeyword TODO: v-model:keyword
(e: 'advSearch', value: FilterResult): void; //
(e: 'dataIndexChange', value: string): void; //
@ -76,7 +72,7 @@
}>();
const { t } = useI18n();
const innerKeyword = useVModel(props, 'keyword', emit);
const innerKeyword = defineModel<string>('keyword', { default: '' });
const visible = ref(false);
const filterCount = ref(0);
const defaultFilterResult: FilterResult = { accordBelow: 'AND', combine: {} };
@ -100,6 +96,11 @@
emit('dataIndexChange', dataIndex);
};
const handleClear = () => {
innerKeyword.value = '';
emit('keywordSearch', '', filterResult.value);
};
const handleOpenFilter = () => {
visible.value = !visible.value;
};

View File

@ -1,6 +1,7 @@
<template>
<MsCard simple>
<MsAdvanceFilter
v-model:keyword="keyword"
:filter-config-list="filterConfigList"
:row-count="filterRowCount"
@keyword-search="fetchData"
@ -173,7 +174,7 @@
import { BugEditCustomField, BugListItem } from '@/models/bug-management';
import { RouteEnum } from '@/enums/routeEnum';
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
import { TableKeyEnum } from '@/enums/tableEnum';
import { useRequest } from 'ahooks-vue';
@ -278,7 +279,6 @@
},
{
title: 'bugManagement.bugName',
editType: ColumnEditTypeEnum.INPUT,
dataIndex: 'title',
width: 300,
showTooltip: true,
@ -409,7 +409,6 @@
const fetchData = async (v = '') => {
setKeyword(v);
keyword.value = v;
await loadList();
};

View File

@ -1,6 +1,7 @@
<template>
<MsCard simple>
<MsAdvanceFilter
v-model:keyword="keyword"
:search-placeholder="t('bugManagement.recycle.searchPlaceholder')"
:filter-config-list="filterConfigList"
:row-count="filterRowCount"
@ -65,6 +66,7 @@
const projectId = computed(() => appStore.currentProjectId);
const filterVisible = ref(false);
const filterRowCount = ref(0);
const keyword = ref('');
const filterConfigList = reactive<FilterFormItem[]>([
{
title: 'bugManagement.ID',