| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530 |
- import { getCurrentInstance as Le, ref as a, reactive as ze, computed as ee, watch as Re, onMounted as Be, resolveComponent as D, resolveDirective as Me, openBlock as n, createElementBlock as i, createElementVNode as p, toDisplayString as _, Fragment as te, renderList as Pe, withDirectives as E, createBlock as S, withCtx as g, createTextVNode as oe, resolveDynamicComponent as He, createCommentVNode as r, vShow as ne, renderSlot as m, normalizeStyle as x, createVNode as I, nextTick as N, h as le } from "vue";
- import { useRoute as Ke } from "vue-router";
- import { n as Ee, B as Ne, y as Fe } from "./index2.js";
- import { _ as Ue } from "./index12.js";
- const Ve = { class: "tools" }, qe = { class: "title" }, We = { class: "btns" }, Xe = { style: { "margin-left": "8px" } }, je = {
- key: 0,
- class: "filter-content"
- }, Je = { class: "filter" }, Qe = {
- key: 1,
- class: "reset-wrap"
- }, Ge = {
- key: 1,
- class: "filter-more-content"
- }, Ye = {
- key: 2,
- class: "desc-wrap"
- }, Ze = { class: "table-content" }, et = { class: "table-container" }, tt = ["onClick"], ot = { class: "other" }, nt = /* @__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
- }
- },
- emits: ["reset", "btnCallback", "tableColCallback", "handExpand"],
- setup(h, { expose: ae, emit: ie }) {
- const $ = h, f = ie;
- Ke(), Le();
- const F = a(null), se = a(null), U = a(null), V = a(null), q = a(null), re = a(null), O = a(!1), u = a(0), W = a(0), k = a(!1), y = a(!1), T = a(232), d = a([]), A = a([]), b = a([]), X = a(!1), ue = a([]), L = a([]), z = a([]), w = ze({
- current: 1,
- pageSize: 20,
- total: 0,
- showSizeChanger: !0,
- showQuickJumper: !0,
- pageSizeOptions: ["10", "20", "50", "100"],
- showTotal: (e) => `${window.$l("共")}${e}${window.$l("条")}`
- }), de = {
- 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"
- }, j = ee(() => b.value.map((e) => e.key).includes("import")), R = ee(() => b.value.find((e) => e.key === "import") || {});
- Re(
- () => $.buttons,
- (e) => {
- e && e.length && ce(e);
- },
- { immediate: !0, deep: !0 }
- );
- function B(e, t = "") {
- return !!(e && typeof e == "function");
- }
- function J(e) {
- return typeof e.icon == "string" ? e.icon : typeof e.icon == "boolean" && e.icon && de[e.key] || "";
- }
- function ce(e) {
- b.value = e.map((t) => (t.key === "remove" && (X.value = !0), t));
- }
- function pe() {
- N(() => {
- K(), A.value = $.columns.map((t) => ((t.template || t.isClick || t.dataIndex === "action" && !t.customRender) && !t.scopedSlots && (t.scopedSlots = { customRender: t.dataIndex }), t)), C();
- });
- 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 me() {
- pe();
- }
- function M() {
- k.value = !k.value, K();
- }
- function Q(e, t) {
- const l = Z[e];
- return l(t);
- }
- function P() {
- f("reset");
- }
- function C(e = !1) {
- e && (w.current = 1);
- const t = $.showPagination ? { pageNo: w.current, pageSize: w.pageSize } : { pageNo: 1, pageSize: 0 };
- return $.loadData(t).then((l) => {
- var v, c;
- const s = l && (l.list || l.records) || [];
- return L.value = s.length ? s : ue.value, w.total = Number((c = l && ((v = l.total) != null ? v : l.totalCount)) != null ? c : s.length), l;
- });
- }
- function fe(e) {
- w.current = e.current, w.pageSize = e.pageSize, C();
- }
- function G(e) {
- f("btnCallback", e.key, d.value);
- const t = Z[e.key];
- typeof t == "function" ? t(e) : Y(e);
- }
- function Y(e) {
- if (e.selection !== !1 && !d.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: () => le(
- "div",
- { style: "color:red" },
- `${window.$l("确认要")}{${window.$l(e.name)}}${window.$l("数据吗?")}`
- ),
- onOk: () => {
- y.value = !0, e.api(d.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), f("reset");
- }).finally(() => {
- y.value = !1;
- });
- }
- });
- return;
- }
- y.value = !0, e.api(d.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), f("reset");
- }).finally(() => {
- y.value = !1;
- });
- }
- }
- function ye() {
- f("btnCallback", "add");
- }
- function ve() {
- if (!d.value.length) {
- window.$notice.warn({
- key: "only-you",
- message: window.$l("操作失败"),
- description: window.$l("请选择要删除的数据")
- });
- return;
- }
- B("deletesApi") && window.$confirm({
- title: window.$l("确认删除"),
- content: () => le("div", { style: "color: red" }, window.$l("确认要批量删除数据吗?")),
- onOk: () => {
- y.value = !0, Q("deletesApi", d.value).then(() => {
- window.$notice.success({
- key: "only-you",
- message: window.$l("操作成功"),
- description: window.$l("删除成功")
- }), f("reset");
- }).finally(() => {
- y.value = !1;
- });
- }
- });
- }
- function we() {
- if (!j.value) {
- f("btnCallback", "import");
- return;
- }
- O.value = !0;
- }
- function he() {
- B("exportApi") && (y.value = !0, Q("exportApi").then(() => {
- y.value = !1;
- }));
- }
- function ge(e, t) {
- f("tableColCallback", e, t);
- }
- function H(e) {
- return A.value.find((t) => t.dataIndex === e);
- }
- function $e(e) {
- const t = H(e);
- return !!(t && t.template);
- }
- function ke(e) {
- const t = H(e);
- return !!(t && t.isClick);
- }
- function be(e) {
- return e == null ? "" : typeof e == "object" ? e.name === void 0 ? "" : e.name : e;
- }
- function Ce(e) {
- d.value = e;
- }
- function K() {
- N(() => {
- var e, t;
- u.value = (((t = (e = F.value) == null ? void 0 : e.parentNode) == null ? void 0 : t.offsetHeight) || 0) - 76, _e();
- });
- }
- function _e() {
- N(() => {
- var s, v;
- const t = ((s = U.value) == null ? void 0 : s.offsetHeight) || 0, l = ((v = V.value) == null ? void 0 : v.offsetHeight) || 0;
- (!u.value || u.value < 200) && (u.value = 400), W.value = u.value - t - 60 - l - ($.showPagination ? 56 : 0);
- });
- }
- function Se(e, t) {
- f("handExpand", e, t);
- }
- const Z = {
- add: ye,
- remove: ve,
- import: we,
- export: he,
- reload: C,
- filterReset: P,
- toggleFilter: M,
- handAction: Y
- }, xe = {
- mounted(e) {
- e.style.cursor = "e-resize", document.addEventListener("selectstart", (t) => {
- t.preventDefault();
- }), e.onmousedown = (t) => {
- const l = t.clientX, s = T.value;
- document.onmousemove = (v) => {
- const c = v.clientX - l;
- if (c < 0) {
- if (s + c <= 232) return;
- T.value = s + c;
- } else {
- if (s + c >= 500) return;
- T.value = s + c;
- }
- }, document.onmouseup = () => {
- document.onmousemove = document.onmousedown = null;
- };
- };
- }
- };
- return Be(() => {
- me();
- }), ae({
- reload: C,
- spinning: y,
- selectedRowKeys: d,
- expandedRowKeys: z,
- renderColumns: A,
- renderButtons: b,
- tableData: L,
- pagination: w,
- table: q,
- importVisible: O,
- measureLayout: K,
- toggleFilter: M,
- filterReset: P,
- btnCallback: G
- }), (e, t) => {
- const l = Ne, s = D("down-outlined"), v = D("up-outlined"), c = D("sync-outlined"), Oe = Fe, Te = Ue, Ae = D("s-import-modal"), De = Me("action");
- return n(), i("div", {
- class: "list-layout",
- ref_key: "layout",
- ref: F
- }, [
- p("div", Ve, [
- p("div", qe, _(h.title), 1),
- p("div", We, [
- (n(!0), i(te, null, Pe(b.value, (o) => (n(), i("span", {
- class: "item-btn",
- key: o.key
- }, [
- E((n(), S(l, {
- class: "btn",
- disabled: !!o.disabled,
- type: o.type || o.key === "add" ? "primary" : "default",
- onClick: (Ie) => G(o)
- }, {
- icon: g(() => [
- J(o) ? (n(), S(He(J(o)), { key: 0 })) : r("", !0)
- ]),
- default: g(() => [
- oe(" " + _(e.$l(o.name)), 1)
- ]),
- _: 2
- }, 1032, ["disabled", "type", "onClick"])), [
- [De, o.action || o.key],
- [ne, o.show !== !1]
- ])
- ]))), 128)),
- p("span", Xe, [
- m(e.$slots, "otherBtns", { selections: d.value }, void 0, !0)
- ])
- ])
- ]),
- p("div", {
- class: "list-layout-main",
- style: x({ height: u.value + "px" })
- }, [
- e.$slots.tree ? (n(), i("div", {
- key: 0,
- class: "side s-side-tree",
- ref_key: "side",
- ref: se,
- style: x({ height: u.value + "px", width: T.value + "px" })
- }, [
- m(e.$slots, "tree", {}, void 0, !0)
- ], 4)) : r("", !0),
- e.$slots.tree ? E((n(), i("div", {
- key: 1,
- class: "side-bar s-theme-bg",
- style: x({ height: u.value + "px" })
- }, null, 4)), [
- [xe]
- ]) : r("", !0),
- e.$slots.empty ? (n(), i("div", {
- key: 3,
- class: "layout-list-content",
- style: x({ height: u.value + "px" })
- }, [
- m(e.$slots, "empty", {}, void 0, !0)
- ], 4)) : (n(), i("div", {
- key: 2,
- class: "layout-list-content",
- style: x({ height: u.value + "px" })
- }, [
- e.$slots.filter || e.$slots.filterMore ? (n(), i("div", {
- key: 0,
- class: "list-filter-wrap",
- ref_key: "filters",
- ref: U
- }, [
- e.$slots.filter ? (n(), i("div", je, [
- p("div", Je, [
- m(e.$slots, "filter", {}, void 0, !0)
- ]),
- e.$slots.filterMore ? (n(), i("a", {
- key: 0,
- class: "filter-more-btn",
- onClick: M
- }, [
- oe(_(k.value ? e.$l("收起") : e.$l("更多")) + " ", 1),
- k.value ? (n(), S(v, {
- key: 1,
- style: { "font-size": "12px" }
- })) : (n(), S(s, {
- key: 0,
- style: { "font-size": "12px" }
- }))
- ])) : r("", !0),
- e.$slots.filter ? (n(), i("div", Qe, [
- I(Oe, {
- placement: "top",
- overlayStyle: { maxWidth: "500px" },
- mouseEnterDelay: 1.5,
- mouseLeaveDelay: 0.5
- }, {
- title: g(() => [
- p("span", null, _(e.$l("条件重置")), 1)
- ]),
- default: g(() => [
- I(l, {
- style: { "padding-bottom": "2px" },
- onClick: P
- }, {
- icon: g(() => [
- I(c)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])) : r("", !0)
- ])) : r("", !0),
- e.$slots.filterMore ? E((n(), i("div", Ge, [
- m(e.$slots, "filterMore", {}, void 0, !0)
- ], 512)), [
- [ne, k.value]
- ]) : r("", !0),
- e.$slots.desc ? (n(), i("div", Ye, [
- m(e.$slots, "desc", {}, void 0, !0)
- ])) : r("", !0)
- ], 512)) : r("", !0),
- p("div", Ze, [
- e.$slots.tabs ? (n(), i("div", {
- key: 0,
- class: "tabs-wrap",
- ref_key: "tabs",
- ref: V
- }, [
- m(e.$slots, "tabs", {}, void 0, !0)
- ], 512)) : r("", !0),
- p("div", et, [
- I(Te, {
- ref_key: "table",
- ref: q,
- size: "middle",
- scroll: { y: W.value },
- rowKey: h.rowKey,
- tableLoading: h.tableLoading,
- columns: A.value,
- dataSource: L.value,
- expandedRowKeys: z.value,
- "onUpdate:expandedRowKeys": t[0] || (t[0] = (o) => z.value = o),
- rowSelection: X.value || h.isSelection ? { selectedRowKeys: d.value, onChange: Ce } : null,
- pagination: h.showPagination ? w : !1,
- onExpand: Se,
- onChange: fe
- }, {
- bodyCell: g((o) => [
- o.column ? (n(), i(te, { key: 0 }, [
- $e(o.column.dataIndex) ? m(e.$slots, o.column.dataIndex, {
- text: o.text,
- record: o.record,
- index: o.index,
- item: H(o.column.dataIndex)
- }, void 0, !0, 0) : ke(o.column.dataIndex) ? (n(), i("a", {
- key: 1,
- onClick: (Ie) => ge(o.column.dataIndex, o.record)
- }, _(be(o.text)), 9, tt)) : o.column.dataIndex === "action" ? m(e.$slots, "action", {
- record: o.record
- }, void 0, !0, 2) : r("", !0)
- ], 64)) : r("", !0)
- ]),
- _: 3
- }, 8, ["scroll", "rowKey", "tableLoading", "columns", "dataSource", "expandedRowKeys", "rowSelection", "pagination"])
- ])
- ])
- ], 4))
- ], 4),
- p("div", ot, [
- m(e.$slots, "other", {}, void 0, !0)
- ]),
- j.value ? (n(), S(Ae, {
- key: 0,
- ref_key: "importModalRef",
- ref: re,
- "upload-url": R.value.importUploadUrl,
- value: O.value,
- "onUpdate:value": t[1] || (t[1] = (o) => O.value = o),
- columns: R.value.importColumns,
- apis: R.value.importApis,
- onReload: C
- }, null, 8, ["upload-url", "value", "columns", "apis"])) : r("", !0)
- ], 512);
- };
- }
- }), rt = /* @__PURE__ */ Ee(nt, [["__scopeId", "data-v-977635c8"]]);
- export {
- rt as default
- };
|