-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
188 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<script setup lang="ts"> | ||
import { RecordSearchItem } from '~/types' | ||
const props = defineProps({ | ||
searchFormList: { | ||
type: Array<RecordSearchItem>, | ||
default: () => [], | ||
}, | ||
}) | ||
const emit = defineEmits(['update:searchFormList', 'search']) | ||
const searchForm = ref(props.searchFormList) | ||
watch(searchForm, (newValue) => { | ||
emit('update:searchFormList', newValue) | ||
}, { deep: true }) | ||
</script> | ||
|
||
<template> | ||
<NForm | ||
label-placement="left" | ||
label-width="auto" | ||
> | ||
<NFormItem | ||
v-for="search in searchForm" | ||
:key="search.key" | ||
:label="search.label" | ||
> | ||
<NInput | ||
v-if="search.type === 'input'" | ||
v-model:value="search.value" | ||
:placeholder="search.placeholder" | ||
/> | ||
<NSelect | ||
v-else-if="search.type === 'select'" | ||
v-model:value="search.value" | ||
:placeholder="search.placeholder" | ||
:options="search.options" | ||
/> | ||
<NDatePicker | ||
v-else-if="search.type === 'date'" | ||
v-model:formatted-value="search.value" | ||
type="date" | ||
class="w-full" | ||
:placeholder="search.placeholder" | ||
/> | ||
</NFormItem> | ||
<NFormItem> | ||
<NButton | ||
type="primary" | ||
class="px-6" | ||
@click="$emit('search')" | ||
> | ||
搜索 | ||
</NButton> | ||
</NFormItem> | ||
</NForm> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { DataTableColumn, PaginationProps, VAdmireTableSize } from 'naive-ui' | ||
import { RowData } from 'naive-ui/es/data-table/src/interface' | ||
|
||
export interface BaseTableProps { | ||
headers: Array<DataTableColumn> | ||
data: RowData[] | ||
border?: boolean // 表格有无边框 | ||
singleColumn?: boolean // 表格有无行分割线 | ||
singleLine?: boolean // 表格有无列分割线 | ||
size?: VAdmireTableSize // 表格尺寸大小 | ||
striped?: boolean // 表格条纹渲染 | ||
maxHeight?: number // 表格最大高度 | ||
minHeight?: number // 表格最小高度 | ||
loading?: boolean // 表格加载状态 | ||
pagination?: PaginationProps // 表格分页 | ||
rowKey?: string // 表格行选中所绑定的Key | ||
searchValue?: string // 搜索框关键词 | ||
scrollX?: number // 表格横向宽度 | ||
isEnableVirtualScroll?: boolean // 是否开启虚拟滚动 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface BaseTableHandleProps { | ||
value: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { SelectMixedOption } from 'naive-ui/es/select/src/interface' | ||
|
||
export interface RecordSearchItem { | ||
label: string | ||
key: string | ||
type: 'input' | 'select' | 'date' | ||
placeholder: string | ||
value: any | ||
options?: SelectMixedOption[] | ||
[key: string]: any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from '.' | ||
export * from './components/BaseTable' | ||
export * from './components/BaseTableHandle' | ||
export * from './components/BaseTableSearch' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters