|
@@ -139,7 +139,6 @@ const submitForm = () => {
|
|
|
const submitAll = () => {
|
|
|
const nodeList = graph.toJSON().cells;
|
|
|
submitFormData.nodeObject = JSON.stringify(nodeList);
|
|
|
- console.log(nodeList, "asda");
|
|
|
// return;
|
|
|
const arr = nodeList
|
|
|
.filter((x) => x.shape != "edge")
|
|
@@ -152,6 +151,7 @@ const submitAll = () => {
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
// 检验名称是否有填写
|
|
|
let nameArr = [];
|
|
|
for (const key in flowNodeObj.value) {
|
|
@@ -165,6 +165,7 @@ const submitAll = () => {
|
|
|
}
|
|
|
nameArr.push(value);
|
|
|
}
|
|
|
+
|
|
|
// 名称不可重复
|
|
|
let newNameArr = nameArr.map((x) => x.nodeName.trim());
|
|
|
if (new Set(newNameArr).size != nameArr.length) {
|
|
@@ -237,8 +238,17 @@ const addVersion = () => {
|
|
|
|
|
|
const pushRoom = (port: any) => {
|
|
|
if (port.node.shape == "handle-btn-one") {
|
|
|
+ let nodeName = "";
|
|
|
+ if (
|
|
|
+ port.node.store &&
|
|
|
+ port.node.store.data &&
|
|
|
+ port.node.store.data.data &&
|
|
|
+ port.node.store.data.data.title
|
|
|
+ ) {
|
|
|
+ nodeName = port.node.store.data.data.title;
|
|
|
+ }
|
|
|
flowNodeObj.value[port.node.id] = {
|
|
|
- nodeName: "",
|
|
|
+ nodeName: nodeName,
|
|
|
id: port.node.id,
|
|
|
};
|
|
|
}
|
|
@@ -379,9 +389,9 @@ const antvInit = async (data) => {
|
|
|
// 监听添加节点
|
|
|
|
|
|
graph.on("node:added", ({ node }) => {
|
|
|
+ let time = Date.now();
|
|
|
+ node.store.data.productionId = time;
|
|
|
if (node.store.data && node.store.data.shape == "handle-btn-one") {
|
|
|
- let time = Date.now();
|
|
|
- node.store.data.productionId = time;
|
|
|
proxy.$emit("addRow", {
|
|
|
productionId: time,
|
|
|
});
|
|
@@ -389,7 +399,7 @@ const antvInit = async (data) => {
|
|
|
let name = node.store.data.label;
|
|
|
proxy.$emit("addRow", {
|
|
|
name,
|
|
|
- productionId: node.store.data.productionId,
|
|
|
+ productionId: time,
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -661,7 +671,7 @@ const antvInit = async (data) => {
|
|
|
return graph.createNode({
|
|
|
shape: "handle-btn",
|
|
|
label: x.name,
|
|
|
- productionId: x.id,
|
|
|
+ productionId: "",
|
|
|
zIndex: 100,
|
|
|
attrs: {
|
|
|
body: {
|
|
@@ -700,6 +710,16 @@ const antvInit = async (data) => {
|
|
|
const getFlowInfo = (data) => {
|
|
|
if (data) {
|
|
|
antvInit(data);
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ let arr = data.filter((x) => x.shape == "handle-btn-one");
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const iele = arr[i];
|
|
|
+ flowNodeObj.value[iele.id] = {
|
|
|
+ nodeName: iele.data.title,
|
|
|
+ id: iele.id,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
antvInit();
|
|
|
}
|