fix:创建用例关联测试显示问题
This commit is contained in:
parent
186e5efa1d
commit
53fc7b6eaf
|
@ -99,8 +99,9 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="14">
|
<el-col :span="14">
|
||||||
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth">
|
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth">
|
||||||
<el-cascader filterable placeholder="请选择要关联的测试" show-all-levels v-model="form.selected" :props="props"
|
<el-cascader :options="sysList" filterable placeholder="请选择要关联的测试" show-all-levels
|
||||||
class="ms-case"></el-cascader>
|
v-model="form.selected" :props="props"
|
||||||
|
class="ms-case" @change="clearInput" ref="cascade"></el-cascader>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -311,45 +312,10 @@ export default {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
multiple: true,
|
multiple: true,
|
||||||
lazy: true,
|
//lazy: true,
|
||||||
lazyLoad: ((node, resolve) => {
|
//lazyLoad:this.lazyLoad
|
||||||
const { level } = node;
|
|
||||||
if(node.level==0){
|
|
||||||
const nodes = TEST
|
|
||||||
.map(item => ({
|
|
||||||
value: item.id,
|
|
||||||
label: item.name,
|
|
||||||
leaf: level >= 1
|
|
||||||
}));
|
|
||||||
resolve(nodes)
|
|
||||||
}
|
|
||||||
if(node.level==1){
|
|
||||||
this.projectId = getCurrentProjectID()
|
|
||||||
this.testOptions = [];
|
|
||||||
let url = '';
|
|
||||||
this.form.type=node.data.value
|
|
||||||
console.log(this.form.type)
|
|
||||||
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
|
||||||
url = '/api/' + this.form.type + '/list/' + this.projectId
|
|
||||||
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
|
||||||
url = '/' + this.form.type + '/list/' + this.projectId
|
|
||||||
}
|
|
||||||
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
|
|
||||||
this.$get(url, response => {
|
|
||||||
const nodes = response.data
|
|
||||||
.map(item => ({
|
|
||||||
value: item.id,
|
|
||||||
label: item.name,
|
|
||||||
leaf: level >= 1
|
|
||||||
}));
|
|
||||||
resolve(nodes)
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
|
sysList: [],//一级选择框的数据
|
||||||
options: REVIEW_STATUS,
|
options: REVIEW_STATUS,
|
||||||
statuOptions: API_STATUS,
|
statuOptions: API_STATUS,
|
||||||
comments: [],
|
comments: [],
|
||||||
|
@ -434,6 +400,7 @@ export default {
|
||||||
},
|
},
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getSelectOptions();
|
this.getSelectOptions();
|
||||||
if (this.type === 'edit' || this.type === 'copy') {
|
if (this.type === 'edit' || this.type === 'copy') {
|
||||||
|
@ -456,8 +423,87 @@ export default {
|
||||||
this.$emit('setModuleOptions', this.moduleOptions);
|
this.$emit('setModuleOptions', this.moduleOptions);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.loadOptions()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
clearInput() {
|
||||||
|
//this.$refs['cascade'].panel.clearCheckedNodes()
|
||||||
|
},
|
||||||
|
async loadOptions(sysLib) {
|
||||||
|
sysLib = TEST
|
||||||
|
.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name,
|
||||||
|
}));
|
||||||
|
let array = [];
|
||||||
|
for (let i = 0; i < sysLib.length; i++) {
|
||||||
|
if (sysLib.length > 0) {
|
||||||
|
let res = await this.getTestOptions(sysLib[i].value);
|
||||||
|
sysLib[i].children = res;
|
||||||
|
}
|
||||||
|
array.push(sysLib[i]);
|
||||||
|
}
|
||||||
|
this.sysList = array;
|
||||||
|
},
|
||||||
|
getTestOptions(val) {
|
||||||
|
this.form.type = val
|
||||||
|
this.projectId = getCurrentProjectID()
|
||||||
|
this.testOptions = [];
|
||||||
|
let url = '';
|
||||||
|
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
||||||
|
url = '/api/' + this.form.type + '/list/' + this.projectId
|
||||||
|
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
||||||
|
url = '/' + this.form.type + '/list/' + this.projectId
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.$get(url).then(res => {
|
||||||
|
console.log(res.data.data)
|
||||||
|
const data = res.data.data.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name,
|
||||||
|
leaf: true
|
||||||
|
}))
|
||||||
|
resolve(data)
|
||||||
|
}).catch((err) => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/* lazyLoad(node, resolve){
|
||||||
|
const { level } = node;
|
||||||
|
if(node.level==0){
|
||||||
|
const nodes = TEST
|
||||||
|
.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name,
|
||||||
|
leaf: level >= 1
|
||||||
|
}));
|
||||||
|
resolve(nodes)
|
||||||
|
}
|
||||||
|
if(node.level==1){
|
||||||
|
this.projectId = getCurrentProjectID()
|
||||||
|
this.testOptions = [];
|
||||||
|
let url = '';
|
||||||
|
this.form.type=node.data.value
|
||||||
|
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
||||||
|
url = '/api/' + this.form.type + '/list/' + this.projectId
|
||||||
|
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
||||||
|
url = '/' + this.form.type + '/list/' + this.projectId
|
||||||
|
}
|
||||||
|
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
|
||||||
|
this.$get(url, response => {
|
||||||
|
const nodes = response.data
|
||||||
|
.map(item => ({
|
||||||
|
value: item.id,
|
||||||
|
label: item.name,
|
||||||
|
leaf: level >= 1
|
||||||
|
}));
|
||||||
|
resolve(nodes)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},*/
|
||||||
handleCommand(e) {
|
handleCommand(e) {
|
||||||
if (e === "ADD_AND_CREATE") {
|
if (e === "ADD_AND_CREATE") {
|
||||||
this.$refs['caseFrom'].validate((valid) => {
|
this.$refs['caseFrom'].validate((valid) => {
|
||||||
|
@ -467,7 +513,8 @@ export default {
|
||||||
this.saveCase();
|
this.saveCase();
|
||||||
let tab = {}
|
let tab = {}
|
||||||
tab.name = 'add'
|
tab.name = 'add'
|
||||||
this.$emit('addTab',tab)}
|
this.$emit('addTab', tab)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}else {
|
}else {
|
||||||
this.saveCase();
|
this.saveCase();
|
||||||
|
@ -499,8 +546,9 @@ export default {
|
||||||
this.$nextTick(() => (this.isStepTableAlive = true));
|
this.$nextTick(() => (this.isStepTableAlive = true));
|
||||||
},
|
},
|
||||||
open(testCase) {
|
open(testCase) {
|
||||||
console.log("测试用例")
|
/*
|
||||||
console.log(testCase)
|
this.form.selected=[["automation", "3edaaf31-3fa4-4a53-9654-320205c2953a"],["automation", "3aa58bd1-c986-448c-8060-d32713dbd4eb"]]
|
||||||
|
*/
|
||||||
this.projectId = getCurrentProjectID();
|
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);
|
||||||
|
@ -573,7 +621,7 @@ export default {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setFormData(testCase) {
|
async setFormData(testCase) {
|
||||||
testCase.tags = JSON.parse(testCase.tags);
|
testCase.tags = JSON.parse(testCase.tags);
|
||||||
testCase.selected = JSON.parse(testCase.testId);
|
testCase.selected = JSON.parse(testCase.testId);
|
||||||
let tmp = {};
|
let tmp = {};
|
||||||
|
@ -583,12 +631,12 @@ export default {
|
||||||
tmp.steps = []
|
tmp.steps = []
|
||||||
}
|
}
|
||||||
Object.assign(this.form, tmp);
|
Object.assign(this.form, tmp);
|
||||||
this.form.module = testCase.nodeId;
|
|
||||||
/*
|
|
||||||
this.form.testId=testCase.selected
|
|
||||||
*/
|
|
||||||
console.log(this.form.selected)
|
console.log(this.form.selected)
|
||||||
|
this.form.module = testCase.nodeId;
|
||||||
this.getFileMetaData(testCase);
|
this.getFileMetaData(testCase);
|
||||||
|
/* testCase.selected = JSON.parse(testCase.testId);
|
||||||
|
this.form.selected= testCase.selected*/
|
||||||
|
await this.loadOptions(this.sysList)
|
||||||
},
|
},
|
||||||
setTestCaseExtInfo(testCase) {
|
setTestCaseExtInfo(testCase) {
|
||||||
this.testCase = {};
|
this.testCase = {};
|
||||||
|
@ -692,7 +740,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 => {
|
||||||
|
@ -780,22 +827,7 @@ export default {
|
||||||
this.maintainerOptions = response.data;
|
this.maintainerOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getTestOptions(val) {
|
|
||||||
this.projectId = getCurrentProjectID()
|
|
||||||
this.testOptions = [];
|
|
||||||
let url = '';
|
|
||||||
if (this.form.type === 'testcase' || this.form.type === 'automation') {
|
|
||||||
url = '/api/' + this.form.type + '/list/' + this.projectId
|
|
||||||
} else if (this.form.type === 'performance' || this.form.type === 'api') {
|
|
||||||
url = '/' + this.form.type + '/list/' + this.projectId
|
|
||||||
}
|
|
||||||
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
|
|
||||||
this.result = this.$get(url, response => {
|
|
||||||
this.testOptions = response.data;
|
|
||||||
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
visibleChange(flag) {
|
visibleChange(flag) {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.getDemandOptions();
|
this.getDemandOptions();
|
||||||
|
|
Loading…
Reference in New Issue