UNPKG

zdy-component

Version:

343 lines (342 loc) 9.66 kB
import { getCurrentInstance as O, ref as x, provide as B, watchEffect as D, computed as T, watch as j, resolveComponent as g, resolveDirective as U, createBlock as l, openBlock as t, withCtx as n, createElementBlock as k, Fragment as M, renderList as V, createCommentVNode as c, withDirectives as f, createTextVNode as y, toDisplayString as i, createElementVNode as P, defineAsyncComponent as E } from "vue"; const I = { __name: "zd-button", props: { list: { type: Array, default: () => [] }, loading: { type: Boolean, default: !1 }, // 导入接口 importUrl: { type: String, default: "" }, //导入列表接口 url: { type: String, default: "" }, // 模板接口 templateUrl: { type: String, default: "" } }, emits: [ // 新增 "add", // 修改 "edit", // 删除 "remove", //分配用户 "assign", // 导入 "import", // 导出 "export", "upFile", // 提交审核 "sub-examine", // 撤销审核 "revoke", // 审核 "examine", // 打印 "pring", // 关结 "closing", // 交接 "handover", // 入库 "warehousing" ], setup(_, { emit: b }) { const { proxy: s } = O(); x(!1); const a = _; B("url", a.url); const o = b, w = x(!1); D( () => a.list, () => { }, { deep: !0 } ), T(() => a.list); const C = async () => { await s.DelMessageBox("是否删除所选的数据?") && o("remove"); }, h = async () => { await s.DelMessageBox("是否提交审核该数据?") && o("sub-examine"); }; j( () => a.templateUrl, (m) => { a.list.find((r) => r.type == "import"); }, { deef: !0, immediate: !0 } ); const z = () => { if (!a.importUrl) { s.errorMsg("p-button组件:请传入“importUrl”,导入接口!"); return; } w.value = !0; }; return (m, r) => { const d = g("el-button"), p = g("el-col"), S = g("el-row"), u = U("hasPermi"); return t(), l(S, { gutter: 10, class: "mb8" }, { default: n(() => [ (t(!0), k(M, null, V(a.list, (e, $) => (t(), k("div", { key: `${$}${e.disabled}` }, [ e.type == "add" ? (t(), l(p, { key: 0, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "primary", plain: "", icon: "Plus", onClick: r[0] || (r[0] = (v) => o("add")) }, { default: n(() => [ y(i(e.label || "新增"), 1) ]), _: 2 }, 1024)), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "edit" ? (t(), l(p, { key: 1, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "primary", plain: "", icon: "Edit", disabled: e.disabled, onClick: r[1] || (r[1] = (v) => o("edit")) }, { default: n(() => [ y(i(e.label || "修改"), 1) ]), _: 2 }, 1032, ["disabled"])), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "remove" ? (t(), l(p, { key: 2, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "danger", plain: "", icon: "Delete", disabled: e.disabled, onClick: C }, { default: n(() => [ y(i(e.label || "批量删除"), 1) ]), _: 2 }, 1032, ["disabled"])), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "import" ? (t(), l(p, { key: 3, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "info", plain: "", icon: "Upload", onClick: z }, { default: n(() => [ y(i(e.label || "导入"), 1) ]), _: 2 }, 1024)), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "export" ? (t(), l(p, { key: 4, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "warning", plain: "", icon: "Download", onClick: r[2] || (r[2] = (v) => o("export")) }, { default: n(() => [ y(i(e.label || "导出"), 1) ]), _: 2 }, 1024)), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "提交审核" ? (t(), l(p, { key: 5, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "warning", plain: "", icon: "Pointer", disabled: e.disabled, onClick: h }, { default: n(() => [ y(i(e.label || "提交审核"), 1) ]), _: 2 }, 1032, ["disabled"])), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "审核" ? (t(), l(p, { key: 6, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "warning", plain: "", icon: "View", disabled: e.disabled, onClick: r[3] || (r[3] = (v) => o("examine")) }, { default: n(() => [ y(i(e.label || "审核"), 1) ]), _: 2 }, 1032, ["disabled"])), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "关结" ? (t(), l(p, { key: 7, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: "primary", plain: "", icon: "View", disabled: e.disabled, onClick: r[4] || (r[4] = (v) => o("closing")) }, { default: n(() => [ y(i(e.label || "关结"), 1) ]), _: 2 }, 1032, ["disabled"])), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0), e.type == "自定义" ? (t(), l(p, { key: 8, span: 1.5 }, { default: n(() => [ f((t(), l(d, { type: e.btnType || "primary", plain: "", icon: e.icon, disabled: e.disabled, onClick: (v) => o(e.emit) }, { default: n(() => [ y(i(e.label || "自定义"), 1) ]), _: 2 }, 1032, ["type", "icon", "disabled", "onClick"])), [ [u, [e.hasPermi]] ]) ]), _: 2 }, 1024)) : c("", !0) ]))), 128)) ]), _: 1 }); }; } }, N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: I }, Symbol.toStringTag, { value: "Module" })), A = (_, b) => { const s = _.__vccOpts || _; for (const [a, o] of b) s[a] = o; return s; }, F = { class: "title" }, L = { __name: "zd-title", props: { title: { type: String, defalut: "" } }, emits: [], setup(_, { emit: b }) { const s = _; return (a, o) => (t(), k("div", F, [ o[0] || (o[0] = P("div", { class: "flag" }, null, -1)), P("div", null, i(s.title), 1) ])); } }, Z = /* @__PURE__ */ A(L, [["__scopeId", "data-v-d6c12e3d"]]), G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: Z }, Symbol.toStringTag, { value: "Module" })), q = /* @__PURE__ */ Object.assign({ "./zd-vin/zd-button.vue": () => Promise.resolve().then(() => N), "./zd-vin/zd-title.vue": () => Promise.resolve().then(() => G) }), J = (_) => { for (const [b, s] of Object.entries(q)) { const a = b.slice(b.lastIndexOf("/") + 1, b.lastIndexOf(".")); _.component(a, E(s)); } }; export { I as ZdButton, Z as ZdTitle, J as default };