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