SettingFilter.js 7.5 KB

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