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
2.8.0
22.14.0
1.24.2
可以
当前excel的导出,会导出全部数据。不能根据查询条件,或者表格内已勾选的数据导出
前端 web\src\components\exportExcel\exportExcel.vue
<script setup> // ... 省略部分代码 ... const props = defineProps({ // ... 省略已有props ... selectedIds: { type: Array, default: () => [] } }) // ... 省略部分代码 ... const exportExcelFunc = async () => { // ... 省略部分代码 ... const paramsCopy = JSON.parse(JSON.stringify(props.condition)) // ... 省略已有参数处理 ... if (props.selectedIds && props.selectedIds.length > 0) { paramsCopy.selectedIds = props.selectedIds.join(',') } // ... 省略部分代码 ... } </script>
后端
server\service\system\sys_export_template.go func (sysExportTemplateService *SysExportTemplateService) ExportExcel(templateID string, values url.Values) (file *bytes.Buffer, name string, err error) { // ... 省略部分代码 ... db = db.Select(selects).Table(template.TableName) // 新增:处理 selectedIds 参数 selectedIdsStr := values.Get("selectedIds") if selectedIdsStr != "" { ids := strings.Split(selectedIdsStr, ",") db = db.Where("id IN ?", ids) } else { // 处理软删除过滤和条件(原有逻辑) // ... 原有代码 ... } // ... 省略后续代码 ... }
父组件使用时
<ExportExcel template-id="WarehouseManag_ApplicationsItems" :selected-ids="multipleSelection.map(item => item.ID)" />
The text was updated successfully, but these errors were encountered:
如上修改以后不需要在意是否支持软删除数据过滤
Sorry, something went wrong.
此改动存在问题,当用户主键不为id时,此改动会导致模板报错。
查询条件可以通过模板配置支持
我也发现同样的问题, 过滤条件会被忽略掉 params参数没有被正确解析为url.Values func (sysExportTemplateService *SysExportTemplateService) ExportExcel(templateID string, params url.Values) (file *bytes.Buffer, name string, err error) { // ... 原有代码 ... if len(template.JoinTemplate) > 0 { for _, join := range template.JoinTemplate { db = db.Joins(join.JOINS + " " + join.Table + " ON " + join.ON) } } db = db.Select(selects).Table(template.TableName) filterDeleted := false
// 新增:处理 开始 valuesStr := params.Get("params")
values, err := url.ParseQuery(valuesStr) if err != nil { return nil, "", err }
// 新增:处理 结束
// ... 原有代码 ...
}
SliverHorn
songzhibin97
bypanghu
pixelmaxQm
No branches or pull requests
gin-vue-admin 版本
2.8.0
Node 版本
22.14.0
Golang 版本
1.24.2
是否依旧存在
可以
bug描述
当前excel的导出,会导出全部数据。不能根据查询条件,或者表格内已勾选的数据导出
修改建议
前端
web\src\components\exportExcel\exportExcel.vue
后端
父组件使用时
<ExportExcel template-id="WarehouseManag_ApplicationsItems" :selected-ids="multipleSelection.map(item => item.ID)" />
The text was updated successfully, but these errors were encountered: