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