fix(测试跟踪): 版本对比创建人显示错误

--bug=1025780 --user=陈建星 【测试跟踪】-测试计划-测试用例-进入编辑,新建版本-版本对比错误 https://www.tapd.cn/55049933/s/1366298
This commit is contained in:
chenjianxing 2023-04-25 11:51:17 +08:00 committed by jianxing
parent b8d37b7b77
commit 77f63fd49f
3 changed files with 33 additions and 48 deletions

View File

@ -315,7 +315,7 @@
</div> </div>
</div> </div>
<!-- since v2.7 --> <!-- since v2.7 -->
<case-diff-side-viewer ref="caseDiffViewerRef" ></case-diff-side-viewer> <case-diff-side-viewer ref="caseDiffViewerRef"/>
<version-create-other-info-select <version-create-other-info-select
@confirmOtherInfo="confirmOtherInfo" @confirmOtherInfo="confirmOtherInfo"
ref="selectPropDialog"/> ref="selectPropDialog"/>
@ -1490,11 +1490,16 @@ export default {
this.currentVersionName = versionName; this.currentVersionName = versionName;
}, },
compareBranchWithVersionId(originId, targetId){ compareBranchWithVersionId(originId, targetId){
let originVersion = this.$refs.versionHistory.findVersionById(originId);
let targetVersion = this.$refs.versionHistory.findVersionById(targetId);
this.compareBranchWithVersionInfo(originVersion, targetVersion, this.currentTestCaseInfo.id);
},
compareBranchWithVersionInfo(originVersion, targetVersion){
// //
this.$refs.caseDiffViewerRef.open(originId, targetId, this.currentTestCaseInfo.id) this.$refs.caseDiffViewerRef.open(originVersion, targetVersion, this.currentTestCaseInfo.id)
}, },
compareBranch(t1, t2) { compareBranch(t1, t2) {
this.compareBranchWithVersionId(t1.id, t2.id); this.compareBranchWithVersionInfo(t1, t2);
}, },
compare(row) { compare(row) {
testCaseGetByVersionId(row.id, this.currentTestCaseInfo.refId).then( testCaseGetByVersionId(row.id, this.currentTestCaseInfo.refId).then(

View File

@ -17,8 +17,8 @@
</div> </div>
</template> </template>
<case-diff-viewer <case-diff-viewer
:versionLeftId="versionLeftId" :left-version="leftVersion"
:versionRightId="versionRightId" :right-version="rightVersion"
:caseId="caseId" :caseId="caseId"
></case-diff-viewer> ></case-diff-viewer>
</el-drawer> </el-drawer>
@ -34,8 +34,8 @@ export default {
visible: false, visible: false,
isFullScreen: false, isFullScreen: false,
// props // props
versionLeftId: "", leftVersion: {},
versionRightId: "", rightVersion: {},
caseId: "", caseId: "",
}; };
}, },
@ -63,9 +63,9 @@ export default {
}, },
}, },
methods: { methods: {
open(versionLeftId, versionRightId, caseId) { open(leftVersion, rightVersion, caseId) {
this.versionLeftId = versionLeftId; this.leftVersion = leftVersion;
this.versionRightId = versionRightId; this.rightVersion = rightVersion;
this.caseId = caseId; this.caseId = caseId;
this.visible = true; this.visible = true;
}, },

View File

@ -24,7 +24,7 @@
</div> </div>
</div> </div>
<div class="version-creator"> <div class="version-creator">
<div class="username">{{ item.createUserName }}</div> <div class="username">{{ item.createName }}</div>
<div class="static-label">{{$t('permission.project_custom_code.create')}}</div> <div class="static-label">{{$t('permission.project_custom_code.create')}}</div>
</div> </div>
</div> </div>
@ -304,13 +304,17 @@ export default {
CaseDiffIssueRelate, CaseDiffIssueRelate,
}, },
props: { props: {
versionLeftId: { leftVersion: {
type: String, type: Object,
default: "", default() {
return {}
},
},
rightVersion: {
type: Object,
default() {
return {}
}, },
versionRightId: {
type: String,
default: "",
}, },
caseId: { caseId: {
type: String, type: String,
@ -325,8 +329,6 @@ export default {
standardWith: 184, standardWith: 184,
prevBtn: true, prevBtn: true,
nextBtn: true, nextBtn: true,
//id
appointVersionRightId: "",
/** /**
* 正文 * 正文
*/ */
@ -344,8 +346,6 @@ export default {
cacheVersionsMap: new Map(), cacheVersionsMap: new Map(),
// id // id
cacheVersionsNameMap: new Map(), cacheVersionsNameMap: new Map(),
// case id
caseVersionIds: new Set(),
// //
versionOptions: [], versionOptions: [],
versionList: [], versionList: [],
@ -439,9 +439,6 @@ export default {
async refresh() { async refresh() {
await this.fetchCaseVersions(); await this.fetchCaseVersions();
await this.fetchAllCaseVersion(); await this.fetchAllCaseVersion();
//
// , ,
// this.formatVersionList();
this.formatCompareVersion(); this.formatCompareVersion();
this.checkoutVersionCase(); this.checkoutVersionCase();
this.calculate(); this.calculate();
@ -474,20 +471,6 @@ export default {
this.tagDiffData = this.defaultExecutor.tagDiffData || {}; this.tagDiffData = this.defaultExecutor.tagDiffData || {};
this.baseInfoDiffData = this.defaultExecutor.baseInfoDiffData || {}; this.baseInfoDiffData = this.defaultExecutor.baseInfoDiffData || {};
}, },
formatVersionList() {
let map = new Map();
this.caseVersionIds.forEach((v) => {
map.set(v, v);
});
//
for (let i = this.versionOptions.length - 1; i >= 0; i--) {
let v = this.versionOptions[i];
if (map.get(v.id)) {
this.versionList.push(v);
}
}
},
async fetchAllCaseVersion() { async fetchAllCaseVersion() {
// //
let res = await getProjectVersions(getCurrentProjectID()); let res = await getProjectVersions(getCurrentProjectID());
@ -499,7 +482,6 @@ export default {
data.forEach((e) => { data.forEach((e) => {
this.cacheVersionsMap.set(e.versionId, e); this.cacheVersionsMap.set(e.versionId, e);
this.cacheVersionsNameMap.set(e.versionName, e.versionId); this.cacheVersionsNameMap.set(e.versionName, e.versionId);
this.caseVersionIds.add(e.versionId);
}); });
}, },
@ -521,17 +503,15 @@ export default {
}, },
formatCompareVersion() { formatCompareVersion() {
// //
let leftVersion = this.versionOptions.filter(version => version.id === this.versionLeftId); this.versionList.push(this.leftVersion);
let rightVersion = this.versionOptions.filter(version => version.id === this.versionRightId); this.versionList.push(this.rightVersion);
this.versionList.push(leftVersion[0]);
this.versionList.push(rightVersion[0]);
}, },
checkoutVersionCase() { checkoutVersionCase() {
if (this.versionLeftId) { if (this.leftVersion) {
this.originCase = this.cacheVersionsMap.get(this.versionLeftId); this.originCase = this.cacheVersionsMap.get(this.leftVersion.id);
} }
if (this.versionRightId) { if (this.rightVersion) {
this.targetCase = this.cacheVersionsMap.get(this.versionRightId); this.targetCase = this.cacheVersionsMap.get(this.rightVersion.id);
} }
}, },
async diffAttachment() { async diffAttachment() {