Skip to content
本页目录

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 时抛出的事件--

预算单位软件产品开发部