UNPKG

quick-admin-vue3-core

Version:

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

97 lines (96 loc) 3.26 kB
import { defineComponent as I, inject as X, resolveComponent as r, createElementBlock as p, openBlock as i, createCommentVNode as v, createElementVNode as c, createVNode as l, toDisplayString as d, createTextVNode as m, withCtx as a, unref as D } from "vue"; import { r as F, aK as P, b as T } from "./platform-DsTwHxm6.js"; import { A as j } from "./index-D-KS7NhM.js"; import "./index-C0qRtkRj.js"; /* empty css */ import { u as z } from "./next-callback-Bd-U9so0.js"; import { _ as K } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const M = { class: "template-hint" }, O = { key: 0, class: "desc mb-o" }, R = { class: "f-fs-c mb-h" }, S = { class: "el-upload__text" }, $ = { key: 0, class: "el-upload__tip" }, q = /* @__PURE__ */ I({ __name: "CommonImport", props: { name: { default: "XXX模板示例" }, cols: { default: () => [] }, accept: { default: ".xls,.xlsx" }, description: { default: "请上传文件,支持拖动上传" }, tips: {} }, emits: ["change"], setup(C, { emit: g }) { const u = X("closePopup"), f = C, w = g; function y() { const { name: o, cols: e } = f; F([e.map((t) => t.label)], o, void 0, () => { T("已下载,请查看!"), u(); }); } function A(o, e) { const { cols: t } = f, s = new FileReader(); s.readAsArrayBuffer(o.raw), s.onloadend = function(n) { var _; const N = (_ = n.target) == null ? void 0 : _.result, E = P(N).map((x) => { var h; const b = {}; for (const k in x) { const V = (h = t == null ? void 0 : t.find((B) => B.label === k)) == null ? void 0 : h.prop; b[V] = x[k]; } return b; }); w("change", E, z("导入", u), n); }; } return (o, e) => { const t = r("el-button"), s = r("el-icon"), n = r("el-upload"); return i(), p("div", M, [ o.description ? (i(), p("div", O, d(o.description), 1)) : v("", !0), c("div", R, [ e[1] || (e[1] = m(" 如果没有模板,请")), l(t, { onClick: y, type: "primary", link: "" }, { default: a(() => e[0] || (e[0] = [ m("点击此处下载模板") ])), _: 1 }), e[2] || (e[2] = m("。 ")) ]), l(n, { class: "upload-demo", "on-change": A, "auto-upload": !1, "show-file-list": !1, accept: o.accept, multiple: "", drag: "" }, { tip: a(() => [ o.tips ? (i(), p("div", $, d(o.tips), 1)) : v("", !0) ]), default: a(() => [ l(s, { size: "3em" }, { default: a(() => [ l(D(j)) ]), _: 1 }), e[3] || (e[3] = c("div", { class: "el-upload__text" }, "点击或拖拽文件到此处上传", -1)), c("div", S, "支持" + d(o.accept), 1) ]), _: 1 }, 8, ["accept"]) ]); }; } }), Z = /* @__PURE__ */ K(q, [["__scopeId", "data-v-1a0e650f"]]); export { Z as default };