@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
76 lines (75 loc) • 2.34 kB
JavaScript
import { defineComponent as f, ref as n, openBlock as k, createBlock as D, unref as c, withCtx as r, createVNode as o, nextTick as u } from "vue";
import { pluginManager as p } from "@javaguns/utils";
import { radioSelect as w } from "./common.mjs";
import x from "./post-tree.vue.mjs";
import A from "./selected-list.vue.mjs";
const B = f({ name: "flow-selection-post" }), T = /* @__PURE__ */ f({
...B,
props: {
isRadio: { type: Boolean, default: !0 },
selectData: { default: () => [] }
},
emits: ["selectedChange"],
setup(m, { expose: _, emit: v }) {
const h = p.getComponent("Row"), d = p.getComponent("Col"), s = m, l = n(null), e = n(s.selectData ? s.selectData : []);
n(!1);
const i = v, C = (t) => {
s.isRadio ? (e.value = [], w(!0, Array.isArray(t) ? t[0] : t, e.value, "positionId", "positionName")) : Array.isArray(t) && (e.value = t.map((a) => ({ id: a.positionId, name: a.positionName }))), i("selectedChange", e.value);
}, g = (t) => {
u(() => {
e.value.splice(
e.value.findIndex((a) => a.id === t.id),
1
), l.value.setCheckedKeys(e.value.map((a) => a.id)), i("selectedChange", e.value);
});
}, y = () => {
e.value = [], l.value.setCheckedKeys(e.value.map((t) => t.id)), i("selectedChange", e.value);
}, R = async (t) => {
await u(() => {
l.value.setCheckedKeys(s.selectData.map((a) => a.id));
});
};
return _({
// setData,
}), (t, a) => (k(), D(c(h), {
class: "flow-select-user",
gutter: 16
}, {
default: r(() => [
o(c(d), {
span: 12,
class: "height100"
}, {
default: r(() => [
o(x, {
ref_key: "treeRef",
ref: l,
"header-title": "岗位",
isRadio: s.isRadio,
onTreeSelect: C,
onLoad: R
}, null, 8, ["isRadio"])
]),
_: 1
}),
o(c(d), {
span: 12,
class: "height100"
}, {
default: r(() => [
o(A, {
datas: e.value,
onDelete: g,
onDeleteAll: y
}, null, 8, ["datas"])
]),
_: 1
})
]),
_: 1
}));
}
});
export {
T as default
};