mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-10-16 05:35:36 +00:00
增加表格导入,增加导入模板下载,修复日志中间件的截断bug。
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="download"
|
||||
@click="exportTemplate"
|
||||
>下载模板</el-button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
templateId: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const exportTemplate = async() => {
|
||||
if (props.templateId === '') {
|
||||
ElMessage.error('组件未设置模板ID')
|
||||
return
|
||||
}
|
||||
const baseUrl = import.meta.env.VITE_BASE_API
|
||||
const url = `${baseUrl}/sysExportTemplate/exportTemplate?templateID=${props.templateId}`
|
||||
window.open(url, '_blank')
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<el-upload
|
||||
:action="url"
|
||||
:show-file-list="false"
|
||||
:on-success="handleSuccess"
|
||||
:multiple="false"
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="upload"
|
||||
>导入</el-button>
|
||||
</el-upload>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const baseUrl = import.meta.env.VITE_BASE_API
|
||||
|
||||
const props = defineProps({
|
||||
templateId: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
const url = `${baseUrl}/sysExportTemplate/importExcel?templateID=${props.templateId}`
|
||||
|
||||
const handleSuccess = (res) => {
|
||||
if (res.code === 200) {
|
||||
ElMessage.success('导入成功')
|
||||
} else {
|
||||
ElMessage.error(res.msg)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user