@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
233 lines (232 loc) • 7.43 kB
JavaScript
import { defineComponent as h, ref as N, reactive as G, onMounted as B, openBlock as f, createElementBlock as V, Fragment as I, createVNode as l, unref as a, withCtx as n, createTextVNode as m, renderList as K, createBlock as v } from "vue";
import { pluginManager as u, getId as T } from "@javaguns/utils";
import { IconDeleteOutline as g, IconPlusOutline as D } from "@javaguns/icon";
import { getFlowVariableFields as q, deleteFlowVariableFields as O, saveFlowVariableFields as P } from "../../utils/dataApi.mjs";
import $ from "../common/flowSelect.vue.mjs";
const A = h({ name: "flow-base-setting" }), J = /* @__PURE__ */ h({
...A,
props: {
modelId: {},
definitionId: {}
},
setup(C, { expose: x }) {
const U = u.getComponent("Alert"), y = u.getComponent("Row"), o = u.getComponent("Col"), c = u.getComponent("Input"), k = u.getComponent("Button"), M = u.getComponent("Popconfirm"), i = C, d = N([]), b = "说明:用来维护流程流转过程中、各个节点需要使用到的属性信息、主要用在条件判断节点", F = G([
{ value: "input", name: "文本框" },
{ value: "number", name: "数字框" },
{ value: "textarea", name: "文本域" },
{ value: "select", name: "下拉框" },
{ value: "selectMultiple", name: "下拉框(多选)" },
{ value: "radio", name: "单选框" },
{ value: "checkbox", name: "复选框" },
{ value: "user", name: "用户控件" },
{ value: "dept", name: "部门控件" },
{ value: "date", name: "日期控件" },
{ value: "datetime", name: "日期时间控件" },
{ value: "time", name: "时间" }
]);
B(() => {
r(i.modelId), console.log(d.value);
});
const r = async (s) => {
const e = await q({ formModelId: s, classify: 3 });
e && e.data && e.data.data && e.data.data.length > 0 ? d.value = e.data.data : w();
}, w = () => {
d.value.push({
fieldId: T(),
formModelId: i.modelId,
formDefinitionId: i.definitionId,
fieldName: "",
fieldKey: "",
fieldModel: "",
fieldType: "input",
width: "100",
topic: !1,
summary: !1,
required: !1,
disabled: !1,
classify: 3,
add: !0,
key: Date.now()
});
}, _ = async (s) => {
if (s.add) {
let p = d.value.indexOf(s);
p !== -1 && d.value.splice(p, 1);
} else
await O({ fieldId: s.fieldId }), r(i.modelId);
};
return x({
save: async () => {
try {
return await P(d.value), r(i.modelId), !0;
} catch {
return !1;
}
}
}), (s, p) => (f(), V(I, null, [
l(a(U), {
message: b,
title: b,
type: "warning"
}),
l(a(y), { style: { "margin-top": "10px" } }, {
default: n(() => [
l(a(o), {
span: 6,
class: "guns-flow-variable-setting-header"
}, {
default: n(() => [
m("显示名")
]),
_: 1
}),
l(a(o), {
span: 5,
class: "guns-flow-variable-setting-header"
}, {
default: n(() => [
m("属性名")
]),
_: 1
}),
l(a(o), {
span: 5,
class: "guns-flow-variable-setting-header"
}, {
default: n(() => [
m("列名")
]),
_: 1
}),
l(a(o), {
span: 6,
class: "guns-flow-variable-setting-header"
}, {
default: n(() => [
m("组件")
]),
_: 1
}),
l(a(o), {
span: 2,
class: "guns-flow-variable-setting-header"
}, {
default: n(() => [
m("操作")
]),
_: 1
})
]),
_: 1
}),
(f(!0), V(I, null, K(d.value, (e) => (f(), v(a(y), {
key: e.fieldId,
gutter: 8
}, {
default: n(() => [
l(a(o), {
span: 6,
class: "guns-flow-variable-setting-body"
}, {
default: n(() => [
l(a(c), {
value: e.fieldName,
"onUpdate:value": (t) => e.fieldName = t,
modelValue: e.fieldName,
"onUpdate:modelValue": (t) => e.fieldName = t,
placeholder: "请输入显示名"
}, null, 8, ["value", "onUpdate:value", "modelValue", "onUpdate:modelValue"])
]),
_: 2
}, 1024),
l(a(o), {
span: 5,
class: "guns-flow-variable-setting-body"
}, {
default: n(() => [
l(a(c), {
value: e.fieldKey,
"onUpdate:value": (t) => e.fieldKey = t,
modelValue: e.fieldKey,
"onUpdate:modelValue": (t) => e.fieldKey = t,
placeholder: "请输入属性名"
}, null, 8, ["value", "onUpdate:value", "modelValue", "onUpdate:modelValue"])
]),
_: 2
}, 1024),
l(a(o), {
span: 5,
class: "guns-flow-variable-setting-body"
}, {
default: n(() => [
l(a(c), {
value: e.fieldModel,
"onUpdate:value": (t) => e.fieldModel = t,
modelValue: e.fieldModel,
"onUpdate:modelValue": (t) => e.fieldModel = t,
placeholder: "请输入列名"
}, null, 8, ["value", "onUpdate:value", "modelValue", "onUpdate:modelValue"])
]),
_: 2
}, 1024),
l(a(o), {
span: 6,
class: "guns-flow-variable-setting-body"
}, {
default: n(() => [
l($, {
modelValue: e.fieldType,
"onUpdate:modelValue": (t) => e.fieldType = t,
mode: "simple",
datas: F
}, null, 8, ["modelValue", "onUpdate:modelValue", "datas"])
]),
_: 2
}, 1024),
l(a(o), {
span: 2,
class: "guns-flow-variable-setting-body"
}, {
default: n(() => [
e.add ? (f(), v(a(g), {
key: 0,
onClick: (t) => _(e)
}, null, 8, ["onClick"])) : (f(), v(a(M), {
key: 1,
title: "确定要删除此记录吗?",
width: "200",
"ok-text": "删除",
"cancel-text": "关闭",
"confirm-button-text": "删除",
"cancel-button-text": "关闭",
onConfirm: (t) => _(e)
}, {
reference: n(() => [
l(a(g))
]),
default: n(() => [
l(a(g))
]),
_: 2
}, 1032, ["onConfirm"]))
]),
_: 2
}, 1024)
]),
_: 2
}, 1024))), 128)),
l(a(k), {
class: "guns-flow-variable-setting-butoon",
onClick: w
}, {
default: n(() => [
l(a(D))
]),
_: 1
})
], 64));
}
});
export {
J as default
};