We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vben Admin V5
在vxe-table中的searchForm中,设置formOptions为 submitOnChange: true 时,RangePicker fieldMappingTime 不生效。submitOnChange: false 时,手动查询生成的params正常。
submitOnChange: true时,没有经过handleRangeTimeValue方法处理,生成的url: http://localhost:5555/api/table/list?page=1&pageSize=20&category=1&createTime[]=Thu, 02 Jan 2025 09:57:23 GMT&createTime[]=Fri, 31 Jan 2025 09:57:23 GMT
submitOnChange: true
http://localhost:5555/api/table/list?page=1&pageSize=20&category=1&createTime[]=Thu, 02 Jan 2025 09:57:23 GMT&createTime[]=Fri, 31 Jan 2025 09:57:23 GMT
submitOnChange: false时,生成的url: http://localhost:5555/api/table/list?page=1&pageSize=20&category=1&startTime=2025-01-02&endTime=2025-01-31
submitOnChange: false
http://localhost:5555/api/table/list?page=1&pageSize=20&category=1&startTime=2025-01-02&endTime=2025-01-31
复现代码,将 /playground/src/views/examples/vxe-table/form.vue 最后的一列 DatePicker改为 RangePicker,并在 formOptions中添加属性 fieldMappingTime: [['createTime', ['startTime', 'endTime'], 'YYYY-MM-DD']]
/playground/src/views/examples/vxe-table/form.vue
DatePicker
RangePicker
fieldMappingTime: [['createTime', ['startTime', 'endTime'], 'YYYY-MM-DD']]
完整代码如下:
<script lang="ts" setup> import type { VbenFormProps } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { Page } from '@vben/common-ui'; import { message } from 'ant-design-vue'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { getExampleTableApi } from '#/api'; interface RowType { category: string; color: string; id: string; price: string; productName: string; releaseDate: string; } const formOptions: VbenFormProps = { // 默认展开 collapsed: false, fieldMappingTime: [['createTime', ['startTime', 'endTime'], 'YYYY-MM-DD']], schema: [ { component: 'Input', defaultValue: '1', fieldName: 'category', label: 'Category', }, { component: 'Input', fieldName: 'productName', label: 'ProductName', }, { component: 'Input', fieldName: 'price', label: 'Price', }, { component: 'Select', componentProps: { allowClear: true, options: [ { label: 'Color1', value: '1', }, { label: 'Color2', value: '2', }, ], placeholder: '请选择', }, fieldName: 'color', label: 'Color', }, { component: 'RangePicker', fieldName: 'createTime', label: 'Date', }, ], // 控制表单是否显示折叠按钮 showCollapseButton: true, // 是否在字段值改变时提交表单 submitOnChange: true, // 按下回车时是否提交表单 submitOnEnter: false, }; const gridOptions: VxeTableGridOptions<RowType> = { checkboxConfig: { highlight: true, labelField: 'name', }, columns: [ { title: '序号', type: 'seq', width: 50 }, { align: 'left', title: 'Name', type: 'checkbox', width: 100 }, { field: 'category', title: 'Category' }, { field: 'color', title: 'Color' }, { field: 'productName', title: 'Product Name' }, { field: 'price', title: 'Price' }, { field: 'releaseDate', formatter: 'formatDateTime', title: 'Date' }, ], exportConfig: {}, height: 'auto', keepSource: true, pagerConfig: {}, proxyConfig: { ajax: { query: async ({ page }, formValues) => { message.success(`Query params: ${JSON.stringify(formValues)}`); return await getExampleTableApi({ page: page.currentPage, pageSize: page.pageSize, ...formValues, }); }, }, }, toolbarConfig: { custom: true, export: true, refresh: true, resizable: true, search: true, zoom: true, }, }; const [Grid] = useVbenVxeGrid({ formOptions, gridOptions, }); </script> <template> <Page auto-content-height> <Grid /> </Page> </template>
no output
No response
The text was updated successfully, but these errors were encountered:
fieldMappingTime
Successfully merging a pull request may close this issue.
Version
Vben Admin V5
Describe the bug?
在vxe-table中的searchForm中,设置formOptions为 submitOnChange: true 时,RangePicker fieldMappingTime 不生效。submitOnChange: false 时,手动查询生成的params正常。
submitOnChange: true
时,没有经过handleRangeTimeValue方法处理,生成的url:http://localhost:5555/api/table/list?page=1&pageSize=20&category=1&createTime[]=Thu, 02 Jan 2025 09:57:23 GMT&createTime[]=Fri, 31 Jan 2025 09:57:23 GMT
submitOnChange: false
时,生成的url:http://localhost:5555/api/table/list?page=1&pageSize=20&category=1&startTime=2025-01-02&endTime=2025-01-31
Reproduction
复现代码,将
/playground/src/views/examples/vxe-table/form.vue
最后的一列DatePicker
改为RangePicker
,并在 formOptions中添加属性fieldMappingTime: [['createTime', ['startTime', 'endTime'], 'YYYY-MM-DD']]
完整代码如下:
System Info
Relevant log output
No response
Validations
The text was updated successfully, but these errors were encountered: