fix: 测试跟踪从vuex获取项目id

This commit is contained in:
chenjianxing 2021-03-23 20:10:55 +08:00
parent 8993e53b70
commit b2514df363
24 changed files with 163 additions and 124 deletions

View File

@ -41,7 +41,6 @@
</template> </template>
<script> <script>
import {getCurrentProjectID} from "@/common/js/utils";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
export default { export default {
@ -58,10 +57,14 @@ export default {
loading: false loading: false
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
search() { search() {
let projectID = getCurrentProjectID(); let projectID = this.projectId;
this.result = this.$get("/api/faliureCaseAboutTestPlan/"+projectID+"/10", response => { this.result = this.$get("/api/faliureCaseAboutTestPlan/"+projectID+"/10", response => {
this.tableData = response.data; this.tableData = response.data;
}); });

View File

@ -57,7 +57,7 @@
</template> </template>
<script> <script>
import {checkoutTestManagerOrTestUser, getCurrentProjectID} from "@/common/js/utils"; import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
export default { export default {
name: "MsRunningTaskList", name: "MsRunningTaskList",
@ -80,12 +80,15 @@ export default {
computed:{ computed:{
isReadOnly(){ isReadOnly(){
return !checkoutTestManagerOrTestUser(); return !checkoutTestManagerOrTestUser();
} },
projectId() {
return this.$store.state.projectId
},
}, },
methods: { methods: {
search() { search() {
let projectID = getCurrentProjectID(); let projectID = this.projectId;
this.result = this.$get("/api/runningTask/"+projectID+"/"+this.callFrom, response => { this.result = this.$get("/api/runningTask/"+projectID+"/"+this.callFrom, response => {
this.tableData = response.data; this.tableData = response.data;
}); });

View File

@ -99,7 +99,7 @@ import SelectMenu from "../common/SelectMenu";
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsAsideContainer from "../../common/components/MsAsideContainer"; import MsAsideContainer from "../../common/components/MsAsideContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser, getCurrentProjectID, getUUID} from "../../../../common/js/utils"; import {checkoutTestManagerOrTestUser, getUUID} from "../../../../common/js/utils";
import TestCaseNodeTree from "../common/TestCaseNodeTree"; import TestCaseNodeTree from "../common/TestCaseNodeTree";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
@ -132,12 +132,10 @@ export default {
loading: false, loading: false,
type:'', type:'',
activeDom: 'left', activeDom: 'left',
projectId: ""
} }
}, },
mounted() { mounted() {
this.init(this.$route); this.init(this.$route);
this.projectId = getCurrentProjectID();
}, },
watch: { watch: {
redirectID() { redirectID() {
@ -151,7 +149,6 @@ export default {
this.init(to); this.init(to);
if (to.path.indexOf('/track/case/all') == -1) { if (to.path.indexOf('/track/case/all') == -1) {
if (this.$refs && this.$refs.autoScenarioConfig) { if (this.$refs && this.$refs.autoScenarioConfig) {
console.log(this.$refs.autoScenarioConfig);
this.$refs.autoScenarioConfig.forEach(item => { this.$refs.autoScenarioConfig.forEach(item => {
/*item.removeListener();*/ /*item.removeListener();*/
}); });
@ -168,7 +165,10 @@ export default {
isRedirectEdit: function () { isRedirectEdit: function () {
let redirectParam = this.$route.params.dataSelectRange; let redirectParam = this.$route.params.dataSelectRange;
return redirectParam; return redirectParam;
} },
projectId() {
return this.$store.state.projectId
},
}, },
methods: { methods: {
handleCommand(e) { handleCommand(e) {
@ -197,7 +197,6 @@ export default {
} }
}, },
addTab(tab) { addTab(tab) {
this.projectId=getCurrentProjectID();
if (!this.projectId) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
@ -238,6 +237,10 @@ export default {
} }
}, },
exportTestCase(){ exportTestCase(){
if (this.activeDom !== 'left') {
this.$warning('请切换成接口列表导出!');
return;
}
this.$refs.testCaseList.exportTestCase() this.$refs.testCaseList.exportTestCase()
}, },
addListener() { addListener() {
@ -258,7 +261,6 @@ export default {
this.testCaseReadOnly = true; this.testCaseReadOnly = true;
} }
let caseId = this.$route.params.caseId; let caseId = this.$route.params.caseId;
this.projectId=getCurrentProjectID();
if (!this.projectId) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;

View File

@ -58,7 +58,7 @@
</template> </template>
<script> <script>
import {getCurrentProjectID, getCurrentUser, getUUID} from "@/common/js/utils"; import {getCurrentUser} from "@/common/js/utils";
import {WORKSPACE_ID} from "@/common/js/constants"; import {WORKSPACE_ID} from "@/common/js/constants";
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter"; import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree"; import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
@ -97,15 +97,20 @@ export default {
this.getModuleOptions(); this.getModuleOptions();
}, },
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
saveTestCase(saveAs) { saveTestCase(saveAs) {
this.$refs['testCaseForm'].validate((valid) => { this.$refs['testCaseForm'].validate((valid) => {
if (valid) { if (valid) {
let path = "/test/case/save"; let path = "/test/case/save";
this.testCaseForm.projectId = getCurrentProjectID(); this.testCaseForm.projectId = this.projectId;
this.testCaseForm.type = ""; this.testCaseForm.type = "";
this.testCaseForm.priority = "P0"; this.testCaseForm.priority = "P0";
if (this.currentModule !== undefined || this.currentModule !== null || this.currentModule !== 0 || this.currentModule !== "") { if (this.currentModule && this.currentModule !== 0) {
this.testCaseForm.nodePath = this.currentModule.path; this.testCaseForm.nodePath = this.currentModule.path;
this.testCaseForm.nodeId = this.currentModule.id; this.testCaseForm.nodeId = this.currentModule.id;
} else { } else {

View File

@ -287,10 +287,8 @@
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants'; import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter' import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {Message} from "element-ui"; import {Message} from "element-ui";
import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import {buildNodePath} from "../../../api/definition/model/NodeTree"; import {buildNodePath} from "../../../api/definition/model/NodeTree";
import CaseComment from "@/business/components/track/case/components/CaseComment"; import CaseComment from "@/business/components/track/case/components/CaseComment";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag"; import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
@ -324,11 +322,9 @@ export default {
resolve(nodes) resolve(nodes)
} }
if(node.level==1){ if(node.level==1){
this.projectId = getCurrentProjectID()
this.testOptions = []; this.testOptions = [];
let url = ''; let url = '';
this.form.type=node.data.value this.form.type=node.data.value
console.log(this.form.type)
if (this.form.type === 'testcase' || this.form.type === 'automation') { if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') { } else if (this.form.type === 'performance' || this.form.type === 'api') {
@ -354,7 +350,6 @@ export default {
statuOptions:API_STATUS, statuOptions:API_STATUS,
comments: [], comments: [],
result: {}, result: {},
projectId: "",
dialogFormVisible: false, dialogFormVisible: false,
form: { form: {
name: '', name: '',
@ -434,6 +429,11 @@ export default {
}, },
type: String type: String
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
mounted() { mounted() {
this.getSelectOptions(); this.getSelectOptions();
if (this.type === 'edit' || this.type === 'copy') { if (this.type === 'edit' || this.type === 'copy') {
@ -499,9 +499,6 @@ export default {
this.$nextTick(() => (this.isStepTableAlive = true)); this.$nextTick(() => (this.isStepTableAlive = true));
}, },
open(testCase) { open(testCase) {
console.log("测试用例")
console.log(testCase)
this.projectId = getCurrentProjectID();
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL); history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.close); window.addEventListener('popstate', this.close);
@ -587,7 +584,6 @@ export default {
/* /*
this.form.testId=testCase.selected this.form.testId=testCase.selected
*/ */
console.log(this.form.selected)
this.getFileMetaData(testCase); this.getFileMetaData(testCase);
}, },
setTestCaseExtInfo(testCase) { setTestCaseExtInfo(testCase) {
@ -692,7 +688,6 @@ export default {
buildParam() { buildParam() {
let param = {}; let param = {};
Object.assign(param, this.form); Object.assign(param, this.form);
console.log(this.form)
param.steps = JSON.stringify(this.form.steps); param.steps = JSON.stringify(this.form.steps);
param.nodeId = this.form.module; param.nodeId = this.form.module;
this.moduleOptions.forEach(item => { this.moduleOptions.forEach(item => {
@ -781,7 +776,6 @@ export default {
}); });
}, },
getTestOptions(val) { getTestOptions(val) {
this.projectId = getCurrentProjectID()
this.testOptions = []; this.testOptions = [];
let url = ''; let url = '';
if (this.form.type === 'testcase' || this.form.type === 'automation') { if (this.form.type === 'testcase' || this.form.type === 'automation') {
@ -803,7 +797,6 @@ export default {
}, },
getDemandOptions() { getDemandOptions() {
if (this.demandOptions.length === 0) { if (this.demandOptions.length === 0) {
this.projectId = getCurrentProjectID();
this.result = {loading : true}; this.result = {loading : true};
this.$get("demand/list/" + this.projectId).then(response => { this.$get("demand/list/" + this.projectId).then(response => {
this.demandOptions = response.data.data; this.demandOptions = response.data.data;

View File

@ -210,7 +210,6 @@ import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEve
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem"; import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
import TestCaseDetail from "./TestCaseDetail"; import TestCaseDetail from "./TestCaseDetail";
import ReviewStatus from "@/business/components/track/case/components/ReviewStatus"; import ReviewStatus from "@/business/components/track/case/components/ReviewStatus";
import {downloadFile, getCurrentProjectID, getCurrentUser} from "../../../../../common/js/utils";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
import { import {
_filter, _filter,
@ -330,7 +329,6 @@ export default {
maintainer: [], maintainer: [],
}, },
currentCaseId: null, currentCaseId: null,
projectId: "",
selectDataCounts: 0, selectDataCounts: 0,
selectDataRange: "all" selectDataRange: "all"
} }
@ -353,6 +351,11 @@ export default {
default: false, default: false,
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
created: function () { created: function () {
this.$emit('setCondition', this.condition); this.$emit('setCondition', this.condition);
if (this.trashEnable) { if (this.trashEnable) {
@ -390,7 +393,6 @@ export default {
this.selectDataRange = dataType === 'case' ? dataRange : 'all'; this.selectDataRange = dataType === 'case' ? dataRange : 'all';
}, },
initTableData() { initTableData() {
this.projectId = getCurrentProjectID();
this.condition.planId = ""; this.condition.planId = "";
this.condition.nodeIds = []; this.condition.nodeIds = [];
initCondition(this.condition); initCondition(this.condition);
@ -538,14 +540,14 @@ export default {
this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows); this.selectDataCounts = getSelectDataCounts(this.condition, this.total, this.selectRows);
}, },
importTestCase() { importTestCase() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }
this.$refs.testCaseImport.open(); this.$refs.testCaseImport.open();
}, },
exportTestCase() { exportTestCase() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -44,9 +44,7 @@
<script> <script>
import NodeEdit from "./NodeEdit"; import NodeEdit from "./NodeEdit";
import {getCurrentProjectID} from "../../../../common/js/utils";
import MsNodeTree from "./NodeTree"; import MsNodeTree from "./NodeTree";
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
import TestCaseCreate from "@/business/components/track/case/components/TestCaseCreate"; import TestCaseCreate from "@/business/components/track/case/components/TestCaseCreate";
import TestCaseImport from "@/business/components/track/case/components/TestCaseImport"; import TestCaseImport from "@/business/components/track/case/components/TestCaseImport";
@ -61,7 +59,6 @@ export default {
}, },
result: {}, result: {},
treeNodes: [], treeNodes: [],
projectId: "",
condition: { condition: {
filterText: "", filterText: "",
trashEnable: false trashEnable: false
@ -83,12 +80,16 @@ export default {
}, },
}, },
mounted() { mounted() {
this.projectId = getCurrentProjectID();
this.list(); this.list();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
addTestCase(){ addTestCase(){
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }
@ -109,7 +110,7 @@ export default {
this.addTestCase(); this.addTestCase();
break; break;
case "import": case "import":
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -124,7 +124,7 @@ name: "TestCaseMinder",
if (isChange) { if (isChange) {
saveCases.push(testCase); saveCases.push(testCase);
} }
if (testCase.nodeId.length < 15) { if (testCase.nodeId !== 'root' && testCase.nodeId.length < 15) {
let tip = this.$t('test_track.case.create_case') + "'" + testCase.name + "'" + this.$t('test_track.case.minder_create_tip'); let tip = this.$t('test_track.case.create_case') + "'" + testCase.name + "'" + this.$t('test_track.case.minder_create_tip');
this.$error(tip) this.$error(tip)
throw new Error(tip); throw new Error(tip);

View File

@ -1,39 +1,41 @@
export function getTestCaseDataMap(testCase, isDisable, setParamCallback) { export function getTestCaseDataMap(testCase, isDisable, setParamCallback) {
let dataMap = new Map(); let dataMap = new Map();
testCase.forEach(item => { if (testCase) {
item.steps = JSON.parse(item.steps); testCase.forEach(item => {
// if (item.tags && item.tags.length > 0) { item.steps = JSON.parse(item.steps);
// item.tags = JSON.parse(item.tags); // if (item.tags && item.tags.length > 0) {
// } // item.tags = JSON.parse(item.tags);
let mapItem = dataMap.get(item.nodeId); // }
let nodeItem = { let mapItem = dataMap.get(item.nodeId);
data: { let nodeItem = {
id: item.id, data: {
text: item.name, id: item.id,
priority: Number.parseInt(item.priority.substring(item.priority.length - 1 )) + 1, text: item.name,
resource: ["用例"], priority: Number.parseInt(item.priority.substring(item.priority.length - 1 )) + 1,
type: item.type, resource: ["用例"],
method: item.method, type: item.type,
maintainer: item.maintainer method: item.method,
maintainer: item.maintainer
}
} }
} if (setParamCallback) {
if (setParamCallback) { setParamCallback(nodeItem.data, item);
setParamCallback(nodeItem.data, item); }
} if (isDisable) {
if (isDisable) { nodeItem.data.disable = true;
nodeItem.data.disable = true; // 用例节点可以打标签
// 用例节点可以打标签 nodeItem.data.allowDisabledTag = true;
nodeItem.data.allowDisabledTag = true; }
} parseChildren(nodeItem, item, isDisable);
parseChildren(nodeItem, item, isDisable); if (mapItem) {
if (mapItem) { mapItem.push(nodeItem);
mapItem.push(nodeItem); } else {
} else { mapItem = [];
mapItem = []; mapItem.push(nodeItem);
mapItem.push(nodeItem); dataMap.set(item.nodeId, mapItem);
dataMap.set(item.nodeId, mapItem); }
} })
}) }
return dataMap; return dataMap;
} }
@ -41,14 +43,16 @@ function parseChildren(nodeItem, item, isDisable) {
nodeItem.children = []; nodeItem.children = [];
let children = []; let children = [];
_parseChildren(children, item.prerequisite, "前置条件", isDisable); _parseChildren(children, item.prerequisite, "前置条件", isDisable);
item.steps.forEach((step) => { if (item.steps) {
let descNode = _parseChildren(children, step.desc, undefined, isDisable); item.steps.forEach((step) => {
if (descNode) { let descNode = _parseChildren(children, step.desc, undefined, isDisable);
descNode.data.num = step.num; if (descNode) {
descNode.children = []; descNode.data.num = step.num;
_parseChildren(descNode.children, step.result, undefined, isDisable); descNode.children = [];
} _parseChildren(descNode.children, step.result, undefined, isDisable);
}); }
});
}
_parseChildren(children, item.remark, "备注", isDisable); _parseChildren(children, item.remark, "备注", isDisable);
nodeItem.children = children; nodeItem.children = children;
} }

View File

@ -73,7 +73,6 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta
import MsContainer from "@/business/components/common/components/MsContainer"; import MsContainer from "@/business/components/common/components/MsContainer";
import CaseCountCard from "@/business/components/track/home/components/CaseCountCard"; import CaseCountCard from "@/business/components/track/home/components/CaseCountCard";
import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard"; import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard";
import {getCurrentProjectID,getUUID} from "@/common/js/utils";
import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance"; import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance";
import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants"; import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants";
import BugCountCard from "@/business/components/track/home/components/BugCountCard"; import BugCountCard from "@/business/components/track/home/components/BugCountCard";
@ -108,13 +107,18 @@ export default {
this.checkTipsType(); this.checkTipsType();
this.init(); this.init();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
checkTipsType() { checkTipsType() {
let random = Math.floor(Math.random() * (4 - 1 + 1)) + 1; let random = Math.floor(Math.random() * (4 - 1 + 1)) + 1;
this.tipsType = random + ""; this.tipsType = random + "";
}, },
init() { init() {
let selectProjectId = getCurrentProjectID(); let selectProjectId = this.projectId;
this.$get("/track/count/" + selectProjectId, response => { this.$get("/track/count/" + selectProjectId, response => {
this.trackCountData = response.data; this.trackCountData = response.data;
@ -191,7 +195,12 @@ export default {
// this.$router.push('/track/plan/view/'+selectType); // this.$router.push('/track/plan/view/'+selectType);
switch (page){ switch (page){
case "case": case "case":
this.$router.push({name:'testCase',params:{dataType:dataType,dataSelectRange:selectType, projectId: getCurrentProjectID()}}); this.$router.push({
name:'testCase',
params:{
dataType:dataType,dataSelectRange:selectType, projectId: this.projectId
}
});
break; break;
} }
} }

View File

@ -20,7 +20,6 @@
import TestPlanEdit from './components/TestPlanEdit'; import TestPlanEdit from './components/TestPlanEdit';
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default { export default {
name: "TestPlan", name: "TestPlan",
@ -29,6 +28,11 @@
return { return {
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
mounted() { mounted() {
if (this.$route.path.indexOf("/track/plan/create") >= 0){ if (this.$route.path.indexOf("/track/plan/create") >= 0){
this.openTestPlanEditDialog(); this.openTestPlanEditDialog();
@ -38,7 +42,7 @@
watch: { watch: {
'$route'(to, from) { '$route'(to, from) {
if (to.path.indexOf("/track/plan/create") >= 0){ if (to.path.indexOf("/track/plan/create") >= 0){
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -125,7 +125,7 @@
import {WORKSPACE_ID} from '@/common/js/constants'; import {WORKSPACE_ID} from '@/common/js/constants';
import TestPlanStatusButton from "../common/TestPlanStatusButton"; import TestPlanStatusButton from "../common/TestPlanStatusButton";
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent"; import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag"; import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";

View File

@ -220,11 +220,10 @@ import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm"; import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components"; import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent"; import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain" import MsScheduleMaintain from "@/business/components/api/automation/schedule/ScheduleMaintain"
import {_filter, _sort, getLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
import {TEST_CASE_LIST, TEST_PLAN_LIST} from "@/common/js/constants"; import {TEST_PLAN_LIST} from "@/common/js/constants";
import {Test_Plan_List, Track_Test_Case} from "@/business/components/common/model/JsonData"; import {Test_Plan_List} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom"; import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
@ -282,6 +281,9 @@ export default {
}, },
created() { created() {
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
if (!this.projectId) {
this.projectId = this.$store.state.projectId;
}
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.initTableData(); this.initTableData();
}, },
@ -296,7 +298,7 @@ export default {
if (this.selectNodeIds && this.selectNodeIds.length > 0) { if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
} }
if (!getCurrentProjectID()) { if (!this.projectId) {
return; return;
} }
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
@ -320,7 +322,7 @@ export default {
return path + "/" + this.currentPage + "/" + this.pageSize; return path + "/" + this.currentPage + "/" + this.pageSize;
}, },
testPlanCreate() { testPlanCreate() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -151,7 +151,7 @@ import MsBottomContainer from "../../../../../api/definition/components/BottomCo
import ShowMoreBtn from "../../../../case/components/ShowMoreBtn"; import ShowMoreBtn from "../../../../case/components/ShowMoreBtn";
import BatchEdit from "@/business/components/track/case/components/BatchEdit"; import BatchEdit from "@/business/components/track/case/components/BatchEdit";
import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData"; import {API_METHOD_COLOUR, CASE_PRIORITY, RESULT_MAP} from "../../../../../api/definition/model/JsonData";
import {getCurrentProjectID, strMapToObj} from "@/common/js/utils"; import {strMapToObj} from "@/common/js/utils";
import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer"; import ApiListContainer from "../../../../../api/definition/components/list/ApiListContainer";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem"; import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils"; import {getBodyUploadFiles, getUUID} from "../../../../../../../common/js/utils";
@ -539,7 +539,7 @@ export default {
}, },
getProjectId() { getProjectId() {
if (!this.isRelevanceModel) { if (!this.isRelevanceModel) {
return getCurrentProjectID(); return this.$store.state.projectId;
} else { } else {
return this.currentCaseProjectId; return this.currentCaseProjectId;
} }

View File

@ -103,7 +103,7 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader
import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn"; import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import MsTag from "../../../../../common/components/MsTag"; import MsTag from "../../../../../common/components/MsTag";
import {getUUID, getCurrentProjectID, getCurrentUser, strMapToObj} from "@/common/js/utils"; import {getUUID, strMapToObj} from "@/common/js/utils";
import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail"; import MsApiReportDetail from "../../../../../api/automation/report/ApiReportDetail";
import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn"; import MsTableMoreBtn from "../../../../../api/automation/scenario/TableMoreBtn";
import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns"; import MsScenarioExtendButtons from "@/business/components/api/automation/scenario/ScenarioExtendBtns";
@ -162,7 +162,6 @@ export default {
status: 'default', status: 'default',
infoDb: false, infoDb: false,
runVisible: false, runVisible: false,
projectId: "",
runData: [], runData: [],
buttons: [ buttons: [
{ {
@ -182,8 +181,12 @@ export default {
}, },
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
created() { created() {
this.projectId = getCurrentProjectID();
this.search(); this.search();
}, },
watch: { watch: {

View File

@ -94,7 +94,7 @@
this.result = this.$get("/project/listAll", res => { this.result = this.$get("/project/listAll", res => {
let data = res.data; let data = res.data;
if (data) { if (data) {
const index = data.findIndex(d => d.id === getCurrentProjectID()); const index = data.findIndex(d => d.id === this.$store.state.projectId);
this.projects = data; this.projects = data;
if (index !== -1) { if (index !== -1) {
this.projectId = data[index].id; this.projectId = data[index].id;

View File

@ -1,7 +1,5 @@
<template> <template>
<div class="card-container"> <div class="card-container">
<!-- <el-card class="card-content" v-loading="result.loading">-->
<!-- <template v-slot:header>-->
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData" <ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData"
:show-create="false" :tip="$t('commons.search_by_id_name_tag')"> :show-create="false" :tip="$t('commons.search_by_id_name_tag')">
@ -18,14 +16,8 @@
<ms-table-button :is-tester-permission="true" icon="el-icon-connection" <ms-table-button :is-tester-permission="true" icon="el-icon-connection"
:content="$t('test_track.plan_view.relevance_test_case')" :content="$t('test_track.plan_view.relevance_test_case')"
@click="$emit('openTestCaseRelevanceDialog')"/> @click="$emit('openTestCaseRelevanceDialog')"/>
<!-- 删除 取消全部关联 按钮-->
<!-- <ms-table-button :is-tester-permission="true" icon="el-icon-document-remove"-->
<!-- :content="$t('test_track.plan_view.cancel_all_relevance')" @click="handleDeleteBatch"/>-->
</template> </template>
</ms-table-header> </ms-table-header>
<!-- </template>-->
<executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" <executor-edit ref="executorEdit" :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))"
@refresh="initTableData"/> @refresh="initTableData"/>
@ -712,4 +704,8 @@ export default {
.el-tag { .el-tag {
margin-left: 10px; margin-left: 10px;
} }
.ms-table-header >>> .table-title {
height: 0px;
}
</style> </style>

View File

@ -51,7 +51,6 @@
import FunctionalTestCaseList from "./FunctionalTestCaseList"; import FunctionalTestCaseList from "./FunctionalTestCaseList";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestPlanMinder from "@/business/components/track/common/minder/TestPlanMinder"; import TestPlanMinder from "@/business/components/track/common/minder/TestPlanMinder";
import {getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "TestPlanFunctional", name: "TestPlanFunctional",
@ -71,7 +70,6 @@
selectParentNodes: [], selectParentNodes: [],
treeNodes: [], treeNodes: [],
activeDom: 'left', activeDom: 'left',
projectId: ""
} }
}, },
props: [ props: [
@ -80,9 +78,13 @@
'clickType' 'clickType'
], ],
mounted() { mounted() {
this.projectId = getCurrentProjectID();
this.initData(); this.initData();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
activated(){ activated(){
this.initData(); this.initData();
this.openTestCaseEdit(this.$route.path); this.openTestCaseEdit(this.$route.path);

View File

@ -13,7 +13,6 @@
import TestPlanReportList from './components/TestPlanReportList'; import TestPlanReportList from './components/TestPlanReportList';
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default { export default {
name: "TestPlanReport", name: "TestPlanReport",

View File

@ -66,7 +66,6 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorBut
import MsTableOperator from "../../../common/components/MsTableOperator"; import MsTableOperator from "../../../common/components/MsTableOperator";
import {checkoutTestManagerOrTestUser} from "@/common/js/utils"; import {checkoutTestManagerOrTestUser} from "@/common/js/utils";
import {TEST_PLAN_REPORT_CONFIGS} from "../../../common/components/search/search-components"; import {TEST_PLAN_REPORT_CONFIGS} from "../../../common/components/search/search-components";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import TestPlanReportView from "@/business/components/track/report/components/TestPlanReportView"; import TestPlanReportView from "@/business/components/track/report/components/TestPlanReportView";
import ReportTriggerModeItem from "@/business/components/common/tableItem/ReportTriggerModeItem"; import ReportTriggerModeItem from "@/business/components/common/tableItem/ReportTriggerModeItem";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
@ -124,6 +123,9 @@ export default {
}, },
created() { created() {
this.projectId = this.$route.params.projectId; this.projectId = this.$route.params.projectId;
if (!this.projectId) {
this.projectId = this.$store.state.projectId;
}
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.initTableData(); this.initTableData();
}, },
@ -139,7 +141,7 @@ export default {
if (this.selectNodeIds && this.selectNodeIds.length > 0) { if (this.selectNodeIds && this.selectNodeIds.length > 0) {
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
} }
if (!getCurrentProjectID()) { if (!this.projectId) {
return; return;
} }
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
@ -214,7 +216,7 @@ export default {
let deleteParam = {}; let deleteParam = {};
let ids = Array.from(this.selectRows).map(row => row.id); let ids = Array.from(this.selectRows).map(row => row.id);
deleteParam.dataIds = ids; deleteParam.dataIds = ids;
deleteParam.projectId = getCurrentProjectID(); deleteParam.projectId = this.projectId;
deleteParam.selectAllDate = this.isSelectAllDate; deleteParam.selectAllDate = this.isSelectAllDate;
deleteParam.unSelectIds = this.unSelection; deleteParam.unSelectIds = this.unSelection;
deleteParam = Object.assign(deleteParam, this.condition); deleteParam = Object.assign(deleteParam, this.condition);

View File

@ -18,7 +18,6 @@ import TestCaseReviewList from "./components/TestCaseReviewList";
import TestCaseReviewEdit from "./components/TestCaseReviewEdit"; import TestCaseReviewEdit from "./components/TestCaseReviewEdit";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import {getCurrentProjectID} from "../../../../common/js/utils";
export default { export default {
name: "TestCaseReview", name: "TestCaseReview",
@ -33,6 +32,11 @@ export default {
} }
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
mounted() { mounted() {
if (this.$route.path.indexOf("/track/review/create") >= 0){ if (this.$route.path.indexOf("/track/review/create") >= 0){
this.openCaseReviewEditDialog(); this.openCaseReviewEditDialog();
@ -42,7 +46,7 @@ export default {
watch: { watch: {
'$route'(to) { '$route'(to) {
if (to.path.indexOf("/track/review/create") >= 0){ if (to.path.indexOf("/track/review/create") >= 0){
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -101,7 +101,7 @@
import TestPlanStatusButton from "../../plan/common/TestPlanStatusButton"; import TestPlanStatusButton from "../../plan/common/TestPlanStatusButton";
import {WORKSPACE_ID} from "@/common/js/constants"; import {WORKSPACE_ID} from "@/common/js/constants";
import {getCurrentProjectID, listenGoBack, removeGoBackListener} from "@/common/js/utils"; import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag"; import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
export default { export default {

View File

@ -120,7 +120,6 @@ import MsCreateBox from "../../../settings/CreateBox";
import MsTablePagination from "../../../common/pagination/TablePagination"; import MsTablePagination from "../../../common/pagination/TablePagination";
import { import {
checkoutTestManagerOrTestUser, checkoutTestManagerOrTestUser,
getCurrentProjectID, getCurrentUser,
getCurrentWorkspaceId getCurrentWorkspaceId
} from "../../../../../common/js/utils"; } from "../../../../../common/js/utils";
import {_filter, _sort, getLabel} from "@/common/js/tableUtils"; import {_filter, _sort, getLabel} from "@/common/js/tableUtils";
@ -176,6 +175,11 @@ export default {
this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser(); this.isTestManagerOrTestUser = checkoutTestManagerOrTestUser();
this.initTableData(); this.initTableData();
}, },
computed: {
projectId() {
return this.$store.state.projectId
},
},
methods: { methods: {
customHeader() { customHeader() {
this.$refs.headerCustom.open(this.tableLabel) this.$refs.headerCustom.open(this.tableLabel)
@ -185,10 +189,10 @@ export default {
getLabel(this, TEST_CASE_REVIEW_LIST); getLabel(this, TEST_CASE_REVIEW_LIST);
let lastWorkspaceId = getCurrentWorkspaceId(); let lastWorkspaceId = getCurrentWorkspaceId();
this.condition.workspaceId = lastWorkspaceId; this.condition.workspaceId = lastWorkspaceId;
if (!getCurrentProjectID()) { if (!this.projectId) {
return; return;
} }
this.condition.projectId = getCurrentProjectID(); this.condition.projectId = this.projectId;
this.result = this.$post("/test/case/review/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => { this.result = this.$post("/test/case/review/list/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
@ -219,7 +223,7 @@ export default {
this.$router.push('/track/review/view/' + row.id); this.$router.push('/track/review/view/' + row.id);
}, },
testCaseReviewCreate() { testCaseReviewCreate() {
if (!getCurrentProjectID()) { if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip')); this.$warning(this.$t('commons.check_project_tip'));
return; return;
} }

View File

@ -49,7 +49,6 @@ import TestReviewRelevance from "@/business/components/track/review/view/compone
import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList"; import TestReviewTestCaseList from "@/business/components/track/review/view/components/TestReviewTestCaseList";
import MsTabButton from "@/business/components/common/components/MsTabButton"; import MsTabButton from "@/business/components/common/components/MsTabButton";
import TestReviewMinder from "@/business/components/track/common/minder/TestReviewMinder"; import TestReviewMinder from "@/business/components/track/common/minder/TestReviewMinder";
import {getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "TestReviewFunction", name: "TestReviewFunction",
@ -69,7 +68,6 @@ export default {
treeNodes: [], treeNodes: [],
isMenuShow: true, isMenuShow: true,
activeDom: 'left', activeDom: 'left',
projectId: ""
} }
}, },
props: [ props: [
@ -79,11 +77,14 @@ export default {
], ],
mounted() { mounted() {
this.getNodeTreeByReviewId() this.getNodeTreeByReviewId()
this.projectId = getCurrentProjectID();
}, },
activated() { activated() {
this.getNodeTreeByReviewId() this.getNodeTreeByReviewId()
},
computed: {
projectId() {
return this.$store.state.projectId
},
}, },
methods: { methods: {
refresh() { refresh() {