|
@@ -12,6 +12,10 @@ import FunctionModule from "./com/function-col.vue";
|
|
|
import TitleHeader from "@/views/modules/project-config/com/titleHeader.vue";
|
|
|
import { AutoTestNodeData, InforPropertyModel } from "./configs/properites";
|
|
|
import type { FormInstance } from "element-plus";
|
|
|
+import { getTestProjectInfo, updateTestModule } from "@/api/project";
|
|
|
+
|
|
|
+import { useCommonStoreHook } from "@/store";
|
|
|
+const { currentTestItemId } = toRefs(useCommonStoreHook());
|
|
|
|
|
|
const flowRef = ref<HJFlowInstance>();
|
|
|
const nodes = ref<HJNodeData[]>([]);
|
|
@@ -23,7 +27,29 @@ const onNodeOperation = (name: HJMethodName, node: HJNodeData): void => {
|
|
|
selectedNode.value = JSON.parse(JSON.stringify(node));
|
|
|
infoVisible.value = true;
|
|
|
} else if (name === HJMethodName.SaveTemplate) {
|
|
|
- console.log("保存模版数据");
|
|
|
+ // 如果没有选测试项目 给提示
|
|
|
+ if (!currentTestItemId.value) {
|
|
|
+ ElMessage.warning("请选择测试项目");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (nodes.value.length === 0) {
|
|
|
+ ElMessage.warning("请编辑功能");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存模版数据
|
|
|
+ let flowData = {
|
|
|
+ nodes: nodes.value,
|
|
|
+ edges: edges.value,
|
|
|
+ };
|
|
|
+ let p = {
|
|
|
+ id: currentTestItemId.value,
|
|
|
+ routeData: JSON.stringify(flowData),
|
|
|
+ };
|
|
|
+ updateTestModule(p).then(() => {
|
|
|
+ ElMessage.success("保存模版成功");
|
|
|
+ });
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -44,12 +70,33 @@ const onSaveConfigs = () => {
|
|
|
onMounted(() => {
|
|
|
// 接口调用完成要初始化 ,为的是保存一个最初的数据
|
|
|
flowRef.value && flowRef.value.initFlow([], []);
|
|
|
+
|
|
|
+ // 如果选择的测试项目id有值,就获取数据
|
|
|
+ if (currentTestItemId.value) {
|
|
|
+ getFlowData();
|
|
|
+ }
|
|
|
});
|
|
|
+
|
|
|
+const getFlowData = () => {
|
|
|
+ getTestProjectInfo(currentTestItemId.value).then((result) => {
|
|
|
+ console.log("getFlowData", result);
|
|
|
+ if (result.data.routeData) {
|
|
|
+ let data = JSON.parse(result.data.routeData);
|
|
|
+ nodes.value = data.nodes;
|
|
|
+ edges.value = data.edges;
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+//选择测试项目相关 每次点击需要重新获取中间的流程的数据
|
|
|
+const onSelectTestPro = (pro) => {
|
|
|
+ getFlowData();
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="project-config-container">
|
|
|
- <ProjectMessage />
|
|
|
+ <ProjectMessage @onClickItem="onSelectTestPro" />
|
|
|
<FunctionModule />
|
|
|
<HJFlow
|
|
|
class="hjflow-box"
|
|
@@ -64,7 +111,7 @@ onMounted(() => {
|
|
|
<TitleHeader>属性配置</TitleHeader>
|
|
|
<div class="form-box" v-if="infoVisible">
|
|
|
<el-form rer="formRef" label-position="top">
|
|
|
- <el-form-item label="节点名称">
|
|
|
+ <el-form-item label="唯一名称">
|
|
|
<el-input
|
|
|
v-model="selectedNode!.data.information.nodeName"
|
|
|
></el-input>
|