| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- import { ref as w, resolveComponent as S, openBlock as f, createBlock as $, withCtx as a, createElementVNode as v, createVNode as o, createTextVNode as i, toDisplayString as r, createElementBlock as y, Fragment as g, renderList as q } from "vue";
- import Q from "./CustomInput.js";
- import { n as W, dn as X, dp as Y, a6 as Z, a7 as ee, B as le } from "./index2.js";
- import { _ as ne } from "./index8.js";
- import { _ as te, a as ae } from "./index11.js";
- const oe = { class: "drawer-wrap" }, ue = { class: "content-wrap" }, se = { class: "remove-filter-wrap" }, ie = { class: "drawer-footer" }, re = /* @__PURE__ */ Object.assign({ name: "SFilter" }, {
- __name: "SettingFilter",
- props: {
- // 表格列配置(只有带 filterConfig 的列才能作为查询条件)
- columns: {
- type: Array,
- default: () => []
- }
- },
- emits: ["reset", "submit"],
- setup(U, { expose: F, emit: N }) {
- const x = U, T = N, I = [
- { id: "includes", name: window.$l("包含") },
- { id: "excludes", name: window.$l("不包含") },
- { id: "equal", name: window.$l("等于") },
- { id: "notequal", name: window.$l("不等于") },
- { id: "null", name: window.$l("为空") },
- { id: "notnull", name: window.$l("不为空") }
- ], O = ["equal", "notequal", "null", "notnull"], P = I.map((l) => l.id), h = ["null", "notnull"], d = w(!1), _ = w({ filter: 1 }), u = w([]), C = w([]);
- function B() {
- C.value = (x.columns || []).filter((e) => !!e.filterConfig);
- const l = new Set((x.columns || []).map((e) => e.dataIndex));
- u.value = u.value.filter((e) => l.has(e.dataIndex)), d.value = !0;
- }
- function A() {
- d.value = !1;
- }
- function L(l) {
- const e = l == null ? void 0 : l.filterType, c = !e || e === "INPUT" ? P : O;
- return I.filter((p) => c.includes(p.id));
- }
- function k(l) {
- return !l || l === "INPUT" ? "includes" : "equal";
- }
- function M() {
- u.value.push({
- id: window.$utils.uuid(),
- dataIndex: void 0,
- name: "",
- filterType: "",
- equals: "",
- value: ""
- });
- }
- function V(l, e) {
- const s = C.value.find((p) => p.dataIndex === l);
- if (e.dataIndex = l, !s) {
- e.name = "", e.filterType = "", e.filterConfig = null, e.equals = "", e.value = "";
- return;
- }
- const c = s.filterConfig || {};
- e.name = s.name || s.title || "", e.filterType = c.filterType || "INPUT", e.filterConfig = c, e.equals = k(e.filterType), e.value = e.filterType === "MULTIPLE_SELECT" ? [] : "";
- }
- function D() {
- u.value = [], _.value = { filter: 1 }, d.value = !1, T("reset");
- }
- function R() {
- const l = u.value.filter((e) => !!e.dataIndex).filter((e) => h.includes(e.equals) || !j(e.value)).map((e) => ({
- dataIndex: e.dataIndex,
- name: e.name,
- filterType: e.filterType,
- equals: e.equals || k(e.filterType),
- value: h.includes(e.equals) ? "" : e.value
- }));
- d.value = !1, T("submit", l, _.value.filter);
- }
- function j(l) {
- return l == null || l === "" ? !0 : Array.isArray(l) ? l.length === 0 : !1;
- }
- function z(l) {
- u.value = u.value.filter((e) => e.id !== l.id) || [];
- }
- return F({
- show: B,
- visible: d,
- filters: u,
- superFilter: _
- }), (l, e) => {
- const s = Y, c = X, p = ae, b = ee, E = Z, G = S("MinusCircleOutlined"), H = te, J = S("PlusOutlined"), m = le, K = ne;
- return f(), $(K, {
- rootClassName: "filter-drawer-wrap",
- title: `${l.$l("高级搜索")}`,
- placement: "right",
- width: 500,
- visible: d.value,
- onClose: A
- }, {
- default: a(() => [
- v("div", oe, [
- v("div", ue, [
- o(H, null, {
- default: a(() => [
- o(p, null, {
- default: a(() => [
- o(c, {
- value: _.value.filter,
- "onUpdate:value": e[0] || (e[0] = (n) => _.value.filter = n)
- }, {
- default: a(() => [
- o(s, { value: 1 }, {
- default: a(() => [
- i(r(l.$l("以下全部条件")), 1)
- ]),
- _: 1
- }),
- o(s, { value: 2 }, {
- default: a(() => [
- i(r(l.$l("以下任意条件")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["value"])
- ]),
- _: 1
- }),
- o(p, null, {
- default: a(() => [
- (f(!0), y(g, null, q(u.value, (n) => (f(), y("div", {
- class: "filter-item",
- key: n.id
- }, [
- o(E, {
- style: { width: "240px" },
- value: n.dataIndex,
- "onUpdate:value": (t) => n.dataIndex = t,
- placeholder: l.$l("请选择"),
- "show-search": "",
- "allow-clear": "",
- "option-filter-prop": "children",
- onChange: (t) => V(t, n)
- }, {
- default: a(() => [
- (f(!0), y(g, null, q(C.value, (t) => (f(), $(b, {
- key: t.dataIndex,
- value: t.dataIndex
- }, {
- default: a(() => [
- i(r(t.name || t.title), 1)
- ]),
- _: 2
- }, 1032, ["value"]))), 128))
- ]),
- _: 1
- }, 8, ["value", "onUpdate:value", "placeholder", "onChange"]),
- e[5] || (e[5] = v("div", { class: "divider" }, null, -1)),
- o(E, {
- style: { width: "240px" },
- value: n.equals,
- "onUpdate:value": (t) => n.equals = t,
- placeholder: l.$l("请选择"),
- disabled: !n.dataIndex
- }, {
- default: a(() => [
- (f(!0), y(g, null, q(L(n), (t) => (f(), $(b, {
- key: t.id,
- value: t.id
- }, {
- default: a(() => [
- i(r(t.name), 1)
- ]),
- _: 2
- }, 1032, ["value"]))), 128))
- ]),
- _: 2
- }, 1032, ["value", "onUpdate:value", "placeholder", "disabled"]),
- e[6] || (e[6] = v("div", { class: "divider" }, null, -1)),
- v("div", se, [
- o(Q, {
- style: { width: "240px" },
- data: n
- }, null, 8, ["data"]),
- o(G, {
- style: { "font-size": "16px", "margin-left": "6px", color: "var(--s-color-error)" },
- onClick: (t) => z(n)
- }, null, 8, ["onClick"])
- ])
- ]))), 128))
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- o(m, {
- onClick: e[1] || (e[1] = (n) => M()),
- class: "add-filter",
- type: "link"
- }, {
- default: a(() => [
- o(J),
- i(" " + r(l.$l("添加筛选条件")), 1)
- ]),
- _: 1
- })
- ]),
- v("div", ie, [
- o(m, {
- class: "cancel",
- onClick: e[2] || (e[2] = (n) => d.value = !1)
- }, {
- default: a(() => [
- i(r(l.$l("取消")), 1)
- ]),
- _: 1
- }),
- o(m, {
- class: "reset",
- onClick: e[3] || (e[3] = (n) => D())
- }, {
- default: a(() => [
- i(r(l.$l("重置")), 1)
- ]),
- _: 1
- }),
- o(m, {
- class: "submit",
- type: "primary",
- onClick: e[4] || (e[4] = (n) => R())
- }, {
- default: a(() => [
- i(r(l.$l("确定")), 1)
- ]),
- _: 1
- })
- ])
- ])
- ]),
- _: 1
- }, 8, ["title", "visible"]);
- };
- }
- }), _e = /* @__PURE__ */ W(re, [["__scopeId", "data-v-ee117bc6"]]);
- export {
- _e as default
- };
|