style(测试跟踪): 用例版本操作样式优化

--bug=1022772 --user=陈建星 【测试跟踪】功能用例-设计验收问题汇总 https://www.tapd.cn/55049933/s/1342676
This commit is contained in:
chenjianxing 2023-02-24 14:53:51 +08:00 committed by jianxing
parent a442f08fb8
commit 3b3c9ddd3c
6 changed files with 163 additions and 87 deletions

View File

@ -533,7 +533,6 @@ export default {
}, },
tabId: getUUID(), tabId: getUUID(),
versionData: [], versionData: [],
dialogVisible: false,
oldData: null, oldData: null,
newData: null, newData: null,
selectedOtherInfo: null, selectedOtherInfo: null,
@ -1438,7 +1437,6 @@ export default {
}, },
compareBranchWithVersionId(originId, targetId){ compareBranchWithVersionId(originId, targetId){
// //
this.dialogVisible = true;
this.$refs.caseDiffViewerRef.open(originId, targetId, this.currentTestCaseInfo.id) this.$refs.caseDiffViewerRef.open(originId, targetId, this.currentTestCaseInfo.id)
}, },
compareBranch(t1, t2) { compareBranch(t1, t2) {
@ -1470,7 +1468,6 @@ export default {
(v) => v.id === that.oldData.id (v) => v.id === that.oldData.id
)[0].createName; )[0].createName;
this.setSpecialPropForCompare(that); this.setSpecialPropForCompare(that);
that.dialogVisible = true;
} }
}); });
} }

View File

