SettingFilter.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. import { ref as f, resolveComponent as q, openBlock as r, createBlock as F, withCtx as a, createElementVNode as _, createVNode as t, createTextVNode as s, toDisplayString as u, createElementBlock as v, Fragment as g, renderList as C } from "vue";
  2. import z from "./CustomInput.js";
  3. import { n as A, d8 as L, d9 as G, a6 as H, a7 as J, B as K } from "./index2.js";
  4. import { _ as Q } from "./index7.js";
  5. import { _ as W, a as X } from "./index9.js";
  6. const Y = { class: "drawer-wrap" }, Z = { class: "content-wrap" }, ee = { class: "remove-filter-wrap" }, le = { class: "drawer-footer" }, ne = /* @__PURE__ */ Object.assign({ name: "SFilter" }, {
  7. __name: "SettingFilter",
  8. emits: ["reset", "submit"],
  9. setup(te, { expose: x, emit: O }) {
  10. const V = O, S = [
  11. { id: "includes", name: window.$l("包含") },
  12. { id: "excludes", name: window.$l("不包含") },
  13. { id: "equal", name: window.$l("等于") },
  14. { id: "notequal", name: window.$l("不等于") },
  15. { id: "null", name: window.$l("为空") },
  16. { id: "notnull", name: window.$l("不为空") }
  17. ], d = f(!1), c = f({ filter: 1 }), i = f([]), w = f([]);
  18. function U(o) {
  19. w.value = o.filter((e) => e.show !== !1 && !!e.filterConfig), d.value = !0;
  20. }
  21. function B() {
  22. d.value = !1;
  23. }
  24. function N() {
  25. i.value.push({
  26. id: window.$utils.uuid(),
  27. name: "",
  28. equals: "",
  29. value: ""
  30. });
  31. }
  32. function E() {
  33. i.value = [], V("reset"), k();
  34. }
  35. function k() {
  36. V("submit", i.value, c.value.filter), d.value = !1;
  37. }
  38. function I(o) {
  39. i.value = i.value.filter((e) => e.id !== o.id) || [];
  40. }
  41. function T(o, e) {
  42. const p = w.value.find(($) => $.dataIndex === o);
  43. Object.assign(e, p);
  44. }
  45. function j(o, e) {
  46. e.equals = o;
  47. }
  48. return x({
  49. show: U,
  50. visible: d,
  51. filters: i,
  52. superFilter: c
  53. }), (o, e) => {
  54. const p = G, $ = L, y = X, b = J, h = H, D = q("MinusCircleOutlined"), M = W, P = q("PlusOutlined"), m = K, R = Q;
  55. return r(), F(R, {
  56. rootClassName: "filter-drawer-wrap",
  57. title: `${o.$l("高级搜索")}`,
  58. placement: "right",
  59. width: 500,
  60. visible: d.value,
  61. onClose: B
  62. }, {
  63. default: a(() => [
  64. _("div", Y, [
  65. _("div", Z, [
  66. t(M, null, {
  67. default: a(() => [
  68. t(y, null, {
  69. default: a(() => [
  70. t($, {
  71. value: c.value.filter,
  72. "onUpdate:value": e[0] || (e[0] = (l) => c.value.filter = l)
  73. }, {
  74. default: a(() => [
  75. t(p, { value: 1 }, {
  76. default: a(() => [
  77. s(u(o.$l("以下全部条件")), 1)
  78. ]),
  79. _: 1
  80. }),
  81. t(p, { value: 2 }, {
  82. default: a(() => [
  83. s(u(o.$l("以下任意条件")), 1)
  84. ]),
  85. _: 1
  86. })
  87. ]),
  88. _: 1
  89. }, 8, ["value"])
  90. ]),
  91. _: 1
  92. }),
  93. t(y, null, {
  94. default: a(() => [
  95. (r(!0), v(g, null, C(i.value, (l) => (r(), v("div", {
  96. class: "filter-item",
  97. key: l.id
  98. }, [
  99. t(h, {
  100. style: { width: "240px" },
  101. modelValue: l.filterType,
  102. "onUpdate:modelValue": (n) => l.filterType = n,
  103. onChange: (n) => T(n, l)
  104. }, {
  105. default: a(() => [
  106. (r(!0), v(g, null, C(w.value, (n) => (r(), F(b, {
  107. key: n.dataIndex
  108. }, {
  109. default: a(() => [
  110. s(u(n.name || n.title), 1)
  111. ]),
  112. _: 2
  113. }, 1024))), 128))
  114. ]),
  115. _: 1
  116. }, 8, ["modelValue", "onUpdate:modelValue", "onChange"]),
  117. e[5] || (e[5] = _("div", { class: "divider" }, null, -1)),
  118. t(h, {
  119. style: { width: "240px" },
  120. modelValue: l.equals,
  121. "onUpdate:modelValue": (n) => l.equals = n,
  122. onChange: (n) => j(n, l)
  123. }, {
  124. default: a(() => [
  125. (r(), v(g, null, C(S, (n) => t(b, {
  126. key: n.id
  127. }, {
  128. default: a(() => [
  129. s(u(n.name), 1)
  130. ]),
  131. _: 2
  132. }, 1024)), 64))
  133. ]),
  134. _: 1
  135. }, 8, ["modelValue", "onUpdate:modelValue", "onChange"]),
  136. e[6] || (e[6] = _("div", { class: "divider" }, null, -1)),
  137. _("div", ee, [
  138. t(z, {
  139. style: { width: "240px" },
  140. data: l,
  141. modelValue: l.value,
  142. "onUpdate:modelValue": (n) => l.value = n
  143. }, null, 8, ["data", "modelValue", "onUpdate:modelValue"]),
  144. t(D, {
  145. style: { "font-size": "16px", "margin-left": "6px", color: "red" },
  146. onClick: (n) => I(l)
  147. }, null, 8, ["onClick"])
  148. ])
  149. ]))), 128))
  150. ]),
  151. _: 1
  152. })
  153. ]),
  154. _: 1
  155. }),
  156. t(m, {
  157. onClick: e[1] || (e[1] = (l) => N()),
  158. class: "add-filter",
  159. type: "link"
  160. }, {
  161. default: a(() => [
  162. t(P),
  163. s(" " + u(o.$l("添加筛选条件")), 1)
  164. ]),
  165. _: 1
  166. })
  167. ]),
  168. _("div", le, [
  169. t(m, {
  170. class: "cancel",
  171. onClick: e[2] || (e[2] = (l) => d.value = !1)
  172. }, {
  173. default: a(() => [
  174. s(u(o.$l("取消")), 1)
  175. ]),
  176. _: 1
  177. }),
  178. t(m, {
  179. class: "reset",
  180. onClick: e[3] || (e[3] = (l) => E())
  181. }, {
  182. default: a(() => [
  183. s(u(o.$l("重置")), 1)
  184. ]),
  185. _: 1
  186. }),
  187. t(m, {
  188. class: "submit",
  189. type: "primary",
  190. onClick: e[4] || (e[4] = (l) => k())
  191. }, {
  192. default: a(() => [
  193. s(u(o.$l("确定")), 1)
  194. ]),
  195. _: 1
  196. })
  197. ])
  198. ])
  199. ]),
  200. _: 1
  201. }, 8, ["title", "visible"]);
  202. };
  203. }
  204. }), de = /* @__PURE__ */ A(ne, [["__scopeId", "data-v-85c923c8"]]);
  205. export {
  206. de as default
  207. };