2160d748 by renchao@pashanhoo.com

style:文件上传功能的完善

1 parent 2239205b
/*
* @Description: 材料信息
* @Autor: renchao
* @LastEditTime: 2023-05-16 14:04:42
* @LastEditTime: 2023-07-28 14:31:00
*/
import request from '@/utils/request'
let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl'))
......@@ -75,6 +75,22 @@ export function uploadSjClmx (data) {
}
/**
* @description: 上传duo个文件
* @param {*} data
* @author: renchao
*/
export function uploadBatch (data) {
return request({
url: SERVER.SERVERAPI + '/rest/ywbl/clxx/uploadBatch',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
data
})
}
/**
* @description: 删除上传文件
* @param {*} bsmClmx
* @author: renchao
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-07-28 14:20:07
* @LastEditTime: 2023-07-28 14:59:55
-->
<template>
<div class="rlPopup">
......@@ -50,7 +50,7 @@
<script>
import PhotoZoom from '@/components/PhotoZoom'
import { getAltimeterInfo, getUuid } from '@/utils/operation.js'
import { uploadSjClmx, deleteClmx } from "@/api/clxx.js";
import { uploadBatch, deleteClmx } from "@/api/clxx.js";
import publicPicture from '@/components/publicPicture/index.vue'
export default {
name: 'PreviewImage',
......@@ -255,8 +255,9 @@
async handleChange (file, fileList) {
let length = fileList.length;
this.maxFileLength = Math.max(length, this.maxFileLength)
console.log(fileList, this.maxFileLength, 'this.maxFileLength');
var formData = new FormData();
setTimeout(() => {
var formData = new FormData();
if (this.maxFileLength !== length) {
return
}
......@@ -265,13 +266,15 @@
})
formData.append("bsmSj", this.previewImg.bsmSj);
formData.append("bsmSlsq", this.previewImg.bsmSlsq);
uploadSjClmx(formData).then((res) => {
uploadBatch(formData).then((res) => {
if (res.code == 200) {
this.$emit('updateList', res.result)
this.$message({
message: '上传成功!',
type: 'success'
})
this.$refs.upload.clearFiles();
this.maxFileLength = 0
}
})
}, 0)
......