| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- var U = ($, D, p) => new Promise((b, m) => {
- var V = (c) => {
- try {
- u(p.next(c));
- } catch (_) {
- m(_);
- }
- }, w = (c) => {
- try {
- u(p.throw(c));
- } catch (_) {
- m(_);
- }
- }, u = (c) => c.done ? b(c.value) : Promise.resolve(c.value).then(V, w);
- u((p = p.apply($, D)).next());
- });
- import { ref as o, watch as re, resolveComponent as B, openBlock as k, createElementBlock as S, createVNode as d, withCtx as h, createElementVNode as t, toDisplayString as i, createTextVNode as I, withModifiers as ve, Fragment as G, renderList as J, createCommentVNode as he } from "vue";
- import { aq as _e, B as pe, d0 as me, cz as fe, cA as ge, d1 as we, d2 as Ce, d3 as ye, d4 as ke, d5 as Se } from "./index2.js";
- const $e = { class: "s-office-select-common" }, be = { class: "modal-container" }, Oe = { class: "side" }, Ne = { class: "main" }, Ae = { class: "filter" }, Ve = { class: "list-wrap" }, Le = { class: "item left-wrap" }, Te = { class: "head" }, je = { class: "sub-title" }, Ue = { class: "right" }, Be = { href: "javascript:;" }, Ie = ["onClick"], De = { class: "icon s-theme-icon-bg" }, Ee = { class: "cont" }, ze = { class: "name" }, Fe = { class: "job" }, Me = {
- key: 0,
- class: "not-more"
- }, qe = { class: "item right-wrap" }, Ge = { class: "head" }, Je = { class: "sub-title" }, Re = { class: "icon s-theme-icon-bg" }, xe = { class: "cont" }, He = { class: "name" }, Ke = { class: "job" }, Pe = ["onClick"], Ze = {
- __name: "SOfficeSelect",
- props: {
- value: {
- type: [String, Array],
- default() {
- return "";
- }
- },
- // 是否多选,传 false 为单选
- multiple: {
- type: Boolean,
- default: !0
- },
- placeholder: {
- type: String,
- default() {
- return window.$l("请选择");
- }
- },
- // 弹窗标题
- title: {
- type: String,
- default() {
- return window.$l("岗位选择");
- }
- }
- },
- emits: ["change", "update:value"],
- setup($, { emit: D }) {
- const p = D, b = $, m = o(""), V = o(""), w = o(""), u = o(!1), c = o(!1), _ = o({}), f = o([]), s = o([]), C = o(1), L = o(0), O = o(!1);
- let T = null;
- const N = o(""), v = o([]), j = o(1), F = o(20), E = o(0);
- re(
- () => b.value,
- (e) => {
- if (e && e.length) {
- const l = Array.isArray(e) ? e : [e];
- s.value = b.multiple ? l : l.slice(0, 1);
- } else
- s.value = [];
- },
- { immediate: !0 }
- );
- const M = () => {
- c.value = !0;
- }, R = () => {
- c.value = !1;
- }, y = (e = 1, l = 0) => U(this, null, function* () {
- if (u.value) {
- u.value = !1;
- return;
- }
- e === 1 && (v.value = []);
- let n = [];
- if (s.value.length < 100 ? (j.value = 1, E.value = 0, n = s.value) : n = s.value.slice(l * (F.value || 20), e * (F.value || 20)), !n.length || v.value.length && n.length >= s.value.length && n.length >= v.value.length)
- return;
- u.value = !0;
- const r = yield Se(n);
- v.value = v.value.concat(r), H(), T = setTimeout(() => {
- u.value = !1, clearTimeout(T);
- }, 200);
- }), x = () => {
- if (!N.value) {
- window.$message.warning(window.$l("请选择部门"));
- return;
- }
- C.value = 1, f.value = [], z(N.value);
- }, H = () => {
- const l = v.value.filter((r) => s.value.includes(r.id)).map((r) => r.name), n = l.length - 1;
- m.value = l.slice(0, 1).join(",") + (n > 0 ? " +" + n : "");
- }, K = () => {
- f.value.forEach((e) => {
- if (s.value.includes(e.id)) {
- const l = s.value.indexOf(e.id);
- s.value.splice(l, 1);
- }
- }), y()();
- }, P = () => {
- O.value = !O.value, O.value ? W() : K();
- }, Q = () => U(this, null, function* () {
- if (!N.value) {
- window.$message.warning(window.$l("请选择部门"));
- return;
- }
- const e = {
- searchValue: w.value,
- unitid: N.value.join(",")
- }, l = yield ye(e), n = s.value.concat(l);
- s.value = Array.from(new Set(n)), y();
- }), W = () => {
- f.value.forEach((e) => {
- s.value.includes(e.id) || s.value.push(e.id);
- }), y();
- }, X = () => {
- O.value = !1, m.value = "", s.value = [], v.value = [];
- }, Y = () => {
- c.value = !1;
- const e = v.value.filter((g) => s.value.includes(g.id)), l = e.map((g) => g.name), n = l.length - 1, r = l.slice(0, 1).join(",") + (n > 0 ? " +" + n : ""), A = e.map((g) => g.id);
- p("update:value", b.multiple ? A : A[0] || ""), p("change", r, l, A, e);
- }, Z = (e, l) => {
- _.value = l.node, C.value = 1, L.value = 0, f.value = [], u.value = !0, N.value = e, z(e);
- }, z = (e) => U(this, null, function* () {
- const l = {
- pageNo: C.value,
- pageSize: 20,
- searchValue: w.value,
- unitid: e.join(","),
- containsChild: !0
- };
- u.value = !0;
- const n = yield ke(l);
- f.value = f.value.concat(n.list), L.value = n.pages, T = setTimeout(() => {
- u.value = !1, clearTimeout(T);
- }, 200);
- }), ee = (e) => {
- s.value.includes(e.id) || s.value.push(e.id), y();
- }, le = (e, l) => {
- v.value.splice(l, 1), s.value.splice(s.value.indexOf(e.id), 1), y();
- }, te = ({ target: { offsetHeight: e, scrollHeight: l, scrollTop: n } }) => {
- u.value || e + n >= l - 20 && C.value <= L.value && (C.value++, z([_.value.id]));
- }, ne = ({ target: { offsetHeight: e, scrollHeight: l, scrollTop: n } }) => {
- u.value || e + n >= l - 20 && (E.value = j.value, j.value++, y(j.value, E.value));
- }, ae = (e) => Ce(e), se = (e) => we(e);
- return (e, l) => {
- const n = _e, r = pe, A = B("s-tree"), g = B("DownOutlined"), oe = ge, ie = fe, ue = me, ce = B("CloseCircleOutlined"), de = B("s-modal");
- return k(), S("div", $e, [
- d(n, {
- value: m.value,
- "onUpdate:value": l[0] || (l[0] = (a) => m.value = a),
- readonly: !0,
- placeholder: $.placeholder,
- onClick: M,
- onSearch: M
- }, null, 8, ["value", "placeholder"]),
- d(de, {
- value: c.value,
- "onUpdate:value": l[4] || (l[4] = (a) => c.value = a),
- title: $.title,
- width: "1000px",
- showFullScreen: !1
- }, {
- footer: h(() => [
- d(r, {
- key: "back",
- onClick: R
- }, {
- default: h(() => [
- I(i(e.$l("取消")), 1)
- ]),
- _: 1
- }),
- d(r, {
- key: "submit",
- type: "primary",
- loading: u.value,
- onClick: Y
- }, {
- default: h(() => [
- I(i(e.$l("确认")), 1)
- ]),
- _: 1
- }, 8, ["loading"])
- ]),
- default: h(() => [
- t("div", be, [
- t("div", Oe, [
- d(A, {
- levelOneChildren: ae,
- levelTwoChildren: se,
- "onSelect:modelValue": Z,
- select: V.value,
- "onUpdate:select": l[1] || (l[1] = (a) => V.value = a),
- height: 470
- }, null, 8, ["select"])
- ]),
- t("div", Ne, [
- t("div", Ae, [
- d(n, {
- value: w.value,
- "onUpdate:value": l[2] || (l[2] = (a) => w.value = a),
- placeholder: e.$l("请输入"),
- style: { width: "330px" },
- onSearch: x
- }, null, 8, ["value", "placeholder"])
- ]),
- t("div", Ve, [
- t("div", Le, [
- t("div", Te, [
- t("div", je, i(_.value.title || _.value.name), 1),
- t("div", Ue, [
- d(r, {
- type: "link",
- onClick: P
- }, {
- default: h(() => [
- I(i(O.value ? e.$l("反选") : e.$l("全选")), 1)
- ]),
- _: 1
- }),
- d(ue, null, {
- overlay: h(() => [
- d(ie, null, {
- default: h(() => [
- d(oe, { onClick: Q }, {
- default: h(() => [
- t("a", Be, i(e.$l("节点全选")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- default: h(() => [
- t("a", {
- type: "link",
- onClick: l[3] || (l[3] = ve(() => {
- }, ["prevent"]))
- }, [
- d(g)
- ])
- ]),
- _: 1
- })
- ])
- ]),
- t("div", {
- class: "user-list",
- onScroll: te
- }, [
- (k(!0), S(G, null, J(f.value, (a) => (k(), S("div", {
- class: "item",
- key: a.id,
- onClick: (q) => ee(a)
- }, [
- t("div", De, i(a.name && a.name.slice(0, 1)), 1),
- t("div", Ee, [
- t("div", ze, i(a.name) + " (" + i(a.nameOrCount) + ")", 1),
- t("div", Fe, i(a.deptName), 1)
- ])
- ], 8, Ie))), 128)),
- C.value >= L.value ? (k(), S("div", Me, i(e.$l("没有更多了")), 1)) : he("", !0)
- ], 32)
- ]),
- t("div", qe, [
- t("div", Ge, [
- t("div", Je, i(e.$l("本次已选")), 1),
- d(r, {
- type: "link",
- onClick: X
- }, {
- default: h(() => [
- I(i(e.$l("清除")), 1)
- ]),
- _: 1
- })
- ]),
- t("div", {
- class: "user-list select-list",
- onScroll: ne
- }, [
- (k(!0), S(G, null, J(v.value, (a, q) => (k(), S("div", {
- class: "item",
- key: a.id
- }, [
- t("div", Re, i(a.name && a.name.slice(0, 1)), 1),
- t("div", xe, [
- t("div", He, i(a.name) + " (" + i(a.nameOrCount) + ")", 1),
- t("div", Ke, i(a.deptName), 1)
- ]),
- t("div", {
- class: "icon no-bg",
- onClick: (Qe) => le(a, q)
- }, [
- d(ce)
- ], 8, Pe)
- ]))), 128))
- ], 32)
- ])
- ])
- ])
- ])
- ]),
- _: 1
- }, 8, ["value", "title"])
- ]);
- };
- }
- };
- export {
- Ze as default
- };
|