| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541 |
- var ze = Object.defineProperty;
- var X = Object.getOwnPropertySymbols;
- var Ee = Object.prototype.hasOwnProperty, Ke = Object.prototype.propertyIsEnumerable;
- var Y = (u, r, d) => r in u ? ze(u, r, { enumerable: !0, configurable: !0, writable: !0, value: d }) : u[r] = d, M = (u, r) => {
- for (var d in r || (r = {}))
- Ee.call(r, d) && Y(u, d, r[d]);
- if (X)
- for (var d of X(r))
- Ke.call(r, d) && Y(u, d, r[d]);
- return u;
- };
- import { ref as a, computed as z, watch as Z, onMounted as qe, onActivated as Ue, resolveComponent as h, resolveDirective as Ve, openBlock as l, createElementBlock as i, createElementVNode as m, toDisplayString as b, Fragment as ee, renderList as Ne, withDirectives as te, createBlock as R, withCtx as k, createTextVNode as D, resolveDynamicComponent as je, createCommentVNode as c, vShow as ne, renderSlot as v, createVNode as p, unref as He, nextTick as oe, h as We } from "vue";
- import { n as Ge, B as Je, y as Qe, c_ as Xe } from "./index2.js";
- const Ye = { class: "tools" }, Ze = { class: "title" }, et = { class: "btn-list" }, tt = {
- key: 0,
- style: { "margin-left": "8px" }
- }, nt = { class: "list-layout-main" }, ot = {
- key: 0,
- class: "layout-list-content"
- }, lt = {
- key: 0,
- class: "filter-content"
- }, at = { class: "filter" }, it = {
- key: 1,
- class: "reset-wrap"
- }, st = {
- key: 1,
- class: "filter-more-content"
- }, ut = {
- key: 2,
- class: "desc-wrap"
- }, rt = { class: "table-content" }, dt = { class: "table-container" }, ct = ["onClick"], ft = {
- key: 1,
- class: "layout-list-content"
- }, mt = { class: "other" }, pt = /* @__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(u, { expose: r, emit: d }) {
- const S = u, g = d, le = a(null), ae = a(null), ie = a(null), f = a(null), E = a(null), K = a(null), I = a(!1), O = a(!1), q = a(300), $ = a(!1), U = a(20), V = a(!1), y = a([]), T = a([]), w = a([]), C = a([]), B = a({}), 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"
- }, ue = z(() => w.value.filter((e) => e.show !== !1)), N = z(() => C.value.map((e) => e.key).includes("import")), A = z(() => C.value.find((e) => e.key === "import") || {});
- Z(
- () => S.buttons,
- (e) => {
- e && e.length && re(e);
- },
- { immediate: !0, deep: !0 }
- ), Z(
- () => S.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 && se[e.key] || "";
- }
- function re(e) {
- C.value = e.map((t) => (t.key === "remove" && (V.value = !0), t));
- }
- function de(e) {
- oe(() => {
- x(), U.value = S.pSize, w.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"), s = document.querySelector(".ant-table-thead tr");
- n && s && s.removeChild(n), clearTimeout(t);
- }, 100);
- }
- function W(e = []) {
- de(e);
- }
- function P() {
- f.value && f.value.refresh(!0);
- }
- function G(e) {
- g("btnCallback", e.key, y.value);
- const t = Ie[e.key];
- typeof t == "function" ? t(e) : F(e);
- }
- function F(e) {
- if (e.selection !== !1 && !y.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: () => We(
- "div",
- { style: "color:var(--s-color-error)" },
- `${window.$l("确认要")}{${window.$l(e.name)}}${window.$l("数据吗?")}`
- ),
- onOk: () => {
- $.value = !0, e.api(y.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), g("reset");
- }).finally(() => {
- $.value = !1;
- });
- }
- });
- return;
- }
- $.value = !0, e.api(y.value).then(() => {
- window.$message.success(`${window.$l(e.name)}${window.$l("成功")}`), g("reset");
- }).finally(() => {
- $.value = !1;
- });
- }
- }
- function J(e, t) {
- typeof e == "string" ? Q(e, t) : e.forEach((n) => {
- Q(n, t);
- });
- }
- function Q(e, t) {
- const n = C.value.find((s) => s.key === e);
- if (!n) {
- console.error(`按钮(${e})未定义, 请确认该变更状态按钮是否设置正确`);
- return;
- }
- Object.keys(t).forEach((s) => {
- n[s] = t[s];
- });
- }
- function ce() {
- }
- function fe(e) {
- F(e);
- }
- function me() {
- if (!N.value) {
- g("btnCallback", "import");
- return;
- }
- I.value = !0;
- }
- function pe(e) {
- j(e.api, e.name, e.key) && ($.value = !0, e.api().then(() => {
- $.value = !1;
- }));
- }
- function ve(e) {
- return S.loadData(M(M({}, e), B.value));
- }
- function ye(e = [], t = 1) {
- const n = { filterMode: t, filterConditions: e };
- e.forEach((s) => {
- ["equal", "includes"].includes(s.equals) && n[s.dataIndex] === void 0 && (n[s.dataIndex] = s.value);
- }), B.value = n, f.value && f.value.refresh(!0);
- }
- function we() {
- B.value = {}, f.value && f.value.refresh(!0);
- }
- function he(e) {
- w.value = e;
- }
- function ke() {
- W(S.columns || []);
- }
- function $e(e, t) {
- g("tableColCallback", e, t);
- }
- function L(e) {
- return w.value.find((t) => t.dataIndex === e);
- }
- function _e(e) {
- const t = L(e);
- return !!(t && t.template);
- }
- function be(e) {
- const t = L(e);
- return !!(t && t.isClick);
- }
- function ge(e) {
- return e == null ? "" : typeof e == "object" ? e.name === void 0 ? "" : e.name : e;
- }
- function Ce(e) {
- y.value = e;
- }
- function x() {
- oe(Se);
- }
- function Se() {
- const e = f.value && f.value.$el, t = e && e.querySelector(".ant-table-body"), n = t && t.clientHeight;
- n && (q.value = Math.max(n - 8, 0));
- }
- function Oe() {
- O.value = !O.value, x();
- }
- function Re() {
- g("reset");
- }
- const Ie = {
- add: ce,
- delete: fe,
- import: me,
- export: pe,
- reload: P,
- setStateBtn: J,
- handAction: F
- };
- return qe(() => {
- }), Ue(() => x()), r({
- reload: P,
- spinning: $,
- selectedRowKeys: y,
- expandedRowKeys: T,
- renderColumns: w,
- renderButtons: C,
- setStateBtn: J,
- btnCallback: G,
- table: f,
- importVisible: I,
- measureLayout: x
- }), (e, t) => {
- const n = Je, s = h("SearchOutlined"), xe = h("SettingOutlined"), De = h("down-outlined"), Te = h("up-outlined"), Be = h("sync-outlined"), Ae = Qe, Pe = h("setting-filter"), Fe = h("setting-columns"), Le = h("s-import-modal"), Me = Ve("action");
- return l(), i("div", {
- class: "list-layout",
- ref_key: "layout",
- ref: le
- }, [
- m("div", Ye, [
- m("div", Ze, b(u.title), 1),
- m("div", et, [
- (l(!0), i(ee, null, Ne(C.value, (o) => (l(), i("span", {
- class: "item-btn",
- key: o.key
- }, [
- te((l(), R(n, {
- class: "btn",
- disabled: !!o.disabled,
- type: o.type || o.key === "add" ? "primary" : "default",
- onClick: (_) => G(o)
- }, {
- icon: k(() => [
- H(o) ? (l(), R(je(H(o)), { key: 0 })) : c("", !0)
- ]),
- default: k(() => [
- D(" " + b(e.$l(o.name)), 1)
- ]),
- _: 2
- }, 1032, ["disabled", "type", "onClick"])), [
- [Me, o.action || o.key],
- [ne, o.show !== !1]
- ])
- ]))), 128)),
- e.$slots.otherBtns ? (l(), i("span", tt, [
- v(e.$slots, "otherBtns", { selections: y.value }, void 0, !0)
- ])) : c("", !0),
- m("span", null, [
- p(n, {
- class: "btn",
- onClick: t[0] || (t[0] = (o) => {
- var _;
- return (_ = E.value) == null ? void 0 : _.show(w.value);
- })
- }, {
- default: k(() => [
- p(s),
- D(" " + b(e.$l("高级搜索")), 1)
- ]),
- _: 1
- }),
- p(n, {
- class: "btn",
- onClick: t[1] || (t[1] = (o) => {
- var _;
- return (_ = K.value) == null ? void 0 : _.show();
- })
- }, {
- default: k(() => [
- p(xe),
- D(" " + b(e.$l("高级表格")), 1)
- ]),
- _: 1
- })
- ])
- ])
- ]),
- m("div", nt, [
- e.$slots.empty ? (l(), i("div", ft, [
- v(e.$slots, "empty", {}, void 0, !0)
- ])) : (l(), i("div", ot, [
- e.$slots.filter || e.$slots.desc ? (l(), i("div", {
- key: 0,
- class: "list-filter-wrap",
- ref_key: "filters",
- ref: ae
- }, [
- e.$slots.filter ? (l(), i("div", lt, [
- m("div", at, [
- v(e.$slots, "filter", {}, void 0, !0)
- ]),
- e.$slots.filterMore ? (l(), i("a", {
- key: 0,
- class: "filter-more-btn",
- onClick: Oe
- }, [
- D(b(O.value ? e.$l("收起") : e.$l("更多")) + " ", 1),
- O.value ? (l(), R(Te, {
- key: 1,
- style: { "font-size": "12px" }
- })) : (l(), R(De, {
- key: 0,
- style: { "font-size": "12px" }
- }))
- ])) : c("", !0),
- e.$slots.filter ? (l(), i("div", it, [
- p(Ae, {
- placement: "top",
- overlayStyle: { maxWidth: "500px" },
- mouseEnterDelay: 1.5,
- mouseLeaveDelay: 0.5
- }, {
- title: k(() => [
- m("span", null, b(e.$l("条件重置")), 1)
- ]),
- default: k(() => [
- p(n, {
- style: { "padding-bottom": "2px" },
- onClick: Re
- }, {
- icon: k(() => [
- p(Be)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])) : c("", !0)
- ])) : c("", !0),
- e.$slots.filterMore ? te((l(), i("div", st, [
- v(e.$slots, "filterMore", {}, void 0, !0)
- ], 512)), [
- [ne, O.value]
- ]) : c("", !0),
- e.$slots.desc ? (l(), i("div", ut, [
- v(e.$slots, "desc", {}, void 0, !0)
- ])) : c("", !0)
- ], 512)) : c("", !0),
- m("div", rt, [
- e.$slots.tabs ? (l(), i("div", {
- key: 0,
- class: "tabs-wrap",
- ref_key: "tabs",
- ref: ie
- }, [
- v(e.$slots, "tabs", {}, void 0, !0)
- ], 512)) : c("", !0),
- m("div", dt, [
- p(He(Xe), {
- ref_key: "table",
- ref: f,
- size: "middle",
- scroll: { y: q.value, x: "100%" },
- pageSize: U.value,
- rowKey: u.rowKey,
- columns: ue.value,
- data: ve,
- "expanded-row-keys": T.value,
- "onUpdate:expandedRowKeys": t[2] || (t[2] = (o) => T.value = o),
- rowSelection: V.value || u.isSelection ? { selectedRowKeys: y.value, onChange: Ce } : null,
- showPagination: u.showPagination
- }, {
- bodyCell: k((o) => [
- o.column ? (l(), i(ee, { key: 0 }, [
- _e(o.column.dataIndex) ? v(e.$slots, o.column.dataIndex, {
- text: o.text,
- record: o.record,
- index: o.index,
- item: L(o.column.dataIndex)
- }, void 0, !0, 0) : be(o.column.dataIndex) ? (l(), i("a", {
- key: 1,
- onClick: (_) => $e(o.column.dataIndex, o.record)
- }, b(ge(o.text)), 9, ct)) : o.column.dataIndex === "action" ? v(e.$slots, "action", {
- record: o.record
- }, void 0, !0, 2) : c("", !0)
- ], 64)) : c("", !0)
- ]),
- _: 3
- }, 8, ["scroll", "pageSize", "rowKey", "columns", "expanded-row-keys", "rowSelection", "showPagination"])
- ])
- ])
- ]))
- ]),
- p(Pe, {
- ref_key: "filterRef",
- ref: E,
- columns: w.value,
- onSubmit: ye,
- onReset: we
- }, null, 8, ["columns"]),
- p(Fe, {
- ref_key: "columnsRef",
- ref: K,
- pageCode: "demo",
- columns: w.value,
- onSave: he,
- onReset: ke
- }, null, 8, ["columns"]),
- m("div", mt, [
- v(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: P
- }, null, 8, ["upload-url", "value", "columns", "apis"])) : c("", !0)
- ], 512);
- };
- }
- }), ht = /* @__PURE__ */ Ge(pt, [["__scopeId", "data-v-e3e6ac41"]]);
- export {
- ht as default
- };
|