From 6d16262e5bdcdd0bbb86b94a394cff82dd0c4661 Mon Sep 17 00:00:00 2001 From: zzl <961867786@qq.com> Date: Mon, 10 Jul 2023 13:51:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/homesteadSurvey/hncyDetails.vue | 20 +++++++++++--------- src/views/homesteadSurvey/hncyList2.vue | 2 +- src/views/homesteadSurvey/nhcyAdd.vue | 22 ++++++++++++---------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/views/homesteadSurvey/hncyDetails.vue b/src/views/homesteadSurvey/hncyDetails.vue index 6cfcc967..3077a356 100644 --- a/src/views/homesteadSurvey/hncyDetails.vue +++ b/src/views/homesteadSurvey/hncyDetails.vue @@ -193,15 +193,6 @@ maxlength="50" autocomplete="off" /> - + + +

户主专用信息

diff --git a/src/views/homesteadSurvey/hncyList2.vue b/src/views/homesteadSurvey/hncyList2.vue index 13237452..2c38fa8c 100644 --- a/src/views/homesteadSurvey/hncyList2.vue +++ b/src/views/homesteadSurvey/hncyList2.vue @@ -73,7 +73,7 @@ - + + +
@@ -94,8 +104,10 @@ import { commonUpload , openAdd } from "@/api/sunVillage_info/fixedAssets"; import Cookies from "js-cookie"; import request from '@/utils/request' + import DnD from "@/components/DnD"; export default { name: "certificateList", + components: {DnD}, data() { return { showBuildTime:false, @@ -140,7 +152,11 @@ console.log(this.openPic) var that = this; that.form.openFile = that.openFile2.join(',') - that.form.openPic = that.openPic2.join(',') + //that.form.openPic = that.openPic2.join(',') + that.form.openPic = that.fileList + .filter((x) => x.url && x.url.startsWith('/api')) + .map((x) => x.url.substr(4)) + .join(','); openAdd(that.form).then((r1) => { if (r1.code == 200){ that.$notify({ type: 'success', message: '新增成功' }); @@ -172,20 +188,42 @@ }); // 此时可以自行将文件上传至服务器 if (file instanceof Array){//判断是否为数组,单张图片为array,多张为数组,数组返回true否则为false - file.map(res=>{ - this.openPic.push(res.file); - let params1 = new FormData(); - params1.append("file", res.file); - commonUpload(params1).then((r1) => { - this.openPic2.push(r1.fileName); + if(false) // 顺序上传 + { + let SequenceUpload = (list, index) => { + if(index >= list.length) + return; + let res = list[index]; + this.openPic.push(res.file); + let params1 = new FormData(); + params1.append("file", res.file); + commonUpload(params1).then((r1) => { + this.openPic2.push(r1.fileName); + res.url = '/api' + r1.fileName; + SequenceUpload(list, index + 1); + }) + }; + SequenceUpload(file, 0); + } + else + { + file.map(res=>{ + this.openPic.push(res.file); + let params1 = new FormData(); + params1.append("file", res.file); + commonUpload(params1).then((r1) => { + this.openPic2.push(r1.fileName); + res.url = '/api' + r1.fileName; + }) }) - }) + } }else{ this.openPic.push(file); let params1 = new FormData(); params1.append("file", file.file); commonUpload(params1).then((r1) => { this.openPic2.push(r1.fileName); + file.url = '/api' + r1.fileName; }) } }, @@ -205,7 +243,30 @@ } this.openFileList.push({name:file.file.name,type:type}) this.openFile.push(file.file); - } + }, + drag(src_element) { + //console.log("drag", event); + }, + drop(src_element, dst_element, srcData, dstData) { + //console.log("drop", event); + let srcIndex = parseInt(srcData); + let index = parseInt(dstData); + //console.log(srcIndex, index,this.fileList); + if(srcIndex !== index) + { + let src = this.fileList[srcIndex]; + if(srcIndex > index) + { + this.fileList.splice(srcIndex, 1); + this.fileList.splice(index, 0, src); + } + else + { + this.fileList.splice(srcIndex, 1); + this.fileList.splice(index, 0, src); + } + } + }, }, } @@ -325,5 +386,17 @@ /deep/ .van-field__error-message{ display: none; } + .preview-cover { + position: absolute; + bottom: 0; + top: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0); + } + + /deep/ .van-uploader__preview-image { + overflow: visible; + } } diff --git a/src/views/sunVillage_info/list_finance_edit.vue b/src/views/sunVillage_info/list_finance_edit.vue index 5ce7f31a..ca34f5ff 100644 --- a/src/views/sunVillage_info/list_finance_edit.vue +++ b/src/views/sunVillage_info/list_finance_edit.vue @@ -50,7 +50,17 @@ - + + +
@@ -94,8 +104,11 @@ import { commonUpload , openEdit , financePublicDetail } from "@/api/sunVillage_info/fixedAssets"; import Cookies from "js-cookie"; import request from '@/utils/request' + import DnD from "@/components/DnD"; + export default { name: "certificateList", + components: {DnD}, data() { return { showBuildTime:false, @@ -167,7 +180,11 @@ onSubmit(){ var that = this; that.form.openFile = that.openFile2.join(',') - that.form.openPic = that.openPic2.join(',') + //that.form.openPic = that.openPic2.join(',') + that.form.openPic = that.openPic + .filter((x) => x.url && x.url.startsWith('/api')) + .map((x) => x.url.substr(4)) + .join(','); openEdit(that.form).then((r1) => { if (r1.code == 200){ that.$notify({ type: 'success', message: '修改成功' }); @@ -197,18 +214,40 @@ duration: 0, }); if (file instanceof Array){//判断是否为数组,单张图片为array,多张为数组,数组返回true否则为false - file.map(res=>{ - let params1 = new FormData(); - params1.append("file", res.file); - commonUpload(params1).then((r1) => { - this.openPic2.push(r1.fileName); + if(false) // 顺序上传 + { + let SequenceUpload = (list, index) => { + if(index >= list.length) + return; + let res = list[index]; + this.openPic.push(res.file); + let params1 = new FormData(); + params1.append("file", res.file); + commonUpload(params1).then((r1) => { + this.openPic2.push(r1.fileName); + res.url = '/api' + r1.fileName; + SequenceUpload(list, index + 1); + }) + }; + SequenceUpload(file, 0); + } + else + { + file.map(res => { + let params1 = new FormData(); + params1.append("file", res.file); + commonUpload(params1).then((r1) => { + this.openPic2.push(r1.fileName); + res.url = '/api' + r1.fileName; + }) }) - }) + } }else{ let params1 = new FormData(); params1.append("file", file.file); commonUpload(params1).then((r1) => { this.openPic2.push(r1.fileName); + file.url = '/api' + r1.fileName; }) } }, @@ -228,7 +267,30 @@ } this.openFile.push({name:file.file.name,type:type}) this.openFileList.push(file.file); - } + }, + drag(src_element) { + //console.log("drag", event); + }, + drop(src_element, dst_element, srcData, dstData) { + //console.log("drop", event); + let srcIndex = parseInt(srcData); + let index = parseInt(dstData); + //console.log(srcIndex, index,this.openPic); + if(srcIndex !== index) + { + let src = this.openPic[srcIndex]; + if(srcIndex > index) + { + this.openPic.splice(srcIndex, 1); + this.openPic.splice(index, 0, src); + } + else + { + this.openPic.splice(srcIndex, 1); + this.openPic.splice(index, 0, src); + } + } + }, }, } @@ -348,5 +410,17 @@ /deep/ .van-field__error-message{ display: none; } + .preview-cover { + position: absolute; + bottom: 0; + top: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0); + } + + /deep/ .van-uploader__preview-image { + overflow: visible; + } }