重构小程序端管理模块
This commit is contained in:
73
src/views/cms/mpDesign/components/search.vue
Normal file
73
src/views/cms/mpDesign/components/search.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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>
|
||||
<SelectDict
|
||||
dict-code="mpGroup"
|
||||
:placeholder="`选择分组`"
|
||||
v-model:value="where.groupName"
|
||||
@done="chooseGroupId"
|
||||
/>
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
import { DictData } from '@/api/system/dict-data/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MpMenuParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<MpMenu>({
|
||||
parentId: undefined,
|
||||
groupName: ''
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
where.parentId = undefined;
|
||||
handleSearch();
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
const chooseGroupId = (item: DictData) => {
|
||||
where.parentId = item.dictDataId;
|
||||
where.groupName = item.dictDataName;
|
||||
handleSearch();
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
Reference in New Issue
Block a user