| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- import { ref as s, computed as W, watch as X, onMounted as Y, resolveComponent as _, openBlock as a, createElementBlock as c, createVNode as l, withCtx as o, createElementVNode as r, toDisplayString as y, createBlock as f, createTextVNode as k, createCommentVNode as i, renderSlot as g, Fragment as A, renderList as V, normalizeClass as Z, normalizeStyle as ee } from "vue";
- import { n as te, aB as ae, y as ne, B as oe } from "./index2.js";
- import { S as le } from "./index9.js";
- import { _ as se, S as ie } from "./index12.js";
- import { T as ue, _ as ce } from "./index13.js";
- const re = { class: "title" }, fe = { style: { "margin-right": "10px" } }, de = { class: "btns" }, me = ["id"], ye = {
- key: 1,
- class: "collapses-content-wrap"
- }, pe = { class: "modal" }, ve = /* @__PURE__ */ Object.assign({ name: "SFormBasicLayout" }, {
- __name: "SFormBasicLayout",
- props: {
- loading: {
- type: Boolean,
- default: !1
- },
- // 表单主体容器的 id(锚点/表单定位用)
- commonId: {
- type: String,
- default: "form-container"
- },
- // 页面标题
- title: {
- type: String,
- required: !0
- },
- subTitle: {
- type: String,
- default: ""
- },
- showBtnIcon: {
- type: Boolean,
- default: !0
- },
- steps: {
- type: Array,
- default: () => []
- },
- stepDefaultActive: {
- type: Number,
- default: 0
- },
- // 上一步校验:返回 Promise<boolean>,resolve(false) 时停在当前步
- stepValid: {
- type: Function,
- default: void 0
- },
- tabs: {
- type: Array,
- default: () => []
- },
- tabKey: {
- type: Object,
- default: () => ({
- label: "label",
- value: "value"
- })
- },
- formStyle: {
- type: Object,
- default: () => ({})
- },
- goBack: {
- type: Boolean,
- default: !0
- },
- isShowSave: {
- type: Boolean,
- default: !0
- },
- saveBtnText: {
- type: String,
- default: "保存"
- }
- },
- emits: ["footer-callback", "tabsChange"],
- setup(e, { expose: z, emit: D }) {
- const u = e, d = D, I = s(null), K = s(null), L = s(null), N = s(null), F = s(null), O = s(null), B = s(8), n = s(0), S = W(() => u.tabKey && u.tabKey.value || "value"), p = s("");
- X(() => u.tabs, () => {
- const t = u.tabs || [];
- if (!t.length) {
- p.value = "";
- return;
- }
- const v = S.value;
- t.some((m) => m && m[v] === p.value) || (p.value = t[0][v]);
- }, { immediate: !0, deep: !0 });
- function w() {
- d("footer-callback", "cancel");
- }
- function C() {
- n.value--, d("footer-callback", "prev", n.value);
- }
- function T() {
- if (typeof u.stepValid != "function") {
- n.value++, d("footer-callback", "next", n.value);
- return;
- }
- u.stepValid(n.value).then((t) => {
- t && (n.value++, d("footer-callback", "next", n.value));
- });
- }
- function $() {
- d("footer-callback", "save");
- }
- function j(t) {
- p.value = t;
- const v = u.tabs.find((m) => m[S.value] === t);
- d("tabsChange", v);
- }
- return Y(() => {
- n.value = u.stepDefaultActive;
- }), z({
- save: $,
- rollback: w,
- handNext: T,
- handPrev: C,
- stepActive: n
- }), (t, v) => {
- const m = _("InfoCircleOutlined"), E = ne, R = le, M = ie, q = se, x = ce, P = ue, G = _("close-outlined"), h = oe, H = _("arrow-left-outlined"), J = _("arrow-right-outlined"), Q = _("save-outlined"), U = ae;
- return a(), c("div", {
- class: "s-form-basic-layout",
- ref_key: "layoutRef",
- ref: I
- }, [
- l(U, { spinning: e.loading }, {
- default: o(() => [
- r("div", {
- class: "tools",
- ref_key: "toolsRef",
- ref: K
- }, [
- r("div", re, [
- r("span", fe, y(e.title), 1),
- e.subTitle ? (a(), f(E, {
- key: 0,
- placement: "topLeft",
- mouseEnterDelay: 0.5,
- mouseLeaveDelay: 0.5
- }, {
- title: o(() => [
- k(y(e.subTitle), 1)
- ]),
- default: o(() => [
- l(m)
- ]),
- _: 1
- })) : i("", !0)
- ]),
- r("div", de, [
- l(R, { size: B.value }, {
- default: o(() => [
- g(t.$slots, "otherBtns", {}, void 0, !0)
- ]),
- _: 3
- }, 8, ["size"])
- ])
- ], 512),
- e.steps && e.steps.length ? (a(), c("div", {
- key: 0,
- class: "step-wrap",
- ref_key: "stepRef",
- ref: L
- }, [
- l(q, {
- current: n.value,
- type: "navigation"
- }, {
- default: o(() => [
- (a(!0), c(A, null, V(e.steps, (b) => (a(), f(M, {
- title: b,
- key: b,
- disabled: ""
- }, null, 8, ["title"]))), 128))
- ]),
- _: 1
- }, 8, ["current"])
- ], 512)) : i("", !0),
- e.tabs && e.tabs.length ? (a(), c("div", {
- key: 1,
- class: "tabs-wrap",
- ref_key: "tabsRef",
- ref: N
- }, [
- l(P, {
- "active-key": p.value,
- onChange: j
- }, {
- default: o(() => [
- (a(!0), c(A, null, V(e.tabs, (b) => (a(), f(x, {
- tab: b[e.tabKey.label],
- key: b[S.value]
- }, null, 8, ["tab"]))), 128))
- ]),
- _: 1
- }, 8, ["active-key"])
- ], 512)) : i("", !0),
- r("div", {
- class: Z(["form-layout-main", { whiteBg: !!t.$slots.form }]),
- id: e.commonId,
- ref_key: "formMain",
- ref: F
- }, [
- t.$slots.form ? (a(), c("div", {
- key: 0,
- class: "form-container-wrap",
- style: ee(e.formStyle)
- }, [
- g(t.$slots, "form", {}, void 0, !0)
- ], 4)) : i("", !0),
- t.$slots.collapses ? (a(), c("div", ye, [
- g(t.$slots, "collapses", {}, void 0, !0)
- ])) : i("", !0)
- ], 10, me),
- r("div", pe, [
- g(t.$slots, "other", {}, void 0, !0)
- ]),
- r("div", {
- class: "s-form-basic-fixed-footer",
- ref_key: "footerRef",
- ref: O
- }, [
- l(R, { size: B.value }, {
- default: o(() => [
- e.goBack ? (a(), f(h, {
- key: 0,
- class: "btn",
- onClick: w
- }, {
- default: o(() => [
- l(G),
- k(y(t.$l("取消")), 1)
- ]),
- _: 1
- })) : i("", !0),
- e.steps.length ? (a(), f(h, {
- key: 1,
- class: "btn",
- disabled: n.value === e.stepDefaultActive,
- onClick: C
- }, {
- default: o(() => [
- l(H),
- k(y(t.$l("上一步")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])) : i("", !0),
- e.steps.length ? (a(), f(h, {
- key: 2,
- class: "btn",
- type: "primary",
- disabled: n.value === e.steps.length - 1,
- onClick: T
- }, {
- default: o(() => [
- l(J),
- k(y(t.$l("下一步")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])) : i("", !0),
- e.isShowSave ? (a(), f(h, {
- key: 3,
- type: "primary",
- onClick: $
- }, {
- default: o(() => [
- l(Q),
- k(" " + y(t.$l(e.saveBtnText)), 1)
- ]),
- _: 1
- })) : i("", !0),
- g(t.$slots, "footer", {}, void 0, !0)
- ]),
- _: 3
- }, 8, ["size"])
- ], 512)
- ]),
- _: 3
- }, 8, ["spinning"])
- ], 512);
- };
- }
- }), Be = /* @__PURE__ */ te(ve, [["__scopeId", "data-v-bdf042a5"]]);
- export {
- Be as default
- };
|