|
@@ -44,7 +44,7 @@
|
|
|
v-if="isModifyMode"
|
|
|
drag
|
|
|
class="upload-demo"
|
|
|
- action="https://jsonplaceholder.typicode.com/posts/"
|
|
|
+ action=""
|
|
|
:on-remove="handleRemove"
|
|
|
:before-remove="beforeRemove"
|
|
|
multiple
|
|
@@ -52,6 +52,7 @@
|
|
|
:on-exceed="handleExceed"
|
|
|
:before-upload="beforeFileUpload"
|
|
|
:file-list="report.file"
|
|
|
+ :http-request="uploadReportFile"
|
|
|
>
|
|
|
<i class="el-icon-upload"></i>
|
|
|
<div class="el-upload__text">
|
|
@@ -61,9 +62,9 @@
|
|
|
<div class="el-upload__tip" slot="tip">请上传报告文件</div>
|
|
|
</el-upload>
|
|
|
<div v-if="!isModifyMode">
|
|
|
- <span v-if="report.file==null">暂无文件</span>
|
|
|
- <a :href="report.file" v-if="report.file!=null"><i class="fa fa-file-text-o"></i>
|
|
|
- {{report.file}}</a>
|
|
|
+ <span v-if="report.fileUrl==null">暂无文件</span>
|
|
|
+ <a :href="report.fileUrl" v-if="report.fileUrl!=null"><i class="fa fa-file-text-o"></i>
|
|
|
+ {{report.fileUrl}}</a>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -97,16 +98,18 @@ export default {
|
|
|
return {
|
|
|
reportId: 0,
|
|
|
projectId: '',
|
|
|
- taskId:'',
|
|
|
+ taskId: '',
|
|
|
isModifyMode: false,
|
|
|
serviceType: ServiceType,
|
|
|
report: {
|
|
|
name: '',
|
|
|
type: '',
|
|
|
description: '',
|
|
|
- content:'',
|
|
|
+ target: '',
|
|
|
+ content: '',
|
|
|
file: [],
|
|
|
- conclusion:''
|
|
|
+ fileUrl: '',
|
|
|
+ conclusion: ''
|
|
|
},
|
|
|
rules: {
|
|
|
// name: [
|
|
@@ -156,11 +159,11 @@ export default {
|
|
|
conclusion: this.report.conclusion
|
|
|
}
|
|
|
console.log(newReport)
|
|
|
- if (this.taskId == null){
|
|
|
+ if (this.taskId == null) {
|
|
|
Http.put(Apis.REPORT.UPDATE_PROJECT_REPORT.replace('{projectId}', this.projectId).replace('{reportId}', this.reportId), newReport).then((res) => {
|
|
|
console.log(res)
|
|
|
})
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
Http.put(Apis.REPORT.UPDATE_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId).replace('{reportId}', this.reportId), newReport).then((res) => {
|
|
|
console.log(res)
|
|
|
})
|
|
@@ -221,17 +224,46 @@ export default {
|
|
|
console.log(this.taskId)
|
|
|
console.log(this.reportId)
|
|
|
console.log('***')
|
|
|
- if (this.taskId == null){
|
|
|
+ if (this.taskId == null) {
|
|
|
Http.get(Apis.REPORT.GET_PROJECT_REPORT.replace('{projectId}', this.projectId).replace('{reportId}', this.reportId)).then((res) => {
|
|
|
console.log(res)
|
|
|
- this.report = res.crowdReportVO
|
|
|
+ this.report.name = res.crowdReportVO.name
|
|
|
+ this.report.crowdTestTaskId = res.crowdReportVO.crowdTestTaskId
|
|
|
+ this.report.scope = res.crowdReportVO.scope
|
|
|
+ this.report.type = res.crowdReportVO.type
|
|
|
+ this.report.description = res.crowdReportVO.description
|
|
|
+ this.report.content = res.crowdReportVO.content
|
|
|
+ this.report.fileUrl = res.crowdReportVO.file
|
|
|
+ this.report.conclusion = res.crowdReportVO.conclusion
|
|
|
+ this.report.target = res.crowdReportVO.target
|
|
|
})
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
Http.get(Apis.REPORT.GET_TASK_REPORT.replace('{projectId}', this.projectId).replace('{taskId}', this.taskId).replace('{reportId}', this.reportId)).then((res) => {
|
|
|
console.log(res)
|
|
|
- this.report = res.crowdReportVO
|
|
|
+ this.report.name = res.crowdReportVO.name
|
|
|
+ this.report.crowdTestTaskId = res.crowdReportVO.crowdTestTaskId
|
|
|
+ this.report.scope = res.crowdReportVO.scope
|
|
|
+ this.report.type = res.crowdReportVO.type
|
|
|
+ this.report.description = res.crowdReportVO.description
|
|
|
+ this.report.content = res.crowdReportVO.content
|
|
|
+ this.report.fileUrl = res.crowdReportVO.file
|
|
|
+ this.report.conclusion = res.crowdReportVO.conclusion
|
|
|
+ this.report.target = res.crowdReportVO.target
|
|
|
})
|
|
|
}
|
|
|
+ },
|
|
|
+ uploadReportFile (param) {
|
|
|
+ const formData = new FormData()
|
|
|
+ let config = {
|
|
|
+ //添加请求头
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'},
|
|
|
+ }
|
|
|
+ formData.append('file', param.file)
|
|
|
+ Http.upload(Apis.FILE.UPLOAD_REPORT_FILE.replace('{userId}', 3), formData, config).then((res) => {
|
|
|
+ console.log('上传成功')
|
|
|
+ this.report.fileUrl = res.data
|
|
|
+ console.log(res)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|