quick-admin-vue3-core
Version:
以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板
173 lines (172 loc) • 5.53 kB
JavaScript
import { defineComponent as V, useAttrs as D, ref as b, watch as k, resolveComponent as _, createElementBlock as B, openBlock as y, normalizeStyle as R, normalizeClass as S, createVNode as h, mergeProps as v, createSlots as E, withCtx as x, Fragment as M, renderList as N, createBlock as F, unref as g, reactive as G, isRef as z } from "vue";
import { u as I, G as L, n as P } from "./index-C0qRtkRj.js";
import { _ as U } from "./AddEdit.vue_vue_type_script_setup_true_lang-vv0BO835.js";
import { aL as T } from "./platform-DsTwHxm6.js";
/* empty css */
import { _ as C } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const W = /* @__PURE__ */ V({
inheritAttrs: !1,
__name: "FilterTree",
props: {
class: {},
style: {},
inputAttrs: {},
options: {},
defaultSelectValue: { default: 0 },
filterNodeMethod: { type: Function, default: (n, d, r) => {
const o = Array.isArray(n) ? n[1] : n;
return o ? d.label.includes(o) : !0;
} }
},
setup(n, { expose: d }) {
const r = n, o = D(), i = b(), u = b(r.defaultSelectValue), c = b("");
return k([c, u], ([l, a]) => {
var p, e, t;
(t = (p = i.value) == null ? void 0 : p.treeRef) == null || t.filter((e = r.options) != null && e.length ? [l, a] : l);
}), d({
baseTreeRef: i
}), (l, a) => {
var s;
const p = _("el-option"), e = _("el-select"), t = _("el-input"), m = _("BaseTree");
return y(), B("div", {
class: S(["filter-tree f-fs-s-c", r.class]),
style: R(l.style)
}, [
h(t, v({
class: "f-0",
size: "small",
modelValue: c.value,
"onUpdate:modelValue": a[1] || (a[1] = (f) => c.value = f),
modelModifiers: { trim: !0 },
placeholder: "请输入关键词",
clearable: ""
}, l.inputAttrs), E({ _: 2 }, [
(s = l.options) != null && s.length ? {
name: "prepend",
fn: x(() => [
h(e, {
modelValue: u.value,
"onUpdate:modelValue": a[0] || (a[0] = (f) => u.value = f),
placeholder: "请选择",
style: { width: "6em" }
}, {
default: x(() => [
(y(!0), B(M, null, N(l.options, (f, A) => (y(), F(p, v({ ref_for: !0 }, f, { key: A }), null, 16))), 128))
]),
_: 1
}, 8, ["modelValue"])
]),
key: "0"
} : void 0
]), 1040, ["modelValue"]),
h(m, v({
class: "f-1",
"filter-node-method": l.filterNodeMethod,
defaultExpandAll: ""
}, g(o), {
ref_key: "baseTreeRef",
ref: i
}), null, 16, ["filter-node-method"])
], 6);
};
}
}), w = /* @__PURE__ */ C(W, [["__scopeId", "data-v-33d02f89"]]), $ = { class: "q-page-view f-sb-s" }, q = /* @__PURE__ */ V({
name: "DemoCenterCrudTreeCrud",
__name: "index",
setup(n) {
const { openPopup: d } = I(), r = b([]);
let o = G({ age: [10, 30] });
const i = b([
{ prop: "id", label: "用户ID" },
{ prop: "name", label: "用户姓名" },
{
prop: "age",
label: "年龄",
type: "BaseNumberRange"
},
{
prop: "gender",
label: "性别",
type: "select",
attrs: {
options: "D_Gender"
}
},
{
prop: "role",
label: "角色类型",
type: "select",
attrs: {
options: "D_RoleType"
}
},
{
prop: "status",
label: "账号状态",
type: "select",
attrs: {
options: "D_EnableStatus"
}
}
]), u = [
{ prop: "name", label: "用户姓名", width: 90 },
{ prop: "gender_text", label: "性别", width: 90, sortable: !0 },
{ prop: "age", label: "年龄", width: 90, sortable: !0 },
{ prop: "address_text", label: "地址", minWidth: 250 },
{ prop: "phone", label: "电话", minWidth: 120 },
{ prop: "role_text", label: "角色类型", minWidth: 90 },
{ prop: "status", label: "状态", type: "BaseTag" }
];
function c(e, t) {
T(
{
add: () => a(null, t)
},
e
);
}
function l(e, t, m) {
T(
{
edit: () => a(t, m)
},
e
);
}
function a(e, t) {
d(e ? "编辑" : "新增", [U, { id: e == null ? void 0 : e.id, refreshList: t }]);
}
p();
function p() {
L().then((e) => {
r.value = e.records;
});
}
return (e, t) => {
const m = _("BaseCrud");
return y(), B("div", $, [
h(w, {
indent: 12,
data: r.value,
class: "f-0 mr-o tree"
}, null, 8, ["data"]),
h(m, {
class: "f-1",
modelValue: g(o),
"onUpdate:modelValue": t[0] || (t[0] = (s) => z(o) ? o.value = s : o = s),
cols: u,
fields: i.value,
fetch: g(P),
extraBtns: ["add", "export"],
operateBtns: ["edit", "delete", (s) => s.status ? "forbid" : "enable", "log"],
onExtraBtns: c,
onOperateBtns: l,
tableAttrs: { showSummary: !0 }
}, null, 8, ["modelValue", "fields", "fetch", "operateBtns"])
]);
};
}
}), X = /* @__PURE__ */ C(q, [["__scopeId", "data-v-daa22530"]]);
export {
X as default
};