quick-admin-vue3-core
Version:
以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板
133 lines (132 loc) • 5.37 kB
JavaScript
import { defineComponent as D, mergeDefaults as M, useSlots as P, ref as g, watch as I, resolveComponent as F, createBlock as u, openBlock as a, mergeProps as K, unref as l, withKeys as U, withCtx as c, renderSlot as d, createElementBlock as b, createCommentVNode as k, Fragment as R, normalizeClass as j, renderList as G, reactive as H } from "vue";
import { a as L, d as N, e as O } from "./index-C0qRtkRj.js";
import { _ as q } from "./Index.vue_vue_type_script_setup_true_lang-C2wcd99b.js";
import { F as J } from "./FooterBtns-BHFZNJWr.js";
import { _ as Q, c as W, k as X, l as Y } from "./platform-DsTwHxm6.js";
/* empty css */
import { u as Z } from "./form-attrs-Ddm3tVIR.js";
import { u as x } from "./index-9d6RO4hD.js";
import { _ } from "./_plugin-vue_export-helper-CHgC5LLL.js";
var V, S;
const ee = /* @__PURE__ */ D({
__name: "BaseForm",
props: /* @__PURE__ */ M({
modelValue: {},
fields: {},
grid: {},
pureText: { type: Boolean },
styleType: {},
footer: { type: [Boolean, Object, Array] },
autoFixedFoot: { type: Boolean },
submitBtn: {},
resetBtn: {},
moreBtns: {},
loading: { type: Boolean },
extraParams: {},
omits: { type: [Boolean, Array] },
fetch: { type: Function },
afterSuccess: { type: Function },
afterFail: { type: Function },
afterReset: { type: Function },
log: { type: [Boolean, String] },
debug: { type: Boolean }
}, {
modelValue: () => H({}),
log: X,
footer: !0,
omits: !0,
autoFixedFoot: !0,
fields: () => [],
grid: (p) => p.styleType === "cell" ? O[Y] : 24,
...(S = (V = W) == null ? void 0 : V.BaseForm) == null ? void 0 : S.Index
}),
emits: ["update:modelValue", "moreBtns", "submit", "reset", "blur", "focus", "change"],
setup(p, { expose: T, emit: w }) {
const { merge: v } = Q, C = P(), B = p, s = w, { disabled: $ } = Z(), f = g(null), i = g(), n = g([]), m = x(B, "modelValue", s);
I(
() => B.fields,
(e) => {
const { data: o, fields: y } = L(e, B.modelValue);
n.value = y, v(m.value, o);
},
{ immediate: !0, deep: !0 }
);
function h() {
f.value.submit();
}
return T({
formRef: i,
validate: () => f.value.validate(),
reset: () => f.value.reset()
}), (e, o) => {
const y = F("el-row"), A = F("BaseEmpty"), E = F("el-form");
return a(), u(E, K({
class: ["base-form f-fs-s-c f-1", e.styleType],
model: l(m)
}, l(N), {
onKeyup: U(h, ["enter"]),
ref_key: "formRef",
ref: i
}), {
default: c(() => [
d(e.$slots, "header", {}, void 0, !0),
C.content ? d(e.$slots, "content", { key: 0 }, void 0, !0) : (a(), b(R, { key: 1 }, [
n.value.length ? (a(), u(y, {
key: 0,
class: j(["section all-hide-scroll", [n.value.length ? "f-fs-s-w" : "f-c-c", e.autoFixedFoot && "auto-fixed-foot"]])
}, {
default: c(() => [
(a(!0), b(R, null, G(n.value, (t, z) => (a(), u(q, {
modelValue: l(m)[t.prop],
"onUpdate:modelValue": (r) => l(m)[t.prop] = r,
field: t,
pureText: e.pureText,
grid: e.grid,
formRef: i.value,
onBlur: o[0] || (o[0] = (...r) => s("blur", ...r)),
onFocus: o[1] || (o[1] = (...r) => s("focus", ...r)),
onChange: o[2] || (o[2] = (...r) => s("change", ...r)),
key: t.key ?? z
}, {
custom: c(({ field: r }) => [
d(e.$slots, r.prop, { field: r }, void 0, !0)
]),
_: 2
}, 1032, ["modelValue", "onUpdate:modelValue", "field", "pureText", "grid", "formRef"]))), 128))
]),
_: 3
}, 8, ["class"])) : (a(), u(A, { key: 1 }))
], 64)),
e.footer ? d(e.$slots, "footer", { key: 2 }, () => [
!e.pureText && e.footer === !0 ? (a(), u(J, {
key: 0,
loading: e.loading,
moreBtns: e.moreBtns,
submitBtn: e.submitBtn,
resetBtn: e.resetBtn,
disabled: l($) || !n.value.length,
formRef: i.value,
omits: e.omits,
log: e.log,
debug: e.debug,
params: l(v)({}, l(m), e.extraParams),
fetch: e.fetch,
afterSuccess: e.afterSuccess,
afterFail: e.afterFail,
afterReset: e.afterReset,
onMoreBtns: o[3] || (o[3] = (...t) => s("moreBtns", ...t)),
onSubmit: o[4] || (o[4] = (...t) => s("submit", ...t)),
onReset: o[5] || (o[5] = (...t) => s("reset", ...t)),
ref_key: "footerBtnsRef",
ref: f
}, null, 8, ["loading", "moreBtns", "submitBtn", "resetBtn", "disabled", "formRef", "omits", "log", "debug", "params", "fetch", "afterSuccess", "afterFail", "afterReset"])) : k("", !0)
], !0) : k("", !0)
]),
_: 3
}, 16, ["class", "model"]);
};
}
}), fe = /* @__PURE__ */ _(ee, [["__scopeId", "data-v-0f7de163"]]);
export {
fe as default
};