|
@@ -62,29 +62,7 @@
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button @click="upload">上传</el-button>
|
|
|
- <!-- <el-upload
|
|
|
- class="upload-demo"
|
|
|
- :on-change="handleChange"
|
|
|
- :auto-upload="false"
|
|
|
- :show-file-list="false"
|
|
|
- :file-list="fileList"
|
|
|
- :limit="1"
|
|
|
- accept=".zip"
|
|
|
- >
|
|
|
- <el-button class="upload-btn" icon="Upload" size="mini"
|
|
|
- >上传</el-button
|
|
|
- >
|
|
|
- </el-upload>
|
|
|
- <el-tooltip
|
|
|
- v-if="fileList.length > 0"
|
|
|
- :content="fileList[0].name"
|
|
|
- placement="bottom-start"
|
|
|
- >
|
|
|
- <span class="title-item" style="display: inline-block; width: 100%">{{
|
|
|
- fileList[0].name
|
|
|
- }}</span>
|
|
|
- </el-tooltip> -->
|
|
|
+ <el-button type="primary" plain icon="el-icon-upload" @click="fileUploadHandle" size="mini">上传</el-button>
|
|
|
</el-col>
|
|
|
<!-- <el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -265,31 +243,22 @@
|
|
|
|
|
|
<el-dialog
|
|
|
title="文件上传"
|
|
|
- :visible.sync="fileUpload"
|
|
|
+ :visible.sync="fileUploadDiv"
|
|
|
width="400px"
|
|
|
append-to-body
|
|
|
>
|
|
|
- <!-- <el-upload
|
|
|
- class="upload-demo"
|
|
|
- :on-change="handleChange"
|
|
|
- :auto-upload="false"
|
|
|
- :show-file-list="false"
|
|
|
- :file-list="fileList"
|
|
|
- :limit="1"
|
|
|
- accept=".zip"
|
|
|
- >
|
|
|
- <el-button class="upload-btn" icon="Upload" size="mini">上传</el-button>
|
|
|
- </el-upload> -->
|
|
|
<el-upload
|
|
|
class="upload-demo"
|
|
|
drag
|
|
|
- :on-change="handleChange"
|
|
|
- :auto-upload="false"
|
|
|
- :show-file-list="false"
|
|
|
- :file-list="fileList"
|
|
|
+ :action="uploadFileUrl"
|
|
|
+ :before-upload="handleBeforeUpload"
|
|
|
+ :on-error="handleUploadError"
|
|
|
+ :on-success="handleUploadSuccess"
|
|
|
:limit="1"
|
|
|
accept=".zip"
|
|
|
- >
|
|
|
+ :file-list="fileList"
|
|
|
+ :show-file-list=true
|
|
|
+ multiple>
|
|
|
<i class="el-icon-upload"></i>
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
<div class="el-upload__tip" slot="tip">只能上传zip文件</div>
|
|
@@ -367,44 +336,68 @@ export default {
|
|
|
// 表单校验
|
|
|
rules: {},
|
|
|
fileList: [],
|
|
|
- fileUpload: false, //文件上传弹窗
|
|
|
+ fileUploadDiv: false, //文件上传弹窗
|
|
|
loading2:null,
|
|
|
+ uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/uploadSpotZip",
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
- upload() {
|
|
|
- this.fileUpload = true;
|
|
|
+ fileUploadHandle() {
|
|
|
+ console.log(this.uploadFileUrl);
|
|
|
+ this.uploadFileUrl= this.uploadFileUrl;
|
|
|
+ this.fileList=[];
|
|
|
+ this.fileUploadDiv = true;
|
|
|
},
|
|
|
//上传文件
|
|
|
handleChange(file, fileList) {
|
|
|
- console.log(111111);
|
|
|
- if (fileList.length > 0) {
|
|
|
- this.fileList = [fileList[fileList.length - 1]]; //这一步,是展示最后一次选择文件
|
|
|
- this.reset();
|
|
|
- }
|
|
|
- console.log(file, "filefile");
|
|
|
- const formdata = new FormData();
|
|
|
- formdata.append("file", file.raw);
|
|
|
- // this.loading2 = true;
|
|
|
- this.loading2 = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: "文件上传中",
|
|
|
- spinner: "el-icon-loading",
|
|
|
- background: "rgba(0, 0, 0, 0.7)",
|
|
|
- });
|
|
|
-
|
|
|
- tiffUpload(formdata).then((res) => {
|
|
|
- if (res.success) {
|
|
|
- // this.loading2 = false;
|
|
|
- this.loading2.close();
|
|
|
- this.fileUpload = false;
|
|
|
- this.getList();
|
|
|
- this.$message.success(res.message);
|
|
|
- }
|
|
|
- });
|
|
|
+ console.log("handleChange ****")
|
|
|
+
|
|
|
+ // if (fileList.length > 0) {
|
|
|
+ // this.fileList = [fileList[fileList.length - 1]]; //这一步,是展示最后一次选择文件
|
|
|
+ // this.reset();
|
|
|
+ // }
|
|
|
+ // console.log(file, "filefile");
|
|
|
+ // const formdata = new FormData();
|
|
|
+ // formdata.append("file", file.raw);
|
|
|
+ // // this.loading2 = true;
|
|
|
+ // this.loading2 = this.$loading({
|
|
|
+ // lock: true,
|
|
|
+ // text: "文件上传中",
|
|
|
+ // spinner: "el-icon-loading",
|
|
|
+ // background: "rgba(0, 0, 0, 0.7)",
|
|
|
+ // });
|
|
|
+ // /file/uploadSpotZip
|
|
|
+ // process.env.VUE_APP_BASE_API + "/file/uploadSpotZip"
|
|
|
+ // tiffUpload(formdata).then((res) => {
|
|
|
+ // if (res.success) {
|
|
|
+ // // this.loading2 = false;
|
|
|
+ // this.loading2.close();
|
|
|
+ // this.fileUpload = false;
|
|
|
+ // this.getList();
|
|
|
+ // this.$message.success(res.message);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ handleBeforeUpload(file) {
|
|
|
+ this.$modal.loading("正在上传文件,请稍候...");
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ // 上传失败
|
|
|
+ handleUploadError(err) {
|
|
|
+ this.$modal.msgError("上传文件失败,请重试");
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ },
|
|
|
+ // 上传成功回调
|
|
|
+ handleUploadSuccess(res, file) {
|
|
|
+ console.log("handleUploadSuccess")
|
|
|
+ this.fileList=[];
|
|
|
+ this.fileUploadDiv = false;
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ this.$modal.msgSuccess(res.message);
|
|
|
+ this.getList();
|
|
|
},
|
|
|
handleDownload(row) {
|
|
|
const zipfile = row.proxypath + ".zip";
|