@javaguns/flow-ui
Version:
``` <template> <a-spin :spinning="loading"> <FlowDesigner ref="flowDesigner" top="50px"> </FlowDesigner> </a-spin> </template> <script lang="ts" setup> import { ref, provide, onMounted } from 'vue'; import { FlowDesigner, LoadingKey } from '@j
95 lines (94 loc) • 3.21 kB
JavaScript
import { defineComponent as y, inject as v, toRef as D, ref as m, onMounted as B, provide as i, openBlock as K, createBlock as M, unref as a, withCtx as S, createVNode as p } from "vue";
import "./style/index.css";
import { STATUS_MODES_MAP as k } from "./render.mjs";
import { getDesign as N, getInstanceDetail as b, getRuTaskList as x } from "../utils/api.mjs";
import { NodeKey as u, TasksKey as z, ReadonlyKey as A } from "../utils/injection-key.mjs";
import { NODE_TYPES_MAP as P } from "../utils/constant.mjs";
import Z from "../hooks/useData.mjs";
import { FlowDesignPanel as E } from "../flow-panel/index.mjs";
import { FlowSimpleNode as f } from "../flow-node/flow-simple-node/index.mjs";
import "../flow-node/flow-branch-node/index.mjs";
import { FlowAssembleNode as F } from "../flow-node/flow-assemble-node/index.mjs";
const R = y({ name: "flow-render" }), Q = /* @__PURE__ */ y({
...R,
props: {
top: {},
zoomTop: {},
pTop: { default: "20px" },
pBottom: {},
scroll: { type: Boolean, default: !0 },
complete: { type: Boolean },
width: {},
height: { default: "100%" },
readonly: { type: Boolean, default: !0 },
showStatus: { type: Boolean, default: !0 },
statusMode: { default: k.horizontal },
nodeMode: { default: P.square },
showZoom: { type: Boolean },
drag: { type: Boolean, default: !1 },
node: { default: {} }
},
emits: ["load"],
setup(h, { expose: g, emit: w }) {
const e = h, o = v(u, D(e.node || {})), l = m([]), r = m(!1), { initNode: c } = Z();
B(() => {
e.node || (o.value = c());
});
const T = w, _ = async (t) => {
const n = await N({
instanceId: t.instanceId,
modelId: t.modelId,
definitionId: t.modelId,
formKey: t.formKey,
modelKey: t.modelKey,
edit: !1
});
if (n && n.data && n.data.data ? o.value = n.data.data : o.value = c(), console.log("node", o.value), t.instanceId) {
const d = await b({
instanceId: t.instanceId
});
d && d.data && d.data.data && (r.value = d.data.data.flowStatus == 2);
const s = await x({
instanceId: t.instanceId
});
s && s.data && (l.value = s.data.data);
}
T("load", { node: o.value, tasks: l.value });
}, I = () => o.value;
return i(u, o), i(z, l), i(A, e.readonly), g({
setData: _,
getData: I
}), (t, n) => (K(), M(a(E), {
height: e.height,
top: e.top,
zoomTop: e.zoomTop,
showZoom: e.showZoom,
drag: e.drag,
scroll: e.scroll
}, {
default: S(() => [
p(a(f), {
type: "circle",
subType: "start",
node: a(o),
top: e.pTop
}, null, 8, ["node", "top"]),
p(a(F), {
type: e.nodeMode,
node: a(o)
}, null, 8, ["type", "node"]),
p(a(f), {
type: "circle",
subType: "end",
node: a(o),
complete: r.value,
bottom: e.pTottom
}, null, 8, ["node", "complete", "bottom"])
]),
_: 1
}, 8, ["height", "top", "zoomTop", "showZoom", "drag", "scroll"]));
}
});
export {
Q as default
};