用例提取为全局变量可引用
This commit is contained in:
@@ -213,12 +213,19 @@ export default {
|
||||
},
|
||||
hosts: {
|
||||
type: Array
|
||||
},
|
||||
quoteList: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 在这里进行数据预处理
|
||||
this.preProcessFormData();
|
||||
},
|
||||
mounted() {
|
||||
// 在组件挂载后调用方法
|
||||
this.appendNamesToExtractObject();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: "Headers",
|
||||
@@ -260,6 +267,24 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
appendNamesToExtractObject() {
|
||||
if (this.quoteList) {
|
||||
this.quoteList.forEach(item => {
|
||||
item.assignment.forEach(item2 => {
|
||||
if (item2.name && !this.isDuplicate(item2.name)) {
|
||||
this.extract_object.push({
|
||||
value: '${' + item2.name + '}',
|
||||
label: '${' + item2.name + '}'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
isDuplicate(name) {
|
||||
let compareName = '${' + name + '}';
|
||||
return this.extract_object.some(obj => obj.value === compareName);
|
||||
},
|
||||
handleLogChange(val) {
|
||||
const selectedItem = this.form.testCaseResultList.find(item => item.title === val);
|
||||
if (selectedItem) {
|
||||
|
||||
@@ -111,8 +111,15 @@ export default {
|
||||
},
|
||||
datasourceList: {
|
||||
type: Array
|
||||
},
|
||||
quoteList: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 在组件挂载后调用方法
|
||||
this.appendNamesToExtractObject();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeName: "sql",
|
||||
@@ -153,6 +160,24 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
appendNamesToExtractObject() {
|
||||
if (this.quoteList) {
|
||||
this.quoteList.forEach(item => {
|
||||
item.assignment.forEach(item2 => {
|
||||
if (item2.name && !this.isDuplicate(item2.name)) {
|
||||
this.extract_object.push({
|
||||
value: '${' + item2.name + '}',
|
||||
label: '${' + item2.name + '}'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
isDuplicate(name) {
|
||||
let compareName = '${' + name + '}';
|
||||
return this.extract_object.some(obj => obj.value === compareName);
|
||||
},
|
||||
handleLogChange(val) {
|
||||
const selectedItem = this.form.testCaseResultList.find(item => item.title === val);
|
||||
if (selectedItem) {
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
<el-tag v-if="item.requestUrl" effect="plain" style="text-align: center;margin-right: 12px;" type="success">{{ item.requestUrl }}</el-tag>
|
||||
</template>
|
||||
<el-button size="mini" type="text" @click="handleDel(index)" style="float: right">删除</el-button>
|
||||
<page1 v-if="item.type == 1" :form="item" :hosts="hosts"/>
|
||||
<page2 v-if="item.type == 2" :form="item" :datasourceList="datasourceList"/>
|
||||
<page1 v-if="item.type == 1" :form="item" :hosts="hosts" :quoteList="quoteList" />
|
||||
<page2 v-if="item.type == 2" :form="item" :datasourceList="datasourceList" :quoteList="quoteList" />
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</div>
|
||||
@@ -39,10 +39,11 @@
|
||||
<script>
|
||||
import page1 from "@/views/test/case/detail/page1.vue";
|
||||
import page2 from "@/views/test/case/detail/page2.vue";
|
||||
import page4 from "./page4.vue";
|
||||
|
||||
export default {
|
||||
dicts: ['step_type'],
|
||||
components: {page1, page2},
|
||||
components: {page4, page1, page2},
|
||||
props: {
|
||||
form: {
|
||||
type: Object
|
||||
@@ -56,6 +57,9 @@ export default {
|
||||
list: {
|
||||
type: Array
|
||||
},
|
||||
quoteList: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -59,6 +59,9 @@ export default {
|
||||
list: {
|
||||
type: Array
|
||||
},
|
||||
quoteList: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
<el-tag effect="plain" style="text-align: center;margin-right: 12px;" class="drag-handle">{{ index + 1 }}</el-tag>
|
||||
</template>
|
||||
<el-button size="mini" type="text" @click="handleDel(index)" style="float: right">删除</el-button>
|
||||
<page1 v-if="item.type == 1" :form="item" :hosts="hosts"/>
|
||||
<page2 v-if="item.type == 2" :form="item" :datasourceList="datasourceList"/>
|
||||
<page3 v-if="item.type == 3" :form="item" :list="item.childrenList" :hosts="hosts" :datasourceList="datasourceList"/>
|
||||
<page4 v-if="item.type == 4" :form="item" :list="item.childrenList" :hosts="hosts" :datasourceList="datasourceList"/>
|
||||
<page1 v-if="item.type == 1" :form="item" :hosts="hosts" :quoteList="list" />
|
||||
<page2 v-if="item.type == 2" :form="item" :datasourceList="datasourceList" :quoteList="list" />
|
||||
<page3 v-if="item.type == 3" :form="item" :list="item.childrenList" :hosts="hosts" :datasourceList="datasourceList" :quoteList="list" />
|
||||
<page4 v-if="item.type == 4" :form="item" :list="item.childrenList" :hosts="hosts" :datasourceList="datasourceList" :quoteList="list" />
|
||||
</el-collapse-item>
|
||||
</draggable>
|
||||
</el-collapse>
|
||||
|
||||
Reference in New Issue
Block a user