UNPKG

quick-admin-vue3-core

Version:

以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板

167 lines (166 loc) 5.29 kB
import { defineComponent as $, reactive as D, ref as T, computed as g, resolveComponent as v, createBlock as V, openBlock as i, mergeProps as c, unref as x, isRef as z, withCtx as a, renderSlot as y, normalizeProps as _, guardReactiveProps as B, createVNode as A, createElementBlock as F, Fragment as R, createTextVNode as C, toDisplayString as k, createElementVNode as I, normalizeClass as N } from "vue"; import { F as P } from "./Index-h9FbLr36.js"; import { _ as U } from "./_plugin-vue_export-helper-CHgC5LLL.js"; import { aL as S } from "./platform-DsTwHxm6.js"; const E = /* @__PURE__ */ $({ inheritAttrs: !1, __name: "FormTable", props: { cols: {}, modelValue: { default: () => D([]) }, formAttrs: {} }, emits: ["update:modelValue"], setup(w, { expose: f, emit: d }) { const m = w, s = d, t = T(null), p = T(null); let n = g({ get: () => m.modelValue, set: (l) => s("update:modelValue", l) }); const q = g(() => { const { cols: l } = m; return l.filter((r) => !!r).map((r) => { const { prop: u, label: b, field: e, ...o } = r; return { prop: u, label: b, ...o, ...e }; }); }); return f({ formRef: t, tableRef: p }), (l, r) => { const u = v("BaseTable"), b = v("BaseForm"); return i(), V(b, c(l.formAttrs, { modelValue: x(n), "onUpdate:modelValue": r[0] || (r[0] = (e) => z(n) ? n.value = e : n = e), fields: q.value, class: "form-table", ref_key: "baseFormRef", ref: t }), { header: a((e) => [ y(l.$slots, "header", _(B(e)), void 0, !0) ]), content: a(() => [ A(u, c(l.$attrs, { cols: l.cols, data: l.modelValue, class: "table", ref_key: "baseTableRef", ref: p }), { header: a(({ column: e, col: o }) => { var h; return [ I("span", { class: N({ required: !!((h = o == null ? void 0 : o.field) != null && h.required) }) }, k(e.label), 3) ]; }), default: a((e) => [ e.col.field ? (i(), F(R, { key: 0 }, [ e.col.field.type === "slot" ? y(l.$slots, e.col.prop, _(c({ key: 0 }, e)), void 0, !0) : (i(), V(P, { key: 1, style: { "margin-bottom": "0" }, modelValue: e.row[e.col.prop], "onUpdate:modelValue": (o) => e.row[e.col.prop] = o, field: e.col.field, prop: e.col.prop, hideLabel: "" }, null, 8, ["modelValue", "onUpdate:modelValue", "field", "prop"])) ], 64)) : (i(), F(R, { key: 1 }, [ C(k(e.row[e.col.prop]), 1) ], 64)) ]), _: 3 }, 16, ["cols", "data"]) ]), footer: a((e) => [ y(l.$slots, "footer", _(B(e)), void 0, !0) ]), _: 3 }, 16, ["modelValue", "fields"]); }; } }), L = /* @__PURE__ */ U(E, [["__scopeId", "data-v-e9e41d45"]]), J = /* @__PURE__ */ $({ name: "DemoCenterCompsTableFormTable", __name: "index", setup(w) { const f = [ { type: "selection" }, { tpl: "T_Sort" }, { tpl: "T_Index" }, { prop: "id", label: "用户ID", width: 80, fixed: "left" }, { prop: "nc", label: "昵称", width: 120, field: { type: "input", required: !0 } }, { prop: "zy", label: "角色", width: 150, field: { type: "select", attrs: { options: "D_RoleType" } } }, { prop: "xb", label: "性别", width: 180, field: { type: "radio-group", required: !0, attrs: { options: "D_Gender" } } }, { prop: "nl", label: "年龄", width: 200, field: { required: !0, tpl: "T_Age" } }, // { prop: "xx", label: "学校" }, { prop: "zt", label: "状态", width: 70, field: { type: "switch" } }, { prop: "xjd", label: "现居地", width: 200, field: { type: "cascader", attrs: { options: "C_Region" } } }, { prop: "dh", label: "电话", width: 200, field: { tpl: "T_Phone" } }, { prop: "zdy", label: "自定义", width: 200, field: { type: "slot" } } ], d = Array(30).fill("").map((s, t) => ({ id: t + 1, zy: 0, xb: 1, nl: 23, zt: 0 })); function m(s, t, p) { const { id: n } = t; S( { // edit: () => handleAddEdit(row, next), // delete: () => DeleteMockUser({ id }).then(() => next()), }, s ); } return (s, t) => (i(), V(L, { modelValue: x(d), "onUpdate:modelValue": t[0] || (t[0] = (p) => z(d) ? d.value = p : null), class: "q-page-view", cols: f, operateBtns: ["edit", "delete"], onOperateBtns: m }, { zdy: a(() => t[1] || (t[1] = [ C("$$这是自定义表格列$$") ])), _: 1 }, 8, ["modelValue"])); } }); export { J as default };