@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
194 lines (193 loc) • 7.06 kB
JavaScript
import { defineComponent as V, getCurrentInstance as L, ref as t, inject as j, onMounted as q, openBlock as v, createBlock as F, unref as r, withCtx as n, createVNode as i } from "vue";
import { pluginManager as p } from "@javaguns/utils";
import { ModelKey as A } from "../../utils/injection-key.mjs";
import { getModelList as O, delFormField as S, getFormFieldList as N } from "../../utils/api.mjs";
import z from "./approver/flowApproverGroup.vue.mjs";
import D from "../common/flowDrawerContent.vue.mjs";
import b from "../common/flowSelect.vue.mjs";
import E from "../common/flowTable.vue.mjs";
const H = V({ name: "flow-subflow-drawer" }), le = /* @__PURE__ */ V({
...H,
props: {
node: { default: () => ({}) }
},
setup(w, { expose: _ }) {
const h = p.getComponent("Tabs"), M = p.getComponent("TabPane"), U = p.getComponent("Form"), C = p.getComponent("FormItem"), o = w, { appContext: T } = L(), y = T.app.config.globalProperties.$flowUI, I = t(), u = t(), s = t(1), g = t([]), x = j(A, t({})), f = t([]), m = t([]), k = t([8, 9, 10, 13, 21]), R = t([
{
title: "父表单字段",
dataIndex: "parentFieldName",
key: "parentFieldName",
span: 11
},
{
title: "子表单字段",
dataIndex: "childFieldName",
key: "childFieldName",
span: 11
},
{
title: "操作",
dataIndex: "action",
key: "action",
span: 2
}
]), G = async (a) => {
if (a.add) {
let l = o.node.parentToChildFields.indexOf(a);
l !== -1 && o.node.parentToChildFields.splice(l, 1);
} else
await S({ fieldId: a.fieldId }), c();
}, $ = () => {
o.node.parentToChildFields.push({
childFieldModel: null,
childFieldName: null,
parentFieldModel: null,
parentFieldName: null,
add: !0
});
}, c = async () => {
var l, e;
const a = o.node.attr.parentModelId;
if (a) {
const d = await N({ modelId: a, classify: 2 });
if (f.value = [], f.value = (l = d.data) == null ? void 0 : l.data, m.value.length == 0) {
const B = await N({ modelId: x.value.modelId, classify: 2 });
m.value = [], m.value = (e = B.data) == null ? void 0 : e.data;
}
}
}, K = async () => {
try {
let a = null;
return y == "element-plus" || y == "arco-design" ? a = await u.value.validate() : a = await u.value.validateFields(), console.log("Success:", a), !0;
} catch (a) {
return console.log("Failed:", a), !1;
}
}, P = async () => {
var e;
const a = await K(), l = await ((e = I.value) == null ? void 0 : e.valid());
return a && l;
};
return q(async () => {
var l;
const a = await O({});
g.value = (l = a == null ? void 0 : a.data) == null ? void 0 : l.data, await c();
}), _({
valid: P
}), (a, l) => (v(), F(r(h), {
class: "demo-tabs",
modelValue: s.value,
"onUpdate:modelValue": l[2] || (l[2] = (e) => s.value = e),
activeKey: s.value,
"onUpdate:activeKey": l[3] || (l[3] = (e) => s.value = e),
animated: ""
}, {
default: n(() => [
(v(), F(r(M), {
label: "发起人设置",
title: "发起人设置",
name: 1,
key: 1,
tab: "发起人设置",
forceRender: ""
}, {
default: n(() => [
i(D, { name: "子流程选择" }, {
default: n(() => [
i(r(U), {
ref_key: "formRef",
ref: u,
model: o.node.attr,
class: "flow-drawer-approver-group"
}, {
default: n(() => [
i(r(C), {
"hide-label": !0,
name: "parentModelId",
prop: "parentModelId",
field: "parentModelId",
rules: [{ required: !0, message: "不能为空" }]
}, {
default: n(() => [
i(b, {
modelValue: o.node.attr.parentModelId,
"onUpdate:modelValue": l[0] || (l[0] = (e) => o.node.attr.parentModelId = e),
label: o.node.attr.parentModelName,
"onUpdate:label": l[1] || (l[1] = (e) => o.node.attr.parentModelName = e),
"label-name": "modelName",
"value-name": "modelId",
mode: "simple",
datas: g.value,
onChange: c
}, null, 8, ["modelValue", "label", "datas"])
]),
_: 1
})
]),
_: 1
}, 8, ["model"])
]),
_: 1
}),
i(z, {
ref_key: "approverGroup",
ref: I,
node: o.node,
title: "发起人",
multiple: !1,
approverTypes: k.value
}, null, 8, ["node", "approverTypes"])
]),
_: 1
})),
(v(), F(r(M), {
label: "数据设置",
title: "数据设置",
name: 2,
key: 2,
tab: "数据设置",
forceRender: ""
}, {
default: n(() => [
i(E, {
columns: R.value,
datas: o.node.parentToChildFields,
onAdd: $,
onRemove: G
}, {
parentFieldName: n(({ record: e }) => [
i(b, {
modelValue: e.parentFieldModel,
"onUpdate:modelValue": (d) => e.parentFieldModel = d,
label: e.parentModelName,
"onUpdate:label": (d) => e.parentModelName = d,
"label-name": "fieldName",
"value-name": "fieldModel",
mode: "simple",
datas: m.value
}, null, 8, ["modelValue", "onUpdate:modelValue", "label", "onUpdate:label", "datas"])
]),
childFieldName: n(({ record: e }) => [
i(b, {
modelValue: e.childFieldModel,
"onUpdate:modelValue": (d) => e.childFieldModel = d,
label: e.childFieldName,
"onUpdate:label": (d) => e.childFieldName = d,
"label-name": "fieldName",
"value-name": "fieldModel",
mode: "simple",
datas: f.value
}, null, 8, ["modelValue", "onUpdate:modelValue", "label", "onUpdate:label", "datas"])
]),
_: 1
}, 8, ["columns", "datas"])
]),
_: 1
}))
]),
_: 1
}, 8, ["modelValue", "activeKey"]));
}
});
export {
le as default
};