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

86 lines (85 loc) 3.26 kB
import { defineComponent as _, getCurrentInstance as b, ref as l, watch as B, onMounted as V, openBlock as E, createElementBlock as U, createElementVNode as c, toDisplayString as R, createVNode as d, unref as r, withCtx as M, withDirectives as g, vShow as v } from "vue"; import { pluginManager as s } from "@javaguns/utils"; import { IconSearchOutline as G } from "@javaguns/icon"; import { getOrgTree as P } from "../../utils/adminApi.mjs"; const $ = { class: "flow-select-org-tree" }, j = { class: "left-header" }, q = { class: "left-header-title" }, z = { class: "search" }, A = { class: "left-tree" }, F = _({ name: "flow-selection-org-tree" }), X = /* @__PURE__ */ _({ ...F, props: { headerTitle: { default: "" }, isRadio: { type: Boolean } }, emits: ["treeSelect", "update:currentSelectOrgId"], setup(C, { expose: S, emit: w }) { const x = s.getComponent("InputSearch"), I = s.getComponent("Empty"), O = s.getComponent("Tree"), T = s.getComponent("Button"), k = C, { appContext: y } = b(), u = y.app.config.globalProperties.$flowUI, p = l(), n = l(""), f = l(!1); l(!0); const t = l([]); l([]), l([]); const m = l([]); B(n, (e) => { u == "element-plus" && p.value.filter(e); }); const i = w, h = (e) => { u == "element-plus" ? (i("treeSelect", e), i("update:currentSelectOrgId", e.id)) : (i("treeSelect", e), i("update:currentSelectOrgId", e[0])); }, D = (e, a) => e ? a.name.indexOf(e) !== -1 : !0, N = (e) => { const a = m.value.filter((o) => o.name.indexOf(e) !== -1); t.value = a; }; return V(async () => { try { f.value = !0; const e = await P({}); t.value = e.data.data, m.value = e.data.data; } finally { f.value = !1; } }), S({}), (e, a) => (E(), U("div", $, [ c("div", j, [ c("span", q, R(k.headerTitle), 1) ]), c("div", z, [ d(r(x), { value: n.value, "onUpdate:value": a[0] || (a[0] = (o) => n.value = o), modelValue: n.value, "onUpdate:modelValue": a[1] || (a[1] = (o) => n.value = o), "enter-button": "", clearable: "", allowClear: "", placeholder: "请输入机构名称", onChange: N }, { append: M(() => [ d(r(T), { icon: r(G) }, null, 8, ["icon"]) ]), _: 1 }, 8, ["value", "modelValue"]) ]), g(c("div", A, [ d(r(O), { ref_key: "treeRef", ref: p, class: "filter-tree", data: t.value, "tree-data": t.value, fieldNames: { children: "children", title: "name", key: "id" }, props: { children: "children", label: "name", key: "id" }, "key-field": "id", "label-field": "name", "children-field": "children", "default-expand-all": !0, onSelect: h, onNodeClick: h, "filter-node-method": D }, null, 8, ["data", "tree-data"]) ], 512), [ [v, t.value && t.value.length > 0] ]), g(d(r(I), { description: "暂无数据" }, null, 512), [ [v, t.value && t.value.length === 0] ]) ])); } }); export { X as default };