liuhj 9 months ago
parent
commit
a158b3e4b6
1 changed files with 83 additions and 5 deletions
  1. 83 5
      src/components/Resource/OpOfficialActivities.vue

+ 83 - 5
src/components/Resource/OpOfficialActivities.vue

@@ -212,7 +212,7 @@
                         </el-form-item>
                     </div>
                     <div style="width:770px;">
-                        <el-form-item label="邮件截图:" prop="attendees" label-width="160px">
+                        <el-form-item label="邮件截图:" prop="fileList" label-width="160px">
                             <!-- <el-upload 
                             ref="Emailscreenshotref" 
                             :action="Emailscreenshoturl" 
@@ -238,10 +238,11 @@
                             :on-change="handleChange"
                             :on-remove="handleRemove"
                             :on-preview="handlePreview"
+                            :before-remove="beforeRemove"
                             name="files"
                             >
                                 <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-                                <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
+                                <!-- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button> -->
                             </el-upload>
                         </el-form-item>
                     </div>
@@ -291,7 +292,8 @@
                 <el-form-item>
                     <div style="text-align: right;">
                         <el-button type="primary" @click="addBtn">保存</el-button>
-                        <el-button v-if="btnPermissions" type="primary">确认</el-button>
+                        <el-button v-if="btnPermissions&&confirmTheInvitation==0" @click="OfficialActivitiesInviteOperation(1)" type="primary">确认</el-button>
+                        <el-button v-if="btnPermissions&&confirmTheInvitation==1" @click="OfficialActivitiesInviteOperation(0)" type="primary">取消确认</el-button>
                         <el-button @click="returnbtn">取消</el-button>
                     </div>
                 </el-form-item>
@@ -304,6 +306,7 @@
 export default {
     data() {
         return {
+            confirmTheInvitation:0,
             title: "新增公务出访客户资料",
             token: '',
             userId: 0,
@@ -639,12 +642,12 @@ export default {
                     that.OpOfficialActivitiesDto.area = dataList.area;
                     that.OpOfficialActivitiesDto.field = dataList.field;
                     that.OpOfficialActivitiesDto.reqSample = dataList.reqSample;
-
+                    that.confirmTheInvitation=dataList.confirmTheInvitation
                     // that.fileList
+                    that.fileList=[]
                     for(let i=0;i<dataList.screenshotOfMailUrls.length;i++){
                         that.fileList.push({'name':dataList.screenshotOfMailUrls[i].split('/')[7],'url':dataList.screenshotOfMailUrls[i]})
                     }
-                    console.log(that.fileList);
                 }
 
             })
@@ -654,6 +657,11 @@ export default {
                 this.$message.error("请选择团组名称");
                 return;
             }
+            if(this.fileList.length<=0){
+                this.$message.error("请先选取邮件截图");
+                return;
+            }
+            this.submitUpload();
             const that = this;
             that.OpOfficialActivitiesDto.createUserId = that.userId
             that.OpOfficialActivitiesDto.diId = that.DiId
@@ -881,15 +889,59 @@ export default {
                 console.log(fileList);
                 this.fileList = fileList
         },
+        //删除文件
+        beforeRemove(file,fileList){
+            if(file && file.status=="success"){
+                return this.$confirm('此文件已上传至服务器此操作将永久删除该文件, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    // this.$message({
+                    //     type: 'success',
+                    //     message: '删除成功!'
+                    // });
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '已取消删除'
+                    });     
+                    reject(false)     
+                });
+            }
+        },
         // 删除文件之前的钩子,参数为上传的文件和文件列表,若返回 false 或者返回 Promise 且被 reject,则停止删除。function(file, fileList)
         handleRemove(file, fileList) {
             this.fileList = fileList
+            if (file && file.status=="success") {
+                var that = this;
+                var url = "/api/Resource/OfficialActivitiesDelFile"
+                this.$axios({
+                    method: 'post',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' + that.token
+                    },
+                    data:{
+                        id:that.id,
+                        fileName:file.name
+                    }
+                }).then(function (res) {
+                    if (res.data.code == 200) {
+                        that.$message.success(res.data.msg);
+                    } else {
+                        that.$message.error(res.data.msg);
+                    }
+                })
+            }
+            
         },
         //点击文件列表中已上传的文件
         handlePreview(file){
             console.log(file);
             window.open(file.url);
         },
+
         //上传服务器
         submitUpload() {
             // console.log(this.id);
@@ -926,11 +978,37 @@ export default {
                 if (res.data.code == 200) {
                     that.$message.success(res.data.msg);
                     that.fileList = []
+                    for(let i=0;i<res.data.data.fileUrls.length;i++){
+                        that.fileList.push({'name':res.data.data.fileUrls[i].split('/')[7],'url':res.data.data.fileUrls[i]})
+                    }
                 } else {
                     that.$message.error(res.data.msg);
                 }
             })
         },
+        //确认邀请
+        OfficialActivitiesInviteOperation(val){
+            var that = this;
+            var url = "/api/Resource/OfficialActivitiesInviteOperation"
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' + that.token
+                },
+                data:{
+                    id:that.id,
+                    type:val
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.QueryOfficialActivitiesById()
+                    that.$message.success(res.data.msg);
+                } else {
+                    that.$message.error(res.data.msg);
+                }
+            })
+        }
     },
 
     mounted() {