fix(接口定义): 修复接口定义编辑页面添加依赖关系页面模块树与列表数据不符的缺陷
--bug=1014985 --user=王孝刚 【接口测试】SQL和dubbo协议接口定义-编辑时添加依赖关系弹窗有时候显示http协议的接口 https://www.tapd.cn/55049933/s/1207798
This commit is contained in:
parent
5fe35fa0b9
commit
b43cf7175a
|
@ -13,6 +13,7 @@
|
||||||
@protocolChange="handleProtocolChange"
|
@protocolChange="handleProtocolChange"
|
||||||
@refreshTable="initTable"
|
@refreshTable="initTable"
|
||||||
:is-read-only="true"
|
:is-read-only="true"
|
||||||
|
:show-case-num="false"
|
||||||
ref="nodeTree"/>
|
ref="nodeTree"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -36,123 +37,123 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import MsApiModule from "@/business/components/api/definition/components/module/ApiModule";
|
import MsApiModule from "@/business/components/api/definition/components/module/ApiModule";
|
||||||
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
|
import TestCaseRelevanceBase from "@/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase";
|
||||||
import ApiTableList from "@/business/components/api/definition/components/complete/ApiTableList";
|
import ApiTableList from "@/business/components/api/definition/components/complete/ApiTableList";
|
||||||
|
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiRelationshipRelevance",
|
name: "ApiRelationshipRelevance",
|
||||||
components: {
|
components: {
|
||||||
'VersionSelect': VersionSelect.default,
|
'VersionSelect': VersionSelect.default,
|
||||||
ApiTableList,
|
ApiTableList,
|
||||||
TestCaseRelevanceBase,
|
TestCaseRelevanceBase,
|
||||||
MsApiModule,
|
MsApiModule,
|
||||||
|
},
|
||||||
|
props: ['apiDefinitionId', 'relationshipType'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showCasePage: true,
|
||||||
|
currentProtocol: null,
|
||||||
|
currentModule: null,
|
||||||
|
selectNodeIds: [],
|
||||||
|
condition: {},
|
||||||
|
currentRow: {},
|
||||||
|
projectId: "",
|
||||||
|
result: {},
|
||||||
|
total: 0,
|
||||||
|
tableData: [],
|
||||||
|
currentVersion: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
projectId() {
|
||||||
|
this.initTable();
|
||||||
},
|
},
|
||||||
props: ['apiDefinitionId', 'relationshipType'],
|
selectNodeIds() {
|
||||||
data() {
|
this.initTable();
|
||||||
return {
|
|
||||||
showCasePage: true,
|
|
||||||
currentProtocol: null,
|
|
||||||
currentModule: null,
|
|
||||||
selectNodeIds: [],
|
|
||||||
condition: {},
|
|
||||||
currentRow: {},
|
|
||||||
projectId: "",
|
|
||||||
result: {},
|
|
||||||
total: 0,
|
|
||||||
tableData: [],
|
|
||||||
currentVersion: null,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
watch: {
|
currentProtocol() {
|
||||||
projectId() {
|
this.$refs.nodeTree.list();
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
}
|
||||||
selectNodeIds() {
|
},
|
||||||
this.initTable();
|
methods: {
|
||||||
},
|
open() {
|
||||||
currentProtocol() {
|
this.condition = {};
|
||||||
|
this.$refs.baseRelevance.open();
|
||||||
|
this.initTable();
|
||||||
|
if (this.$refs.nodeTree) {
|
||||||
this.$refs.nodeTree.list();
|
this.$refs.nodeTree.list();
|
||||||
this.initTable();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
initTable() {
|
||||||
open() {
|
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
||||||
this.condition = {};
|
this.condition.moduleIds = this.selectNodeIds;
|
||||||
this.$refs.baseRelevance.open();
|
this.condition.projectId = this.projectId;
|
||||||
this.initTable();
|
|
||||||
if (this.$refs.nodeTree) {
|
|
||||||
this.$refs.nodeTree.list();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
initTable() {
|
|
||||||
this.condition.filters = {status: ["Prepare", "Underway", "Completed"]};
|
|
||||||
this.condition.moduleIds = this.selectNodeIds;
|
|
||||||
this.condition.projectId = this.projectId;
|
|
||||||
|
|
||||||
if (this.currentProtocol != null) {
|
if (this.currentProtocol != null) {
|
||||||
this.condition.protocol = this.currentProtocol;
|
this.condition.protocol = this.currentProtocol;
|
||||||
} else {
|
} else {
|
||||||
this.condition.protocol = "HTTP";
|
this.condition.protocol = "HTTP";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.condition.versionId = this.currentVersion;
|
this.condition.versionId = this.currentVersion;
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.apiDefinitionId) {
|
if (this.apiDefinitionId) {
|
||||||
this.condition.id = this.apiDefinitionId;
|
this.condition.id = this.apiDefinitionId;
|
||||||
this.result = this.$post(this.buildPagePath('/api/definition/relationship/relate'), this.condition, response => {
|
this.result = this.$post(this.buildPagePath('/api/definition/relationship/relate'), this.condition, response => {
|
||||||
this.total = response.data.itemCount;
|
this.total = response.data.itemCount;
|
||||||
this.tableData = response.data.listObject;
|
this.tableData = response.data.listObject;
|
||||||
this.tableData.forEach(item => {
|
this.tableData.forEach(item => {
|
||||||
if (item.tags && item.tags.length > 0) {
|
if (item.tags && item.tags.length > 0) {
|
||||||
item.tags = JSON.parse(item.tags);
|
item.tags = JSON.parse(item.tags);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
|
||||||
},
|
|
||||||
buildPagePath(path) {
|
|
||||||
return path + "/" + this.$refs.apitable.currentPage + "/" + this.$refs.apitable.pageSize;
|
|
||||||
},
|
|
||||||
setProject(projectId) {
|
|
||||||
this.projectId = projectId;
|
|
||||||
},
|
|
||||||
nodeChange(node, nodeIds, pNodes) {
|
|
||||||
this.selectNodeIds = nodeIds;
|
|
||||||
},
|
|
||||||
handleProtocolChange(protocol) {
|
|
||||||
this.currentProtocol = protocol;
|
|
||||||
},
|
|
||||||
saveCaseRelevance() {
|
|
||||||
let param = {};
|
|
||||||
param.ids = this.$refs.apitable.getSelectIds();
|
|
||||||
param.request = this.condition;
|
|
||||||
if (this.relationshipType === 'PRE') {
|
|
||||||
param.targetIds = param.ids;
|
|
||||||
} else {
|
|
||||||
param.sourceIds = param.ids;
|
|
||||||
}
|
}
|
||||||
param.id = this.apiDefinitionId;
|
});
|
||||||
param.type = 'API';
|
},
|
||||||
param.condition = this.condition;
|
buildPagePath(path) {
|
||||||
|
return path + "/" + this.$refs.apitable.currentPage + "/" + this.$refs.apitable.pageSize;
|
||||||
|
},
|
||||||
|
setProject(projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
},
|
||||||
|
nodeChange(node, nodeIds, pNodes) {
|
||||||
|
this.selectNodeIds = nodeIds;
|
||||||
|
},
|
||||||
|
handleProtocolChange(protocol) {
|
||||||
|
this.currentProtocol = protocol;
|
||||||
|
},
|
||||||
|
saveCaseRelevance() {
|
||||||
|
let param = {};
|
||||||
|
param.ids = this.$refs.apitable.getSelectIds();
|
||||||
|
param.request = this.condition;
|
||||||
|
if (this.relationshipType === 'PRE') {
|
||||||
|
param.targetIds = param.ids;
|
||||||
|
} else {
|
||||||
|
param.sourceIds = param.ids;
|
||||||
|
}
|
||||||
|
param.id = this.apiDefinitionId;
|
||||||
|
param.type = 'API';
|
||||||
|
param.condition = this.condition;
|
||||||
|
|
||||||
this.result = this.$post('/api/definition/relationship/add', param, () => {
|
this.result = this.$post('/api/definition/relationship/add', param, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.$refs.baseRelevance.close();
|
this.$refs.baseRelevance.close();
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
currentVersionChange(currentVersion) {
|
currentVersionChange(currentVersion) {
|
||||||
this.currentVersion = currentVersion || null;
|
this.currentVersion = currentVersion || null;
|
||||||
this.initTable();
|
this.initTable();
|
||||||
},
|
},
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Reference in New Issue