fix: 保持工作流分类筛选与列表一致
- 合并分类与搜索条件,避免筛选状态相互覆盖 - 保存工作流后按当前条件刷新并同步左侧选中状态
This commit is contained in:
@@ -274,6 +274,8 @@ onMounted(() => {
|
||||
});
|
||||
const pageDataRef = ref();
|
||||
const saveDialog = ref();
|
||||
const selectedCategoryId = ref<number | string>('');
|
||||
const searchKeyword = ref('');
|
||||
const dictStore = useDictStore();
|
||||
const headerButtons = [
|
||||
{
|
||||
@@ -343,11 +345,18 @@ async function updateVisibilityScope(
|
||||
updatingScopeId.value = null;
|
||||
}
|
||||
}
|
||||
const handleSearch = (params: string) => {
|
||||
pageDataRef.value.setQuery({ title: params, isQueryOr: true });
|
||||
};
|
||||
function reset() {
|
||||
pageDataRef.value.setQuery({});
|
||||
function applyFilters() {
|
||||
pageDataRef.value?.setQuery({
|
||||
categoryId: selectedCategoryId.value || undefined,
|
||||
title: searchKeyword.value || undefined,
|
||||
});
|
||||
}
|
||||
function handleSearch(keyword: string) {
|
||||
searchKeyword.value = keyword;
|
||||
applyFilters();
|
||||
}
|
||||
function reloadCurrentList() {
|
||||
pageDataRef.value?.reload?.();
|
||||
}
|
||||
function showDialog(row: any, importMode = false) {
|
||||
saveDialog.value.openDialog({ ...row }, importMode);
|
||||
@@ -968,7 +977,8 @@ const formRules = computed(() => {
|
||||
});
|
||||
|
||||
function changeCategory(category: any) {
|
||||
pageDataRef.value.setQuery({ categoryId: category.id });
|
||||
selectedCategoryId.value = category?.id ?? '';
|
||||
applyFilters();
|
||||
}
|
||||
function showControlDialog(item: any) {
|
||||
formRef.value?.resetFields();
|
||||
@@ -1046,7 +1056,7 @@ function handleHeaderButtonClick(data: any) {
|
||||
|
||||
<template>
|
||||
<div class="flex h-full flex-col gap-6 p-6">
|
||||
<WorkflowModal ref="saveDialog" @reload="reset" />
|
||||
<WorkflowModal ref="saveDialog" @reload="reloadCurrentList" />
|
||||
<ElDialog
|
||||
v-model="apiInstructionVisible"
|
||||
:title="$t('aiWorkflow.apiInstruction')"
|
||||
@@ -1080,6 +1090,7 @@ function handleHeaderButtonClick(data: any) {
|
||||
<PageSide
|
||||
label-key="categoryName"
|
||||
value-key="id"
|
||||
:default-selected="selectedCategoryId"
|
||||
:menus="sideList"
|
||||
:control-btns="controlBtns"
|
||||
:footer-button="footerButton"
|
||||
|
||||
Reference in New Issue
Block a user