SettingFilter.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. import x from "./CustomInput.js";
  2. 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";
  3. import { l as O, aC as B, aD as D, U as E } from "./index2.js";
  4. import { R as I, _ as N } from "./index9.js";
  5. import { _ as R, a as T } from "./index5.js";
  6. import { _ as A } from "./index3.js";
  7. const M = {
  8. name: "SFilter",
  9. components: {
  10. CustomInput: x
  11. },
  12. data() {
  13. return {
  14. equals: [
  15. {
  16. id: "includes",
  17. name: this.$l("包含")
  18. },
  19. {
  20. id: "excludes",
  21. name: this.$l("不包含")
  22. },
  23. {
  24. id: "equal",
  25. name: this.$l("等于")
  26. },
  27. {
  28. id: "notequal",
  29. name: this.$l("不等于")
  30. },
  31. {
  32. id: "null",
  33. name: this.$l("为空")
  34. },
  35. {
  36. id: "notnull",
  37. name: this.$l("不为空")
  38. }
  39. ],
  40. visible: !1,
  41. superFilter: {
  42. filter: 1
  43. },
  44. filters: [],
  45. columns: []
  46. };
  47. },
  48. methods: {
  49. show(n) {
  50. this.columns = n.filter((e) => e.show !== !1 && !!e.filterConfig), this.visible = !0;
  51. },
  52. // 抽屉关闭
  53. onDrawerClose() {
  54. this.visible = !1;
  55. },
  56. // 添加查询条件
  57. handleAddFilter() {
  58. this.filters.push({
  59. id: this.$utils.uuid(),
  60. name: "",
  61. equals: "",
  62. value: ""
  63. });
  64. },
  65. // 查询条件重置
  66. handFilterReset() {
  67. this.filters = [], this.$emit("reset"), this.handSubmit();
  68. },
  69. // 确认查询条件
  70. handSubmit() {
  71. this.$emit("submit", this.filters, this.superFilter.filter), this.visible = !1;
  72. },
  73. removeFilter(n) {
  74. this.filters = this.filters.filter((e) => e.id !== n.id) || [];
  75. },
  76. handChangeConfig(n, e) {
  77. const C = this.columns.find((g) => g.dataIndex === n);
  78. Object.assign(e, C);
  79. },
  80. handleEquals(n, e) {
  81. e.equals = n;
  82. }
  83. },
  84. mounted() {
  85. }
  86. }, P = { class: "drawer-wrap" }, j = { class: "content-wrap" }, z = { class: "remove-filter-wrap" }, L = { class: "drawer-footer" };
  87. function G(n, e, C, g, r, u) {
  88. 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;
  89. return d(), c(U, {
  90. rootClassName: "filter-drawer-wrap",
  91. title: `${n.$l("高级搜索")}`,
  92. placement: "right",
  93. width: 500,
  94. visible: r.visible,
  95. onClose: u.onDrawerClose
  96. }, {
  97. default: s(() => [
  98. m("div", P, [
  99. m("div", j, [
  100. o(q, null, {
  101. default: s(() => [
  102. o(b, null, {
  103. default: s(() => [
  104. o(y, {
  105. value: r.superFilter.filter,
  106. "onUpdate:value": e[0] || (e[0] = (l) => r.superFilter.filter = l)
  107. }, {
  108. default: s(() => [
  109. o(w, { value: 1 }, {
  110. default: s(() => [
  111. i(a(n.$l("以下全部条件")), 1)
  112. ]),
  113. _: 1
  114. }),
  115. o(w, { value: 2 }, {
  116. default: s(() => [
  117. i(a(n.$l("以下任意条件")), 1)
  118. ]),
  119. _: 1
  120. })
  121. ]),
  122. _: 1
  123. }, 8, ["value"])
  124. ]),
  125. _: 1
  126. }),
  127. o(b, null, {
  128. default: s(() => [
  129. (d(!0), p(h, null, v(r.filters, (l) => (d(), p("div", {
  130. class: "filter-item",
  131. key: l.id
  132. }, [
  133. o(k, {
  134. style: { width: "240px" },
  135. modelValue: l.filterType,
  136. "onUpdate:modelValue": (t) => l.filterType = t,
  137. onChange: (t) => u.handChangeConfig(t, l)
  138. }, {
  139. default: s(() => [
  140. (d(!0), p(h, null, v(r.columns, (t) => (d(), c(V, {
  141. key: t.dataIndex
  142. }, {
  143. default: s(() => [
  144. i(a(t.name || t.title), 1)
  145. ]),
  146. _: 2
  147. }, 1024))), 128))
  148. ]),
  149. _: 2
  150. }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
  151. e[5] || (e[5] = m("div", { class: "divider" }, null, -1)),
  152. o(k, {
  153. style: { width: "240px" },
  154. modelValue: l.equals,
  155. "onUpdate:modelValue": (t) => l.equals = t,
  156. onChange: (t) => u.handleEquals(t, l)
  157. }, {
  158. default: s(() => [
  159. (d(!0), p(h, null, v(r.equals, (t) => (d(), c(V, {
  160. key: t.id
  161. }, {
  162. default: s(() => [
  163. i(a(t.name), 1)
  164. ]),
  165. _: 2
  166. }, 1024))), 128))
  167. ]),
  168. _: 2
  169. }, 1032, ["modelValue", "onUpdate:modelValue", "onChange"]),
  170. e[6] || (e[6] = m("div", { class: "divider" }, null, -1)),
  171. m("div", z, [
  172. o(F, {
  173. style: { width: "240px" },
  174. data: l,
  175. modelValue: l.value,
  176. "onUpdate:modelValue": (t) => l.value = t
  177. }, null, 8, ["data", "modelValue", "onUpdate:modelValue"]),
  178. o($, {
  179. style: { "font-size": "16px", "margin-left": "6px", color: "red" },
  180. onClick: (t) => u.removeFilter(l)
  181. }, null, 8, ["onClick"])
  182. ])
  183. ]))), 128))
  184. ]),
  185. _: 1
  186. })
  187. ]),
  188. _: 1
  189. }),
  190. o(_, {
  191. onClick: e[1] || (e[1] = (l) => u.handleAddFilter()),
  192. class: "add-filter",
  193. type: "link"
  194. }, {
  195. default: s(() => [
  196. o(S),
  197. i(" " + a(n.$l("添加筛选条件")), 1)
  198. ]),
  199. _: 1
  200. })
  201. ]),
  202. m("div", L, [
  203. o(_, {
  204. class: "cancel",
  205. onClick: e[2] || (e[2] = (l) => r.visible = !1)
  206. }, {
  207. default: s(() => [
  208. i(a(n.$l("取消")), 1)
  209. ]),
  210. _: 1
  211. }),
  212. o(_, {
  213. class: "reset",
  214. onClick: e[3] || (e[3] = (l) => u.handFilterReset())
  215. }, {
  216. default: s(() => [
  217. i(a(n.$l("重置")), 1)
  218. ]),
  219. _: 1
  220. }),
  221. o(_, {
  222. class: "submit",
  223. type: "primary",
  224. onClick: e[4] || (e[4] = (l) => u.handSubmit())
  225. }, {
  226. default: s(() => [
  227. i(a(n.$l("确定")), 1)
  228. ]),
  229. _: 1
  230. })
  231. ])
  232. ])
  233. ]),
  234. _: 1
  235. }, 8, ["title", "visible", "onClose"]);
  236. }
  237. const Y = /* @__PURE__ */ O(M, [["render", G], ["__scopeId", "data-v-83e2964c"]]);
  238. export {
  239. Y as default
  240. };