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

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