Explorar o código

编辑公务出访上传文件

wangh hai 1 ano
pai
achega
89354bad41

+ 0 - 3
src/components/OP/OpDecreasePayments.vue

@@ -390,10 +390,7 @@ export default {
                 } 个文件,请取消要替换的文件`
             );
         },
-        //文件上传
-        // submitUpload() {
 
-        // },
         //文件上传成功时的钩子
         upLoadSuccess(response, file, fileList) {
             if (response.code == 200) {

+ 104 - 26
src/components/Resource/OpOfficialActivities.vue

@@ -194,21 +194,15 @@
                             @click="submitUpload2">上传</el-button>
                     </el-upload>
                 </div>
-                <div style="width: 33%;display: flex;">
-                    <div style="width: 10%;">
-                        发票:
-                    </div>
-                    <div style="width: 90%;">
-                        <el-upload :file-list="uploadFiles3" ref="upload3" :on-success="upLoadSuccess3"
-                            :on-error="upLoadError3" :before-remove="beforeRemove3" :on-change="onChange3" :limit="1"
-                            :on-exceed="exceed3" :action="uploadURL" :headers="headers3" :auto-upload="false">
-                            <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-                            <el-button style="margin-left: 10px;" size="small" type="success"
-                                @click="submitUpload3">上传</el-button>
-                        </el-upload>
-                    </div>
-
-
+                <div style="width: 33%;">
+                    发票:
+                    <el-upload :file-list="uploadFiles3" ref="upload3" :on-success="upLoadSuccess3" :on-error="upLoadError3"
+                        :before-remove="beforeRemove3" :on-change="onChange3" :limit="1" :on-exceed="exceed3"
+                        :action="uploadURL" :headers="headers3" :auto-upload="false">
+                        <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
+                        <el-button style="margin-left: 10px;" size="small" type="success"
+                            @click="submitUpload3">上传</el-button>
+                    </el-upload>
                 </div>
             </div>
         </div>
@@ -295,16 +289,42 @@ export default {
                     Authorization: 'Bearer ' + this.token
                 },
                 data: {
-                    diid: that.diId
+                    diid: that.DiId
                 }
             }).then(function (res) {
                 if (res.data.code == 200) {
 
                     that.deleFile = res.data.data.deleFile;
+                    that.deleFile.forEach(function (item) {
+                        if (item.kind == 1) {
+                            that.uploadFiles1.push({
+                                name: item.fileName,
+                                url: 'http://localhost:5256/Office/GrpFile/团组增减款项相关文件/',
+                                id: item.id
+                            });
+                        } else if (item.kind == 2) {
+                            that.uploadFiles2.push({
+                                name: item.fileName,
+                                url: 'http://localhost:5256/Office/GrpFile/团组增减款项相关文件/',
+                                id: item.id
+                            });
+                        }
+                        else if (item.kind == 3) {
+                            that.uploadFiles3.push({
+                                name: item.fileName,
+                                url: 'http://localhost:5256/Office/GrpFile/团组增减款项相关文件/',
+                                id: item.id
+                            });
+                        }
+                    });
+
+                    console.log(that.uploadFiles1)
+                    console.log(that.uploadFiles2)
+                    console.log(that.uploadFiles3)
+
                     that.delegationInfoList = res.data.data.delegation;
                     that.OfficialFormList = res.data.data.setData;
                     if (that.OfficialFormList.length != 0) {
-
                         that.OpOfficialActivitiesDto.officialForm = that.OfficialFormList[0].id
                     }
                     for (let index = 0; index < that.delegationInfoList.length; index++) {
@@ -366,9 +386,6 @@ export default {
                     that.OpOfficialActivitiesDto.trip = dataList.trip
                     that.OpOfficialActivitiesDto.createUserId = dataList.createUserId
                     that.OpOfficialActivitiesDto.remark = dataList.remark
-
-                    var DeleFileList = res.data.data.deleFile;
-                    console.log(DeleFileList)
                 }
 
             })
@@ -429,8 +446,30 @@ export default {
         upLoadError1(response, file, fileList) {
             console.log("项目添加失败");
         },
+        //取消文件时的钩子
         beforeRemove1(file, fileList) {
-
+            const that = this;
+            var url = "/api/Resource/DelloadOfficialActivities"
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    Id: file.id,
+                    DeleteUserId: that.userId
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success'
+                    });
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
         },
         onChange1(file, fileList) {
 
@@ -457,7 +496,28 @@ export default {
             console.log("项目添加失败");
         },
         beforeRemove2(file, fileList) {
-
+            const that = this;
+            var url = "/api/Resource/DelloadOfficialActivities"
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    Id: file.id,
+                    DeleteUserId: that.userId
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success'
+                    });
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
         },
         onChange2(file, fileList) {
 
@@ -483,10 +543,28 @@ export default {
             console.log("项目添加失败");
         },
         beforeRemove3(file, fileList) {
-
-        },
-        onChange3(file, fileList) {
-
+            const that = this;
+            var url = "/api/Resource/DelloadOfficialActivities"
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data: {
+                    Id: file.id,
+                    DeleteUserId: that.userId
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.$message({
+                        message: res.data.msg,
+                        type: 'success'
+                    });
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
         },
     },