9acbfe0d by weimo934

refactor(fjcl):文件上传修改

1 parent b12f6345
......@@ -3,6 +3,7 @@
<el-upload
class="upload-demo"
action="/api/file/uploadList"
:data="fileData"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
......@@ -50,9 +51,13 @@
name: "fjcl",
data() {
return {
fileData:{
glbsm:'',
dylx:''
},
list: [
],
filesData: {
/* filesData: {
dylx: "",
glbsm: "",
list: [
......@@ -63,7 +68,7 @@
preViewUrl:""
}
]
},
},*/
}
},
mounted() {
......@@ -101,28 +106,27 @@
window.open(`/api/file/download?url=`+url);
},
getFileList() {
console.log(this.$route.name,'NAME')
switch (this.$route.name) {
case "宗地":
this.filesData.dylx = 'zd';
this.filesData.glbsm = this.$store.state.zdbsm
this.fileData.dylx = 'zd';
this.fileData.glbsm = this.$store.state.zdbsm
break;
case "自然幢":
this.filesData.dylx = 'zrz';
this.filesData.glbsm = this.$store.state.zrzbsm
this.fileData.dylx = 'zrz';
this.fileData.glbsm = this.$store.state.zrzbsm
break
case "多幢":
this.filesData.dylx = 'dz';
this.filesData.glbsm = this.$store.state.dzbsm
this.fileData.dylx = 'dz';
this.fileData.glbsm = this.$store.state.dzbsm
break
case "户":
this.filesData.dylx = 'h';
this.filesData.glbsm = this.$store.state.hbsm
this.fileData.dylx = 'h';
this.fileData.glbsm = this.$store.state.hbsm
break;
default:
break
}
getFileLis(this.filesData.glbsm ).then(res => {
getFileLis(this.fileData.glbsm ).then(res => {
if (res.success) {
this.list = res.result;
} else {
......@@ -134,15 +138,7 @@
console.log("上传文件失败", err)
},
uploadSuccess(res, file, fileList) {
this.filesData.list = res.result;
insertFile(this.filesData).then(res => {
if (res.success) {
Message.success("上传成功")
this.getFileList(this.filesData.glbsm)
} else {
Message.error(res.message)
}
})
this.getFileList();
},
handleRemove(file, fileList) {
console.log(file, fileList);
......