fix: 高级搜索清空&无项目组件跳转
This commit is contained in:
parent
48a1e03477
commit
fb0b297234
|
@ -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 || []);
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue