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