UNPKG

@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

87 lines (86 loc) 4.82 kB
import { ref as V } from "vue"; import { NodeType as i } from "../../types/node.mjs"; import { updateDesignNode as F } from "../../utils/api.mjs"; function _(T, h, n, e, j, O, b, D, E) { const m = V(!1), s = () => { m.value = !1, n.value.active = !1; }, R = async () => { e.value.nodeType == i.APPROVER ? await c() : e.value.nodeType == i.START ? await A() : e.value.nodeType == i.BRANCH || e.value.nodeType == i.PARALLEL_BRANCH ? await B() : e.value.nodeType == i.JUMP ? await G() : e.value.nodeType == i.NOTICE ? await L() : e.value.nodeType == i.SUB_FLOW && await P(); }, A = async () => ((e.value.privileges || []).length > 0 ? (e.value.error = !1, e.value.content = "已设置", e.value.update && f(e.value), Object.assign(n.value, e.value), s()) : (e.value.error = !1, e.value.content = "", Object.assign(n.value, e.value)), e.value), c = async () => { var t; const l = await j.value.valid(); if (l) { let v = ""; (t = e.value.approverGroups) == null || t.forEach((a) => { (a.approverType == 9 || a.approverType == 10) && a.approverNames.length == 0 ? v += a.approverTypeName : (a.approverType == 9 || a.approverType == 20) && a.selectRange == 3 ? v += a.approverTypeName + ":全公司" : a.approverType == 13 || a.approverType == 14 ? v += a.approverTypeName : a.approverNames.length > 0 && (v += a.approverTypeName + ":" + a.approverNames.join(",")), v && (v += ` `); }), v && l ? (e.value.error = !1, e.value.content = v, e.value.update && f(e.value), Object.assign(n.value, e.value), s()) : (e.value.error = !1, e.value.content = void 0, Object.assign(n.value, e.value)); } }, B = async () => { var l; try { if (await O.value.valid()) { let v = ""; e.value.attr && e.value.attr.branchType == 1 ? (l = e.value.conditionGroup) == null || l.forEach((a, U) => { U != 0 && (v += ` 或 `), a.conditions.length > 0 && a.conditions.forEach((p, S) => { const w = p.conditionValueName[0]; w && (S != 0 && (v += ` 且 `), v += "[" + p.columnName + " " + p.optName + " " + w + "]"); }); }) : v += "任意(其他)", e.value.error = !0, e.value.content = "", v && (e.value.error = !1, e.value.content = v, e.value.update && f(e.value), Object.assign(n.value, e.value), s()); } return e.value; } catch { } }, G = async () => { var l; try { const t = await b.value.valid(); if (t) { let v = ""; (l = e.value.approverGroups) == null || l.forEach((a) => { a.approverNames.length > 0 && (v += a.approverTypeName + ":" + a.approverNames.join(",")), v && (v += ` `); }), v && t ? (e.value.error = !1, e.value.content = v, e.value.update && f(e.value), Object.assign(n.value, e.value), s()) : (e.value.error = !1, e.value.content = void 0, Object.assign(n.value, e.value)); } } catch { } }, L = async () => { var l; try { const t = await D.value.valid(); if (t) { let v = ""; (l = e.value.approverGroups) == null || l.forEach((a) => { (a.approverType == 9 || a.approverType == 10) && a.approverNames.length == 0 ? v += a.approverTypeName : (a.approverType == 9 || a.approverType == 20) && a.selectRange == 3 ? v += a.approverTypeName + ":全公司" : a.approverType == 13 || a.approverType == 14 ? v += a.approverTypeName : a.approverNames.length > 0 && (v += a.approverTypeName + ":" + a.approverNames.join(",")), v && (v += ` `); }), v && t ? (e.value.error = !1, e.value.content = v, e.value.update && f(e.value), Object.assign(n.value, e.value), s()) : (e.value.error = !1, e.value.content = void 0, Object.assign(n.value, e.value)); } } catch { } }, P = async () => { var t; const l = await E.value.valid(); if (l) { let v = ""; (t = e.value.approverGroups) == null || t.forEach((a) => { (a.approverType == 9 || a.approverType == 10) && a.approverNames.length == 0 ? v += a.approverTypeName : (a.approverType == 9 || a.approverType == 20) && a.selectRange == 3 ? v += a.approverTypeName + ":全公司" : a.approverType == 13 || a.approverType == 14 ? v += a.approverTypeName : a.approverNames.length > 0 && (v += a.approverTypeName + ":" + a.approverNames.join(",")), v && (v += ` `); }), v && l ? (e.value.error = !1, e.value.content = v, e.value.update && f(e.value), Object.assign(n.value, e.value), s()) : (e.value.error = !1, e.value.content = void 0, Object.assign(n.value, e.value)); } }, f = async (l) => { if (console.log("nodeUpdate", l), l && T.value) { const t = { modelId: T.value, definitionId: h.value, node: l }; await F(t); } }; return { open: m, closeDrawer: s, saveDrawer: R }; } export { _ as useDrawer };