perf: vxe
parent
725cc4e41b
commit
ac47638249
|
@ -131,12 +131,12 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => {
|
|||
}
|
||||
const searchSchemaItem = {
|
||||
// 默认为 input
|
||||
span: 8,
|
||||
folding: searchSchema.length > 2,
|
||||
itemRender: itemRender,
|
||||
...schemaItem.search,
|
||||
field: schemaItem.field,
|
||||
title: schemaItem.search?.title || schemaItem.title
|
||||
title: schemaItem.search?.title || schemaItem.title,
|
||||
span: 8
|
||||
}
|
||||
// 删除不必要的字段
|
||||
delete searchSchemaItem.show
|
||||
|
|
|
@ -85,7 +85,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
|||
props: { result: 'list', total: 'total' },
|
||||
ajax: {
|
||||
query: ({ page, form }) => {
|
||||
const queryParams = Object.assign({}, form)
|
||||
const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form)))
|
||||
queryParams.pageSize = page.pageSize
|
||||
queryParams.pageNo = page.currentPage
|
||||
gridOptions.loading = false
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { ElDatePicker } from 'element-plus'
|
||||
import { VXETable } from 'vxe-table'
|
||||
|
||||
// 日期区间选择渲染
|
||||
VXETable.renderer.add('XDataTimePicker', {
|
||||
// 默认显示模板
|
||||
renderItemContent(renderOpts, params) {
|
||||
const { t } = useI18n()
|
||||
const { data, field } = params
|
||||
const { content } = renderOpts
|
||||
return (
|
||||
<ElDatePicker
|
||||
v-model={data[field]}
|
||||
type={content ? (content as any) : 'datetimerange'}
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
range-separator="-"
|
||||
start-placeholder={t('common.startTimeText')}
|
||||
end-placeholder={t('common.endTimeText')}
|
||||
></ElDatePicker>
|
||||
)
|
||||
}
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
import { DictTag } from '@/components/DictTag'
|
||||
import { VXETable } from 'vxe-table'
|
||||
|
||||
// 创建一个简单的超链接渲染
|
||||
// 字典渲染
|
||||
VXETable.renderer.add('XDict', {
|
||||
// 默认显示模板
|
||||
renderDefault(renderOpts, params) {
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
import './dataTimePicker'
|
||||
import './dict'
|
||||
|
|
|
@ -48,6 +48,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
|||
formatter: 'formatDate',
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
search: {
|
||||
show: true,
|
||||
itemRender: {
|
||||
name: 'XDataTimePicker'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue