| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513 |
- import { getCurrentInstance as ze, ref as a, reactive as Ae, computed as J, watch as De, onMounted as Ie, resolveComponent as K, resolveDirective as Be, openBlock as n, createElementBlock as i, createElementVNode as m, toDisplayString as k, createVNode as b, withCtx as y, Fragment as Q, renderList as Le, withDirectives as E, createBlock as C, createTextVNode as G, resolveDynamicComponent as Pe, createCommentVNode as s, vShow as X, renderSlot as u, normalizeStyle as Re, unref as Me, nextTick as Y, h as Z } from "vue";
- import { useRoute as Ke } from "vue-router";
- import { c as Ee } from "./side-drag.js";
- import { n as Fe, B as Ne, y as Ue } from "./index2.js";
- import { S as Ve } from "./index9.js";
- import { _ as qe } from "./index15.js";
- const He = { class: "tools" }, je = { class: "title" }, We = { class: "btns" }, Je = { class: "list-layout-main" }, Qe = {
- key: 1,
- class: "side-bar s-theme-bg"
- }, Ge = {
- key: 2,
- class: "layout-list-content"
- }, Xe = {
- key: 0,
- class: "filter-content"
- }, Ye = { class: "filter" }, Ze = {
- key: 1,
- class: "reset-wrap"
- }, et = {
- key: 1,
- class: "filter-more-content"
- }, tt = {
- key: 2,
- class: "desc-wrap"
- }, ot = { class: "table-content" }, nt = { class: "table-container" }, lt = ["onClick"], at = {
- key: 3,
- class: "layout-list-content"
- }, it = { class: "other" }, st = /* @__PURE__ */ Object.assign({ name: "SListTableTreeLayout" }, {
- __name: "SListTableTreeLayout",
- props: {
- // 页面标题
- title: {
- type: String,
- required: !0
- },
- buttons: {
- type: Array,
- default: () => [
- {
- name: window.$l("添加"),
- key: "add",
- show: !0,
- type: "primary",
- icon: "plus-circle",
- api: null
- },
- {
- name: window.$l("批量删除"),
- key: "remove",
- action: "remove",
- show: !0,
- icon: "delete",
- api: null
- },
- {
- name: window.$l("导入"),
- key: "import",
- show: !0,
- icon: "upload",
- importColumns: [],
- // 预览的表头信息
- importUploadUrl: null,
- // 上传url
- importApis: {
- templateDownload: null,
- importPreview: null,
- importData: null,
- exportExceptionData: null
- }
- },
- {
- name: window.$l("导出"),
- key: "export",
- show: !0,
- icon: "download",
- api: null
- }
- ]
- },
- // 列表checkbox列
- isSelection: {
- type: Boolean,
- default: !1
- },
- showBtnIcon: {
- type: Boolean,
- default: !0
- },
- showPagination: {
- type: Boolean,
- default: !0
- },
- columns: {
- type: Array,
- default: () => []
- },
- rowKey: {
- type: [Function, String],
- default: "id"
- },
- tableLoading: {
- type: Boolean,
- default: !1
- },
- loadData: {
- type: Function,
- required: !0
- },
- getCheckboxProps: {
- type: Function,
- default: (d = {}) => ({ props: d })
- }
- },
- emits: ["reset", "btnCallback", "tableColCallback", "handExpand"],
- setup(d, { expose: ee, emit: te }) {
- const _ = d, c = te;
- Ke(), ze();
- const oe = a(null), ne = a(null), le = a(null), S = a(null), ae = a(8), O = a(!1), F = a(300), v = a(!1), p = a(!1), z = a(232), r = a([]), T = a([]), w = a([]), N = a(!1), ie = a([]), A = a([]), D = a([]), f = Ae({
- current: 1,
- pageSize: 20,
- total: 0,
- showSizeChanger: !0,
- showQuickJumper: !0,
- pageSizeOptions: ["10", "20", "50", "100"],
- showTotal: (e) => `${window.$l("共")}${e}${window.$l("条")}`
- }), se = {
- 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"
- }, U = J(() => w.value.map((e) => e.key).includes("import")), I = J(() => w.value.find((e) => e.key === "import") || {});
- De(
- () => _.buttons,
- (e) => {
- e && e.length && re(e);
- },
- { immediate: !0, deep: !0 }
- );
- function B(e, t = "") {
- return !!(e && typeof e == "function");
- }
- function V(e) {
- return typeof e.icon == "string" ? e.icon : typeof e.icon == "boolean" && e.icon && se[e.key] || "";
- }
- function re(e) {
- w.value = e.map((t) => (t.key === "remove" && (N.value = !0), t));
- }
- function ue() {
- Y(() => {
- M(), T.value = _.columns.map((t) => ((t.template || t.isClick || t.dataIndex === "action" && !t.customRender) && !t.scopedSlots && (t.scopedSlots = { customRender: t.dataIndex }), t)), h();
- });
- const e = setTimeout(() => {
- const t = document.querySelector(".ant-table-cell.ant-table-cell-scrollbar"), l = document.querySelector(".ant-table-thead tr");
- t && l && l.removeChild(t), clearTimeout(e);
- }, 100);
- }
- function de() {
- ue();
- }
- function L() {
- v.value = !v.value, M();
- }
- function q(e, t) {
- const l = W[e];
- return l(t);
- }
- function P() {
- c("reset");
- }
- function h(e = !1) {
- e && (f.current = 1);
- const t = _.showPagination ? { pageNo: f.current, pageSize: f.pageSize } : { pageNo: 1, pageSize: 0 };
- return _.loadData(t).then((l) => {
- var g, x;
- const $ = l && (l.list || l.records) || [];
- return A.value = $.length ? $ : ie.value, f.total = Number((x = l && ((g = l.total) != null ? g : l.totalCount)) != null ? x : $.length), l;
- });
- }
- function ce(e) {
- f.current = e.current, f.pageSize = e.pageSize, h();
- }
- function H(e) {
- c("btnCallback", e.key, r.value);
- const t = W[e.key];
- typeof t == "function" ? t(e) : j(e);
- }
- function j(e) {
- if (e.selection !== !1 && !r.value.length) {
- window.$message.warn(`${window.$l("请选择要")}${window.$l(e.name)}${window.$l("的数据")}`);
- return;
- }
- if (B(e.api, e.name)) {
- if (e.confirm) {
- window.$confirm({
- title: `${e.name}`,
- content: () => Z(
- "div",
- { style: "color:var(--s-color-error)" },
- `${window.$l("确认要")}{${window.$l(e.name)}}${window.$l("数据吗?")}`
- ),
- onOk: () => {
- p.value = !0, e.api(r.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), c("reset");
- }).finally(() => {
- p.value = !1;
- });
- }
- });
- return;
- }
- p.value = !0, e.api(r.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), c("reset");
- }).finally(() => {
- p.value = !1;
- });
- }
- }
- function pe() {
- c("btnCallback", "add");
- }
- function me() {
- if (!r.value.length) {
- window.$notice.warn({
- key: "only-you",
- message: window.$l("操作失败"),
- description: window.$l("请选择要删除的数据")
- });
- return;
- }
- B("deletesApi") && window.$confirm({
- title: window.$l("确认删除"),
- content: () => Z("div", { style: "color: var(--s-color-error)" }, window.$l("确认要批量删除数据吗?")),
- onOk: () => {
- p.value = !0, q("deletesApi", r.value).then(() => {
- window.$notice.success({
- key: "only-you",
- message: window.$l("操作成功"),
- description: window.$l("删除成功")
- }), c("reset");
- }).finally(() => {
- p.value = !1;
- });
- }
- });
- }
- function fe() {
- if (!U.value) {
- c("btnCallback", "import");
- return;
- }
- O.value = !0;
- }
- function ye() {
- B("exportApi") && (p.value = !0, q("exportApi").then(() => {
- p.value = !1;
- }));
- }
- function ve(e, t) {
- c("tableColCallback", e, t);
- }
- function R(e) {
- return T.value.find((t) => t.dataIndex === e);
- }
- function we(e) {
- const t = R(e);
- return !!(t && t.template);
- }
- function he(e) {
- const t = R(e);
- return !!(t && t.isClick);
- }
- function $e(e) {
- return e == null ? "" : typeof e == "object" ? e.name === void 0 ? "" : e.name : e;
- }
- function ge(e) {
- r.value = e;
- }
- function M() {
- Y(ke);
- }
- function ke() {
- const e = S.value && S.value.$el, t = e && e.querySelector(".ant-table-body"), l = t && t.clientHeight;
- l && (F.value = Math.max(l - 8, 0));
- }
- function be(e, t) {
- c("handExpand", e, t);
- }
- const W = {
- add: pe,
- remove: me,
- import: fe,
- export: ye,
- reload: h,
- filterReset: P,
- toggleFilter: L,
- handAction: j
- }, Ce = Ee(
- () => z.value,
- (e) => z.value = e,
- { min: 232 }
- );
- return Ie(() => {
- de();
- }), ee({
- reload: h,
- spinning: p,
- selectedRowKeys: r,
- expandedRowKeys: D,
- renderColumns: T,
- renderButtons: w,
- tableData: A,
- pagination: f,
- table: S,
- importVisible: O,
- measureLayout: M,
- toggleFilter: L,
- filterReset: P,
- btnCallback: H
- }), (e, t) => {
- const l = Ne, $ = Ve, g = K("double-right-outlined"), x = K("sync-outlined"), _e = Ue, Se = qe, Oe = K("s-import-modal"), Te = Be("action");
- return n(), i("div", {
- class: "list-layout",
- ref_key: "layout",
- ref: oe
- }, [
- m("div", He, [
- m("div", je, k(d.title), 1),
- m("div", We, [
- b($, { size: ae.value }, {
- default: y(() => [
- (n(!0), i(Q, null, Le(w.value, (o) => (n(), i("span", {
- class: "item-btn",
- key: o.key
- }, [
- E((n(), C(l, {
- class: "btn",
- disabled: !!o.disabled,
- type: o.type || o.key === "add" ? "primary" : "default",
- onClick: (xe) => H(o)
- }, {
- icon: y(() => [
- V(o) ? (n(), C(Pe(V(o)), { key: 0 })) : s("", !0)
- ]),
- default: y(() => [
- G(" " + k(e.$l(o.name)), 1)
- ]),
- _: 2
- }, 1032, ["disabled", "type", "onClick"])), [
- [Te, o.action || o.key],
- [X, o.show !== !1]
- ])
- ]))), 128)),
- u(e.$slots, "otherBtns", { selections: r.value }, void 0, !0)
- ]),
- _: 3
- }, 8, ["size"])
- ])
- ]),
- m("div", Je, [
- e.$slots.tree ? (n(), i("div", {
- key: 0,
- class: "side s-side-tree",
- ref: "side",
- style: Re({ width: z.value + "px" })
- }, [
- u(e.$slots, "tree", {}, void 0, !0)
- ], 4)) : s("", !0),
- e.$slots.tree ? E((n(), i("div", Qe, null, 512)), [
- [Me(Ce)]
- ]) : s("", !0),
- e.$slots.empty ? (n(), i("div", at, [
- u(e.$slots, "empty", {}, void 0, !0)
- ])) : (n(), i("div", Ge, [
- e.$slots.filter || e.$slots.filterMore ? (n(), i("div", {
- key: 0,
- class: "list-filter-wrap",
- ref_key: "filters",
- ref: ne
- }, [
- e.$slots.filter ? (n(), i("div", Xe, [
- m("div", Ye, [
- u(e.$slots, "filter", {}, void 0, !0)
- ]),
- e.$slots.filterMore ? (n(), i("a", {
- key: 0,
- class: "filter-more-btn",
- onClick: L
- }, [
- G(k(v.value ? e.$l("收起") : e.$l("更多")) + " ", 1),
- v.value ? (n(), C(g, {
- key: 1,
- style: { "font-size": "12px", transform: "rotate(-90deg)" }
- })) : (n(), C(g, {
- key: 0,
- style: { "font-size": "12px", transform: "rotate(90deg)" }
- }))
- ])) : s("", !0),
- e.$slots.filter ? (n(), i("div", Ze, [
- b(_e, {
- placement: "top",
- overlayStyle: { maxWidth: "500px" },
- mouseEnterDelay: 1.5,
- mouseLeaveDelay: 0.5
- }, {
- title: y(() => [
- m("span", null, k(e.$l("条件重置")), 1)
- ]),
- default: y(() => [
- b(l, {
- style: { "padding-bottom": "2px" },
- onClick: P
- }, {
- icon: y(() => [
- b(x)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])) : s("", !0)
- ])) : s("", !0),
- e.$slots.filterMore ? E((n(), i("div", et, [
- u(e.$slots, "filterMore", {}, void 0, !0)
- ], 512)), [
- [X, v.value]
- ]) : s("", !0),
- e.$slots.desc ? (n(), i("div", tt, [
- u(e.$slots, "desc", {}, void 0, !0)
- ])) : s("", !0)
- ], 512)) : s("", !0),
- m("div", ot, [
- e.$slots.tabs ? (n(), i("div", {
- key: 0,
- class: "tabs-wrap",
- ref_key: "tabs",
- ref: le
- }, [
- u(e.$slots, "tabs", {}, void 0, !0)
- ], 512)) : s("", !0),
- m("div", nt, [
- b(Se, {
- ref_key: "table",
- ref: S,
- size: "middle",
- scroll: { y: F.value },
- rowKey: d.rowKey,
- tableLoading: d.tableLoading,
- columns: T.value,
- dataSource: A.value,
- expandedRowKeys: D.value,
- "onUpdate:expandedRowKeys": t[0] || (t[0] = (o) => D.value = o),
- rowSelection: N.value || d.isSelection ? {
- selectedRowKeys: r.value,
- onChange: ge,
- getcheckboxProps: d.getCheckboxProps
- } : null,
- pagination: d.showPagination ? f : !1,
- onExpand: be,
- onChange: ce
- }, {
- bodyCell: y((o) => [
- o.column ? (n(), i(Q, { key: 0 }, [
- we(o.column.dataIndex) ? u(e.$slots, o.column.dataIndex, {
- text: o.text,
- record: o.record,
- index: o.index,
- item: R(o.column.dataIndex)
- }, void 0, !0, 0) : he(o.column.dataIndex) ? (n(), i("a", {
- key: 1,
- onClick: (xe) => ve(o.column.dataIndex, o.record)
- }, k($e(o.text)), 9, lt)) : o.column.dataIndex === "action" ? u(e.$slots, "action", {
- record: o.record
- }, void 0, !0, 2) : s("", !0)
- ], 64)) : s("", !0)
- ]),
- _: 3
- }, 8, ["scroll", "rowKey", "tableLoading", "columns", "dataSource", "expandedRowKeys", "rowSelection", "pagination"])
- ])
- ])
- ]))
- ]),
- m("div", it, [
- u(e.$slots, "other", {}, void 0, !0)
- ]),
- U.value ? (n(), C(Oe, {
- key: 0,
- ref: "importModalRef",
- "upload-url": I.value.importUploadUrl,
- value: O.value,
- "onUpdate:value": t[1] || (t[1] = (o) => O.value = o),
- columns: I.value.importColumns,
- apis: I.value.importApis,
- onReload: h
- }, null, 8, ["upload-url", "value", "columns", "apis"])) : s("", !0)
- ], 512);
- };
- }
- }), ft = /* @__PURE__ */ Fe(st, [["__scopeId", "data-v-136ef62f"]]);
- export {
- ft as default
- };
|