diff --git a/src/components/DnD.vue b/src/components/DnD.vue new file mode 100644 index 00000000..d05bd5cd --- /dev/null +++ b/src/components/DnD.vue @@ -0,0 +1,326 @@ + + + + + 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,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; + } }