| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- import { ref as l, watch as z, onMounted as Y, onActivated as Z, nextTick as w, resolveComponent as _, openBlock as o, createElementBlock as s, createVNode as f, withCtx as m, createElementVNode as r, renderSlot as a, createTextVNode as ee, toDisplayString as g, createBlock as L, createCommentVNode as i, withDirectives as te, vShow as ne, Fragment as oe } from "vue";
- import { n as le, ao as se, y as ae, B as ie } from "./index2.js";
- const re = { class: "s-list-basic-layout-main" }, de = {
- key: 0,
- class: "s-list-basic-content"
- }, ce = {
- key: 0,
- class: "filter-content"
- }, ue = { class: "filter" }, fe = {
- key: 1,
- class: "reset-wrap"
- }, me = {
- key: 1,
- class: "filter-more-content"
- }, ye = {
- key: 2,
- class: "desc-wrap"
- }, pe = { class: "table-content" }, ve = { class: "table-container" }, _e = ["onClick"], be = {
- key: 1,
- class: "s-list-basic-content"
- }, ke = { class: "other" }, he = /* @__PURE__ */ Object.assign({ name: "SListBasicLayout" }, {
- __name: "SListBasicLayout",
- props: {
- // 列表 checkbox 列
- isSelection: {
- type: Boolean,
- default: !1
- },
- showPagination: {
- type: Boolean,
- default: !0
- },
- columns: {
- type: Array,
- default: () => []
- },
- rowKey: {
- type: [Function, String],
- default: "id"
- },
- loadData: {
- type: Function,
- required: !0
- },
- pSize: {
- type: [String, Number],
- default: 10
- },
- // 初始勾选的表格行 key
- selectedRowKeysArr: {
- type: Array,
- default: () => []
- }
- },
- emits: ["reset", "tableColCallback"],
- setup(c, { expose: D, emit: M }) {
- const y = c, C = M, T = l(null), A = l(null), F = l(null), d = l(null), u = l(!1), S = l(300), $ = l(!1), R = l(10), N = l(!1), p = l([]), x = l([]), b = l([]);
- z(
- () => y.columns,
- () => B()
- ), z(
- () => y.selectedRowKeysArr,
- (e) => {
- p.value = e || [];
- },
- { immediate: !0 }
- );
- function P() {
- R.value = y.pSize, b.value = y.columns.map((e) => ((e.template || e.isClick || e.dataIndex === "action" && !e.customRender) && !e.scopedSlots && (e.scopedSlots = { customRender: e.dataIndex }), e)), w(h);
- }
- function B() {
- P();
- }
- function I() {
- u.value = !u.value, w(h);
- }
- function K() {
- C("reset");
- }
- function E() {
- d.value && d.value.refresh(!0);
- }
- function V(e, t) {
- C("tableColCallback", e, t);
- }
- function j(e) {
- p.value = e;
- }
- function k(e) {
- return b.value.find((t) => t.dataIndex === e);
- }
- function q(e) {
- const t = k(e);
- return !!(t && t.template);
- }
- function H(e) {
- const t = k(e);
- return !!(t && t.isClick);
- }
- function O(e) {
- return e == null ? "" : typeof e == "object" ? e.name === void 0 ? "" : e.name : e;
- }
- function h() {
- const e = d.value && d.value.$el, t = e && e.querySelector(".ant-table-body"), v = t && t.clientHeight;
- v && (S.value = Math.max(v - 8, 0));
- }
- return Y(() => {
- B();
- }), Z(() => {
- w(h);
- }), D({
- reload: E,
- table: d,
- spinning: $,
- selectedRowKeys: p,
- filterReset: K,
- toggleFilter: I
- }), (e, t) => {
- const v = _("down-outlined"), U = _("up-outlined"), W = _("sync-outlined"), G = ie, J = ae, Q = _("s-table"), X = se;
- return o(), s("div", {
- class: "s-list-basic-layout",
- ref_key: "layoutRef",
- ref: T
- }, [
- f(X, { spinning: $.value }, {
- default: m(() => [
- r("div", re, [
- e.$slots.empty ? (o(), s("div", be, [
- a(e.$slots, "empty", {}, void 0, !0)
- ])) : (o(), s("div", de, [
- r("div", {
- class: "filter-wrap",
- ref_key: "filtersRef",
- ref: A
- }, [
- e.$slots.filter ? (o(), s("div", ce, [
- r("div", ue, [
- a(e.$slots, "filter", {}, void 0, !0)
- ]),
- e.$slots.filterMore ? (o(), s("a", {
- key: 0,
- class: "filter-more-btn",
- onClick: I
- }, [
- ee(g(u.value ? e.$l("收起筛选") : e.$l("更多筛选")) + " ", 1),
- u.value ? (o(), L(U, {
- key: 1,
- style: { "font-size": "12px" }
- })) : (o(), L(v, {
- key: 0,
- style: { "font-size": "12px" }
- }))
- ])) : i("", !0),
- e.$slots.filter ? (o(), s("div", fe, [
- f(J, {
- placement: "top",
- overlayStyle: { maxWidth: "500px" },
- mouseEnterDelay: 1.5,
- mouseLeaveDelay: 0.5
- }, {
- title: m(() => [
- r("span", null, g(e.$l("条件重置")), 1)
- ]),
- default: m(() => [
- f(G, {
- style: { "padding-bottom": "2px" },
- onClick: K
- }, {
- icon: m(() => [
- f(W)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])) : i("", !0)
- ])) : i("", !0),
- e.$slots.filterMore ? te((o(), s("div", me, [
- a(e.$slots, "filterMore", {}, void 0, !0)
- ], 512)), [
- [ne, u.value]
- ]) : i("", !0),
- e.$slots.desc ? (o(), s("div", ye, [
- a(e.$slots, "desc", {}, void 0, !0)
- ])) : i("", !0)
- ], 512),
- r("div", pe, [
- e.$slots.tabs ? (o(), s("div", {
- key: 0,
- class: "tabs-wrap",
- ref_key: "tabsRef",
- ref: F
- }, [
- a(e.$slots, "tabs", {}, void 0, !0)
- ], 512)) : i("", !0),
- r("div", ve, [
- f(Q, {
- ref_key: "table",
- ref: d,
- size: "middle",
- scroll: { y: S.value, x: "100%" },
- pageSize: R.value,
- rowKey: c.rowKey,
- columns: b.value,
- data: c.loadData,
- "expanded-row-keys": x.value,
- "onUpdate:expandedRowKeys": t[0] || (t[0] = (n) => x.value = n),
- rowSelection: N.value || c.isSelection ? { selectedRowKeys: p.value, onChange: j } : null,
- showPagination: c.showPagination
- }, {
- bodyCell: m((n) => [
- n.column ? (o(), s(oe, { key: 0 }, [
- q(n.column.dataIndex) ? a(e.$slots, n.column.dataIndex, {
- text: n.text,
- record: n.record,
- index: n.index,
- item: k(n.column.dataIndex)
- }, void 0, !0, 0) : H(n.column.dataIndex) ? (o(), s("a", {
- key: 1,
- onClick: (we) => V(n.column.dataIndex, n.record)
- }, g(O(n.text)), 9, _e)) : n.column.dataIndex === "action" ? a(e.$slots, "action", {
- record: n.record
- }, void 0, !0, 2) : i("", !0)
- ], 64)) : i("", !0)
- ]),
- _: 3
- }, 8, ["scroll", "pageSize", "rowKey", "columns", "data", "expanded-row-keys", "rowSelection", "showPagination"])
- ])
- ])
- ]))
- ]),
- r("div", ke, [
- a(e.$slots, "other", {}, void 0, !0)
- ])
- ]),
- _: 3
- }, 8, ["spinning"])
- ], 512);
- };
- }
- }), Se = /* @__PURE__ */ le(he, [["__scopeId", "data-v-2d898bde"]]);
- export {
- Se as default
- };
|