<!-- 文件上传 -->
<template>
<section class="file-upload">
<p class="title">提案信息</p>
<el-upload
class="upload-demo"
ref="fileUpload"
accept=".xls,.xlsx"
:class="{'pointer-events' : fileShow}"
:action="action"
:data="excelPath"
:on-change="fileData"
:on-success="fileSuccess"
:show-file-list="fileShow"
:limit="1"
:file-list="fileList"
:before-remove="beforeRemove"
:disabled="disabled"
:auto-upload="false"
>
<el-button :type=" disabled ? 'info' : 'primary'" >导入发起提案</el-button> </el-upload> </section>
</template> <script> export default {
data() {
return {
action: process.env.VUE_APP_BASE_API + process.env.VUE_APP_REQURL +"/fileImport/getFileInfo",
excelPath: {
"excelPath": ""
}
};
},
computed:{
fileShow : {
get : function () {
return this.fileList.length > 0 ? true : false
},
set : function (newValue) { }
},
disabled : {
get : function () {
return this.$route.query.id ? true : false
},
set : function (newValue) { }
},
},
props:{
fileList: Array,Object,
}, methods: { beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`).then(()=>{
this.$emit('dataInit')
});
},
fileSuccess (response, file, fileList) {
this.getData(response.data)
this.fileShow = true
this.disabled = true
this.$emit('addFile',{name: file.name, url: ''})
}, getData(val){
this.$emit('getData',val)
},
// 获取本地路径地址
fileData(file){
let reader = new FileReader()
reader.readAsDataURL(file.raw);// 这里也可以直接写参数event.raw
reader.onload=()=>{
this.excelPath.excelPath = reader.result
this.$refs.fileUpload.submit(); }
}, }
}
</script>

  

element upload上传前对文件专门bs64上传的更多相关文章

  1. .NET 客户端上传本地excel文件到服务器上,并在客户端显示

    // 上传按钮 protected void btnUp_Click(object sender, EventArgs e) { bool b = Upload(fuExcel); // 上传exce ...

  2. Uploadify 上传后的文件删除,上传队列无法更新问题

    1. 定义一个上传限制数量 var uploadLimit = 3; 2. 点击页面的删除图片成功后,将uploadLimit++操作 3. 通过uploadify的settings方式重置上传限制数 ...

  3. SpringMVC结合ajaxfileupload.js实现文件无刷新上传

    直接看代码吧,注释都在里面 首先是web.xml <?xml version="1.0" encoding="UTF-8"?> <web-ap ...

  4. WEB版一次选择多个文件进行批量上传(WebUploader)的解决方案

    本人在2010年时使用swfupload为核心进行文件的批量上传的解决方案.见文章:WEB版一次选择多个文件进行批量上传(swfupload)的解决方案. 本人在2013年时使用plupload为核心 ...

  5. JS开发——文件夹的上传和下载

    文件夹上传:从前端到后端 文件上传是 Web 开发肯定会碰到的问题,而文件夹上传则更加难缠.网上关于文件夹上传的资料多集中在前端,缺少对于后端的关注,然后讲某个后端框架文件上传的文章又不会涉及文件夹. ...

  6. B/S开发——文件夹的上传和下载

    本人在2010年时使用swfupload为核心进行文件的批量上传的解决方案.见文章:WEB版一次选择多个文件进行批量上传(swfupload)的解决方案. 本人在2013年时使用plupload为核心 ...

  7. 前端js webuploader上传(导入)excel文件

    项目开发中用到导入(上传)Excel文件 我使用的是百度的webuploader: 1:下载:http://fex.baidu.com/webuploader/(官方下载/示例) 2:使用Web Up ...

  8. 将文件夹上传到FTP服务器,遍历上传,,,文件夹不能直接上传到FTP服务器上。。。

    <? $ftp_ip = "FTP"; $ftp_user = "user"; $ftp_pwd = "password"; $con ...

  9. ng-file-upload(在单文件选择,并且通过点击“上传”按钮上传文件的情况下,如何在真正选择文件之前保留上一文件信息?)

    文章前面研究ng-file-upload可能涉及指令: You can use ng-model or ngf-change instead of specifying function for ng ...

随机推荐

  1. WEB服务端安全---文件上传漏洞

    1.简述 文件上传漏洞是指用户上传了一个可执行的脚本文件,并通过此脚本文件获得了执行服务端命令的能力.这种攻击方式是最直接和有效的,而且互联网中我们经常会用到文件上传功能,它本身是没有问题的,正常的业 ...

  2. 合并石子(区间DP)

    有N堆石子,现要将石子有序的合并成一堆,规定如下:每次只能移动相邻的2堆石子合并,合并花费为新合成的一堆石子的数量.求将这N堆石子合并成一堆的总花费最小. 区间DP思想:现在小区间进行DP得到最优解, ...

  3. Go-Mutex互斥量

    先来看一段go1.12.5中Mutex的源码: // Copyright 2009 The Go Authors. All rights reserved. // Use of this source ...

  4. python3 -tensorflow-dataset 之map函数 lambda隐函数的应用

    ###隐函数lanbda及map函数的应用实例 ''' lambda 参数1,参数2,参数3,...:表达式 ''' f = lambda x,y :x+y print(f(1,2)) ###输出3 ...

  5. maven基础--下载安装配置命令生命周期

    maven apache 公司开源项目,项目构建工具 好处: 项目小 坐标:公司名称+项目名称+版本信息 通过坐标去 仓库查找jar包 maven的两大核心: *赖管理:对jar包管理过程. 项目构建 ...

  6. PHP中的九大缓存技术

    1.全页面静态化缓存也就是将页面全部生成html静态页面,用户访问时直接访问的静态页面,而不会去走php服务器解析的流程.此种方式,在CMS系统中比较常见,比如dedecms: 一种比较常用的实现方式 ...

  7. P3515 [POI2011]Lightning Conductor(决策单调性分治)

    P3515 [POI2011]Lightning Conductor 式子可转化为:$p>=a_j-a_i+sqrt(i-j) (j<i)$ $j>i$的情况,把上式翻转即可得到 下 ...

  8. Python之反向迭代

    需求:得到反方向迭代一个序列解决:使用内置的 reversed() 函数 a = [1, 2, 3, 4] for x in reversed(a): print(x) # 4 3 2 1 反向迭代仅 ...

  9. hadoop工作流调度系统

    常见工作流调度系统 Oozie, Azkaban, Cascading, Hamake 各种调度工具特性对比 特性 Hamake Oozie Azkaban Cascading 工作流描述语言 XML ...

  10. JavaScript —— 正则表达式元字符

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...