/admin/content/list 페이징 처리와 검색 조건 기능 추가

This commit is contained in:
이진기
2024-11-27 16:23:07 +09:00
parent 40a1c2740d
commit f786df1d9b
19 changed files with 449 additions and 54 deletions

View File

@@ -0,0 +1,40 @@
<script setup lang="ts">
import type { GridCodeType } from '~/types';
const value = defineModel<string>({ default: '' });
const props = defineProps<{
options: GridCodeType[];
className?: string;
selectType?: 'SELECT' | 'ALL';
isLoading?: boolean;
}>();
const selectOptions = computed(() => {
if (props.selectType === 'REQUIRED') {
return [{ label: '선택', value: '' }, ...props.options];
}
if (props.selectType === 'ALL') {
return [{ label: '전체', value: '' }, ...props.options];
}
return props.options;
});
const emit = defineEmits(['change']);
const change = () => {
emit('change');
};
</script>
<template>
<a-select
:class="className"
:options="selectOptions"
:loading="isLoading"
v-model:value="value"
@change="change"
/>
</template>

View File

@@ -0,0 +1,29 @@
<script setup lang="ts">
const props = defineProps<{
className?: string;
selectType?: 'SELECT' | 'ALL';
}>();
const commonCodeStore = useCommonCodeStore();
const value = defineModel<string>('');
const { data, isLoading } = useQuery({
queryKey: ['INST_CODE_LIST'],
queryFn: async () => {
return await commonCodeStore.searchInstCodeList();
},
staleTime: 60 * 1000,
refetchOnWindowFocus: false,
refetchOnMount: false
});
</script>
<template>
<common-default-select-code
v-if="!isLoading"
:class-name="className"
:select-type="selectType"
:options="data"
v-model="value"
/>
</template>