fix(测试跟踪): 新建用例时版本及所属模块未指定初值

--bug=1023265,1023264 --user=宋昌昌 【测试跟踪】功能用例-创建用例/功能用例列表-复制用例/编辑用例-更多操作-复制-版本默认为空 https://www.tapd.cn/55049933/s/1337907
This commit is contained in:
song-cc-rock 2023-02-20 00:02:33 +08:00 committed by jianxing
parent 8716a1d0ea
commit fb9791e4d6
4 changed files with 36 additions and 13 deletions

View File

@ -28,7 +28,7 @@
<svg-icon v-if="data.id !== 'root' && !hideNodeOperator" icon-class="icon_drag_outlined"/>
</span>
<span v-if="data.isEdit" @click.stop @click.stop style="width: 92%">
<span v-if="data.isEdit" @click.stop style="width: 92%">
<el-input @blur.stop="save(node, data)" @keyup.enter.native.stop="$event.target.blur()" v-model="data.name"
class="name-input" size="mini" ref="nameInput" :draggable="true"/>
</span>

View File

@ -345,7 +345,8 @@ export default {
hasPermission,
handleCreateCase(){
openCaseCreate({
projectId: this.projectId
projectId: this.projectId,
createNodeId: this.selectNode.data && this.selectNode.data.id !== 'root' ? this.selectNode.data.id : ""
}, this);
},
handleImportCommand(e) {

View File

@ -307,6 +307,7 @@
</template>
<script>
import {getProjectVersions} from "metersphere-frontend/src/api/version";
import { TokenKey } from "metersphere-frontend/src/utils/constants";
import MsDialogFooter from "metersphere-frontend/src/components/MsDialogFooter";
import {
@ -691,8 +692,21 @@ export default {
this.$router.push('/track/case/all');
});
this.$EventBus.$on("handleSaveCaseWithEvent", this.handleSaveCaseWithEvent);
this.setInitialVal();
},
methods: {
setInitialVal() {
if (this.isAdd) {
getProjectVersions(getCurrentProjectID()).then(
(r) => {
let latestVersion = r.data.filter(version => version.latest);
if (latestVersion && latestVersion.length === 1 && this.editable) {
this.initLatestVersionId = latestVersion[0].id;
}
}
);
}
},
checkoutLatest(){
//
this.checkoutByVersionId(this.latestVersionId);
@ -937,6 +951,7 @@ export default {
this.form.method = "manual";
this.form.maintainer = user.id;
this.form.tags = [];
this.form.versionId = this.initLatestVersionId;
this.getSelectOptions();
this.customFieldForm = parseCustomField(
this.form,
@ -986,7 +1001,7 @@ export default {
//
testCase.id = getUUID();
testCase.refId = null;
testCase.versionId = null;
testCase.versionId = this.initLatestVersionId;
this.testCaseTemplate.customFields.forEach((item) => {
item.isEdit = false;

View File

@ -328,9 +328,7 @@
</template>
<script>
import {
getProjectVersions,
} from "metersphere-frontend/src/api/version";
import {getProjectVersions} from "metersphere-frontend/src/api/version";
import { hasLicense } from "metersphere-frontend/src/utils/permission";
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
import MsSelectTree from "metersphere-frontend/src/components/select-tree/SelectTree";
@ -466,13 +464,17 @@ export default {
defaultModuleKey() {
if (this.editable) {
let defaultNodeKey = '';
this.treeNodes.forEach(node => {
if (node.label === '未规划用例') {
defaultNodeKey = node.id;
this.form.module = defaultNodeKey;
this.form.nodePath = node.path;
}
})
if (this.$route.query.createNodeId) {
defaultNodeKey = this.$route.query.createNodeId;
} else {
this.treeNodes.forEach(node => {
if (node.label === '未规划用例') {
defaultNodeKey = node.id;
this.form.module = defaultNodeKey;
this.form.nodePath = node.path;
}
})
}
return defaultNodeKey;
} else {
return this.form.module
@ -482,6 +484,11 @@ export default {
mounted() {
this.getDemandOptions();
this.getVersionOptions();
if (this.$route.query.createNodeId) {
this.form.module = this.$route.query.createNodeId;
let node = this.findTreeNode(this.treeNodes);
this.form.nodePath = node.path;
}
},
methods: {
handleDemandOptionPlatform(data){