fix(测试跟踪): 复制用例需求未显示

--bug=1023432 --user=陈建星 【测试跟踪】功能用例-公共用例库列表-操作-查看-详情页点击复制进入创建用例页面-关系需求未显示 https://www.tapd.cn/55049933/s/1338979
This commit is contained in:
chenjianxing 2023-02-20 21:23:27 +08:00 committed by jianxing
parent be18f694d7
commit bb79f40f1b
2 changed files with 44 additions and 32 deletions

View File

@ -335,3 +335,12 @@ textarea {
.el-message-box { .el-message-box {
margin-bottom: 20%; margin-bottom: 20%;
} }
/* 超出文本显示... */
.text-ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
}

View File

@ -233,7 +233,7 @@
<div class="story-label" v-if="data.value === 'other'"> <div class="story-label" v-if="data.value === 'other'">
{{ $t("test_track.case.other") }} {{ $t("test_track.case.other") }}
</div> </div>
<div class="story-label" v-else>{{ handleDemandOptionLabel(data) }}</div> <div class="story-label text-ellipsis" v-else>{{ handleDemandOptionLabel(data) }}</div>
</div> </div>
</template> </template>
</el-cascader> </el-cascader>
@ -253,7 +253,7 @@
</div> </div>
</div> </div>
<!-- 选择了关联需求后展示并且必填 --> <!-- 选择了关联需求后展示并且必填 -->
<div class="story-name-row case-wrap" v-if="form.demandId"> <div class="story-name-row case-wrap" v-if="form.demandId === 'other'">
<div class="case-title-wrap"> <div class="case-title-wrap">
<div class="name title-wrap"> <div class="name title-wrap">
{{ $t("test_track.case.demand_name_id") }} {{ $t("test_track.case.demand_name_id") }}
@ -339,9 +339,6 @@ import CustomFiledFormRow from "./CaseCustomFiledFormRow";
import { useStore } from "@/store"; import { useStore } from "@/store";
import BaseEditItemComponent from "../BaseEditItemComponent"; import BaseEditItemComponent from "../BaseEditItemComponent";
import { issueDemandList } from "@/api/issue"; import { issueDemandList } from "@/api/issue";
import {
getCurrentProjectID,
} from "metersphere-frontend/src/utils/token";
export default { export default {
name: "CaseBaseInfo", name: "CaseBaseInfo",
components: { components: {
@ -359,6 +356,13 @@ export default {
this.form.demandId = null; this.form.demandId = null;
} }
}, },
'form.demandId'() {
this.buildDemandOptions();
},
projectId() {
this.getDemandOptions();
this.getVersionOptions();
}
}, },
data() { data() {
return { return {
@ -438,6 +442,7 @@ export default {
demandLabel: "", demandLabel: "",
demandOptions: [], demandOptions: [],
versionFilters: [], versionFilters: [],
demandList: [],
}; };
}, },
props: { props: {
@ -455,11 +460,9 @@ export default {
testCaseTemplate: Object, testCaseTemplate: Object,
defaultOpen: String, defaultOpen: String,
versionEnable: Boolean, versionEnable: Boolean,
projectId: String,
}, },
computed: { computed: {
projectId() {
return getCurrentProjectID();
},
isCustomNum() { isCustomNum() {
return useStore().currentProjectIsCustomNum; return useStore().currentProjectIsCustomNum;
}, },
@ -515,16 +518,13 @@ export default {
} }
return ""; return "";
}, },
validateAllForm(callback) {
callback(
this.editable ? true : this.validateForm() && this.validateCustomForm()
);
},
getVersionOptions() { getVersionOptions() {
if (hasLicense()) { if (hasLicense()) {
getProjectVersions(getCurrentProjectID()).then( if (this.projectId) {
(r) => (this.versionFilters = r.data) getProjectVersions(this.projectId).then(
); (r) => (this.versionFilters = r.data)
);
}
} }
}, },
changeVersion(data) { changeVersion(data) {
@ -589,11 +589,6 @@ export default {
}, },
validateForm() { validateForm() {
let isValidate = true; let isValidate = true;
// this.$refs["caseFrom"].validate((valid) => {
// if (!valid) {
// isValidate = false;
// }
// });
this.$refs["baseCaseFrom"].validate((valid) => { this.$refs["baseCaseFrom"].validate((valid) => {
if (!valid) { if (!valid) {
isValidate = false; isValidate = false;
@ -626,17 +621,24 @@ export default {
getDemandOptions() { getDemandOptions() {
this.result = { loading: true }; this.result = { loading: true };
this.demandLabel = ""; this.demandLabel = "";
issueDemandList(this.projectId) if (this.projectId) {
.then((r) => { issueDemandList(this.projectId)
this.demandOptions = []; .then((r) => {
if (r.data && r.data.length > 0) { this.demandOptions = [];
this.buildDemandCascaderOptions(r.data, this.demandOptions, []); this.demandList = r.data;
} this.buildDemandOptions();
this.addOtherOption(); })
}) .catch(() => {
.catch(() => { this.addOtherOption();
this.addOtherOption(); });
}); }
},
buildDemandOptions() {
this.demandOptions = [];
if (this.demandList.length > 0) {
this.addOtherOption();
this.buildDemandCascaderOptions(this.demandList, this.demandOptions, []);
}
}, },
addOtherOption() { addOtherOption() {
this.demandOptions.unshift({ this.demandOptions.unshift({
@ -714,6 +716,7 @@ export default {
.story-label { .story-label {
line-height: 22px; line-height: 22px;
color: #1f2329; color: #1f2329;
max-width: 300px;
} }
} }
.selectHover { .selectHover {