优化小程序菜单管理功能

This commit is contained in:
gxwebsoft
2024-06-01 02:45:33 +08:00
parent 4bae8599e1
commit e3fb9ba283
36 changed files with 2161 additions and 430 deletions

View File

@@ -0,0 +1,104 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<DictSelect
dict-code="ICType"
:placeholder="`IC卡类型`"
style="width: 120px"
v-model:value="where.typeName"
@done="onType"
/>
<a-input-search
allow-clear
placeholder="请输入关键词"
v-model:value="where.keywords"
@pressEnter="search"
@search="search"
>
<template #addonBefore>
<a-select v-model:value="type" style="width: 100px; margin: -5px -12px">
<a-select-option value="userId">用户ID</a-select-option>
<a-select-option value="username">真实姓名</a-select-option>
<a-select-option value="phone">手机号</a-select-option>
<a-select-option value="cardNum">IC卡数字</a-select-option>
</a-select>
</template>
</a-input-search>
<a-button @click="reset">重置</a-button>
</a-space>
</template>
<script lang="ts" setup>
import { ref, watch } from 'vue';
import useSearch from '@/utils/use-search';
import { UserCardParam } from '@/api/booking/userCard/model';
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
}>(),
{}
);
const emit = defineEmits<{
(e: 'search', where?: UserCardParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'batchMove'): void;
}>();
const type = ref('phone');
// 新增
const add = () => {
emit('add');
};
// 表单数据
const { where, resetFields } = useSearch<UserCardParam>({
type: undefined,
userId: undefined,
phone: undefined,
keywords: undefined
});
const search = () => {
if (type.value == 'userId') {
where.userId = Number(where.keywords);
where.keywords = undefined;
emit('search', where);
}
if (type.value == 'username') {
where.username = where.keywords;
where.keywords = undefined;
emit('search', where);
}
if (type.value == 'phone') {
where.phone = where.keywords;
where.keywords = undefined;
emit('search', where);
}
if (type.value == 'cardNum') {
where.cardNum = where.keywords;
where.keywords = undefined;
emit('search', where);
}
// emit('search', where);
};
/* 重置 */
const reset = () => {
resetFields();
search();
};
const onType = (item: any) => {
where.type = item.key;
emit('search', where);
};
watch(
() => props.selection,
() => {}
);
</script>