|
@@ -357,10 +357,20 @@
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<div style="width: 385px;">
|
|
|
- <el-form-item label="附件:" prop="fileUrl" label-width="160px">
|
|
|
- <el-upload :file-list="uploadFiles" multiple ref="upload" :on-success="upLoadSuccess"
|
|
|
- :on-error="upLoadError" :before-remove="beforeRemove" :on-change="onChange" :limit="10"
|
|
|
- :on-exceed="exceed" :action="uploadURL" :headers="headers" :auto-upload="false">
|
|
|
+ <el-form-item style="position: relative;" label="附件:" prop="fileUrl" label-width="160px">
|
|
|
+ <span style="position: absolute;top: 0;left: -50px;color: red;">*</span>
|
|
|
+ <el-upload
|
|
|
+ :file-list="uploadFiles"
|
|
|
+ multiple ref="upload"
|
|
|
+ :on-success="upLoadSuccess"
|
|
|
+ :on-error="upLoadError"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :before-remove="beforeRemove"
|
|
|
+ :on-change="onChange"
|
|
|
+ :limit="10"
|
|
|
+ :on-exceed="exceed"
|
|
|
+ action=""
|
|
|
+ :auto-upload="false">
|
|
|
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
|
|
<!-- <el-button style="margin-left: 10px;" size="small" type="success"
|
|
|
@click="submitUpload">上传到服务器</el-button> -->
|
|
@@ -756,6 +766,7 @@ export default {
|
|
|
that.InvitationOfficialActivities.email = res.data.data._InvitationData.email;
|
|
|
that.InvitationOfficialActivities.fax = res.data.data._InvitationData.fax;
|
|
|
that.InvitationOfficialActivities.otherInformation = res.data.data._InvitationData.remark;
|
|
|
+
|
|
|
if (that.InvitationOfficialActivities.attachment != null && that.InvitationOfficialActivities.attachment != undefined && that.InvitationOfficialActivities.attachment != "") {
|
|
|
for (let m = 0; m < that.InvitationOfficialActivities.attachment.length; m++) {
|
|
|
that.uploadFiles.push({
|
|
@@ -763,9 +774,7 @@ export default {
|
|
|
url: 'http://132.232.92.186:24/Office/GrpFile/商邀相关文件/'+that.InvitationOfficialActivities.attachment[m],
|
|
|
})
|
|
|
}
|
|
|
- }
|
|
|
- console.log(that.uploadFiles);
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
})
|
|
@@ -845,96 +854,31 @@ export default {
|
|
|
const that = this;
|
|
|
that.$refs.InvitationOfficialActivities.validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (that.InvitationOfficialActivities.attachment == that.projectName) {
|
|
|
- if (that.DelfileName != null && that.DelfileName != "" && that.DelfileName != undefined) {
|
|
|
- that.$axios({
|
|
|
- method: 'post',
|
|
|
- url: "/api/Groups/DelFile",
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data: {
|
|
|
- fileName: that.DelfileName,
|
|
|
- id: that.id
|
|
|
- }
|
|
|
- }).then(function (res) {
|
|
|
- if (res.data.code == 200) {
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- that.InvitationOfficialActivities.attachment = that.projectName
|
|
|
- that.InvitationOfficialActivities.diId = that.DiIdSelect;
|
|
|
- that.InvitationOfficialActivities.createUserId = that.userId;
|
|
|
- var url = "/api/Groups/OpInvitationOfficialActivities"
|
|
|
- that.$axios({
|
|
|
- method: 'post',
|
|
|
- url: url,
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data: that.InvitationOfficialActivities
|
|
|
- }).then(function (res) {
|
|
|
- if (res.data.code == 200) {
|
|
|
- that.$message({
|
|
|
- message: res.data.msg,
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- that.cancelbtn()
|
|
|
- }, 500);
|
|
|
- } else {
|
|
|
- that.$message.error(res.data.msg);
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- if (that.DelfileName != null && that.DelfileName != "" && that.DelfileName != undefined) {
|
|
|
- that.$axios({
|
|
|
- method: 'post',
|
|
|
- url: "/api/Groups/DelFile",
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data: {
|
|
|
- fileName: that.DelfileName,
|
|
|
- id: that.id
|
|
|
- }
|
|
|
- }).then(function (res) {
|
|
|
- if (res.data.code == 200) {
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- if (that.projectName != "" && that.projectName != null && that.projectName != undefined) {
|
|
|
- that.$refs.upload.submit();//上传文件到服务器
|
|
|
+ that.submitUpload()
|
|
|
+ that.InvitationOfficialActivities.attachment = that.projectName
|
|
|
+ that.InvitationOfficialActivities.diId = that.DiIdSelect;
|
|
|
+ that.InvitationOfficialActivities.createUserId = that.userId;
|
|
|
+ var url = "/api/Groups/OpInvitationOfficialActivities"
|
|
|
+ that.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token
|
|
|
+ },
|
|
|
+ data: that.InvitationOfficialActivities
|
|
|
+ }).then(function (res) {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ that.$message({
|
|
|
+ message: res.data.msg,
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ that.cancelbtn()
|
|
|
+ }, 500);
|
|
|
} else {
|
|
|
- that.InvitationOfficialActivities.attachment = that.projectName
|
|
|
- that.InvitationOfficialActivities.diId = that.DiIdSelect;
|
|
|
- that.InvitationOfficialActivities.createUserId = that.userId;
|
|
|
- var url = "/api/Groups/OpInvitationOfficialActivities"
|
|
|
- that.$axios({
|
|
|
- method: 'post',
|
|
|
- url: url,
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data: that.InvitationOfficialActivities
|
|
|
- }).then(function (res) {
|
|
|
- if (res.data.code == 200) {
|
|
|
- that.$message({
|
|
|
- message: res.data.msg,
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- setTimeout(() => {
|
|
|
- that.cancelbtn();
|
|
|
- }, 500);
|
|
|
- } else {
|
|
|
- that.$message.error(res.data.msg);
|
|
|
- }
|
|
|
- })
|
|
|
+ that.$message.error(res.data.msg);
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$message.error('请完善信息在保存!');
|
|
|
return false;
|
|
@@ -968,23 +912,23 @@ export default {
|
|
|
//文件上传成功时的钩子
|
|
|
upLoadSuccess(response, file, fileList) {
|
|
|
if (response.code == 200) {
|
|
|
- var that = this;
|
|
|
- that.$axios({
|
|
|
- method: 'post',
|
|
|
- url: "/api/Groups/DelFile",
|
|
|
- headers: {
|
|
|
- Authorization: 'Bearer ' + that.token
|
|
|
- },
|
|
|
- data: {
|
|
|
- fileName: that.DelfileName,
|
|
|
- id: that.id
|
|
|
- }
|
|
|
- }).then(function (res) {
|
|
|
- if (res.data.code == 200) {
|
|
|
+ // var that = this;
|
|
|
+ // that.$axios({
|
|
|
+ // method: 'post',
|
|
|
+ // url: "/api/Groups/DelFile",
|
|
|
+ // headers: {
|
|
|
+ // Authorization: 'Bearer ' + that.token
|
|
|
+ // },
|
|
|
+ // data: {
|
|
|
+ // fileName: that.DelfileName,
|
|
|
+ // id: that.id
|
|
|
+ // }
|
|
|
+ // }).then(function (res) {
|
|
|
+ // if (res.data.code == 200) {
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
- that.InvitationOfficialActivities.attachment = response.data
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // that.InvitationOfficialActivities.attachment = response.data
|
|
|
that.InvitationOfficialActivities.diId = that.DiIdSelect;
|
|
|
that.InvitationOfficialActivities.createUserId = that.userId;
|
|
|
var url = "/api/Groups/OpInvitationOfficialActivities"
|
|
@@ -1003,7 +947,7 @@ export default {
|
|
|
});
|
|
|
that.loading = true;
|
|
|
setTimeout(() => {
|
|
|
- that.$router.push('/home/InvitationOfficialActivities')
|
|
|
+ that.$router.push('/home/InvitationOfficialActivities?DiId='+that.DiIdSelect)
|
|
|
}, 500);
|
|
|
} else {
|
|
|
that.$message.error(res.data.msg);
|
|
@@ -1015,23 +959,105 @@ export default {
|
|
|
}
|
|
|
|
|
|
},
|
|
|
+ //上传服务器
|
|
|
+ submitUpload(val) {
|
|
|
+ //判断是否有文件再上传
|
|
|
+ var verdict=false
|
|
|
+ if (this.uploadFiles.length === 0) {
|
|
|
+ return this.$message.warning('请选取文件后再上传');
|
|
|
+ }
|
|
|
+ // 下面的代码将创建一个空的FormData对象:
|
|
|
+ const formData = new FormData()
|
|
|
+ // 你可以使用FormData.append来添加键/值对到表单里面;
|
|
|
+ this.uploadFiles.forEach((file) => {
|
|
|
+ if(file.raw!=undefined){
|
|
|
+ verdict=true;
|
|
|
+ formData.append('files', file.raw);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(!verdict){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var that = this;
|
|
|
+ var url = "/api/Groups/UploadProjects"
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token,
|
|
|
+ TypeName: "B"
|
|
|
+ },
|
|
|
+ data:formData
|
|
|
+ }).then(function (res) {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
//文件上传失败时的钩子
|
|
|
upLoadError(response, file, fileList) {
|
|
|
console.log("项目添加失败");
|
|
|
},
|
|
|
- beforeRemove(file, fileList) {
|
|
|
- console.log(file.name)
|
|
|
- let id1 = this.uploadFiles.findIndex(item => {
|
|
|
- if (item.name == file.name) {
|
|
|
- return true
|
|
|
+ //删除文件
|
|
|
+ beforeRemove(file,fileList){
|
|
|
+ if(file && file.status=="success"){
|
|
|
+ return this.$confirm('此文件已上传至服务器此操作将永久删除该文件, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+
|
|
|
+
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ reject(false)
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ let id1 = this.projectName.findIndex(item => {
|
|
|
+ if (item.name == file.name) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.projectName.splice(id1, 1)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ var that = this;
|
|
|
+ that.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: "/api/Groups/DelFile",
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + that.token,
|
|
|
+ typeName:'B'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ fileName: file.name,
|
|
|
+ id: that.id,
|
|
|
+ }
|
|
|
+ }).then(function (res) {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ let id1 = that.projectName.findIndex(item => {
|
|
|
+ if (item.name == file.name) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.projectName.splice(id1, 1)
|
|
|
+ that.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.msg
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
- this.uploadFiles.splice(id1, 1)
|
|
|
- this.projectName = ""
|
|
|
- this.DelfileName = file.name
|
|
|
+
|
|
|
},
|
|
|
onChange(file, fileList) {
|
|
|
- this.projectName.push(file.name);
|
|
|
+ this.uploadFiles = fileList;
|
|
|
+ this.projectName.push(file.name)
|
|
|
},
|
|
|
QueryRate() {
|
|
|
var url = "/api/Business/PostGroupTeamRateByDiIdAndCTableId"
|