GicImportTemplate
内置导入按钮,提供了模板下载,文件上传
基本用法

示例
vue
<template>
<GicImportTemplate
:params="btn"
@import-success="importSuccess"
@import-fulfill="importFulfill"
@download-template="downloadTemplate"
></GicImportTemplate>
</template>
<script setup lang="ts">
import { GicImportTemplate } from 'ctj-ui-next'
import { ref } from 'vue'
const btn = reactive<any>({
title: '导入',
name: '导入',
icon: 'innerImport',
reamrk:'templatePath=/public/templateDownload?templateName=财政指标导入、导出模板;downTemText=下载财政指标导入模板;importTips=[请使用最新版财政预算一体化系统导出的Excel 文件,导入操作将覆盖当前未确认版本数据];modalTitle=导入财政指标;accept=.doc,.docx,.xls';
})
const importSuccess = (data: any)=>{
console.log('在remark内配置了tempType时导入接口返回成功后的参数:', data);
}
const importFulfill = (data: any) =>{
console.log('未配置tempType时的导入事件参数为导入的文件:',data)
}
const downloadTemplate = ()=>{
console.log('tempType、templatePath、templateParams都未配置时的模板下载事件')
}
</script>
<style lang="less" scoped></style><template>
<GicImportTemplate
:params="btn"
@import-success="importSuccess"
@import-fulfill="importFulfill"
@download-template="downloadTemplate"
></GicImportTemplate>
</template>
<script setup lang="ts">
import { GicImportTemplate } from 'ctj-ui-next'
import { ref } from 'vue'
const btn = reactive<any>({
title: '导入',
name: '导入',
icon: 'innerImport',
reamrk:'templatePath=/public/templateDownload?templateName=财政指标导入、导出模板;downTemText=下载财政指标导入模板;importTips=[请使用最新版财政预算一体化系统导出的Excel 文件,导入操作将覆盖当前未确认版本数据];modalTitle=导入财政指标;accept=.doc,.docx,.xls';
})
const importSuccess = (data: any)=>{
console.log('在remark内配置了tempType时导入接口返回成功后的参数:', data);
}
const importFulfill = (data: any) =>{
console.log('未配置tempType时的导入事件参数为导入的文件:',data)
}
const downloadTemplate = ()=>{
console.log('tempType、templatePath、templateParams都未配置时的模板下载事件')
}
</script>
<style lang="less" scoped></style>属性 Props
| 参数 | 说明 | 类型 | 是否必传 | 默认值 |
|---|---|---|---|---|
| params | 导入按钮的配置信息 | any | 是 | - |
事件 Events
| 事件名 | 说明 | 回调参数 | 参数说明 |
|---|---|---|---|
| importSuccess | 导入成功事件,传了 tempType 时直接调接口成功的事件 | data | 接口返回的数据,不一定有 |
| importFulfill | 导入文件完成事件,没传 tempType 时的导入完成事件 | formData | 文件数据 |
| downloadTemplate | 下载按钮点击事件,不传 templatePath,tempType、templateParams 时抛出的事件 | - | - |