feat: 调整流程节点
This commit is contained in:
parent
18072915a3
commit
c7d8a49b3b
@ -60,4 +60,12 @@ export function flowStop(instId) {
|
|||||||
url: `/flow/stop/${instId}`,
|
url: `/flow/stop/${instId}`,
|
||||||
method: 'post'
|
method: 'post'
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getArmStatus(params) {
|
||||||
|
return request({
|
||||||
|
url: '/api/arm/getPose',
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@ -59,14 +59,14 @@ defineExpose({ confirmSave })
|
|||||||
// 保存成功 / 失败处理
|
// 保存成功 / 失败处理
|
||||||
const handleSaveSuccess = () => {
|
const handleSaveSuccess = () => {
|
||||||
emitter.emit('setProperties', { id: props.data.id })
|
emitter.emit('setProperties', { id: props.data.id })
|
||||||
emitter.emit("throwAnError", { id: props.data.id, hasError: false });
|
emitter.emit("throwAnError", { id: props.data.id, hasError: false, type: props.data.type });
|
||||||
// 无错误,关闭抽屉
|
// 无错误,关闭抽屉
|
||||||
emits('close')
|
emits('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSaveError = () => {
|
const handleSaveError = () => {
|
||||||
emitter.emit('setProperties', { id: props.data.id })
|
emitter.emit('setProperties', { id: props.data.id })
|
||||||
emitter.emit("throwAnError", { id: props.data.id, hasError: true });
|
emitter.emit("throwAnError", { id: props.data.id, hasError: true, type: props.data.type });
|
||||||
emits('close')
|
emits('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -231,7 +231,7 @@ const robotFormAction = ref()
|
|||||||
const submitRobotForm = () => {
|
const submitRobotForm = () => {
|
||||||
if (robotFormAction.value === 'AGV_MOVE_TO_POINT') {
|
if (robotFormAction.value === 'AGV_MOVE_TO_POINT') {
|
||||||
|
|
||||||
} else if (robotFormAction.value === 'ALM') {
|
} else if (robotFormAction.value === 'ARM_MOVE_TO_POINT') {
|
||||||
robotFormRef.value.validate(async (valid) => {
|
robotFormRef.value.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -383,7 +383,7 @@ function handler(params) {
|
|||||||
name: "机械臂",
|
name: "机械臂",
|
||||||
type: "serviceNode",
|
type: "serviceNode",
|
||||||
desc: "控制机器人的手臂",
|
desc: "控制机器人的手臂",
|
||||||
action: 'ALM',
|
action: 'ARM_MOVE_TO_POINT',
|
||||||
nodeType: 'EDGE',
|
nodeType: 'EDGE',
|
||||||
nodeParams: [
|
nodeParams: [
|
||||||
{ name: "deviceId", type: "input", input: "", disabled: true },
|
{ name: "deviceId", type: "input", input: "", disabled: true },
|
||||||
|
|||||||
@ -542,8 +542,8 @@ const initFlow = () => {
|
|||||||
keys: ["backspace", "delete"], // 覆盖删除键
|
keys: ["backspace", "delete"], // 覆盖删除键
|
||||||
callback: () => {
|
callback: () => {
|
||||||
const activeElem = document.activeElement;
|
const activeElem = document.activeElement;
|
||||||
if (activeElem.tagName === "INPUT" || activeElem.tagName === "TEXTAREA") {
|
if (["INPUT", "TEXTAREA"].includes(activeElem.tagName)) {
|
||||||
return; // 不处理输入框内的删除
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const { nodes, edges } = lf.getSelectElements();
|
const { nodes, edges } = lf.getSelectElements();
|
||||||
@ -555,7 +555,7 @@ const initFlow = () => {
|
|||||||
|
|
||||||
if (hasProtectedNode) {
|
if (hasProtectedNode) {
|
||||||
lf.selectElementById(null); // 取消选中
|
lf.selectElementById(null); // 取消选中
|
||||||
return; // 阻断删除
|
return false; // 阻断删除
|
||||||
}
|
}
|
||||||
|
|
||||||
// 默认删除逻辑
|
// 默认删除逻辑
|
||||||
@ -571,7 +571,7 @@ const initFlow = () => {
|
|||||||
// 删除节点所有的边
|
// 删除节点所有的边
|
||||||
lf.deleteEdgeByNodeId(node.id);
|
lf.deleteEdgeByNodeId(node.id);
|
||||||
});
|
});
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (nodes.length === 0 && edges.length > 0) {
|
if (nodes.length === 0 && edges.length > 0) {
|
||||||
edges.forEach((node) => {
|
edges.forEach((node) => {
|
||||||
@ -584,12 +584,12 @@ const initFlow = () => {
|
|||||||
{
|
{
|
||||||
keys: ["ctrl+z"], // 自定义快捷键
|
keys: ["ctrl+z"], // 自定义快捷键
|
||||||
callback: () => {
|
callback: () => {
|
||||||
return false;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
keys: ["ctrl+shift+z"],
|
keys: ["ctrl+shift+z"],
|
||||||
callback: () => false,
|
callback: () => true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -789,8 +789,23 @@ onMounted(() => {
|
|||||||
|
|
||||||
emitter.on("throwAnError", (data) => {
|
emitter.on("throwAnError", (data) => {
|
||||||
// 处理错误抛出逻辑
|
// 处理错误抛出逻辑
|
||||||
const { id, hasError } = data;
|
const { id, hasError, type } = data;
|
||||||
const element = document.getElementsByClassName(`node__container ${id}`)[0].parentElement;
|
let element
|
||||||
|
if (type === 'loop') {
|
||||||
|
const tt = document.getElementsByClassName(`group__container ${id}`)[0];
|
||||||
|
if (tt?.parentElement) {
|
||||||
|
element = tt.parentElement;
|
||||||
|
} else {
|
||||||
|
element = tt
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const tt = document.getElementsByClassName(`node__container ${id}`)[0]
|
||||||
|
if (tt?.parentElement) {
|
||||||
|
element = tt.parentElement;
|
||||||
|
} else {
|
||||||
|
element = tt
|
||||||
|
}
|
||||||
|
}
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
if (!nodeErrorList.value.includes(id)) {
|
if (!nodeErrorList.value.includes(id)) {
|
||||||
nodeErrorList.value.push(id);
|
nodeErrorList.value.push(id);
|
||||||
@ -889,10 +904,12 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
.node__container {
|
.node__container {
|
||||||
border-color: #8dc99d;
|
border-color: #8dc99d;
|
||||||
|
// pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group__container {
|
.group__container {
|
||||||
border-color: #8dc99d;
|
border-color: #8dc99d;
|
||||||
|
// pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -181,7 +181,7 @@ class EndNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,7 +198,7 @@ class ServiceNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -180,7 +180,7 @@ class StartNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = 'none';
|
style.stroke = 'none';
|
||||||
style.hover.stroke = 'none';
|
// style.hover.stroke = 'none';
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,7 +198,7 @@ class CodeNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -204,7 +204,7 @@ class CurrentLoopNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,7 +198,7 @@ class HttpNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,6 @@ class loopBodyModel extends GroupNodeModel {
|
|||||||
// 计算子节点的包围盒(包含所有子节点的最小矩形区域)
|
// 计算子节点的包围盒(包含所有子节点的最小矩形区域)
|
||||||
getChildrenBBox() {
|
getChildrenBBox() {
|
||||||
const children = this.getAllValidChildren(this.children, this.graphModel)
|
const children = this.getAllValidChildren(this.children, this.graphModel)
|
||||||
console.log('children', children)
|
|
||||||
// Array.from(this.children).forEach((id) => {
|
// Array.from(this.children).forEach((id) => {
|
||||||
// const node = this.graphModel.getNodeModelById(id)
|
// const node = this.graphModel.getNodeModelById(id)
|
||||||
// if (node) {
|
// if (node) {
|
||||||
@ -109,14 +108,16 @@ class loopBodyModel extends GroupNodeModel {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
x: x + width / 2 ,
|
x: x + width / 2 ,
|
||||||
y: y + height / 2,
|
// y: y + height / 2,
|
||||||
|
y:y,
|
||||||
name: "right",
|
name: "right",
|
||||||
id: "".concat(this.id, "_1"),
|
id: "".concat(this.id, "_1"),
|
||||||
properties: { connectionType: "source" },
|
properties: { connectionType: "source" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
x: x - width / 2,
|
x: x - width / 2,
|
||||||
y: y + height / 2,
|
// y: y + height / 2,
|
||||||
|
y:y,
|
||||||
name: "left",
|
name: "left",
|
||||||
id: "".concat(this.id, "_3"),
|
id: "".concat(this.id, "_3"),
|
||||||
properties: { connectionType: "target" },
|
properties: { connectionType: "target" },
|
||||||
@ -241,6 +242,13 @@ class loopBodyView extends HtmlNode {
|
|||||||
return svgH('g', {}, anchorShapes);
|
return svgH('g', {}, anchorShapes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOutlineStyle() {
|
||||||
|
const style = super.getOutlineStyle();
|
||||||
|
style.stroke = "none";
|
||||||
|
// style.hover.stroke = "none";
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将 HTML 内容设置到指定的根元素上
|
* 将 HTML 内容设置到指定的根元素上
|
||||||
* @param rootEl 根元素
|
* @param rootEl 根元素
|
||||||
|
|||||||
@ -87,13 +87,13 @@ onUnmounted(() => {
|
|||||||
.group__container {
|
.group__container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
min-height: 420px;
|
// min-height: 420px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
border: 2px solid white;
|
border: 2px solid white;
|
||||||
box-shadow: 0 5px 15px 0#00000008;
|
// box-shadow: 0 5px 15px 0#00000008;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -198,7 +198,7 @@ class SdAgentNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,7 +198,7 @@ class SleepNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,7 +176,7 @@ class StopLoopHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,7 +171,7 @@ class SubEndNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ class SubStartNodeHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -303,7 +303,7 @@ class SwitchHtmlModel extends HtmlNodeModel {
|
|||||||
getOutlineStyle() {
|
getOutlineStyle() {
|
||||||
const style = super.getOutlineStyle();
|
const style = super.getOutlineStyle();
|
||||||
style.stroke = "none";
|
style.stroke = "none";
|
||||||
style.hover.stroke = "none";
|
// style.hover.stroke = "none";
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user