@fskj-admin/core
Version:
[官方文档](https://unidoc.sxidc.com/admin/)
1,487 lines • 90.4 kB
JavaScript
import { defineComponent as G, computed as te, provide as oo, inject as se, resolveComponent as p, openBlock as s, createBlock as k, withCtx as t, createElementBlock as I, Fragment as N, renderList as w, unref as e, resolveDynamicComponent as _e, mergeProps as A, toHandlers as de, createSlots as M, renderSlot as S, normalizeProps as T, guardReactiveProps as q, createVNode as V, ref as U, watchEffect as to, watch as ue, useSlots as Pe, createCommentVNode as B, createElementVNode as Y, createTextVNode as H, toDisplayString as X, nextTick as $e, resolveDirective as Le, normalizeStyle as me, withDirectives as ce, isRef as fe, vShow as De, useCssVars as Be, withModifiers as Te, withKeys as lo, normalizeClass as Me } from "vue";
import { ElLoading as ao, ElMessage as ve, ElMessageBox as Ie } from "element-plus";
import { useRouter as qe } from "vue-router";
import { useStorage as no } from "@vueuse/core";
const Ce = [
"form-tabs",
"form-layout",
"form-card",
"form-group",
"form-steps",
"form-table",
"sub-form"
], so = [
"form-tabs",
"tab-pane",
"form-layout",
"row",
"col",
"form-card",
"divider",
"form-group",
"form-steps",
"button",
"tag",
"alert"
], ro = (o) => o ? o.startsWith("http") || o.startsWith("blob:") : !1, Ae = (o = 16) => {
const y = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), l = [];
if (o)
for (let f = 0; f < o; f++)
l[f] = y[0 | Math.random() * y.length];
else {
let f;
l[8] = l[13] = l[18] = l[23] = "-", l[14] = "4";
for (let g = 0; g < 36; g++)
l[g] || (f = 0 | Math.random() * 16, l[g] = y[g == 19 ? f & 3 | 8 : f]);
}
return l.join("");
}, Ne = (o, y) => (o.forEach((l) => {
l.slots && Array.prototype.push.apply(y, l.slots), l.children && Ne(l.children, y);
}), y), uo = (o, y) => (o.forEach((l) => {
l.formItemSlots && Array.prototype.push.apply(y, l.formItemSlots);
}), y), io = (o) => {
const y = (l, f) => {
l.forEach((g) => {
g.slots && Array.prototype.push.apply(f, g.slots), g.children && y(g.children, f);
});
};
o.forEach((l) => {
Ce.includes(l.type) && (l.slots = l.slots || [], l.children && y(l.children, l.slots));
});
}, mo = /* @__PURE__ */ G({
__name: "BasicForm",
props: {
formConfig: {},
formData: {}
},
setup(o) {
const y = o, l = te(() => {
if (y.formData.id)
return y.formData;
{
const v = y.formData, a = (d, b) => {
d.forEach((m) => {
(!m.notFormItem || !so.includes(m.type)) && (b[m.name] = b[m.name] !== void 0 && m.value !== void 0 ? b[m.name] : m.value), m.children && a(m.children, b);
});
};
return a(y.formConfig.formItems, v), v;
}
});
oo("formData", l.value);
const f = te(() => y.formConfig.formItems.filter((v) => !v.hidden));
io(y.formConfig.formItems);
const g = se("globalConfig", {});
return (v, a) => {
const d = p("form-comp"), b = p("el-form-item"), m = p("el-col"), C = p("el-row");
return s(), k(C, { gutter: 20 }, {
default: t(() => [
(s(!0), I(N, null, w(f.value, (n, h) => (s(), k(m, {
span: n.span || v.formConfig.span || e(g).formItemSpan || 12,
key: h
}, {
default: t(() => [
e(Ce).includes(n.type) ? (s(), k(_e("el-" + n.type), A({
key: 0,
modelValue: l.value[n.name],
"onUpdate:modelValue": (c) => l.value[n.name] = c
}, n.props, {
formItem: n,
formConfig: v.formConfig
}, de(n.events || {})), M({ _: 2 }, [
w(n.slots, (c) => ({
name: c.alias,
fn: t((i) => [
S(v.$slots, c.alias, T(q(i)), void 0, !0)
])
}))
]), 1040, ["modelValue", "onUpdate:modelValue", "formItem", "formConfig"])) : (s(), k(b, A({
key: 1,
label: n.label,
rules: n.rules,
prop: n.name
}, n.formItemProps), M({
default: t(() => [
V(d, {
item: n,
modelValue: l.value[n.name],
"onUpdate:modelValue": (c) => l.value[n.name] = c
}, M({ _: 2 }, [
w(n.slots, (c) => ({
name: c.alias,
fn: t((i) => [
S(v.$slots, c.alias, T(q(i)), void 0, !0)
])
}))
]), 1032, ["item", "modelValue", "onUpdate:modelValue"])
]),
_: 2
}, [
w(n.formItemSlots, (c) => ({
name: c.name,
fn: t((i) => [
S(v.$slots, c.alias, T(q(i)), void 0, !0)
])
}))
]), 1040, ["label", "rules", "prop"]))
]),
_: 2
}, 1032, ["span"]))), 128))
]),
_: 3
});
};
}
}), pe = (o, y) => {
const l = o.__vccOpts || o;
for (const [f, g] of y)
l[f] = g;
return l;
}, co = /* @__PURE__ */ pe(mo, [["__scopeId", "data-v-b8049675"]]), fo = {
install(o) {
o.component("BasicForm", co);
}
}, ke = (o, y) => {
const l = U({});
to(() => {
l.value = o.formData;
});
const f = te(() => o.formConfig.disabled ? "查看" : o.formData.id ? "编辑" : "新增"), g = te({
get: () => o.modelValue,
set: (C) => y("update:modelValue", C)
}), v = () => {
g.value = !1, l.value = {}, y("close");
}, a = U(), d = async () => {
await a.value.submit() && (v(), y("success"));
}, b = U([]), m = U([]);
return ue(
() => o.formConfig.formItems,
() => {
b.value = Ne(o.formConfig.formItems, b.value), m.value = uo(o.formConfig.formItems, m.value);
},
{ deep: !0, immediate: !0 }
), {
formInitData: l,
title: f,
visible: g,
close: v,
formRef: a,
submit: d,
formSlots: b,
formItemSlots: m
};
}, po = /* @__PURE__ */ G({
__name: "ProForm",
props: {
formConfig: {},
formData: {},
formSlots: {},
create: { type: Function },
update: { type: Function },
formSubmit: { type: Function }
},
setup(o, { expose: y }) {
var n;
const l = o, f = se("globalConfig", {}), g = U({
labelWidth: "100px",
labelPosition: "top",
size: "large",
...f.form,
...(n = l.formConfig) == null ? void 0 : n.props
}), v = te(() => l.formData), a = U(), { formSlots: d, formItemSlots: b } = ke(l), m = (h, c) => {
h.forEach((i) => {
i.type === "upload" && Array.isArray(c[i.name]) && (c[i.name] = c[i.name].join(",")), i.children && m(i.children, c);
});
};
return y({
submit: async () => {
let h, c;
return a.value.validate().then(async () => {
if (l.formSubmit)
return l.formSubmit({ ...v.value });
const i = ao.service();
try {
const r = { ...v.value };
return m(l.formConfig.formItems, r), r.id && l.update ? (c = await l.update(r), h = "编辑成功") : l.create ? (c = await l.create(r), h = "新增成功") : c = !1, i.close(), c === !1 ? !1 : (ve({
type: "success",
message: h
}), !0);
} catch {
return i.close(), !1;
}
});
},
formRef: a
}), (h, c) => {
const i = p("basic-form"), r = p("el-form");
return s(), k(r, A({
model: v.value,
disabled: h.formConfig.disabled,
ref_key: "formRef",
ref: a,
"status-icon": "",
scrollToError: ""
}, g.value, { class: "form" }), {
default: t(() => [
V(i, {
formConfig: h.formConfig,
formData: v.value
}, M({ _: 2 }, [
w(e(d), (_) => ({
name: _.alias,
fn: t((u) => [
S(h.$slots, _.alias, T(q(u)))
])
})),
w(e(b), (_) => ({
name: _.alias,
fn: t((u) => [
S(h.$slots, _.alias, T(q(u)))
])
}))
]), 1032, ["formConfig", "formData"])
]),
_: 3
}, 16, ["model", "disabled"]);
};
}
}), go = {
install(o) {
o.component("ProForm", po);
}
}, ho = {
class: "px-12px flex",
style: { flex: "1", "justify-content": "end" }
}, vo = {
key: 1,
class: "flex flex-items-start"
}, _o = { class: "flex-grow" }, yo = { class: "flex-shrink-0 ml-4" }, bo = /* @__PURE__ */ G({
__name: "ProSearch",
props: {
queryConfig: {},
searchList: {}
},
emits: ["query", "reset"],
setup(o, { expose: y, emit: l }) {
const f = o, g = l, v = Pe(), a = se("globalConfig", {}), d = U({}), b = U({}), m = (F) => {
F.value !== void 0 && F.value !== null && F.value !== "" && (d.value[F.name] = F.value, b.value[F.name] = F.value), F.children && F.children.forEach(m);
};
ue(
() => f.searchList,
(F) => {
F.forEach(m);
},
{ immediate: !0 }
);
const C = te(() => ({
maxShow: 3,
col: {
xs: 24,
sm: 12,
md: 8,
lg: 6
},
fold: !0,
fluid: !0,
searchText: "查询",
...a.queryConfig,
...f.queryConfig
})), n = U(!0), h = C.value.maxShow, c = te(() => n.value ? f.searchList.slice(0, h) : f.searchList), i = v.query && v.query(d).length || 0, r = te(() => h < f.searchList.length + i), _ = te(() => r.value ? !n.value : !0), u = () => {
n.value = !n.value;
}, $ = () => {
g("query", d.value);
}, E = () => {
d.value = { ...b.value }, g("reset", d.value);
};
return y({
queryData: d
}), (F, R) => {
const O = p("form-comp"), x = p("el-form-item"), ae = p("el-col"), K = p("el-button"), re = p("ArrowDown"), J = p("el-icon"), L = p("ArrowUp"), ee = p("el-row"), ge = p("el-form"), he = p("el-card");
return F.searchList.length || e(v).query ? (s(), k(he, {
key: 0,
class: "mb-4 shrink-0",
shadow: "never",
"body-style": { "padding-bottom": "0" }
}, {
default: t(() => [
e(C).fold ? (s(), k(ge, {
key: 0,
ref: "formRef",
model: e(d)
}, {
default: t(() => [
e(C).fluid ? (s(), k(ee, {
key: 0,
gutter: 24
}, {
default: t(() => [
(s(!0), I(N, null, w(e(c), (W, D) => (s(), k(ae, A(e(C).col, { key: D }), {
default: t(() => [
V(x, {
label: W.label
}, M({
default: t(() => [
V(O, {
item: W,
modelValue: e(d)[W.name],
"onUpdate:modelValue": (z) => e(d)[W.name] = z
}, M({ _: 2 }, [
w(W.slots, (z) => ({
name: z.alias,
fn: t(() => [
S(F.$slots, z.alias)
])
}))
]), 1032, ["item", "modelValue", "onUpdate:modelValue"])
]),
_: 2
}, [
w(W.formItemSlots, (z) => ({
name: z.name,
fn: t((Z) => [
S(F.$slots, z.alias, T(q(Z)))
])
}))
]), 1032, ["label"])
]),
_: 2
}, 1040))), 128)),
e(_) ? S(F.$slots, "query", {
key: 0,
query: e(d)
}) : B("", !0),
Y("div", ho, [
V(x, null, {
default: t(() => [
V(K, {
type: "primary",
icon: "Search",
onClick: $
}, {
default: t(() => [
H(X(e(C).searchText), 1)
]),
_: 1
}),
V(K, {
icon: "RefreshRight",
onClick: E
}, {
default: t(() => [
H("重置")
]),
_: 1
}),
e(r) ? (s(), k(K, {
key: 0,
link: "",
onClick: u
}, {
default: t(() => [
H(X(e(n) ? "展开" : "收起") + " ", 1),
e(n) ? (s(), k(J, { key: 0 }, {
default: t(() => [
V(re)
]),
_: 1
})) : (s(), k(J, { key: 1 }, {
default: t(() => [
V(L)
]),
_: 1
}))
]),
_: 1
})) : B("", !0)
]),
_: 1
})
])
]),
_: 3
})) : (s(), I("div", vo, [
Y("div", _o, [
V(ee, { gutter: 24 }, {
default: t(() => [
(s(!0), I(N, null, w(e(c), (W, D) => (s(), k(ae, A(e(C).col, { key: D }), {
default: t(() => [
V(x, {
label: W.label
}, M({
default: t(() => [
V(O, {
item: W,
modelValue: e(d)[W.name],
"onUpdate:modelValue": (z) => e(d)[W.name] = z
}, M({ _: 2 }, [
w(W.slots, (z) => ({
name: z.alias,
fn: t(() => [
S(F.$slots, z.alias)
])
}))
]), 1032, ["item", "modelValue", "onUpdate:modelValue"])
]),
_: 2
}, [
w(W.formItemSlots, (z) => ({
name: z.name,
fn: t((Z) => [
S(F.$slots, z.alias, T(q(Z)))
])
}))
]), 1032, ["label"])
]),
_: 2
}, 1040))), 128)),
e(_) ? S(F.$slots, "query", {
key: 0,
query: e(d)
}) : B("", !0)
]),
_: 3
})
]),
Y("div", yo, [
V(K, {
type: "primary",
icon: "Search",
onClick: $
}, {
default: t(() => [
H(X(e(C).searchText), 1)
]),
_: 1
}),
V(K, {
icon: "RefreshRight",
onClick: E
}, {
default: t(() => [
H("重置")
]),
_: 1
}),
e(r) ? (s(), k(K, {
key: 0,
link: "",
onClick: u
}, {
default: t(() => [
H(X(e(n) ? "展开" : "收起") + " ", 1),
e(n) ? (s(), k(J, { key: 0 }, {
default: t(() => [
V(re)
]),
_: 1
})) : (s(), k(J, { key: 1 }, {
default: t(() => [
V(L)
]),
_: 1
}))
]),
_: 1
})) : B("", !0)
])
]))
]),
_: 3
}, 8, ["model"])) : (s(), k(ge, {
key: 1,
ref: "formRef",
model: e(d),
inline: !0
}, {
default: t(() => [
(s(!0), I(N, null, w(F.searchList, (W, D) => (s(), k(x, {
label: W.label,
key: D
}, M({
default: t(() => [
V(O, {
item: W,
modelValue: e(d)[W.name],
"onUpdate:modelValue": (z) => e(d)[W.name] = z
}, M({ _: 2 }, [
w(W.slots, (z) => ({
name: z.alias,
fn: t(() => [
S(F.$slots, z.alias)
])
}))
]), 1032, ["item", "modelValue", "onUpdate:modelValue"])
]),
_: 2
}, [
w(W.formItemSlots, (z) => ({
name: z.name,
fn: t((Z) => [
S(F.$slots, z.alias, T(q(Z)))
])
}))
]), 1032, ["label"]))), 128)),
S(F.$slots, "query", { query: e(d) }),
V(x, null, {
default: t(() => [
V(K, {
type: "primary",
icon: "Search",
onClick: $
}, {
default: t(() => [
H(X(e(C).searchText), 1)
]),
_: 1
}),
V(K, {
icon: "RefreshRight",
onClick: E
}, {
default: t(() => [
H("重置")
]),
_: 1
})
]),
_: 1
})
]),
_: 3
}, 8, ["model"]))
]),
_: 3
})) : B("", !0);
};
}
}), Co = {
install(o) {
o.component("ProSearch", bo);
}
}, Qe = (o, y) => {
var W;
const l = U([]), f = (D) => {
D.search && l.value.push(Object.assign({}, D, { props: { ...D.props, disabled: !1 } })), D.children && D.children.forEach(f);
};
ue(
() => o.formConfig.formItems,
(D) => {
l.value = [], D.forEach((z) => {
f(z);
});
},
{ immediate: !0, deep: !0 }
);
const g = () => {
C.value = 1, h();
}, v = async (D) => {
if (!o.beforeQuery)
return g();
let z = !0;
try {
z = await o.beforeQuery(D);
} catch {
z = !1;
}
z !== !1 && g();
}, a = (D) => {
y("click-reset", D), g();
}, d = U(!1), b = U([]), m = U(0), C = U(1), n = U(((W = o.paginationConfig.value) == null ? void 0 : W.pageSize) || 10), h = () => {
var D, z, Z;
d.value = !0, (Z = o.crud) == null || Z.getList({
...(z = (D = o.queryRef) == null ? void 0 : D.value) == null ? void 0 : z.queryData,
pageSize: n.value,
pageNo: C.value
}).then((ne) => {
b.value = ne.infos || ne.list || ne.records || ne.rows, m.value = ne.total || ne.totalCount || 0;
}).finally(() => {
d.value = !1;
});
};
h();
const c = () => {
C.value = 1, h();
}, i = () => {
h();
}, r = (D) => {
n.value = D, C.value = 1, h();
}, _ = U(o.formConfig.route), u = U({}), $ = U(!1), E = () => {
y("click-create"), _.value ? qe().push(_.value) : (u.value = {}, o.formConfig.disabled = !1, $.value = !0);
}, F = async () => {
if (!o.beforeCreate)
return E();
let D = !0;
try {
D = await o.beforeCreate(u.value);
} catch {
D = !1;
}
D !== !1 && E();
}, R = (D, z) => {
var Z;
_.value ? qe().push(_.value) : ((Z = o.crud) != null && Z.getRecord ? (u.value = {}, o.crud.getRecord({ id: D.id }).then((ne) => {
u.value = ne.data || ne.info;
})) : u.value = { ...D }, o.formConfig.disabled = z, $.value = !0);
}, O = (D) => {
y("click-edit", D), R(D, !1);
}, x = (D) => {
y("click-view", D), R(D, !0);
}, ae = (D) => {
D.success || D.code === 200 ? (h(), ve({
type: "success",
message: "删除成功"
})) : ve.error(D.msg);
}, re = {
...se("globalConfig", {}).dialogConfig,
...o.dialogConfig
};
let J = {
type: "warning"
};
re.btnExchange && (J = {
type: "warning",
customClass: "el-message-box-exchange"
});
const L = (D) => {
Ie.confirm(
o.tableConfig.value.deleteMessage,
"提示",
J
).then(async () => {
var Z;
const z = await ((Z = o.crud) == null ? void 0 : Z.delete({ id: D }));
ae(z);
});
}, ee = U([]);
return {
tableData: b,
total: m,
curPage: C,
pageSize: n,
loading: d,
formData: u,
formVisible: $,
multipleSelection: ee,
getTableData: h,
refresh: c,
handleCreate: F,
handleDelete: L,
handleBatchDelete: () => {
Ie.confirm(
o.tableConfig.value.batchDeleteMessage,
"提示",
J
).then(async () => {
if (o.crud.deleteBatch) {
const D = await o.crud.deleteBatch({
ids: ee.value.map((z) => z.id).join(",")
});
ae(D);
} else
ve({
type: "error",
message: "未提供deleteBatch方法"
});
});
},
handleUpdate: O,
handleView: x,
handleFormSuccess: () => {
h();
},
handlePageSizeChange: r,
handleCurrentChange: i,
searchList: l,
handleQuery: v,
handleReset: a
};
}, ko = { class: "flex flex-col h-full" }, Vo = /* @__PURE__ */ G({
inheritAttrs: !1,
__name: "ProTable",
props: {
crud: {},
selection: { type: Boolean, default: !0 },
formConfig: {},
dialogConfig: {},
drawerConfig: {},
tableConfig: {},
toolbarConfig: {},
queryConfig: {},
showToolbar: { type: Boolean, default: !0 },
height: {},
formMode: { default: "dialog" },
beforeCreate: {},
beforeQuery: {},
paginationConfig: {}
},
emits: [
"click-create",
"click-edit",
"click-view",
"checkbox-change",
"click-reset"
],
setup(o, { expose: y, emit: l }) {
var Ue;
const f = o, g = l, v = Pe(), a = se("globalConfig", {}), d = U(), b = te(() => ({
...a.paginationConfig,
...f.paginationConfig
})), m = a.tableConfig || {}, C = {
description: "暂无数据",
...m.empty,
...(Ue = f.tableConfig) == null ? void 0 : Ue.empty
}, n = te(() => ({
showOperate: !0,
showView: !1,
viewText: "查看",
showAdd: !0,
addText: "新增",
showBatchDelete: !0,
batchDeleteText: "删除",
showEdit: !0,
editText: "编辑",
showDelete: !0,
deleteText: "删除",
operateWidth: 140,
batchDeleteMessage: "您确定要删除吗",
deleteMessage: "您确定要删除该项吗",
...m,
...f.tableConfig
})), h = {
...a.toolbarConfig,
...f.toolbarConfig
}, {
tableData: c,
formData: i,
total: r,
curPage: _,
pageSize: u,
loading: $,
formVisible: E,
multipleSelection: F,
refresh: R,
handleCreate: O,
handleDelete: x,
handleBatchDelete: ae,
handleUpdate: K,
handleView: re,
handleFormSuccess: J,
handlePageSizeChange: L,
handleCurrentChange: ee,
searchList: ge,
handleQuery: he,
handleReset: W
} = Qe({ ...f, paginationConfig: b, queryRef: d, tableConfig: n }, g), D = U(), z = U();
$e(() => {
const P = D.value, oe = z.value;
oe && P.connect(oe);
});
const Z = () => {
F.value = D.value.getCheckboxRecords(), g("checkbox-change", F.value);
}, ne = U(null), ye = U(null), Ve = U(), Se = () => {
const P = ne.value ? ne.value.offsetHeight : 0, oe = ye.value ? ye.value.offsetHeight : 0;
Ve.value = `calc(100% - ${P + oe}px)`;
};
$e(() => {
Se();
}), ue(
() => f.showToolbar,
() => {
$e(() => {
Se();
});
}
);
const j = ({ rowIndex: P }) => P + 1 + (_.value - 1) * u.value, { formSlots: le, formItemSlots: Fe } = ke(f), je = se("permissionList", no("permissionList", [])), Oe = (P) => (Array.isArray(P) || (P = (P == null ? void 0 : P.split(",")) || []), je.value.some((oe) => P.includes(oe))), we = {
mounted(P, oe) {
if (oe.arg) {
if (Oe(oe.value))
return;
P.parentNode && P.parentNode.removeChild(P);
}
}
}, ze = U(), Ee = U();
return y({
handleCreate: O,
handleDelete: x,
handleUpdate: K,
handleView: re,
handleQuery: he,
handleReset: W,
handleCurrentChange: ee,
refresh: R,
formData: i,
table: D,
queryRef: d,
getForm: () => {
var P, oe;
return f.formMode === "dialog" ? (P = ze.value) == null ? void 0 : P.getForm() : (oe = Ee.value) == null ? void 0 : oe.getForm();
}
}), (P, oe) => {
const We = p("pro-search"), be = p("el-button"), Je = p("vxe-toolbar"), Re = p("vxe-column"), Xe = p("el-empty"), Ye = p("vxe-table"), Ge = p("el-pagination"), Ke = p("el-card"), Ze = p("dialog-form"), xe = p("drawer-form"), eo = Le("loading");
return s(), I(N, null, [
Y("div", {
class: "flex flex-col fs-pro-table",
style: me([{ "max-height": "100vh" }, { height: P.height || "100%" }])
}, [
V(We, {
ref_key: "queryRef",
ref: d,
searchList: e(ge),
queryConfig: P.queryConfig,
onQuery: e(he),
onReset: e(W)
}, M({ _: 2 }, [
w(e(le), (Q) => ({
name: Q.alias,
fn: t((ie) => [
S(P.$slots, Q.alias, T(q(ie)), void 0, !0)
])
})),
e(v).query ? {
name: "query",
fn: t(({ query: Q }) => [
S(P.$slots, "query", { query: Q }, void 0, !0)
]),
key: "0"
} : void 0,
w(e(Fe), (Q) => ({
name: Q.alias,
fn: t((ie) => [
S(P.$slots, Q.alias, T(q(ie)), void 0, !0)
])
}))
]), 1032, ["searchList", "queryConfig", "onQuery", "onReset"]),
V(Ke, {
class: "h-full flex-grow",
"body-style": { height: "100%" },
shadow: "never"
}, {
default: t(() => [
Y("div", ko, [
Y("div", {
ref_key: "toolbarRef",
ref: ne,
class: "shrink-0"
}, [
S(P.$slots, "header", {}, void 0, !0),
P.showToolbar ? (s(), k(Je, A({
key: 0,
ref_key: "xToolbar",
ref: z,
"refresh-options": { queryMethod: e(R) }
}, h), {
buttons: t(() => [
e(n).showAdd ? ce((s(), k(be, {
key: 0,
type: "primary",
icon: "Plus",
onClick: e(O)
}, {
default: t(() => [
H(X(e(n).addText), 1)
]),
_: 1
}, 8, ["onClick"])), [
[we, e(n).addPermission, e(n).addPermission]
]) : B("", !0),
e(n).showBatchDelete && P.selection ? ce((s(), k(be, {
key: 1,
type: "danger",
icon: "Delete",
onClick: e(ae),
disabled: !e(F).length
}, {
default: t(() => [
H(X(e(n).batchDeleteText), 1)
]),
_: 1
}, 8, ["onClick", "disabled"])), [
[we, e(n).deletePermission, e(n).deletePermission]
]) : B("", !0),
S(P.$slots, "toolbar", { selection: e(F) }, void 0, !0)
]),
_: 3
}, 16, ["refresh-options"])) : B("", !0)
], 512),
Y("div", {
style: me({ height: e(Ve) })
}, [
ce((s(), k(Ye, A({
ref_key: "xTable",
ref: D,
id: "xProTable",
size: "medium",
"auto-resize": "",
height: "auto",
data: e(c),
"row-config": { isHover: !0 },
"seq-config": { seqMethod: j },
"column-config": e(n).columnConfig
}, P.$attrs, {
onCheckboxChange: Z,
onCheckboxAll: Z
}), {
empty: t(() => [
V(Xe, {
description: C.description,
"image-size": C.imageSize,
image: C.image
}, null, 8, ["description", "image-size", "image"])
]),
default: t(() => [
P.selection ? (s(), k(Re, {
key: 0,
type: "checkbox",
width: "50"
})) : B("", !0),
S(P.$slots, "default", {}, void 0, !0),
e(n).showOperate ? (s(), k(Re, {
key: 1,
fixed: "right",
title: "操作",
width: e(n).operateWidth
}, {
default: t(({ row: Q }) => [
S(P.$slots, "operateBefore", { row: Q }, void 0, !0),
e(n).showView ? (s(), k(be, A({
key: 0,
size: "small"
}, e(n).operateBtn, {
onClick: (ie) => e(re)(Q)
}), {
default: t(() => [
H(X(e(n).viewText), 1)
]),
_: 2
}, 1040, ["onClick"])) : B("", !0),
e(n).showEdit ? ce((s(), k(be, A({
key: 1,
type: "primary",
size: "small"
}, e(n).operateBtn, {
onClick: (ie) => e(K)(Q)
}), {
default: t(() => [
H(X(e(n).editText), 1)
]),
_: 2
}, 1040, ["onClick"])), [
[we, e(n).editPermission, e(n).editPermission]
]) : B("", !0),
e(n).showDelete ? ce((s(), k(be, A({
key: 2,
type: "danger",
size: "small"
}, e(n).operateBtn, {
onClick: (ie) => e(x)(Q.id)
}), {
default: t(() => [
H(X(e(n).deleteText), 1)
]),
_: 2
}, 1040, ["onClick"])), [
[we, e(n).deletePermission, e(n).deletePermission]
]) : B("", !0),
S(P.$slots, "operateAfter", { row: Q }, void 0, !0)
]),
_: 3
}, 8, ["width"])) : B("", !0)
]),
_: 3
}, 16, ["data", "seq-config", "column-config"])), [
[eo, e($)]
])
], 4),
Y("div", {
ref_key: "paginationRef",
ref: ye
}, [
V(Ge, A({
background: "",
"current-page": e(_),
"onUpdate:currentPage": oe[0] || (oe[0] = (Q) => fe(_) ? _.value = Q : null),
layout: "->,total, sizes, prev, pager, next, jumper",
total: e(r)
}, e(b), {
onSizeChange: e(L),
onCurrentChange: e(ee),
class: "mt-16px"
}), null, 16, ["current-page", "total", "onSizeChange", "onCurrentChange"])
], 512)
])
]),
_: 3
})
], 4),
P.formMode === "dialog" ? (s(), I(N, { key: 0 }, [
e(E) ? (s(), k(Ze, {
key: 0,
ref_key: "dialogFormRef",
ref: ze,
modelValue: e(E),
"onUpdate:modelValue": oe[1] || (oe[1] = (Q) => fe(E) ? E.value = Q : null),
dialogConfig: P.dialogConfig,
formConfig: P.formConfig,
formData: e(i),
formSlots: e(le),
create: P.crud.create,
update: P.crud.update,
onSuccess: e(J)
}, M({ _: 2 }, [
w(e(le), (Q) => ({
name: Q.alias,
fn: t((ie) => [
S(P.$slots, Q.alias, T(q(ie)), void 0, !0)
])
})),
w(e(Fe), (Q) => ({
name: Q.alias,
fn: t((ie) => [
S(P.$slots, Q.alias, T(q(ie)), void 0, !0)
])
}))
]), 1032, ["modelValue", "dialogConfig", "formConfig", "formData", "formSlots", "create", "update", "onSuccess"])) : B("", !0)
], 64)) : (s(), I(N, { key: 1 }, [
e(E) ? (s(), k(xe, {
key: 0,
ref_key: "drawerFormRef",
ref: Ee,
modelValue: e(E),
"onUpdate:modelValue": oe[2] || (oe[2] = (Q) => fe(E) ? E.value = Q : null),
drawerConfig: P.drawerConfig,
formConfig: P.formConfig,
formData: e(i),
formSlots: e(le),
create: P.crud.create,
update: P.crud.update,
onSuccess: e(J)
}, M({ _: 2 }, [
w(e(le), (Q) => ({
name: Q.alias,
fn: t((ie) => [
S(P.$slots, Q.alias, T(q(ie)), void 0, !0)
])
})),
w(e(Fe), (Q) => ({
name: Q.alias,
fn: t((ie) => [
S(P.$slots, Q.alias, T(q(ie)), void 0, !0)
])
}))
]), 1032, ["modelValue", "drawerConfig", "formConfig", "formData", "formSlots", "create", "update", "onSuccess"])) : B("", !0)
], 64))
], 64);
};
}
}), So = /* @__PURE__ */ pe(Vo, [["__scopeId", "data-v-cc084e15"]]), wo = {
install(o) {
o.component("ProTable", So);
}
}, $o = /* @__PURE__ */ G({
__name: "DialogForm",
props: {
modelValue: { type: Boolean },
dialogConfig: {},
dialogEvents: {},
formSlots: {},
formConfig: {},
formData: {},
create: { type: Function },
update: { type: Function },
formSubmit: { type: Function }
},
emits: ["update:modelValue", "success", "close"],
setup(o, { expose: y, emit: l }) {
const f = o, g = l, a = {
confirmText: "确定",
cancelText: "取消",
btnIcon: !0,
...se("globalConfig", {}).dialogConfig,
...f.dialogConfig
}, { formInitData: d, formRef: b, title: m, visible: C, formSlots: n, formItemSlots: h, close: c, submit: i } = ke(
f,
g
);
return y({
getForm: () => {
var _;
return (_ = b.value) == null ? void 0 : _.formRef;
},
submit: i
}), (_, u) => {
const $ = p("pro-form"), E = p("el-button"), F = p("el-dialog");
return s(), I("div", null, [
V(F, A({
draggable: "",
class: { "dialog-footer-btn-exchange": a == null ? void 0 : a.btnExchange },
title: e(m),
"align-center": ""
}, a, {
modelValue: e(C),
"onUpdate:modelValue": u[0] || (u[0] = (R) => fe(C) ? C.value = R : null),
onClose: e(c)
}, de(_.dialogEvents || {}), { "close-on-click-modal": !1 }), {
footer: t(() => [
V(E, {
icon: a.btnIcon ? "Close" : "",
onClick: e(c)
}, {
default: t(() => [
H(X(a == null ? void 0 : a.cancelText), 1)
]),
_: 1
}, 8, ["icon", "onClick"]),
_.formConfig.disabled ? B("", !0) : (s(), k(E, {
key: 0,
icon: a.btnIcon ? "Check" : "",
type: "primary",
onClick: e(i)
}, {
default: t(() => [
H(X(a == null ? void 0 : a.confirmText), 1)
]),
_: 1
}, 8, ["icon", "onClick"]))
]),
default: t(() => [
V($, {
class: "pro-form",
ref_key: "formRef",
ref: b,
formConfig: _.formConfig,
formData: e(d),
formSlots: e(n),
create: _.create,
update: _.update,
formSubmit: _.formSubmit
}, M({ _: 2 }, [
w(e(n), (R) => ({
name: R.alias,
fn: t((O) => [
S(_.$slots, R.alias, T(q(O)), void 0, !0)
])
})),
w(e(h), (R) => ({
name: R.alias,
fn: t((O) => [
S(_.$slots, R.alias, T(q(O)), void 0, !0)
])
}))
]), 1032, ["formConfig", "formData", "formSlots", "create", "update", "formSubmit"])
]),
_: 3
}, 16, ["class", "title", "modelValue", "onClose"])
]);
};
}
}), Do = /* @__PURE__ */ pe($o, [["__scopeId", "data-v-83b457c6"]]), Fo = {
install(o) {
o.component("DialogForm", Do);
}
}, Io = /* @__PURE__ */ G({
__name: "DrawerForm",
props: {
modelValue: { type: Boolean },
drawerConfig: {},
formSlots: {},
formConfig: {},
formData: {},
create: { type: Function },
update: { type: Function }
},
emits: ["update:modelValue", "success"],
setup(o, { expose: y, emit: l }) {
const f = o, g = l, { formInitData: v, formRef: a, title: d, visible: b, formSlots: m, formItemSlots: C, close: n, submit: h } = ke(
f,
g
), i = {
confirmText: "确定",
cancelText: "取消",
btnIcon: !0,
...se("globalConfig", {}).drawerConfig,
...f.drawerConfig
};
return y({
getForm: () => {
var _;
return (_ = a.value) == null ? void 0 : _.formRef;
},
submit: h
}), (_, u) => {
const $ = p("pro-form"), E = p("el-button"), F = p("el-drawer");
return s(), I("div", null, [
V(F, A({
class: { "drawer-footer-btn-exchange": i == null ? void 0 : i.btnExchange },
title: e(d)
}, i, {
modelValue: e(b),
"onUpdate:modelValue": u[0] || (u[0] = (R) => fe(b) ? b.value = R : null),
onClose: e(n),
"close-on-click-modal": !1
}), M({
default: t(() => [
V($, {
class: "pro-form",
ref_key: "formRef",
ref: a,
formConfig: _.formConfig,
formData: e(v),
formSlots: e(m),
create: _.create,
update: _.update
}, M({ _: 2 }, [
w(e(m), (R) => ({
name: R.alias,
fn: t((O) => [
S(_.$slots, R.alias, T(q(O)))
])
})),
w(e(C), (R) => ({
name: R.alias,
fn: t((O) => [
S(_.$slots, R.alias, T(q(O)))
])
}))
]), 1032, ["formConfig", "formData", "formSlots", "create", "update"])
]),
_: 2
}, [
_.formConfig.disabled ? void 0 : {
name: "footer",
fn: t(() => [
V(E, {
icon: i.btnIcon ? "Close" : "",
onClick: e(n)
}, {
default: t(() => [
H(X(i == null ? void 0 : i.cancelText), 1)
]),
_: 1
}, 8, ["icon", "onClick"]),
V(E, {
icon: i.btnIcon ? "Check" : "",
type: "primary",
onClick: e(h)
}, {
default: t(() => [
H(X(i == null ? void 0 : i.confirmText), 1)
]),
_: 1
}, 8, ["icon", "onClick"])
]),
key: "0"
}
]), 1040, ["class", "title", "modelValue", "onClose"])
]);
};
}
}), Po = {
install(o) {
o.component("DrawerForm", Io);
}
}, zo = ["innerHTML"], Eo = /* @__PURE__ */ G({
__name: "FormComp",
props: {
modelValue: {},
item: {}
},
emits: ["update:modelValue"],
setup(o, { emit: y }) {
const l = o, f = y, g = te({
get: () => l.modelValue,
set: (a) => f("update:modelValue", a)
}), v = (a) => [
"select",
"cascader",
"date-picker",
"time-picker",
"time-select",
"dict",
"area",
"tree-select"
].includes(a.type) ? "请选择" + a.label : "请输入" + a.label;
return l.item.request && l.item.request(l.item).then((a) => {
l.item.options = a;
}), (a, d) => {
var i;
const b = p("el-cascader"), m = p("el-date-picker"), C = p("el-upload"), n = p("el-radio"), h = p("el-checkbox"), c = p("el-option");
return a.item.type === "cascader" ? (s(), k(b, A({
key: 0,
style: { width: "100%" },
modelValue: g.value,
"onUpdate:modelValue": d[0] || (d[0] = (r) => g.value = r),
clearable: ""
}, a.item.props, de(a.item.events || {}), {
placeholder: a.item.placeholder || v(a.item)
}), M({ _: 2 }, [
w(a.item.slots, (r) => ({
name: r.name,
fn: t(({ node: _, data: u }) => [
S(a.$slots, r.alias, {
node: _,
data: u
})
])
}))
]), 1040, ["modelValue", "placeholder"])) : a.item.type === "date-picker" ? (s(), k(m, A({
key: 1,
style: { width: "100%" },
modelValue: g.value,
"onUpdate:modelValue": d[1] || (d[1] = (r) => g.value = r),
clearable: ""
}, a.item.props, de(a.item.events || {}), {
placeholder: a.item.placeholder || v(a.item)
}), M({ _: 2 }, [
w(a.item.slots, (r) => ({
name: r.name,
fn: t((_) => [
S(a.$slots, r.alias, T(q(_)))
])
}))
]), 1040, ["modelValue", "placeholder"])) : a.item.type === "upload" ? (s(), k(C, A({
key: 2,
"file-list": g.value,
"onUpdate:fileList": d[2] || (d[2] = (r) => g.value = r)
}, a.item.props, de(a.item.events || {})), null, 16, ["file-list"])) : a.item.type === "form-html" ? (s(), I("div", {
key: 3,
innerHTML: (i = a.item.props) == null ? void 0 : i.html
}, null, 8, zo)) : (s(), k(_e("el-" + a.item.type), A({
key: 4,
item: a.item,
modelValue: g.value,
"onUpdate:modelValue": d[3] || (d[3] = (r) => g.value = r),
clearable: ""
}, a.item.props, {
placeholder: a.item.placeholder || v(a.item)
}, de(a.item.events || {})), M({
default: t(() => {
var r, _, u, $;
return [
a.item.type === "button" ? (s(), I(N, { key: 0 }, [
H(X((r = a.item.props) == null ? void 0 : r.buttonName), 1)
], 64)) : B("", !0),
a.item.type === "tag" ? (s(), I(N, { key: 1 }, [
H(X((_ = a.item.props) == null ? void 0 : _.tagName), 1)
], 64)) : B("", !0),
a.item.type === "divider" ? (s(), I(N, { key: 2 }, [
H(X((u = a.item.props) == null ? void 0 : u.dividerName), 1)
], 64)) : B("", !0),
a.item.type === "text" ? (s(), I(N, { key: 3 }, [
H(X(($ = a.item.props) == null ? void 0 : $.textName), 1)
], 64)) : B("", !0),
a.item.type === "radio-group" ? (s(!0), I(N, { key: 4 }, w(a.item.options, (E, F) => {
var R;
return s(), k(n, A({
label: E.label,
key: F,
border: (R = a.item.props) == null ? void 0 : R.border
}, E.props), {
default: t(() => [
H(X(E.value), 1)
]),
_: 2
}, 1040, ["label", "border"]);
}), 128)) : B("", !0),
a.item.type === "checkbox-group" ? (s(!0), I(N, { key: 5 }, w(a.item.options, (E, F) => {
var R;
return s(), k(h, A({
label: E.label,
value: E.value,
key: F,
border: (R = a.item.props) == null ? void 0 : R.border
}, E.props), {
default: t(() => [
H(X(E.value), 1)
]),
_: 2
}, 1040, ["label", "value", "border"]);
}), 128)) : B("", !0),
a.item.type === "select" ? (s(!0), I(N, { key: 6 }, w(a.item.options, (E, F) => (s(), k(c, A({
label: E.label,
value: E.value,
key: F,
clearable: ""
}, E.props), null, 16, ["label", "value"]))), 128)) : B("", !0)
];
}),
_: 2
}, [
w(a.item.slots, (r) => ({
name: r.name,
fn: t((_) => [
S(a.$slots, r.alias, T(q(_)))
])
}))
]), 1040, ["item", "modelValue", "placeholder"]));
};
}
}), Uo = {
install(o) {
o.component("FormComp", Eo);
}
}, Ro = /* @__PURE__ */ G({
inheritAttrs: !1,
__name: "ElCustom",
setup(o) {
return (y, l) => S(y.$slots, "default");
}
}), To = {
install(o) {
o.component("ElCustom", Ro);
}
}, qo = /* @__PURE__ */ G({
__name: "ElFormCard",
props: {
formItem: {},
formConfig: {}
},
setup(o) {
var g;
const y = o, l = se("formData"), f = (g = y.formItem.slots) == null ? void 0 : g.find((v) => v.name === "header");
return (v, a) => {
const d = p("form-comp"), b = p("el-form-item"), m = p("el-col"), C = p("el-row"), n = p("el-card");
return s(), k(n, {
header: v.formItem.label
}, M({
default: t(() => [
V(C, { gutter: 20 }, {
default: t(() => [
(s(!0), I(N, null, w(v.formItem.children, (h, c) => ce((s(), k(m, {
span: h.span || v.formConfig.span || 12,
key: c
}, {
default: t(() => [
e(Ce).includes(h.type) ? (s(), k(_e("el-" + h.type), A({
key: 0,
modelValue: h.value,
"onUpdate:modelValue": (i) => h.value = i
}, h.props, {
children: h.children,
formItem: h,
formConfig: v.formConfig
}, de(h.events || {})), M({ _: 2 }, [
w(h.slots, (i) => ({
name: i.alias,
fn: t((r) => [
S(v.$slots, i.alias, T(q(r)))
])
}))
]), 1040, ["modelValue", "onUpdate:modelValue", "children", "formItem", "formConfig"])) : (s(), k(b, A({
key: 1,
label: h.label,
rules: h.rules,
prop: h.name
}, h.formItemProps), {
default: t(() => [
V(d, {
item: h,
modelValue: e(l)[h.name],
"onUpdate:modelValue": (i) => e(l)[h.name] = i
}, M({ _: 2 }, [
w(h.slots, (i) => ({
name: i.alias,
fn: t((r) => [
S(v.$slots, i.alias, T(q(r)))
])
}))
]), 1032,