feature:表格导出支持配置limit order和where条件 (#1665)
* feature:导出功能可携带条件 * feature:组件增加导出入参 * 带条件导出Excel功能
This commit is contained in:
@@ -11,6 +11,10 @@ const props = defineProps({
|
||||
templateId: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
condition: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -22,7 +26,11 @@ const exportExcelFunc = async() => {
|
||||
return
|
||||
}
|
||||
const baseUrl = import.meta.env.VITE_BASE_API
|
||||
const url = `${baseUrl}/sysExportTemplate/exportExcel?templateID=${props.templateId}`
|
||||
const params = Object.entries(props.condition)
|
||||
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
||||
.join('&')
|
||||
const url = `${baseUrl}/sysExportTemplate/exportExcel?templateID=${props.templateId}${params ? '&' + params : ''}`
|
||||
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user