9acbfe0d by weimo934

refactor(fjcl):文件上传修改

1 parent b12f6345
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
3 <el-upload 3 <el-upload
4 class="upload-demo" 4 class="upload-demo"
5 action="/api/file/uploadList" 5 action="/api/file/uploadList"
6 :data="fileData"
6 :on-preview="handlePreview" 7 :on-preview="handlePreview"
7 :on-remove="handleRemove" 8 :on-remove="handleRemove"
8 :before-remove="beforeRemove" 9 :before-remove="beforeRemove"
...@@ -50,9 +51,13 @@ ...@@ -50,9 +51,13 @@
50 name: "fjcl", 51 name: "fjcl",
51 data() { 52 data() {
52 return { 53 return {
54 fileData:{
55 glbsm:'',
56 dylx:''
57 },
53 list: [ 58 list: [
54 ], 59 ],
55 filesData: { 60 /* filesData: {
56 dylx: "", 61 dylx: "",
57 glbsm: "", 62 glbsm: "",
58 list: [ 63 list: [
...@@ -63,7 +68,7 @@ ...@@ -63,7 +68,7 @@
63 preViewUrl:"" 68 preViewUrl:""
64 } 69 }
65 ] 70 ]
66 }, 71 },*/
67 } 72 }
68 }, 73 },
69 mounted() { 74 mounted() {
...@@ -101,28 +106,27 @@ ...@@ -101,28 +106,27 @@
101 window.open(`/api/file/download?url=`+url); 106 window.open(`/api/file/download?url=`+url);
102 }, 107 },
103 getFileList() { 108 getFileList() {
104 console.log(this.$route.name,'NAME')
105 switch (this.$route.name) { 109 switch (this.$route.name) {
106 case "宗地": 110 case "宗地":
107 this.filesData.dylx = 'zd'; 111 this.fileData.dylx = 'zd';
108 this.filesData.glbsm = this.$store.state.zdbsm 112 this.fileData.glbsm = this.$store.state.zdbsm
109 break; 113 break;
110 case "自然幢": 114 case "自然幢":
111 this.filesData.dylx = 'zrz'; 115 this.fileData.dylx = 'zrz';
112 this.filesData.glbsm = this.$store.state.zrzbsm 116 this.fileData.glbsm = this.$store.state.zrzbsm
113 break 117 break
114 case "多幢": 118 case "多幢":
115 this.filesData.dylx = 'dz'; 119 this.fileData.dylx = 'dz';
116 this.filesData.glbsm = this.$store.state.dzbsm 120 this.fileData.glbsm = this.$store.state.dzbsm
117 break 121 break
118 case "户": 122 case "户":
119 this.filesData.dylx = 'h'; 123 this.fileData.dylx = 'h';
120 this.filesData.glbsm = this.$store.state.hbsm 124 this.fileData.glbsm = this.$store.state.hbsm
121 break; 125 break;
122 default: 126 default:
123 break 127 break
124 } 128 }
125 getFileLis(this.filesData.glbsm ).then(res => { 129 getFileLis(this.fileData.glbsm ).then(res => {
126 if (res.success) { 130 if (res.success) {
127 this.list = res.result; 131 this.list = res.result;
128 } else { 132 } else {
...@@ -134,15 +138,7 @@ ...@@ -134,15 +138,7 @@
134 console.log("上传文件失败", err) 138 console.log("上传文件失败", err)
135 }, 139 },
136 uploadSuccess(res, file, fileList) { 140 uploadSuccess(res, file, fileList) {
137 this.filesData.list = res.result; 141 this.getFileList();
138 insertFile(this.filesData).then(res => {
139 if (res.success) {
140 Message.success("上传成功")
141 this.getFileList(this.filesData.glbsm)
142 } else {
143 Message.error(res.message)
144 }
145 })
146 }, 142 },
147 handleRemove(file, fileList) { 143 handleRemove(file, fileList) {
148 console.log(file, fileList); 144 console.log(file, fileList);
......