dfs-page-config 0.5.77 → 0.5.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27295,11 +27295,11 @@ Store.prototype._withCommit = function Ff(kh) {
27295
27295
  Object.defineProperties(Store.prototype, prototypeAccessors);
27296
27296
  const elBadge = "", elMessage = "";
27297
27297
  function errorHandle(Ff, kh, tAe) {
27298
- var sAe, pAe;
27298
+ var sAe, pAe, hAe, AAe, vAe;
27299
27299
  let oAe = ((sAe = Ff == null ? void 0 : Ff.data) == null ? void 0 : sAe.message) || ((pAe = Ff == null ? void 0 : Ff.data) == null ? void 0 : pAe.msg);
27300
27300
  ElMessage({
27301
27301
  type: "error",
27302
- message: oAe,
27302
+ message: (((hAe = Ff == null ? void 0 : Ff.data) == null ? void 0 : hAe.status) || "") + " " + (oAe || ((AAe = Ff.data) == null ? void 0 : AAe.statusText) || ((vAe = Ff.data) == null ? void 0 : vAe.error) || ""),
27303
27303
  duration: tAe || 2e3,
27304
27304
  onClose: () => {
27305
27305
  kh && kh();
@@ -27340,23 +27340,63 @@ service.interceptors.response.use(
27340
27340
  return errorHandle(Ff), window.location.href = window.location.origin, Promise.reject(Ff.data.message);
27341
27341
  if (Ff.data.code === 204)
27342
27342
  return errorHandle(Ff.data.msg, () => window.location.href = "/"), Promise.reject(Ff);
27343
- if (Ff.data.code !== 0)
27344
- return errorHandle(Ff), Promise.reject(Ff.data);
27345
- if (Object.prototype.toString.call(Ff.data.data).toLowerCase() == "[object object]")
27346
- return Ff.data.data;
27347
- if (typeof Ff.data.data == "string" && Ff.data.data != "") {
27348
- let kh = {};
27349
- try {
27350
- kh = JSON.parse(Ff.data.data);
27351
- } catch {
27352
- kh = Ff.data.data;
27343
+ if (Object.prototype.toString.call(Ff.data) === "[object Blob]") {
27344
+ if (Ff.data.type === "application/json") {
27345
+ const kh = new FileReader();
27346
+ return kh.readAsText(Ff.data, "utf-8"), new Promise((tAe, oAe) => {
27347
+ kh.onload = function() {
27348
+ try {
27349
+ const sAe = JSON.parse(kh.result);
27350
+ tAe(sAe);
27351
+ } catch (sAe) {
27352
+ oAe(sAe);
27353
+ }
27354
+ };
27355
+ });
27353
27356
  }
27354
- return kh;
27355
- } else
27356
- return Ff.data.data;
27357
+ return Ff.data;
27358
+ } else {
27359
+ if (Ff.data.code !== 0)
27360
+ return errorHandle(Ff), Promise.reject(Ff.data);
27361
+ if (Object.prototype.toString.call(Ff.data.data).toLowerCase() == "[object object]")
27362
+ return Ff.data.data;
27363
+ if (typeof Ff.data.data == "string" && Ff.data.data != "") {
27364
+ let kh = {};
27365
+ try {
27366
+ kh = JSON.parse(Ff.data.data);
27367
+ } catch {
27368
+ kh = Ff.data.data;
27369
+ }
27370
+ return kh;
27371
+ } else
27372
+ return Ff.data.data;
27373
+ }
27357
27374
  }
27358
27375
  },
27359
- (Ff) => (errorHandle(Ff.response), Promise.reject(Ff))
27376
+ (Ff) => {
27377
+ if (Object.prototype.toString.call(Ff.response.data) === "[object Blob]") {
27378
+ const kh = new FileReader();
27379
+ return kh.readAsText(Ff.response.data, "utf-8"), new Promise((tAe, oAe) => {
27380
+ kh.onload = function() {
27381
+ try {
27382
+ if (Ff.response.data.type === "application/json") {
27383
+ const sAe = JSON.parse(kh.result);
27384
+ errorHandle({ data: sAe }), oAe({ data: sAe });
27385
+ } else if (Ff.response.data.type === "text/html" && typeof kh.result == "string") {
27386
+ const sAe = kh.result.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
27387
+ if (sAe && sAe[1]) {
27388
+ const pAe = sAe[1].replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim();
27389
+ errorHandle({ data: { msg: pAe } }), oAe({ data: { msg: pAe } });
27390
+ }
27391
+ }
27392
+ } catch (sAe) {
27393
+ oAe(sAe);
27394
+ }
27395
+ };
27396
+ });
27397
+ } else
27398
+ return errorHandle(Ff.response), Promise.reject(Ff);
27399
+ }
27360
27400
  );
27361
27401
  const initPage = (Ff, kh) => {
27362
27402
  kh.dispatch("_INIT_PAGE", {
@@ -52660,7 +52700,23 @@ const __unplugin_components_2$3 = { name: "ep-download", render: render$5 }, _ho
52660
52700
  function render$4(Ff, kh) {
52661
52701
  return openBlock(), createElementBlock("svg", _hoisted_1$k, _hoisted_3$b);
52662
52702
  }
52663
- const __unplugin_components_2$2 = { name: "ep-upload", render: render$4 }, _sfc_main$j = defineComponent({
52703
+ const __unplugin_components_2$2 = { name: "ep-upload", render: render$4 }, httpRequest = (Ff, kh) => {
52704
+ const tAe = new FormData();
52705
+ tAe.append("file", Ff.file), service({
52706
+ url: kh,
52707
+ method: "POST",
52708
+ data: tAe,
52709
+ responseType: "blob"
52710
+ }).then((oAe) => {
52711
+ if (Object.prototype.toString.call(oAe) === "[object Blob]") {
52712
+ const sAe = new Blob([oAe], { type: "application/xlsx" }), pAe = window.URL.createObjectURL(sAe), hAe = document.createElement("a");
52713
+ hAe.href = pAe, hAe.download = Ff.file.name + "失败原因.xlsx" || "下载文件", document.body.appendChild(hAe), hAe.click(), document.body.removeChild(hAe), window.URL.revokeObjectURL(pAe), store.commit("setLoading", !1), ElMessage.error("上传失败"), Ff.onError("上传失败");
52714
+ } else
52715
+ oAe.code == 0 ? Ff.onSuccess(oAe) : (ElMessage.error(oAe.msg), Ff.onError(oAe));
52716
+ }).catch((oAe) => {
52717
+ Ff.onError(oAe);
52718
+ });
52719
+ }, _sfc_main$j = defineComponent({
52664
52720
  name: "Upload",
52665
52721
  props: {
52666
52722
  url: String,
@@ -52703,11 +52759,7 @@ const __unplugin_components_2$2 = { name: "ep-upload", render: render$4 }, _sfc_
52703
52759
  },
52704
52760
  emits: ["onSuccess", "onError"],
52705
52761
  setup(Ff, kh) {
52706
- const { t: tAe } = getCurrentInstance().appContext.config.globalProperties.useI18n(), oAe = useStore(), sAe = ref(), pAe = reactive({
52707
- uploadUrl: computed$1(
52708
- () => handleProxy(oAe.state._BASE_URL + Ff.url)
52709
- )
52710
- }), hAe = ref(!1), AAe = getRequestHeaders(pAe.uploadUrl);
52762
+ const { t: tAe } = getCurrentInstance().appContext.config.globalProperties.useI18n(), oAe = useStore(), sAe = ref(), pAe = computed$1(() => handleProxy(oAe.state._BASE_URL + Ff.url)), hAe = ref(!1), AAe = getRequestHeaders(pAe.value);
52711
52763
  async function vAe() {
52712
52764
  if (Ff.disabled)
52713
52765
  return;
@@ -52723,18 +52775,18 @@ const __unplugin_components_2$2 = { name: "ep-upload", render: render$4 }, _sfc_
52723
52775
  _Ae.code == 0 ? (ElMessage.success(_Ae.msg || tAe("上传成功")), kh.emit("onSuccess", _Ae)) : (ElMessage.error(_Ae.msg), kh.emit("onError", _Ae)), hAe.value = !1, oAe.commit("setLoading", !1);
52724
52776
  }
52725
52777
  function EAe(_Ae) {
52726
- const xAe = _Ae.toString(), DAe = new RegExp('"msg":"(.*?)(?<!\\\\)"'), PAe = xAe.match(DAe);
52727
- PAe && ElMessage.error(PAe[1]), hAe.value = !1, oAe.commit("setLoading", !1), kh.emit("onError", _Ae);
52778
+ hAe.value = !1, oAe.commit("setLoading", !1), kh.emit("onError", _Ae);
52728
52779
  }
52729
52780
  return {
52730
- ...toRefs(pAe),
52781
+ uploadUrl: pAe,
52731
52782
  uploadButtonRef: sAe,
52732
52783
  headers: AAe,
52733
52784
  uploading: hAe,
52734
52785
  validate: vAe,
52735
52786
  beforeUpload: CAe,
52736
52787
  uploadSuccess: wAe,
52737
- uploadError: EAe
52788
+ uploadError: EAe,
52789
+ httpRequest
52738
52790
  };
52739
52791
  }
52740
52792
  });
@@ -52743,7 +52795,7 @@ function _sfc_render$h(Ff, kh, tAe, oAe, sAe, pAe) {
52743
52795
  return openBlock(), createElementBlock(Fragment, null, [
52744
52796
  createVNode(AAe, {
52745
52797
  style: { display: "inline-flex" },
52746
- action: Ff.uploadUrl,
52798
+ "http-request": (wAe) => Ff.httpRequest(wAe, Ff.uploadUrl),
52747
52799
  accept: Ff.accept,
52748
52800
  "with-credentials": !0,
52749
52801
  multiple: "",
@@ -52770,7 +52822,7 @@ function _sfc_render$h(Ff, kh, tAe, oAe, sAe, pAe) {
52770
52822
  }, 8, ["size", "type", "loading"])
52771
52823
  ]),
52772
52824
  _: 1
52773
- }, 8, ["action", "accept", "before-upload", "on-success", "on-error", "disabled", "headers", "data"]),
52825
+ }, 8, ["http-request", "accept", "before-upload", "on-success", "on-error", "disabled", "headers", "data"]),
52774
52826
  Ff.type === "text" ? (openBlock(), createElementBlock("span", {
52775
52827
  key: 0,
52776
52828
  class: normalizeClass(["dfs-text-btn", { disabled: Ff.disabled }]),
@@ -52966,7 +53018,7 @@ const Upload = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["render", _sfc_rende
52966
53018
  // exportData
52967
53019
  };
52968
53020
  }
52969
- }), ButtonGroup_vue_vue_type_style_index_0_scoped_493fa6cd_lang = "", ButtonGroup_vue_vue_type_style_index_1_lang = "", _hoisted_1$j = ["onClick"];
53021
+ }), ButtonGroup_vue_vue_type_style_index_0_scoped_09cea2bd_lang = "", ButtonGroup_vue_vue_type_style_index_1_lang = "", _hoisted_1$j = ["onClick"];
52970
53022
  function _sfc_render$g(Ff, kh, tAe, oAe, sAe, pAe) {
52971
53023
  const hAe = Upload, AAe = ElIcon, vAe = __unplugin_components_2$3, CAe = ElButton;
52972
53024
  return openBlock(), createElementBlock("div", {
@@ -53028,7 +53080,7 @@ function _sfc_render$g(Ff, kh, tAe, oAe, sAe, pAe) {
53028
53080
  renderSlot(Ff.$slots, "default", {}, void 0, !0)
53029
53081
  ], 4);
53030
53082
  }
53031
- const ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["render", _sfc_render$g], ["__scopeId", "data-v-493fa6cd"]]), _sfc_main$h = defineComponent({
53083
+ const ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["render", _sfc_render$g], ["__scopeId", "data-v-09cea2bd"]]), _sfc_main$h = defineComponent({
53032
53084
  props: {
53033
53085
  gridApi: {
53034
53086
  type: Object,