fix(测试跟踪): 编辑用例自定义ID选项

--bug=1023260 --user=陈建星 【测试跟踪】功能用例开启自定义用例ID,新建/编辑 页面没有填写ID的地方 https://www.tapd.cn/55049933/s/1337681
This commit is contained in:
chenjianxing 2023-02-18 21:02:24 +08:00 committed by jianxing
parent 74a96dab9e
commit 5498a17695
1 changed files with 27 additions and 16 deletions

View File

@ -383,6 +383,7 @@ import {openCaseEdit} from "@/business/case/test-case";
import ListItemDeleteConfirm from "metersphere-frontend/src/components/ListItemDeleteConfirm"; import ListItemDeleteConfirm from "metersphere-frontend/src/components/ListItemDeleteConfirm";
import CaseDiffSideViewer from "./case/diff/CaseDiffSideViewer"; import CaseDiffSideViewer from "./case/diff/CaseDiffSideViewer";
const store = useStore();
export default { export default {
name: "TestCaseEdit", name: "TestCaseEdit",
components: { components: {
@ -583,10 +584,10 @@ export default {
return pId ? pId : getCurrentProjectID(); return pId ? pId : getCurrentProjectID();
}, },
moduleOptions() { moduleOptions() {
return useStore().testCaseModuleOptions; return store.testCaseModuleOptions;
}, },
isCustomNum() { isCustomNum() {
return useStore().currentProjectIsCustomNum; return store.currentProjectIsCustomNum;
}, },
richTextDefaultOpen() { richTextDefaultOpen() {
return this.type === "edit" ? "preview" : "edit"; return this.type === "edit" ? "preview" : "edit";
@ -635,20 +636,20 @@ export default {
}, },
form: { form: {
handler(val) { handler(val) {
if (val && useStore().testCaseMap && this.form.id) { if (val && store.testCaseMap && this.form.id) {
let change = useStore().testCaseMap.get(this.form.id); let change = store.testCaseMap.get(this.form.id);
change = change + 1; change = change + 1;
useStore().testCaseMap.set(this.form.id, change); store.testCaseMap.set(this.form.id, change);
} }
}, },
deep: true, deep: true,
}, },
customFieldForm: { customFieldForm: {
handler(val) { handler(val) {
if (val && useStore().testCaseMap && this.form.id) { if (val && store.testCaseMap && this.form.id) {
let change = useStore().testCaseMap.get(this.form.id); let change = store.testCaseMap.get(this.form.id);
change = change + 1; change = change + 1;
useStore().testCaseMap.set(this.form.id, change); store.testCaseMap.set(this.form.id, change);
} }
}, },
deep: true, deep: true,
@ -673,11 +674,11 @@ export default {
}); });
}, 1000); }, 1000);
if (!(useStore().testCaseMap instanceof Map)) { if (!(store.testCaseMap instanceof Map)) {
useStore().testCaseMap = new Map(); store.testCaseMap = new Map();
} }
if (this.form.id) { if (this.form.id) {
useStore().testCaseMap.set(this.form.id, 0); store.testCaseMap.set(this.form.id, 0);
} }
}, },
@ -719,10 +720,20 @@ export default {
this.loading = true; this.loading = true;
getTestTemplate().then((template) => { getTestTemplate().then((template) => {
this.testCaseTemplate = template; this.testCaseTemplate = template;
useStore().testCaseTemplate = this.testCaseTemplate; store.testCaseTemplate = this.testCaseTemplate;
initFuc(); initFuc();
}); });
getProjectApplicationConfig('CASE_CUSTOM_NUM')
.then(result => {
let data = result.data;
if (data && data.typeValue === 'true') {
store.currentProjectIsCustomNum = true;
} else {
store.currentProjectIsCustomNum = false;
}
});
this.addListener(); // ctrl s this.addListener(); // ctrl s
if (!this.projectList || this.projectList.length === 0) { if (!this.projectList || this.projectList.length === 0) {
// //
@ -846,7 +857,7 @@ export default {
this.form.remark = ""; this.form.remark = "";
} }
if (this.form.id) { if (this.form.id) {
useStore().testCaseMap.set(this.form.id, 0); store.testCaseMap.set(this.form.id, 0);
} }
}, },
addPublic() { addPublic() {
@ -887,7 +898,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.isStepTableAlive = true; this.isStepTableAlive = true;
if (this.form.id) { if (this.form.id) {
useStore().testCaseMap.set(this.form.id, 0); store.testCaseMap.set(this.form.id, 0);
} }
}); });
}, },
@ -1089,7 +1100,7 @@ export default {
this.$success(this.$t("commons.save_success"), false); this.$success(this.$t("commons.save_success"), false);
this.operationType = "edit"; this.operationType = "edit";
this.$emit("refreshTestCase"); this.$emit("refreshTestCase");
useStore().testCaseMap.set(this.form.id, 0); store.testCaseMap.set(this.form.id, 0);
this.$emit("refresh", response.data); this.$emit("refresh", response.data);
if (this.form.id) { if (this.form.id) {
this.$emit("caseEdit", param); this.$emit("caseEdit", param);
@ -1280,7 +1291,7 @@ export default {
document.removeEventListener("keydown", this.createCtrlSHandle); document.removeEventListener("keydown", this.createCtrlSHandle);
}, },
createCtrlSHandle(event) { createCtrlSHandle(event) {
let curTabId = useStore().curTabId; let curTabId = store.curTabId;
if (curTabId === this.tabId) { if (curTabId === this.tabId) {
if (event.keyCode === 83 && event.ctrlKey && this.readOnly) { if (event.keyCode === 83 && event.ctrlKey && this.readOnly) {
this.$warning(this.$t("commons.no_operation_permission"), false); this.$warning(this.$t("commons.no_operation_permission"), false);