| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542 |
- import { ref as s, computed as X, watch as Y, nextTick as _, onMounted as Ae, onActivated as Ie, resolveComponent as M, resolveDirective as Pe, openBlock as n, createElementBlock as l, createVNode as w, withCtx as f, createElementVNode as m, toDisplayString as k, Fragment as Z, renderList as ze, withDirectives as R, createBlock as $, createTextVNode as x, resolveDynamicComponent as Ee, createCommentVNode as a, vShow as ee, renderSlot as i, normalizeStyle as Me, unref as te, h as Re } from "vue";
- import { useRoute as xe } from "vue-router";
- import { n as Fe, aB as Ke, B as Le, y as Ne, d0 as Ue } from "./index2.js";
- import { c as Ve } from "./side-drag.js";
- import { S as qe } from "./index9.js";
- const je = { class: "tools" }, He = { class: "title" }, We = { class: "btns" }, Ge = { class: "list-layout-main" }, Je = {
- key: 1,
- class: "side-bar s-theme-bg"
- }, Qe = {
- 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 = {
- key: 1,
- class: "search-bar"
- }, nt = {
- key: 2,
- class: "status-bar"
- }, lt = { class: "table-content" }, at = { class: "table-container" }, st = ["onClick"], it = {
- key: 3,
- class: "layout-list-content"
- }, rt = {
- key: 4,
- class: "layout-list-content"
- }, ut = { class: "other" }, dt = /* @__PURE__ */ Object.assign({ name: "SNewestDataListLayout" }, {
- __name: "SNewestDataListLayout",
- 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
- },
- columns: {
- type: Array,
- default: () => []
- },
- rowKey: {
- type: [Function, String],
- default: "id"
- },
- loadData: {
- type: Function,
- required: !0
- },
- pSize: {
- type: [String, Number],
- default: 20
- },
- // 列表主体形态:table 走表格,custom 走 custom-layout-list-content 插槽
- listType: {
- type: String,
- default: "table"
- },
- // 高级搜索入口
- isEnableAdvancedSearch: {
- type: Boolean,
- default: !1
- },
- // 状态条插槽开关
- isEnableStatusBar: {
- type: Boolean,
- default: !1
- },
- // 搜索条插槽开关
- isEnableSearchBar: {
- type: Boolean,
- default: !1
- },
- // 行勾选控制(antd rowSelection.getCheckboxProps):返回 { disabled, ... }
- getCheckboxProps: {
- type: Function,
- default: () => ({})
- }
- },
- emits: ["reset", "btnCallback", "tableColCallback", "advancedSearch"],
- setup(r, { expose: oe, emit: ne }) {
- const g = r, y = ne;
- xe();
- const le = s(null), ae = s(null), se = s(null), ie = s(null), p = s(null), re = s(null), ue = s(8), S = s(!1), F = s(300), b = s(!1), d = s(!1), K = s(20), B = s(256), L = s(!1), c = s([]), O = s([]), C = s([]), v = s([]), 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"
- }, N = X(() => v.value.map((e) => e.key).includes("import")), D = X(() => v.value.find((e) => e.key === "import") || {});
- Y(
- () => g.buttons,
- (e) => {
- e && e.length && ce(e);
- },
- { immediate: !0, deep: !0 }
- ), Y(
- () => g.columns,
- () => q()
- );
- function U(e, t = "") {
- return !!(e && typeof e == "function");
- }
- function V(e) {
- return typeof e.icon == "string" ? e.icon : typeof e.icon == "boolean" && e.icon && de[e.key] || "";
- }
- function ce(e) {
- v.value = e.map((t) => (t.key === "remove" && (L.value = !0), t));
- }
- function fe() {
- _(() => {
- E(), K.value = g.pSize, C.value = g.columns.map((e) => ((e.template || e.isClick || e.dataIndex === "action" && !e.customRender) && !e.scopedSlots && (e.scopedSlots = { customRender: e.dataIndex }), e));
- }), setTimeout(() => {
- const e = document.querySelector(".ant-table-cell.ant-table-cell-scrollbar"), t = document.querySelector(".ant-table-thead tr");
- e && t && t.removeChild(e);
- }, 100);
- }
- function q() {
- _(() => {
- fe();
- });
- }
- function T() {
- b.value = !b.value, E();
- }
- function A() {
- y("reset");
- }
- function I() {
- p.value && p.value.refresh(!0);
- }
- function j(e) {
- y("btnCallback", e.key, c.value);
- const t = ge[e.key];
- typeof t == "function" ? t(e) : P(e);
- }
- function P(e) {
- if (e.selection !== !1 && !c.value.length) {
- window.$message.warn(`${window.$l("请选择要")}${window.$l(e.name)}${window.$l("的数据")}`);
- return;
- }
- if (U(e.api, e.name, e.key)) {
- if (e.confirm) {
- window.$confirm({
- title: `${e.name}`,
- content: () => Re(
- "div",
- { style: "color:var(--s-color-error)" },
- `${window.$l("确认要")}${window.$l(e.name)}${window.$l("数据吗?")}`
- ),
- onOk: () => {
- d.value = !0, e.api(c.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), y("reset");
- }).finally(() => {
- d.value = !1;
- });
- }
- });
- return;
- }
- d.value = !0, e.api(c.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), y("reset");
- }).finally(() => {
- d.value = !1;
- });
- }
- }
- function H(e, t) {
- typeof e == "string" ? W(e, t) : e.forEach((u) => {
- W(u, t);
- });
- }
- function W(e, t) {
- const u = v.value.find((h) => h.key === e);
- if (!u) {
- console.error(`按钮(${e})未定义, 请确认该变更状态按钮是否设置正确`);
- return;
- }
- Object.keys(t).forEach((h) => {
- u[h] = t[h];
- });
- }
- function me() {
- }
- function ye(e) {
- P(e);
- }
- function pe() {
- if (!N.value) {
- y("btnCallback", "import");
- return;
- }
- S.value = !0;
- }
- function ve(e) {
- U(e.api, e.name, e.key) && (d.value = !0, e.api(c.value).then(() => {
- d.value = !1;
- }).catch(() => {
- d.value = !1;
- }));
- }
- function he(e, t) {
- y("tableColCallback", e, t);
- }
- function z(e) {
- return C.value.find((t) => t.dataIndex === e);
- }
- function we(e) {
- const t = z(e);
- return !!(t && t.template);
- }
- function ke(e) {
- const t = z(e);
- return !!(t && t.isClick);
- }
- function $e(e) {
- return e == null ? "" : typeof e == "object" ? e.name === void 0 ? "" : e.name : e;
- }
- function be(e) {
- c.value = e;
- }
- function E() {
- _(G);
- }
- function G() {
- const e = p.value && p.value.$el, t = e && e.querySelector(".ant-table-body"), u = t && t.clientHeight;
- u && (F.value = Math.max(u - 8, 0));
- }
- function J() {
- y("advancedSearch");
- }
- const ge = {
- add: me,
- delete: ye,
- import: pe,
- export: ve,
- reload: I,
- filterReset: A,
- toggleFilter: T,
- setStateBtn: H,
- handAction: P
- }, Se = Ve(
- () => B.value,
- (e) => B.value = e,
- { min: 256 }
- );
- return Ae(() => {
- q();
- }), Ie(() => {
- _(G);
- }), oe({
- reload: I,
- spinning: d,
- selectedRowKeys: c,
- expandedRowKeys: O,
- renderColumns: C,
- renderButtons: v,
- setStateBtn: H,
- btnCallback: j,
- filterReset: A,
- toggleFilter: T,
- table: p,
- importVisible: S,
- measureLayout: E,
- advancedSearch: J
- }), (e, t) => {
- const u = Le, h = qe, Q = M("double-right-outlined"), Ce = M("sync-outlined"), _e = Ne, Be = Ke, Oe = M("s-import-modal"), De = Pe("action");
- return n(), l("div", {
- class: "list-layout",
- ref_key: "layout",
- ref: le
- }, [
- w(Be, { spinning: d.value }, {
- default: f(() => [
- m("div", je, [
- m("div", He, k(e.$l(r.title)), 1),
- m("div", We, [
- w(h, { size: ue.value }, {
- default: f(() => [
- (n(!0), l(Z, null, ze(v.value, (o) => (n(), l("span", {
- class: "item-btn",
- key: o.key
- }, [
- R((n(), $(u, {
- class: "btn",
- disabled: !!o.disabled,
- type: o.type || (o.key === "add" ? "primary" : "default"),
- onClick: (Te) => j(o)
- }, {
- icon: f(() => [
- V(o) ? (n(), $(Ee(V(o)), { key: 0 })) : a("", !0)
- ]),
- default: f(() => [
- x(" " + k(e.$l(o.name)), 1)
- ]),
- _: 2
- }, 1032, ["disabled", "type", "onClick"])), [
- [De, o.action || o.key],
- [ee, o.show !== !1]
- ])
- ]))), 128)),
- i(e.$slots, "otherBtns", { selections: c.value }, void 0, !0)
- ]),
- _: 3
- }, 8, ["size"])
- ])
- ]),
- m("div", Ge, [
- e.$slots.tree ? (n(), l("div", {
- key: 0,
- class: "side s-side-tree",
- ref_key: "side",
- ref: ae,
- style: Me([{ width: B.value + "px" }, { "overflow-y": "auto" }])
- }, [
- i(e.$slots, "tree", {}, void 0, !0)
- ], 4)) : a("", !0),
- e.$slots.tree ? R((n(), l("div", Je, null, 512)), [
- [te(Se)]
- ]) : a("", !0),
- !e.$slots.empty && r.listType === "table" ? (n(), l("div", Qe, [
- e.$slots.filter || e.$slots.filterMore ? (n(), l("div", {
- key: 0,
- class: "filter-wrap",
- ref_key: "filters",
- ref: se
- }, [
- e.$slots.filter ? (n(), l("div", Xe, [
- m("div", Ye, [
- i(e.$slots, "filter", {}, void 0, !0)
- ]),
- e.$slots.filterMore ? (n(), l("a", {
- key: 0,
- class: "filter-more-btn",
- onClick: T
- }, [
- x(k(b.value ? e.$l("收起") : e.$l("更多筛选")) + " ", 1),
- b.value ? (n(), $(Q, {
- key: 1,
- style: { "font-size": "12px", transform: "rotate(-90deg)" }
- })) : (n(), $(Q, {
- key: 0,
- style: { "font-size": "12px", transform: "rotate(90deg)" }
- }))
- ])) : a("", !0),
- e.$slots.filter ? (n(), l("div", Ze, [
- r.isEnableAdvancedSearch ? (n(), $(u, {
- key: 0,
- class: "advanced-search",
- type: "link",
- onClick: J
- }, {
- default: f(() => [
- x(k(e.$l("高级搜索")), 1)
- ]),
- _: 1
- })) : a("", !0),
- w(_e, {
- placement: "top",
- overlayStyle: { maxWidth: "500px" }
- }, {
- title: f(() => [
- m("span", null, k(e.$l("条件重置")), 1)
- ]),
- default: f(() => [
- w(u, {
- style: { "padding-bottom": "2px" },
- onClick: A
- }, {
- icon: f(() => [
- w(Ce)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])) : a("", !0)
- ])) : a("", !0),
- e.$slots.filterMore ? R((n(), l("div", et, [
- i(e.$slots, "filterMore", {}, void 0, !0)
- ], 512)), [
- [ee, b.value]
- ]) : a("", !0),
- e.$slots.desc ? (n(), l("div", tt, [
- i(e.$slots, "desc", {}, void 0, !0)
- ])) : a("", !0)
- ], 512)) : a("", !0),
- r.isEnableSearchBar ? (n(), l("div", ot, [
- i(e.$slots, "search-bar", {}, void 0, !0)
- ])) : a("", !0),
- r.isEnableStatusBar ? (n(), l("div", nt, [
- i(e.$slots, "status-bar", {}, void 0, !0)
- ])) : a("", !0),
- m("div", lt, [
- e.$slots.tabs ? (n(), l("div", {
- key: 0,
- class: "tabs-wrap",
- ref_key: "tabs",
- ref: ie
- }, [
- i(e.$slots, "tabs", {}, void 0, !0)
- ], 512)) : a("", !0),
- m("div", at, [
- w(te(Ue), {
- ref_key: "table",
- ref: p,
- size: "middle",
- scroll: { y: F.value, x: "100%" },
- pageSize: K.value,
- rowKey: r.rowKey,
- columns: C.value,
- data: r.loadData,
- "expanded-row-keys": O.value,
- "onUpdate:expandedRowKeys": t[0] || (t[0] = (o) => O.value = o),
- rowSelection: L.value || r.isSelection ? {
- selectedRowKeys: c.value,
- onChange: be,
- getCheckboxProps: r.getCheckboxProps
- } : null,
- showPagination: r.showPagination
- }, {
- bodyCell: f((o) => [
- o.column ? (n(), l(Z, { key: 0 }, [
- we(o.column.dataIndex) ? i(e.$slots, o.column.dataIndex, {
- text: o.text,
- record: o.record,
- index: o.index,
- item: z(o.column.dataIndex)
- }, void 0, !0, 0) : ke(o.column.dataIndex) ? (n(), l("a", {
- key: 1,
- onClick: (Te) => he(o.column.dataIndex, o.record)
- }, k($e(o.text)), 9, st)) : o.column.dataIndex === "action" ? i(e.$slots, "action", {
- record: o.record
- }, void 0, !0, 2) : a("", !0)
- ], 64)) : a("", !0)
- ]),
- _: 3
- }, 8, ["scroll", "pageSize", "rowKey", "columns", "data", "expanded-row-keys", "rowSelection", "showPagination"])
- ])
- ])
- ])) : a("", !0),
- !e.$slots.empty && r.listType === "custom" ? (n(), l("div", it, [
- i(e.$slots, "custom-layout-list-content", {}, void 0, !0)
- ])) : a("", !0),
- e.$slots.empty ? (n(), l("div", rt, [
- i(e.$slots, "empty", {}, void 0, !0)
- ])) : a("", !0)
- ]),
- m("div", ut, [
- i(e.$slots, "other", {}, void 0, !0)
- ])
- ]),
- _: 3
- }, 8, ["spinning"]),
- N.value ? (n(), $(Oe, {
- key: 0,
- ref_key: "importModalRef",
- ref: re,
- "upload-url": D.value.importUploadUrl,
- value: S.value,
- "onUpdate:value": t[1] || (t[1] = (o) => S.value = o),
- columns: D.value.importColumns,
- apis: D.value.importApis,
- onReload: I
- }, null, 8, ["upload-url", "value", "columns", "apis"])) : a("", !0)
- ], 512);
- };
- }
- }), vt = /* @__PURE__ */ Fe(dt, [["__scopeId", "data-v-db157b4f"]]);
- export {
- vt as default
- };
|