81 lines
1.8 KiB
Vue
81 lines
1.8 KiB
Vue
<!-- 搜索表单 -->
|
|
<template>
|
|
<a-space :size="10" style="flex-wrap: wrap">
|
|
<a-button type="primary" class="ele-btn-icon" @click="add">
|
|
<template #icon>
|
|
<PlusOutlined />
|
|
</template>
|
|
<span>添加</span>
|
|
</a-button>
|
|
<a-tree-select
|
|
allow-clear
|
|
:tree-data="navigationList"
|
|
tree-default-expand-all
|
|
style="width: 230px"
|
|
placeholder="请选择栏目"
|
|
:value="where.categoryId || undefined"
|
|
:dropdown-style="{ maxHeight: '360px', overflow: 'auto' }"
|
|
@update:value="(value?: number) => (where.categoryId = value)"
|
|
@change="onCategoryId"
|
|
/>
|
|
<a-button @click="reset">重置</a-button>
|
|
</a-space>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { PlusOutlined } from '@ant-design/icons-vue';
|
|
import type { GradeParam } from '@/api/user/grade/model';
|
|
import { watch } from 'vue';
|
|
import useSearch from "@/utils/use-search";
|
|
import type { ArticleParam } from "@/api/cms/article/model";
|
|
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
// 选中的角色
|
|
selection?: [];
|
|
navigationList?: Navigator[];
|
|
}>(),
|
|
{}
|
|
);
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'search', where?: GradeParam): void;
|
|
(e: 'add'): void;
|
|
(e: 'remove'): void;
|
|
(e: 'batchMove'): void;
|
|
}>();
|
|
|
|
// 新增
|
|
const add = () => {
|
|
emit('add');
|
|
};
|
|
|
|
// 表单数据
|
|
const { where, resetFields } = useSearch<ArticleParam>({
|
|
articleId: undefined,
|
|
navigationId: undefined,
|
|
categoryId: undefined,
|
|
merchantId: undefined,
|
|
status: undefined,
|
|
keywords: ''
|
|
});
|
|
|
|
// 按分类查询
|
|
const onCategoryId = (id: number) => {
|
|
where.categoryId = id;
|
|
emit('search', where);
|
|
};
|
|
|
|
/* 重置 */
|
|
const reset = () => {
|
|
resetFields();
|
|
type.value = '';
|
|
reload();
|
|
};
|
|
|
|
watch(
|
|
() => props.selection,
|
|
() => {}
|
|
);
|
|
</script>
|