import x from "./CustomInput.js";
import { resolveComponent as f, openBlock as d, createBlock as c, withCtx as s, createElementVNode as m, createVNode as o, createTextVNode as i, toDisplayString as a, createElementBlock as p, Fragment as h, renderList as v } from "vue";
import { l as O, aC as B, aD as D, U as E } from "./index2.js";
import { R as I, _ as N } from "./index21.js";
import { _ as R, a as T } from "./index17.js";
import { _ as A } from "./index15.js";
const M = {
  name: "SFilter",
  components: {
    CustomInput: x
  },
  data() {
    return {
      equals: [
        {
          id: "includes",
          name: this.$l("包含")
        },
        {
          id: "excludes",
          name: this.$l("不包含")
        },
        {
          id: "equal",
          name: this.$l("等于")
        },
        {
          id: "notequal",
          name: this.$l("不等于")
        },
        {
          id: "null",
          name: this.$l("为空")
        },
        {
          id: "notnull",
          name: this.$l("不为空")
        }
      ],
      visible: !1,
      superFilter: {
        filter: 1
      },
      filters: [],
      columns: []
    };
  },
  methods: {
    show(n) {
      this.columns = n.filter((e) => e.show !== !1 && !!e.filterConfig), this.visible = !0;
    },
    // 抽屉关闭
    onDrawerClose() {
      this.visible = !1;
    },
    // 添加查询条件
    handleAddFilter() {
      this.filters.push({
        id: this.$utils.uuid(),
        name: "",
        equals: "",
        value: ""
      });
    },
    // 查询条件重置
    handFilterReset() {
      this.filters = [], this.$emit("reset"), this.handSubmit();
    },
    // 确认查询条件
    handSubmit() {
      this.$emit("submit", this.filters, this.superFilter.filter), this.visible = !1;
    },
    removeFilter(n) {
      this.filters = this.filters.filter((e) => e.id !== n.id) || [];
    },
    handChangeConfig(n, e) {
      const C = this.columns.find((g) => g.dataIndex === n);
      Object.assign(e, C);
    },
    handleEquals(n, e) {
      e.equals = n;
    }
  },
  mounted() {
  }
}, P = { class: "drawer-wrap" }, j = { class: "content-wrap" }, z = { class: "remove-filter-wrap" }, L = { class: "drawer-footer" };
function G(n, e, C, g, r, u) {
  const w = I, y = N, b = R, V = B, k = D, F = f("custom-input"), $ = f("MinusCircleOutlined"), q = T, S = f("PlusOutlined"), _ = E, U = A;
  return d(), c(U, {
    rootClassName: "filter-drawer-wrap",
    title: `${n.$l("高级搜索")}`,
    placement: "right",
    width: 500,
    visible: r.visible,
    onClose: u.onDrawerClose
  }, {
    default: s(() => [
      m("div", P, [
        m("div", j, [
          o(q, null, {
            default: s(() => [
              o(b, null, {
                default: s(() => [
                  o(y, {
                    value: r.superFilter.filter,
                    "onUpdate:value": e[0] || (e[0] = (l) => r.superFilter.filter = l)
                  }, {
                    default: s(() => [
                      o(w, { value: 1 }, {
                        default: s(() => [
                          i(a(n.$l("以下全部条件")), 1)
                        ]),
                        _: 1
                      }),
                      o(w, { value: 2 }, {
                        default: s(() => [
                          i(a(n.$l("以下任意条件")), 1)
                        ]),
                        _: 1
                      })
                    ]),
                    _: 1
                  }, 8, ["value"])
                ]),
                _: 1
              }),
              o(b, null, {
                default: s(() => [
                  (d(!0), p(h, null, v(r.filters, (l) => (d(), p("div", {
                    class: "filter-item",
                    key: l.id
                  }, [
                    o(k, {
                      style: { width: "240px" },
                      modelValue: l.filterType,
                      "onUpdate:modelValue": (t) => l.filterType = t,
                      onChange: (t) => u.handChangeConfig(t, l)
                    }, {
                      default: s(() => [
                        (d(!0), p(h, null, v(r.columns, (t) => (d(), c(V, {
                          key: t.dataIndex
                        }, {
                          default: s(() => [
                            i(a(t.name || t.title), 1)
                          ]),
                          _: 2
                        }, 1024))), 128))
                      ]),
                      _: 2
                    }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
                    e[5] || (e[5] = m("div", { class: "divider" }, null, -1)),
                    o(k, {
                      style: { width: "240px" },
                      modelValue: l.equals,
                      "onUpdate:modelValue": (t) => l.equals = t,
                      onChange: (t) => u.handleEquals(t, l)
                    }, {
                      default: s(() => [
                        (d(!0), p(h, null, v(r.equals, (t) => (d(), c(V, {
                          key: t.id
                        }, {
                          default: s(() => [
                            i(a(t.name), 1)
                          ]),
                          _: 2
                        }, 1024))), 128))
                      ]),
                      _: 2
                    }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
                    e[6] || (e[6] = m("div", { class: "divider" }, null, -1)),
                    m("div", z, [
                      o(F, {
                        style: { width: "240px" },
                        data: l,
                        modelValue: l.value,
                        "onUpdate:modelValue": (t) => l.value = t
                      }, null, 8, ["data", "modelValue", "onUpdate:modelValue"]),
                      o($, {
                        style: { "font-size": "16px", "margin-left": "6px", color: "red" },
                        onClick: (t) => u.removeFilter(l)
                      }, null, 8, ["onClick"])
                    ])
                  ]))), 128))
                ]),
                _: 1
              })
            ]),
            _: 1
          }),
          o(_, {
            onClick: e[1] || (e[1] = (l) => u.handleAddFilter()),
            class: "add-filter",
            type: "link"
          }, {
            default: s(() => [
              o(S),
              i(" " + a(n.$l("添加筛选条件")), 1)
            ]),
            _: 1
          })
        ]),
        m("div", L, [
          o(_, {
            class: "cancel",
            onClick: e[2] || (e[2] = (l) => r.visible = !1)
          }, {
            default: s(() => [
              i(a(n.$l("取消")), 1)
            ]),
            _: 1
          }),
          o(_, {
            class: "reset",
            onClick: e[3] || (e[3] = (l) => u.handFilterReset())
          }, {
            default: s(() => [
              i(a(n.$l("重置")), 1)
            ]),
            _: 1
          }),
          o(_, {
            class: "submit",
            type: "primary",
            onClick: e[4] || (e[4] = (l) => u.handSubmit())
          }, {
            default: s(() => [
              i(a(n.$l("确定")), 1)
            ]),
            _: 1
          })
        ])
      ])
    ]),
    _: 1
  }, 8, ["title", "visible", "onClose"]);
}
const Y = /* @__PURE__ */ O(M, [["render", G], ["__scopeId", "data-v-83e2964c"]]);
export {
  Y as default
};
