var Ee = Object.defineProperty; var Y = Object.getOwnPropertySymbols; var Ke = Object.prototype.hasOwnProperty, qe = Object.prototype.propertyIsEnumerable; var Z = (r, u, c) => u in r ? Ee(r, u, { enumerable: !0, configurable: !0, writable: !0, value: c }) : r[u] = c, L = (r, u) => { for (var c in u || (u = {})) Ke.call(u, c) && Z(r, c, u[c]); if (Y) for (var c of Y(u)) qe.call(u, c) && Z(r, c, u[c]); return r; }; import { ref as a, computed as M, watch as ee, onMounted as Ue, onActivated as Ve, resolveComponent as g, resolveDirective as Ne, openBlock as l, createElementBlock as s, createElementVNode as p, toDisplayString as b, createVNode as d, withCtx as v, Fragment as te, renderList as je, withDirectives as ne, createBlock as R, createTextVNode as D, resolveDynamicComponent as He, createCommentVNode as f, vShow as oe, renderSlot as y, unref as We, nextTick as le, h as Ge } from "vue"; import { n as Je, B as Qe, y as Xe, d0 as Ye } from "./index2.js"; import { S as Ze } from "./index9.js"; const et = { class: "tools" }, tt = { class: "title" }, nt = { class: "btns" }, ot = { class: "list-layout-main" }, lt = { key: 0, class: "layout-list-content" }, at = { key: 0, class: "filter-content" }, it = { class: "filter" }, st = { key: 1, class: "reset-wrap" }, rt = { key: 1, class: "filter-more-content" }, ut = { key: 2, class: "desc-wrap" }, ct = { class: "table-content" }, dt = { class: "table-container" }, ft = ["onClick"], mt = { key: 1, class: "layout-list-content" }, pt = { class: "other" }, vt = /* @__PURE__ */ Object.assign({ name: "SSuperListLayout" }, { __name: "SSuperListLayout", props: { // 页面标题 title: { type: String, required: !0 }, buttons: { type: Array, default: () => [ { name: window.$l("添加"), key: "add", show: !0, type: "primary", icon: !0, api: null }, { name: window.$l("批量删除"), key: "remove", action: "remove", show: !0, icon: !0, api: null }, { name: window.$l("导入"), key: "import", show: !0, icon: !0, importColumns: [], // 预览的表头信息 importUploadUrl: null, // 上传url importApis: { templateDownload: null, importPreview: null, importData: null, exportExceptionData: null } }, { name: window.$l("导出"), key: "export", show: !0, icon: !0, api: null } ] }, // 列表checkbox列 isSelection: { type: Boolean, default: !1 }, showPagination: { type: Boolean, default: !0 }, /** title = String:列标题 * @dataIndex = String:列数据字段名 * @align = String:left || right || center * @ellipsis = true:是否自动换行 * @isClick = true:是否支持点击跳转 * @template = true:是否使用自定义模板 * @customRender = Function:自定义jsx模板 * @fixed = null:是否固定列 left || right || null 默认null * @isFixed = false:是否固定列 Boolean fixed存在时无效 * @width = null:列宽 不要写百分比 组件内强制转换成Number * @filterConfig = 默认null | Object: 自定义筛选配置 { @filterType = String: SINGLE_SELECT:单选/ MULTIPLE_SELECT:多选/ GANDER:性别/ IS:是否/ USER:用户/ OFFICE:组织机构/ DATE:日期/ DATETIME:时间/ INPUT:输入框 INT:整数/ FLOAT:浮点数/ @filterApi = null:自定义接口 Function => filterType = SINGLE_SELECT || MULTIPLE_SELECT || GANDER || IS 时生效 @filterData = []:自定义数据 Array => filterType = SINGLE_SELECT || MULTIPLE_SELECT || GANDER || IS 时生效 优先级大于 filterApi @props = Object:自定义属性 使用filterApi时 处理 结果集中的 key、value 键值对映射内容使用 @precision = 0:小数点后保留位数 filterType = FLOAT 时生效 @step = 1:步长 filterType = INT || FLOAT 时生效 @minValue = 0:最小值 filterType = INT || FLOAT 时生效 @maxValue = 0:最大值 filterType = INT || FLOAT 时生效 @length = 200:长度 filterType = INPUT 时生效 @startDate = null :开始可选时间 filterType = DATE || DATETIME 时生效 @endDate = null :结束可选时间 filterType = DATE || DATETIME 时生效 * } */ columns: { type: Array, default: () => [] }, rowKey: { type: [Function, String], default: "id" }, loadData: { type: Function, required: !0 }, pSize: { type: [String, Number], default: 20 } }, emits: ["reset", "btnCallback", "tableColCallback"], setup(r, { expose: u, emit: c }) { const C = r, _ = c, ae = a(null), ie = a(null), se = a(null), m = a(null), E = a(null), K = a(null), re = a(8), I = a(!1), O = a(!1), q = a(300), k = a(!1), U = a(20), V = a(!1), w = a([]), T = a([]), h = a([]), S = a([]), z = a({}), ue = { add: "PlusCircleOutlined", edit: "FormOutlined", delete: "DeleteOutlined", remove: "DeleteOutlined", import: "UploadOutlined", export: "DownloadOutlined", assign: "ClusterOutlined", execute: "PlayCircleOutlined", pause: "PauseCircleOutlined", resume: "PoweroffOutlined", approve: "HighlightOutlined", setting: "SettingOutlined", TopOfType: "VerticalAlignTopOutlined", TOP: "VerticalAlignTopOutlined", synchronize: "SyncOutlined" }, ce = M(() => h.value.filter((e) => e.show !== !1)), N = M(() => S.value.map((e) => e.key).includes("import")), A = M(() => S.value.find((e) => e.key === "import") || {}); ee( () => C.buttons, (e) => { e && e.length && de(e); }, { immediate: !0, deep: !0 } ), ee( () => C.columns, (e) => { W(e || []); }, { deep: !0, immediate: !0 } ); function j(e, t = "") { return !!(e && typeof e == "function"); } function H(e) { return typeof e.icon == "string" ? e.icon : typeof e.icon == "boolean" && e.icon && ue[e.key] || ""; } function de(e) { S.value = e.map((t) => (t.key === "remove" && (V.value = !0), t)); } function fe(e) { le(() => { x(), U.value = C.pSize, h.value = e.map((n) => ((n.template || n.isClick || n.dataIndex === "action" && !n.customRender) && !n.scopedSlots && (n.scopedSlots = { customRender: n.dataIndex }), (n.dataIndex === "action" || n.title === "操作") && (n.fixed = "right"), n)); }); const t = setTimeout(() => { const n = document.querySelector(".ant-table-cell.ant-table-cell-scrollbar"), i = document.querySelector(".ant-table-thead tr"); n && i && i.removeChild(n), clearTimeout(t); }, 100); } function W(e = []) { fe(e); } function B() { m.value && m.value.refresh(!0); } function G(e) { _("btnCallback", e.key, w.value); const t = De[e.key]; typeof t == "function" ? t(e) : P(e); } function P(e) { if (e.selection !== !1 && !w.value.length) { window.$message.warn(`${window.$l("请选择要")}${window.$l(e.name)}${window.$l("的数据")}`); return; } if (j(e.api, e.name, e.key)) { if (e.confirm) { window.$confirm({ title: `${window.$l(e.name)}`, content: () => Ge( "div", { style: "color:var(--s-color-error)" }, `${window.$l("确认要")}{${window.$l(e.name)}}${window.$l("数据吗?")}` ), onOk: () => { k.value = !0, e.api(w.value).then(() => { window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), _("reset"); }).finally(() => { k.value = !1; }); } }); return; } k.value = !0, e.api(w.value).then(() => { window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), _("reset"); }).finally(() => { k.value = !1; }); } } function J(e, t) { typeof e == "string" ? Q(e, t) : e.forEach((n) => { Q(n, t); }); } function Q(e, t) { const n = S.value.find((i) => i.key === e); if (!n) { console.error(`按钮(${e})未定义, 请确认该变更状态按钮是否设置正确`); return; } Object.keys(t).forEach((i) => { n[i] = t[i]; }); } function me() { } function pe(e) { P(e); } function ve() { if (!N.value) { _("btnCallback", "import"); return; } I.value = !0; } function ye(e) { j(e.api, e.name, e.key) && (k.value = !0, e.api().then(() => { k.value = !1; })); } function we(e) { return C.loadData(L(L({}, e), z.value)); } function he(e = [], t = 1) { const n = { filterMode: t, filterConditions: e }; e.forEach((i) => { ["equal", "includes"].includes(i.equals) && n[i.dataIndex] === void 0 && (n[i.dataIndex] = i.value); }), z.value = n, m.value && m.value.refresh(!0); } function ke() { z.value = {}, m.value && m.value.refresh(!0); } function $e(e) { h.value = e; } function ge() { W(C.columns || []); } function be(e, t) { _("tableColCallback", e, t); } function F(e) { return h.value.find((t) => t.dataIndex === e); } function _e(e) { const t = F(e); return !!(t && t.template); } function Se(e) { const t = F(e); return !!(t && t.isClick); } function Ce(e) { return e == null ? "" : typeof e == "object" ? e.name === void 0 ? "" : e.name : e; } function Oe(e) { w.value = e; } function x() { le(Re); } function Re() { const e = m.value && m.value.$el, t = e && e.querySelector(".ant-table-body"), n = t && t.clientHeight; n && (q.value = Math.max(n - 8, 0)); } function Ie() { O.value = !O.value, x(); } function xe() { _("reset"); } const De = { add: me, delete: pe, import: ve, export: ye, reload: B, setStateBtn: J, handAction: P }; return Ue(() => { }), Ve(() => x()), u({ reload: B, spinning: k, selectedRowKeys: w, expandedRowKeys: T, renderColumns: h, renderButtons: S, setStateBtn: J, btnCallback: G, table: m, importVisible: I, measureLayout: x }), (e, t) => { const n = Qe, i = g("SearchOutlined"), Te = g("SettingOutlined"), ze = Ze, X = g("double-right-outlined"), Ae = g("sync-outlined"), Be = Xe, Pe = g("setting-filter"), Fe = g("setting-columns"), Le = g("s-import-modal"), Me = Ne("action"); return l(), s("div", { class: "list-layout", ref_key: "layout", ref: ae }, [ p("div", et, [ p("div", tt, b(r.title), 1), p("div", nt, [ d(ze, { size: re.value }, { default: v(() => [ (l(!0), s(te, null, je(S.value, (o) => (l(), s("span", { class: "item-btn", key: o.key }, [ ne((l(), R(n, { class: "btn", disabled: !!o.disabled, type: o.type || o.key === "add" ? "primary" : "default", onClick: ($) => G(o) }, { icon: v(() => [ H(o) ? (l(), R(He(H(o)), { key: 0 })) : f("", !0) ]), default: v(() => [ D(" " + b(e.$l(o.name)), 1) ]), _: 2 }, 1032, ["disabled", "type", "onClick"])), [ [Me, o.action || o.key], [oe, o.show !== !1] ]) ]))), 128)), y(e.$slots, "otherBtns", { selections: w.value }, void 0, !0), d(n, { class: "btn", onClick: t[0] || (t[0] = (o) => { var $; return ($ = E.value) == null ? void 0 : $.show(h.value); }) }, { default: v(() => [ d(i), D(" " + b(e.$l("高级搜索")), 1) ]), _: 1 }), d(n, { class: "btn", onClick: t[1] || (t[1] = (o) => { var $; return ($ = K.value) == null ? void 0 : $.show(); }) }, { default: v(() => [ d(Te), D(" " + b(e.$l("高级表格")), 1) ]), _: 1 }) ]), _: 3 }, 8, ["size"]) ]) ]), p("div", ot, [ e.$slots.empty ? (l(), s("div", mt, [ y(e.$slots, "empty", {}, void 0, !0) ])) : (l(), s("div", lt, [ e.$slots.filter || e.$slots.desc ? (l(), s("div", { key: 0, class: "list-filter-wrap", ref_key: "filters", ref: ie }, [ e.$slots.filter ? (l(), s("div", at, [ p("div", it, [ y(e.$slots, "filter", {}, void 0, !0) ]), e.$slots.filterMore ? (l(), s("a", { key: 0, class: "filter-more-btn", onClick: Ie }, [ D(b(O.value ? e.$l("收起") : e.$l("更多")) + " ", 1), O.value ? (l(), R(X, { key: 1, style: { "font-size": "12px", transform: "rotate(-90deg)" } })) : (l(), R(X, { key: 0, style: { "font-size": "12px", transform: "rotate(90deg)" } })) ])) : f("", !0), e.$slots.filter ? (l(), s("div", st, [ d(Be, { placement: "top", overlayStyle: { maxWidth: "500px" }, mouseEnterDelay: 1.5, mouseLeaveDelay: 0.5 }, { title: v(() => [ p("span", null, b(e.$l("条件重置")), 1) ]), default: v(() => [ d(n, { style: { "padding-bottom": "2px" }, onClick: xe }, { icon: v(() => [ d(Ae) ]), _: 1 }) ]), _: 1 }) ])) : f("", !0) ])) : f("", !0), e.$slots.filterMore ? ne((l(), s("div", rt, [ y(e.$slots, "filterMore", {}, void 0, !0) ], 512)), [ [oe, O.value] ]) : f("", !0), e.$slots.desc ? (l(), s("div", ut, [ y(e.$slots, "desc", {}, void 0, !0) ])) : f("", !0) ], 512)) : f("", !0), p("div", ct, [ e.$slots.tabs ? (l(), s("div", { key: 0, class: "tabs-wrap", ref_key: "tabs", ref: se }, [ y(e.$slots, "tabs", {}, void 0, !0) ], 512)) : f("", !0), p("div", dt, [ d(We(Ye), { ref_key: "table", ref: m, size: "middle", scroll: { y: q.value, x: "100%" }, pageSize: U.value, rowKey: r.rowKey, columns: ce.value, data: we, "expanded-row-keys": T.value, "onUpdate:expandedRowKeys": t[2] || (t[2] = (o) => T.value = o), rowSelection: V.value || r.isSelection ? { selectedRowKeys: w.value, onChange: Oe } : null, showPagination: r.showPagination }, { bodyCell: v((o) => [ o.column ? (l(), s(te, { key: 0 }, [ _e(o.column.dataIndex) ? y(e.$slots, o.column.dataIndex, { text: o.text, record: o.record, index: o.index, item: F(o.column.dataIndex) }, void 0, !0, 0) : Se(o.column.dataIndex) ? (l(), s("a", { key: 1, onClick: ($) => be(o.column.dataIndex, o.record) }, b(Ce(o.text)), 9, ft)) : o.column.dataIndex === "action" ? y(e.$slots, "action", { record: o.record }, void 0, !0, 2) : f("", !0) ], 64)) : f("", !0) ]), _: 3 }, 8, ["scroll", "pageSize", "rowKey", "columns", "expanded-row-keys", "rowSelection", "showPagination"]) ]) ]) ])) ]), d(Pe, { ref_key: "filterRef", ref: E, columns: h.value, onSubmit: he, onReset: ke }, null, 8, ["columns"]), d(Fe, { ref_key: "columnsRef", ref: K, pageCode: "demo", columns: h.value, onSave: $e, onReset: ge }, null, 8, ["columns"]), p("div", pt, [ y(e.$slots, "other", {}, void 0, !0) ]), N.value ? (l(), R(Le, { key: 0, ref: "importModalRef", "upload-url": A.value.importUploadUrl, value: I.value, "onUpdate:value": t[3] || (t[3] = (o) => I.value = o), columns: A.value.importColumns, apis: A.value.importApis, onReload: B }, null, 8, ["upload-url", "value", "columns", "apis"])) : f("", !0) ], 512); }; } }), $t = /* @__PURE__ */ Je(vt, [["__scopeId", "data-v-e0415438"]]); export { $t as default };