|
@@ -12,10 +12,15 @@ 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 {
|
|
|
+ getProjectGlobalConfig,
|
|
|
+ getTestProjectInfo,
|
|
|
+ updateTestModule,
|
|
|
+} from "@/api/project";
|
|
|
|
|
|
import { useCommonStoreHook } from "@/store";
|
|
|
-const { currentTestItemId } = toRefs(useCommonStoreHook());
|
|
|
+
|
|
|
+const { currentTestItemId, currentProjectId } = toRefs(useCommonStoreHook());
|
|
|
|
|
|
const flowRef = ref<HJFlowInstance>();
|
|
|
const nodes = ref<HJNodeData[]>([]);
|
|
@@ -38,6 +43,11 @@ const onNodeOperation = (name: HJMethodName, node: HJNodeData): void => {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if (selectedNode.value) {
|
|
|
+ ElMessage.warning("请先保存节点信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
// 保存模版数据
|
|
|
let flowData = {
|
|
|
nodes: nodes.value,
|
|
@@ -49,6 +59,7 @@ const onNodeOperation = (name: HJMethodName, node: HJNodeData): void => {
|
|
|
};
|
|
|
updateTestModule(p).then(() => {
|
|
|
ElMessage.success("保存模版成功");
|
|
|
+ flowRef.value && flowRef.value.clearStatus();
|
|
|
});
|
|
|
}
|
|
|
};
|
|
@@ -59,6 +70,9 @@ const infoVisible = ref(false);
|
|
|
const selectedNode = ref<AutoTestNodeData | null>(null); //双击的节点数据
|
|
|
const onSaveConfigs = () => {
|
|
|
console.log("onSaveConfigs", selectedNode.value);
|
|
|
+ if (!selectedNode.value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
flowRef.value &&
|
|
|
flowRef.value.updateNodeData(
|
|
|
JSON.parse(JSON.stringify(selectedNode.value))
|
|
@@ -67,60 +81,42 @@ const onSaveConfigs = () => {
|
|
|
selectedNode.value = null;
|
|
|
};
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- // 接口调用完成要初始化 ,为的是保存一个最初的数据
|
|
|
- flowRef.value && flowRef.value.initFlow([], []);
|
|
|
-
|
|
|
+onMounted(async () => {
|
|
|
// 如果选择的测试项目id有值,就获取数据
|
|
|
if (currentTestItemId.value) {
|
|
|
getFlowData();
|
|
|
}
|
|
|
+
|
|
|
+ let res = await getProjectGlobalConfig(currentProjectId.value);
|
|
|
+ configData.value = res.data;
|
|
|
});
|
|
|
|
|
|
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;
|
|
|
+ // 接口调用完成要初始化 ,为的是保存一个最初的数据
|
|
|
+ flowRef.value && flowRef.value.initFlow([], []);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
//选择测试项目相关 每次点击需要重新获取中间的流程的数据
|
|
|
const onSelectTestPro = () => {
|
|
|
+ flowRef.value && flowRef.value.clearStatus();
|
|
|
+ selectedNode.value = null;
|
|
|
+ infoVisible.value = false;
|
|
|
getFlowData();
|
|
|
};
|
|
|
|
|
|
// 全局变量和仪器列表选择相关
|
|
|
-const configData: Record<string, any[]> = {
|
|
|
- "@": [
|
|
|
- {
|
|
|
- label: "Fuphoenixes",
|
|
|
- value: "Fuphoenixes",
|
|
|
- id: "111",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "kooriookami",
|
|
|
- value: "222",
|
|
|
- },
|
|
|
- ],
|
|
|
- "#": [
|
|
|
- {
|
|
|
- label: "Fuphoenixes",
|
|
|
- value: "333",
|
|
|
- },
|
|
|
- {
|
|
|
- label: "kooriookami",
|
|
|
- value: "444",
|
|
|
- },
|
|
|
- ],
|
|
|
-};
|
|
|
+const configData: Record<string, any[]> = ref({});
|
|
|
const configOptions = ref([]);
|
|
|
|
|
|
const handleSearch = (_: string, prefix: string) => {
|
|
|
- configOptions.value = configData[prefix] || [];
|
|
|
+ configOptions.value = configData.value[prefix] || [];
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -146,6 +142,11 @@ const handleSearch = (_: string, prefix: string) => {
|
|
|
v-model="selectedNode!.data.information.nodeName"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-text class="mx-1" type="warning">
|
|
|
+ 输入@选择全局变量或#选择仪器
|
|
|
+ </el-text>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item
|
|
|
v-for="property in selectedNode?.data?.information?.properties"
|
|
|
:label="property.proName"
|
|
@@ -162,6 +163,13 @@ const handleSearch = (_: string, prefix: string) => {
|
|
|
property.bindCode = opt.code;
|
|
|
}
|
|
|
"
|
|
|
+ @blur="
|
|
|
+ () => {
|
|
|
+ if (property.bindLabel === '') {
|
|
|
+ property.bindCode = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ "
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -182,6 +190,7 @@ const handleSearch = (_: string, prefix: string) => {
|
|
|
width: 100%;
|
|
|
height: calc(100vh - $main-header-height);
|
|
|
}
|
|
|
+
|
|
|
.hjflow-box {
|
|
|
//width: 100%;
|
|
|
flex: 1;
|
|
@@ -231,6 +240,7 @@ const handleSearch = (_: string, prefix: string) => {
|
|
|
line-height: 16px;
|
|
|
text-align: left;
|
|
|
}
|
|
|
+
|
|
|
:deep(.el-collapse-item__wrap) {
|
|
|
border: 0;
|
|
|
}
|