fix: 高级搜索清空&无项目组件跳转
This commit is contained in:
parent
48a1e03477
commit
fb0b297234
|
@ -79,7 +79,9 @@
|
||||||
const res = await getProjectInfo(appStore.currentProjectId);
|
const res = await getProjectInfo(appStore.currentProjectId);
|
||||||
if (res && (res.deleted || !res.enable)) {
|
if (res && (res.deleted || !res.enable)) {
|
||||||
// 如果项目被删除或者被禁用,跳转到无项目页面
|
// 如果项目被删除或者被禁用,跳转到无项目页面
|
||||||
router.push(NO_PROJECT_ROUTE_NAME);
|
router.push({
|
||||||
|
name: NO_PROJECT_ROUTE_NAME,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appStore.setCurrentMenuConfig(res?.moduleIds || []);
|
appStore.setCurrentMenuConfig(res?.moduleIds || []);
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
<slot name="left"></slot>
|
<slot name="left"></slot>
|
||||||
<div class="flex flex-row gap-[8px]">
|
<div class="flex flex-row gap-[8px]">
|
||||||
<a-input-search
|
<a-input-search
|
||||||
v-model="innerKeyword"
|
v-model:modelValue="innerKeyword"
|
||||||
size="small"
|
size="small"
|
||||||
:placeholder="props.searchPlaceholder"
|
:placeholder="props.searchPlaceholder"
|
||||||
class="w-[240px]"
|
class="w-[240px]"
|
||||||
allow-clear
|
allow-clear
|
||||||
@press-enter="emit('keywordSearch', innerKeyword, filterResult)"
|
@press-enter="emit('keywordSearch', innerKeyword, filterResult)"
|
||||||
@search="emit('keywordSearch', innerKeyword, filterResult)"
|
@search="emit('keywordSearch', innerKeyword, filterResult)"
|
||||||
@clear="emit('keywordSearch', innerKeyword, filterResult)"
|
@clear="handleClear"
|
||||||
></a-input-search>
|
></a-input-search>
|
||||||
<MsTag
|
<MsTag
|
||||||
:type="visible ? 'primary' : 'default'"
|
:type="visible ? 'primary' : 'default'"
|
||||||
|
@ -49,8 +49,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useVModel } from '@vueuse/core';
|
|
||||||
|
|
||||||
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
|
import MsIcon from '@/components/pure/ms-icon-font/index.vue';
|
||||||
import MsTag from '../ms-tag/ms-tag.vue';
|
import MsTag from '../ms-tag/ms-tag.vue';
|
||||||
import FilterForm from './FilterForm.vue';
|
import FilterForm from './FilterForm.vue';
|
||||||
|
@ -64,11 +62,9 @@
|
||||||
filterConfigList: FilterFormItem[]; // 系统字段
|
filterConfigList: FilterFormItem[]; // 系统字段
|
||||||
customFieldsConfigList?: FilterFormItem[]; // 自定义字段
|
customFieldsConfigList?: FilterFormItem[]; // 自定义字段
|
||||||
searchPlaceholder?: string;
|
searchPlaceholder?: string;
|
||||||
keyword?: string;
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:keyword', value: string): void;
|
|
||||||
(e: 'keywordSearch', value: string | undefined, combine: FilterResult): void; // innerKeyword 搜索 TODO:可以去除,父组件通过 v-model:keyword 获取关键字
|
(e: 'keywordSearch', value: string | undefined, combine: FilterResult): void; // innerKeyword 搜索 TODO:可以去除,父组件通过 v-model:keyword 获取关键字
|
||||||
(e: 'advSearch', value: FilterResult): void; // 高级搜索
|
(e: 'advSearch', value: FilterResult): void; // 高级搜索
|
||||||
(e: 'dataIndexChange', value: string): void; // 高级搜索选项变更
|
(e: 'dataIndexChange', value: string): void; // 高级搜索选项变更
|
||||||
|
@ -76,7 +72,7 @@
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const innerKeyword = useVModel(props, 'keyword', emit);
|
const innerKeyword = defineModel<string>('keyword', { default: '' });
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const filterCount = ref(0);
|
const filterCount = ref(0);
|
||||||
const defaultFilterResult: FilterResult = { accordBelow: 'AND', combine: {} };
|
const defaultFilterResult: FilterResult = { accordBelow: 'AND', combine: {} };
|
||||||
|
@ -100,6 +96,11 @@
|
||||||
emit('dataIndexChange', dataIndex);
|
emit('dataIndexChange', dataIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleClear = () => {
|
||||||
|
innerKeyword.value = '';
|
||||||
|
emit('keywordSearch', '', filterResult.value);
|
||||||
|
};
|
||||||
|
|
||||||
const handleOpenFilter = () => {
|
const handleOpenFilter = () => {
|
||||||
visible.value = !visible.value;
|
visible.value = !visible.value;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<MsCard simple>
|
<MsCard simple>
|
||||||
<MsAdvanceFilter
|
<MsAdvanceFilter
|
||||||
|
v-model:keyword="keyword"
|
||||||
:filter-config-list="filterConfigList"
|
:filter-config-list="filterConfigList"
|
||||||
:row-count="filterRowCount"
|
:row-count="filterRowCount"
|
||||||
@keyword-search="fetchData"
|
@keyword-search="fetchData"
|
||||||
|
@ -173,7 +174,7 @@
|
||||||
|
|
||||||
import { BugEditCustomField, BugListItem } from '@/models/bug-management';
|
import { BugEditCustomField, BugListItem } from '@/models/bug-management';
|
||||||
import { RouteEnum } from '@/enums/routeEnum';
|
import { RouteEnum } from '@/enums/routeEnum';
|
||||||
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
|
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||||
|
|
||||||
import { useRequest } from 'ahooks-vue';
|
import { useRequest } from 'ahooks-vue';
|
||||||
|
|
||||||
|
@ -278,7 +279,6 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'bugManagement.bugName',
|
title: 'bugManagement.bugName',
|
||||||
editType: ColumnEditTypeEnum.INPUT,
|
|
||||||
dataIndex: 'title',
|
dataIndex: 'title',
|
||||||
width: 300,
|
width: 300,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
|
@ -409,7 +409,6 @@
|
||||||
|
|
||||||
const fetchData = async (v = '') => {
|
const fetchData = async (v = '') => {
|
||||||
setKeyword(v);
|
setKeyword(v);
|
||||||
keyword.value = v;
|
|
||||||
await loadList();
|
await loadList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<MsCard simple>
|
<MsCard simple>
|
||||||
<MsAdvanceFilter
|
<MsAdvanceFilter
|
||||||
|
v-model:keyword="keyword"
|
||||||
:search-placeholder="t('bugManagement.recycle.searchPlaceholder')"
|
:search-placeholder="t('bugManagement.recycle.searchPlaceholder')"
|
||||||
:filter-config-list="filterConfigList"
|
:filter-config-list="filterConfigList"
|
||||||
:row-count="filterRowCount"
|
:row-count="filterRowCount"
|
||||||
|
@ -65,6 +66,7 @@
|
||||||
const projectId = computed(() => appStore.currentProjectId);
|
const projectId = computed(() => appStore.currentProjectId);
|
||||||
const filterVisible = ref(false);
|
const filterVisible = ref(false);
|
||||||
const filterRowCount = ref(0);
|
const filterRowCount = ref(0);
|
||||||
|
const keyword = ref('');
|
||||||
const filterConfigList = reactive<FilterFormItem[]>([
|
const filterConfigList = reactive<FilterFormItem[]>([
|
||||||
{
|
{
|
||||||
title: 'bugManagement.ID',
|
title: 'bugManagement.ID',
|
||||||
|
|
Loading…
Reference in New Issue