@ -5,59 +5,53 @@
:visible.sync="visible" :visible.sync="visible"
:show-close="false" :show-close="false"
width="600px" width="600px"
heigth="234px"
> >
<div class="version-label">{{ $t("case.choose_copy_info") }}</div> <div class="version-label">{{ $t("case.choose_copy_info") }}</div>
<el-form ref="form" :model="form" label-width="10px" label-position="left">
<div class="version-detail-wrap"> <div class="version-detail-wrap">
<div class="item-row"> <div class="item-row">
<el-form-item>
<el-checkbox v-model="form.remark">{{ <el-checkbox v-model="form.remark">{{
$t("commons.remark") $t("commons.remark")
}}</el-checkbox> }}
</el-form-item> </el-checkbox>
</div> </div>
<div class="item-row"> <div class="item-row">
<el-form-item>
<el-checkbox v-model="form.relateTest">{{ <el-checkbox v-model="form.relateTest">{{
$t("test_track.case.relate_test") $t("test_track.case.relate_test")
}}</el-checkbox> }}
</el-form-item> </el-checkbox>
</div> </div>
<div class="item-row"> <div class="item-row">
<el-form-item>
<el-checkbox v-model="form.relateDemand">{{ <el-checkbox v-model="form.relateDemand">{{
$t("test_track.related_requirements") $t("test_track.related_requirements")
}}</el-checkbox> }}
</el-form-item> </el-checkbox>
</div> </div>
</div> </div>
<div class="version-detail-wrap"> <div class="version-detail-wrap">
<div class="item-row"> <div class="item-row">
<el-form-item>
<el-checkbox v-model="form.relateIssue">{{ <el-checkbox v-model="form.relateIssue">{{
$t("test_track.case.relate_issue") $t("test_track.case.relate_issue")
}}</el-checkbox> }}
</el-form-item> </el-checkbox>
</div> </div>
<div class="item-row"> <div class="item-row">
<el-form-item>
<el-checkbox v-model="form.dependency">{{ <el-checkbox v-model="form.dependency">{{
$t("commons.relationship.name") $t("commons.relationship.name")
}}</el-checkbox> }}
</el-form-item> </el-checkbox>
</div> </div>
<div class="item-row"> <div class="item-row">
<el-form-item>
<el-checkbox v-model="form.archive">{{ <el-checkbox v-model="form.archive">{{
$t("test_track.case.attachment") $t("test_track.case.attachment")
}}</el-checkbox> }}
</el-form-item> </el-checkbox>
</div> </div>
</div> </div>
</el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ $t("commons.cancel") }}</el-button> <el-button @click="visible = false" size="small">{{ $t("commons.cancel") }}</el-button>
<el-button type="primary" @click="confirmOtherInfo">{{ <el-button type="primary" size="small"
@click="confirmOtherInfo">{{
$t("commons.confirm") $t("commons.confirm")
}}</el-button> }}</el-button>
</span> </span>
@ -103,6 +97,11 @@ export default {
color: #1f2329; color: #1f2329;
margin-top: 12px; margin-top: 12px;
} }
.version-detail-wrap:not(:last-child) {
margin-bottom: 8px;
}
.version-detail-wrap { .version-detail-wrap {
:deep(.el-form-item__content) { :deep(.el-form-item__content) {
margin-left: 0px !important; margin-left: 0px !important;
@ -111,8 +110,22 @@ export default {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
.item-row {
height: 22px;
line-height: 22px;
width: 168px;
}
.item-row:not(:first-child) { .item-row:not(:first-child) {
margin-left: 24px; margin-left: 24px;
} }
} }
.dialog-footer {
.el-button {
width: 80px;
margin-top: 27px;
}
}
</style> </style>

View File

@ -3,7 +3,7 @@
<el-drawer <el-drawer
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="visible" :visible.sync="visible"
:size="widthCacl" :size="widthCalc"
@close="close" @close="close"
destroy-on-close destroy-on-close
:full-screen="isFullScreen" :full-screen="isFullScreen"
@ -52,7 +52,7 @@ export default {
}, },
}, },
computed: { computed: {
widthCacl() { widthCalc() {
if (!isNaN(this.width)) { if (!isNaN(this.width)) {
//rem //rem
let remW = (this.width / 1440) * 100; let remW = (this.width / 1440) * 100;

View File

@ -133,6 +133,7 @@ export default {
.content-wrap { .content-wrap {
margin-left: 2px; margin-left: 2px;
color: #1F2329;
.text { .text {
} }
} }

View File

@ -466,11 +466,13 @@ export default {
map.set(v, v); map.set(v, v);
}); });
this.versionOptions.forEach((v) => { //
for (let i = this.versionOptions.length - 1; i >= 0; i--) {
let v = this.versionOptions[i];
if (map.get(v.id)) { if (map.get(v.id)) {
this.versionList.push(v); this.versionList.push(v);
} }
}); }
}, },
async fetchAllCaseVersion() { async fetchAllCaseVersion() {
// //

View File

@ -3,7 +3,6 @@
<el-popover <el-popover
placement="bottom-end" placement="bottom-end"
width="392" width="392"
height="271"
trigger="click" trigger="click"
popper-class="version-popover" popper-class="version-popover"
v-loading="loading" v-loading="loading"
@ -13,16 +12,16 @@
<div class="label">{{ $t("project.version.name") }}</div> <div class="label">{{ $t("project.version.name") }}</div>
</div> </div>
<div class="history-container"> <div class="history-container">
<div class="item-row" v-for="item in versionOptions" :key="item.id" @click="checkout(item)"> <div class="item-row"
v-for="item in versionOptions"
:key="item.id"
:class="{'not-create-item' : !caseVersionMap.has(item.id)}"
@click="checkout(item)">
<div class="left-detail-row"> <div class="left-detail-row">
<div class="version-info-row"> <div class="version-info-row">
<div <div
:class=" class="version-label"
item.id == dataLatestId :class="{'active': item.id == currentVersionId}">
? ['version-label', 'active']
: ['version-label']
"
>
{{ item.name }} {{ item.name }}
</div> </div>
<div class="version-lasted" v-if="item.id == dataLatestId"> <div class="version-lasted" v-if="item.id == dataLatestId">
@ -63,8 +62,9 @@
</div> </div>
</div> </div>
</div> </div>
<div class="compare-row" :disabled="!versionCompareOptions || versionCompareOptions.length < 2" <div class="compare-row"
@click.stop="compareDialogVisible = true"> :class="{'compare-btn-disable': !compareBtnEnable}"
@click.stop="openCompare">
<div class="icon"> <div class="icon">
<img src="/assets/module/figma/icon_contrast_outlined.svg" alt=""/> <img src="/assets/module/figma/icon_contrast_outlined.svg" alt=""/>
</div> </div>
@ -89,25 +89,34 @@
> >
<div class="compare-wrap"> <div class="compare-wrap">
<div class="version-left-box"> <div class="version-left-box">
<el-select v-model="versionLeftId" size="small"> <el-select v-model="versionLeftId" size="small" clearable>
<el-option <el-option
v-for="item in versionCompareOptions" v-for="item in versionLeftCompareOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
></el-option> >
<span>{{ item.name }}</span>
<span class="compare-version-lasted" v-if="item.id == dataLatestId">
{{ $t("case.last_version") }}
</span>
</el-option>
</el-select> </el-select>
</div> </div>
<div class="desc">{{ $t("case.compare") }}</div> <div class="desc">{{ $t("case.compare") }}</div>
<div class="version-right-box"> <div class="version-right-box">
<el-select v-model="versionRightId" size="small"> <el-select v-model="versionRightId" size="small" clearable>
<el-option <el-option
v-for="item in versionCompareOptions" v-for="item in versionRightCompareOptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
></el-option
> >
<span>{{ item.name }}</span>
<span class="compare-version-lasted" v-if="item.id == dataLatestId">
{{ $t("case.last_version") }}
</span>
</el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
@ -169,14 +178,16 @@ export default {
versionEnable: false, versionEnable: false,
versionOptions: [], versionOptions: [],
versionCompareOptions: [], versionCompareOptions: [],
versionLeftCompareOptions: [],
versionRightCompareOptions: [],
userData: {}, userData: {},
currentVersion: {}, currentVersion: {},
dataLatestId: null, dataLatestId: null,
latestVersionId: null, latestVersionId: null,
compareDialogVisible: false, compareDialogVisible: false,
// //
versionLeftId: "", versionLeftId: '',
versionRightId: "", versionRightId: '',
// //
caseVersionMap: new Map() caseVersionMap: new Map()
}; };
@ -185,6 +196,9 @@ export default {
enableCompare() { enableCompare() {
return this.versionLeftId && this.versionRightId; return this.versionLeftId && this.versionRightId;
}, },
compareBtnEnable() {
return this.versionCompareOptions || this.versionCompareOptions.length < 2;
}
}, },
beforeDestroy() { beforeDestroy() {
this.clearSelectData(); this.clearSelectData();
@ -194,10 +208,18 @@ export default {
this.compareDialogVisible = false; this.compareDialogVisible = false;
this.clearSelectData(); this.clearSelectData();
}, },
openCompare() {
if (!this.compareBtnEnable) {
return;
}
this.setDefaultCompareOptions();
this.versionLeftId = this.currentVersionId;
this.compareDialogVisible = true;
},
clearSelectData() { clearSelectData() {
// //
this.versionLeftId = ""; this.versionLeftId = '';
this.versionRightId = ""; this.versionRightId = '';
}, },
findVersionById(id) { findVersionById(id) {
let version = this.versionCompareOptions.filter((v) => v.id === id); let version = this.versionCompareOptions.filter((v) => v.id === id);
@ -205,7 +227,7 @@ export default {
}, },
compareBranch() { compareBranch() {
this.$emit( this.$emit(
"compareBranch", 'compareBranch',
this.findVersionById(this.versionLeftId), this.findVersionById(this.versionLeftId),
this.findVersionById(this.versionRightId) this.findVersionById(this.versionRightId)
); );
@ -319,8 +341,27 @@ export default {
this.loading = false; this.loading = false;
}, },
setDefaultCompareOptions() {
this.versionLeftCompareOptions = this.versionCompareOptions;
this.versionRightCompareOptions = this.versionCompareOptions;
},
}, },
watch: { watch: {
versionLeftId() {
//
if (this.versionLeftId) {
this.versionRightCompareOptions = this.versionCompareOptions.filter(v => v.id != this.versionLeftId);
} else {
this.versionRightCompareOptions = this.versionCompareOptions;
}
},
versionRightId() {
if (this.versionRightId) {
this.versionLeftCompareOptions = this.versionCompareOptions.filter(v => v.id != this.versionRightId);
} else {
this.versionLeftCompareOptions = this.versionCompareOptions;
}
},
currentId() { currentId() {
if (!hasLicense()) { if (!hasLicense()) {
return; return;
@ -348,9 +389,28 @@ export default {
width: 392px !important; width: 392px !important;
} }
.compare-version-lasted {
display: inline-block;
font-weight: 400;
font-size: 14px;
line-height: 22px;
color: #783887;
padding: 1px 6px;
margin-left: 5px;
gap: 4px;
min-width: 49px;
height: 20px;
background: rgba(120, 56, 135, 0.2);
border-radius: 2px;
margin-right: 8px;
}
.compare-btn-disable {
color: #BBBFC4 !important;
}
.version-history-wrap { .version-history-wrap {
width: 392px; width: 392px;
height: 271px;
.label-row { .label-row {
height: 32px; height: 32px;
@ -368,7 +428,6 @@ export default {
} }
.history-container { .history-container {
height: 182px;
overflow: scroll; overflow: scroll;
.item-row:hover { .item-row:hover {
@ -431,7 +490,6 @@ export default {
} }
.opt-row { .opt-row {
margin-top: 4px;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
font-size: 14px; font-size: 14px;
@ -444,6 +502,9 @@ export default {
background: rgba(120, 56, 135, 0.1); background: rgba(120, 56, 135, 0.1);
border-radius: 4px; border-radius: 4px;
cursor: pointer; cursor: pointer;
padding-left: 3px;
padding-right: 3px;
color: #783887;
} }
.updated { .updated {
@ -456,10 +517,15 @@ export default {
} }
} }
} }
.not-create-item {
height: 32px;
}
} }
.active { .active {
color: #783887; color: #783887 !important;
font-weight: 550 !important;
} }
.compare-row { .compare-row {
@ -467,8 +533,6 @@ export default {
display: flex; display: flex;
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
margin-bottom: 8px;
margin-top: 3px;
border-top: 1px solid rgba(31, 35, 41, 0.15); border-top: 1px solid rgba(31, 35, 41, 0.15);
align-items: center; align-items: center;
@ -507,7 +571,7 @@ export default {
.desc { .desc {
color: #1f2329; color: #1f2329;
margin: 0 5px; margin: 0 8px;
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
} }
@ -527,6 +591,5 @@ export default {
.version-popover { .version-popover {
left: 215px !important; left: 215px !important;
padding: 0px !important; padding: 0px !important;
height: 271px !important;
} }
</style> </style>