Merge branch 'master' into v1.4
This commit is contained in:
commit
005cdc9eb5
|
@ -1 +1 @@
|
||||||
Subproject commit cf6b06526324326a563d933e07118fac014a63b4
|
Subproject commit ee74568be0beba46da19616f5832e83f9164c688
|
|
@ -0,0 +1,118 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-row type="flex" justify="center">
|
||||||
|
<el-col>
|
||||||
|
<el-table class="basic-config" :data="tableData">
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
:label="$t('load_test.file_name')">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="size"
|
||||||
|
:label="$t('load_test.file_size')">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="type"
|
||||||
|
:label="$t('load_test.file_type')">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
:label="$t('test_track.case.upload_time')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<i class="el-icon-time"/>
|
||||||
|
<span class="last-modified">{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
:label="$t('commons.operating')">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<el-button @click="preview(scope.row)" :disabled="!scope.row.id || readOnly" type="primary"
|
||||||
|
v-if="isPreview(scope.row)"
|
||||||
|
icon="el-icon-view"
|
||||||
|
size="mini" circle/>
|
||||||
|
<el-button @click="handleDownload(scope.row)" :disabled="!scope.row.id || readOnly" type="primary"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini" circle/>
|
||||||
|
<el-button :disabled="readOnly || !isDelete" @click="handleDelete(scope.row, scope.$index)" type="danger"
|
||||||
|
icon="el-icon-delete" size="mini"
|
||||||
|
circle/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<test-case-file ref="testCaseFile"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TestCaseFile from "@/business/components/track/case/components/TestCaseFile";
|
||||||
|
import {Message} from "element-ui";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TestCaseAttachment",
|
||||||
|
components: {TestCaseFile},
|
||||||
|
props: {
|
||||||
|
tableData: Array,
|
||||||
|
readOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
isDelete: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
preview(row) {
|
||||||
|
this.$refs.testCaseFile.open(row);
|
||||||
|
},
|
||||||
|
isPreview(row) {
|
||||||
|
const fileType = row.type;
|
||||||
|
return fileType === 'JPG' || fileType === 'JPEG' || fileType === 'PDF' || fileType === 'PNG';
|
||||||
|
},
|
||||||
|
handleDownload(file) {
|
||||||
|
let data = {
|
||||||
|
name: file.name,
|
||||||
|
id: file.id,
|
||||||
|
};
|
||||||
|
let config = {
|
||||||
|
url: '/test/case/file/download',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
responseType: 'blob'
|
||||||
|
};
|
||||||
|
this.result = this.$request(config).then(response => {
|
||||||
|
const content = response.data;
|
||||||
|
const blob = new Blob([content]);
|
||||||
|
if ("download" in document.createElement("a")) {
|
||||||
|
// 非IE下载
|
||||||
|
// chrome/firefox
|
||||||
|
let aTag = document.createElement('a');
|
||||||
|
aTag.download = file.name;
|
||||||
|
aTag.href = URL.createObjectURL(blob);
|
||||||
|
aTag.click();
|
||||||
|
URL.revokeObjectURL(aTag.href)
|
||||||
|
} else {
|
||||||
|
// IE10+下载
|
||||||
|
navigator.msSaveBlob(blob, this.filename)
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
Message.error({message: e.message, showClose: true});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(file, index) {
|
||||||
|
this.$emit("handleDelete", file, index);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
|
@ -226,47 +226,15 @@
|
||||||
<span slot="tip" class="el-upload__tip"> {{ $t('test_track.case.upload_tip') }} </span>
|
<span slot="tip" class="el-upload__tip"> {{ $t('test_track.case.upload_tip') }} </span>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
<el-col :offset="2" :span="20">
|
||||||
<el-row type="flex" justify="center">
|
<test-case-attachment :table-data="tableData"
|
||||||
<el-col :span="20">
|
:read-only="readOnly"
|
||||||
<el-table class="basic-config" :data="tableData">
|
:is-delete="true"
|
||||||
<el-table-column
|
@handleDelete="handleDelete"
|
||||||
prop="name"
|
/>
|
||||||
:label="$t('load_test.file_name')">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="size"
|
|
||||||
:label="$t('load_test.file_size')">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="type"
|
|
||||||
:label="$t('load_test.file_type')">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
:label="$t('test_track.case.upload_time')">
|
|
||||||
<template v-slot:default="scope">
|
|
||||||
<i class="el-icon-time"/>
|
|
||||||
<span class="last-modified">{{ scope.row.updateTime | timestampFormatDate }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
:label="$t('commons.operating')">
|
|
||||||
<template v-slot:default="scope">
|
|
||||||
<el-button @click="preview(scope.row)" :disabled="!scope.row.id || readOnly" type="primary"
|
|
||||||
v-if="isPreview(scope.row)"
|
|
||||||
icon="el-icon-view"
|
|
||||||
size="mini" circle/>
|
|
||||||
<el-button @click="handleDownload(scope.row)" :disabled="!scope.row.id || readOnly" type="primary"
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini" circle/>
|
|
||||||
<el-button :disabled="readOnly" @click="handleDelete(scope.row, scope.$index)" type="danger"
|
|
||||||
icon="el-icon-delete" size="mini"
|
|
||||||
circle/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
|
@ -281,7 +249,6 @@
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<test-case-file ref="testCaseFile"/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,11 +261,11 @@ import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
||||||
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
||||||
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
import TestCaseFile from "@/business/components/track/case/components/TestCaseFile";
|
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestCaseEdit",
|
name: "TestCaseEdit",
|
||||||
components: {MsDialogFooter, TestCaseFile},
|
components: {MsDialogFooter, TestCaseAttachment},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
|
@ -723,13 +690,6 @@ export default {
|
||||||
fileValidator(file) {
|
fileValidator(file) {
|
||||||
/// todo: 是否需要对文件内容和大小做限制
|
/// todo: 是否需要对文件内容和大小做限制
|
||||||
return file.size > 0;
|
return file.size > 0;
|
||||||
},
|
|
||||||
preview(row) {
|
|
||||||
this.$refs.testCaseFile.open(row);
|
|
||||||
},
|
|
||||||
isPreview(row) {
|
|
||||||
const fileType = row.type;
|
|
||||||
return fileType === 'JPG' || fileType === 'JPEG' || fileType === 'PDF' || fileType === 'PNG';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :visible.sync="dialogVisible" width="80%" :destroy-on-close="true" :before-close="close">
|
<el-dialog :visible.sync="dialogVisible" width="80%" :destroy-on-close="true" :before-close="close" :append-to-body="true">
|
||||||
<div>
|
<div>
|
||||||
<img :src="'/test/case/file/preview/' + file.id" :alt="$t('test_track.case.img_loading_fail')" style="width: 100%;height: 100%;"
|
<img :src="'/test/case/file/preview/' + file.id" :alt="$t('test_track.case.img_loading_fail')" style="width: 100%;height: 100%;"
|
||||||
v-if="file.type === 'JPG' || file.type === 'JPEG' || file.type === 'PNG'">
|
v-if="file.type === 'JPG' || file.type === 'JPEG' || file.type === 'PNG'">
|
||||||
|
|
|
@ -299,6 +299,21 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="15" :offset="1">
|
||||||
|
<div>
|
||||||
|
<span class="cast_label">{{ $t('test_track.case.attachment') }}:</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<test-case-attachment :table-data="tableData"
|
||||||
|
:read-only="isReadOnly"
|
||||||
|
:is-delete="false"
|
||||||
|
@handleDelete="handleDelete"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
@ -320,6 +335,7 @@ import ApiTestResult from "./test/ApiTestResult";
|
||||||
import PerformanceTestDetail from "./test/PerformanceTestDetail";
|
import PerformanceTestDetail from "./test/PerformanceTestDetail";
|
||||||
import PerformanceTestResult from "./test/PerformanceTestResult";
|
import PerformanceTestResult from "./test/PerformanceTestResult";
|
||||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||||
|
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanTestCaseEdit",
|
name: "TestPlanTestCaseEdit",
|
||||||
|
@ -328,7 +344,8 @@ export default {
|
||||||
PerformanceTestDetail,
|
PerformanceTestDetail,
|
||||||
ApiTestResult,
|
ApiTestResult,
|
||||||
ApiTestDetail,
|
ApiTestDetail,
|
||||||
TestPlanTestCaseStatusButton
|
TestPlanTestCaseStatusButton,
|
||||||
|
TestCaseAttachment
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -348,7 +365,8 @@ export default {
|
||||||
activeTab: 'detail',
|
activeTab: 'detail',
|
||||||
isFailure: true,
|
isFailure: true,
|
||||||
users: [],
|
users: [],
|
||||||
hasTapdId: false
|
hasTapdId: false,
|
||||||
|
tableData: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -449,6 +467,20 @@ export default {
|
||||||
this.initTest();
|
this.initTest();
|
||||||
this.getIssues(testCase.caseId);
|
this.getIssues(testCase.caseId);
|
||||||
this.stepResultChange();
|
this.stepResultChange();
|
||||||
|
this.getFileMetaData(testCase);
|
||||||
|
},
|
||||||
|
getFileMetaData(testCase) {
|
||||||
|
this.tableData = [];
|
||||||
|
this.result = this.$get("test/case/file/metadata/" + testCase.caseId, response => {
|
||||||
|
let files = response.data;
|
||||||
|
if (!files) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.tableData = JSON.parse(JSON.stringify(files));
|
||||||
|
this.tableData.map(f => {
|
||||||
|
f.size = f.size + ' Bytes';
|
||||||
|
});
|
||||||
|
})
|
||||||
},
|
},
|
||||||
openTestCaseEdit(testCase) {
|
openTestCaseEdit(testCase) {
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
|
@ -589,6 +621,9 @@ export default {
|
||||||
this.getIssues(this.testCase.caseId);
|
this.getIssues(this.testCase.caseId);
|
||||||
this.$success(this.$t('commons.delete_success'));
|
this.$success(this.$t('commons.delete_success'));
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
handleDelete() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,22 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="20" :offset="1">
|
||||||
|
<div>
|
||||||
|
<span class="cast_label">{{ $t('test_track.case.attachment') }}:</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<test-case-attachment :table-data="tableData"
|
||||||
|
:read-only="false"
|
||||||
|
:is-delete="false"
|
||||||
|
@handleDelete="handleDelete"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
|
@ -234,6 +250,7 @@ import ApiTestDetail from "../../../plan/view/comonents/test/ApiTestDetail";
|
||||||
import TestPlanTestCaseStatusButton from "../../../plan/common/TestPlanTestCaseStatusButton";
|
import TestPlanTestCaseStatusButton from "../../../plan/common/TestPlanTestCaseStatusButton";
|
||||||
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
|
||||||
import ReviewComment from "../../commom/ReviewComment";
|
import ReviewComment from "../../commom/ReviewComment";
|
||||||
|
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestReviewTestCaseEdit",
|
name: "TestReviewTestCaseEdit",
|
||||||
|
@ -243,7 +260,8 @@ export default {
|
||||||
ApiTestResult,
|
ApiTestResult,
|
||||||
ApiTestDetail,
|
ApiTestDetail,
|
||||||
TestPlanTestCaseStatusButton,
|
TestPlanTestCaseStatusButton,
|
||||||
ReviewComment
|
ReviewComment,
|
||||||
|
TestCaseAttachment
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -258,7 +276,8 @@ export default {
|
||||||
isFailure: true,
|
isFailure: true,
|
||||||
users: [],
|
users: [],
|
||||||
activeName: 'comment',
|
activeName: 'comment',
|
||||||
comments: []
|
comments: [],
|
||||||
|
tableData: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -332,6 +351,20 @@ export default {
|
||||||
this.testCase = item;
|
this.testCase = item;
|
||||||
this.getComments(item);
|
this.getComments(item);
|
||||||
this.initTest();
|
this.initTest();
|
||||||
|
this.getFileMetaData(testCase);
|
||||||
|
},
|
||||||
|
getFileMetaData(testCase) {
|
||||||
|
this.tableData = [];
|
||||||
|
this.result = this.$get("test/case/file/metadata/" + testCase.caseId, response => {
|
||||||
|
let files = response.data;
|
||||||
|
if (!files) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.tableData = JSON.parse(JSON.stringify(files));
|
||||||
|
this.tableData.map(f => {
|
||||||
|
f.size = f.size + ' Bytes';
|
||||||
|
});
|
||||||
|
})
|
||||||
},
|
},
|
||||||
openTestCaseEdit(testCase) {
|
openTestCaseEdit(testCase) {
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
|
@ -406,6 +439,9 @@ export default {
|
||||||
}).length > 0;
|
}).length > 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleDelete() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 06d935cd1d22ab36f09763745c2aff8ad3fb08c1
|
Subproject commit cc38137a69a0f20fadece9c0f9f50a9468c4ace9
|
Loading…
Reference in New Issue