dfs-page-config 0.9.4 → 0.9.6

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.
@@ -56633,7 +56633,102 @@ function _sfc_render$k(Ff, kh, tAe, oAe, uAe, pAe) {
56633
56633
  }, 1032, ["type", "onClick", "size"]))), 128))
56634
56634
  ]));
56635
56635
  }
56636
- const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$k], ["__scopeId", "data-v-50ed1da4"]]), _sfc_main$l = defineComponent({
56636
+ const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["render", _sfc_render$k], ["__scopeId", "data-v-50ed1da4"]]);
56637
+ function withTraceAction(Ff, kh) {
56638
+ return Ff ? {
56639
+ needReason: !0,
56640
+ headers: { ...kh, "X-Op-Action": Ff }
56641
+ } : {};
56642
+ }
56643
+ const DEFAULTS = {
56644
+ title: "操作留痕",
56645
+ message: "请填写操作原因",
56646
+ batchMessage: "请填写本次批量操作原因",
56647
+ placeholder: "必填,将随本次操作记录",
56648
+ confirmText: "确认",
56649
+ cancelText: "取消",
56650
+ reasonHeader: "X-Op-Reason",
56651
+ required: !0,
56652
+ requiredMessage: "请输入操作原因"
56653
+ }, runtimes = /* @__PURE__ */ new WeakMap();
56654
+ function eject(Ff, kh) {
56655
+ var tAe, oAe;
56656
+ kh !== null && ((oAe = (tAe = Ff.interceptors) == null ? void 0 : tAe.request) == null || oAe.eject(kh));
56657
+ }
56658
+ function setReasonHeader(Ff, kh, tAe) {
56659
+ Ff.headers = Ff.headers || {}, Ff.headers[kh] = tAe;
56660
+ }
56661
+ function askReason(Ff, kh) {
56662
+ const { config: tAe } = Ff;
56663
+ return ElMessageBox.prompt(kh, tAe.title, {
56664
+ inputType: "textarea",
56665
+ inputPlaceholder: tAe.placeholder,
56666
+ confirmButtonText: tAe.confirmText,
56667
+ cancelButtonText: tAe.cancelText,
56668
+ ...tAe.required && {
56669
+ inputPattern: /\S+/,
56670
+ inputErrorMessage: tAe.requiredMessage
56671
+ }
56672
+ }).then((oAe) => (oAe == null ? void 0 : oAe.value) || "");
56673
+ }
56674
+ async function withBusyPaused(Ff, kh) {
56675
+ var oAe;
56676
+ let tAe = !1;
56677
+ try {
56678
+ (oAe = Ff.busy) != null && oAe.isBusy() && (Ff.busy.setBusy(!1), tAe = !0);
56679
+ } catch {
56680
+ }
56681
+ try {
56682
+ return await kh();
56683
+ } finally {
56684
+ if (tAe)
56685
+ try {
56686
+ Ff.busy.setBusy(!0);
56687
+ } catch {
56688
+ }
56689
+ }
56690
+ }
56691
+ async function intercept(Ff, kh) {
56692
+ if (!Ff.enabled)
56693
+ return kh;
56694
+ if (Ff.pendingReason)
56695
+ return setReasonHeader(kh, Ff.config.reasonHeader, Ff.pendingReason), kh;
56696
+ if (!kh.needReason)
56697
+ return kh;
56698
+ const tAe = await withBusyPaused(Ff, () => askReason(Ff, Ff.config.message));
56699
+ return setReasonHeader(kh, Ff.config.reasonHeader, encodeURIComponent(tAe.trim())), kh;
56700
+ }
56701
+ function installOpTrace(Ff, kh = {}) {
56702
+ var hAe, AAe;
56703
+ if (typeof ((AAe = (hAe = Ff == null ? void 0 : Ff.interceptors) == null ? void 0 : hAe.request) == null ? void 0 : AAe.use) != "function")
56704
+ throw new Error("[op-trace] installOpTrace 需要一个 axios 实例作为第一个参数");
56705
+ const tAe = runtimes.get(Ff);
56706
+ tAe && (eject(Ff, tAe.interceptorId), runtimes.delete(Ff));
56707
+ const { busy: oAe, ...uAe } = kh, pAe = {
56708
+ config: { ...DEFAULTS, ...uAe },
56709
+ busy: oAe,
56710
+ enabled: !0,
56711
+ pendingReason: null,
56712
+ interceptorId: null
56713
+ };
56714
+ return runtimes.set(Ff, pAe), pAe.interceptorId = Ff.interceptors.request.use((vAe) => intercept(pAe, vAe)), {
56715
+ isEnabled: () => pAe.enabled,
56716
+ enable(vAe) {
56717
+ return pAe.enabled = vAe, vAe || (pAe.pendingReason = null), this;
56718
+ },
56719
+ destroy() {
56720
+ pAe.pendingReason = null, pAe.enabled = !1, eject(Ff, pAe.interceptorId), pAe.interceptorId = null, runtimes.delete(Ff);
56721
+ },
56722
+ async confirmReason() {
56723
+ const vAe = await askReason(pAe, pAe.config.batchMessage);
56724
+ return pAe.pendingReason = encodeURIComponent(vAe.trim()), vAe;
56725
+ },
56726
+ clearReason: () => {
56727
+ pAe.pendingReason = null;
56728
+ }
56729
+ };
56730
+ }
56731
+ const _sfc_main$l = defineComponent({
56637
56732
  name: "Form",
56638
56733
  components: { SearchTab: __unplugin_components_1$1, uploadComp: UploadComp },
56639
56734
  props: {
@@ -56743,7 +56838,8 @@ const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["
56743
56838
  service({
56744
56839
  url: oAe.state._BASE_URL + pAe.url,
56745
56840
  [MAe]: typeof FAe == "object" ? FAe : pAe.formData || {},
56746
- method: pAe.method || "POST"
56841
+ method: pAe.method || "POST",
56842
+ ...withTraceAction(pAe.traceAction, pAe.headers)
56747
56843
  }).then((kAe) => {
56748
56844
  if (pAe.submitAfter) {
56749
56845
  let _Ae = {};
@@ -56775,7 +56871,7 @@ const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["
56775
56871
  fileUrlInfo: bAe
56776
56872
  };
56777
56873
  }
56778
- }), Form_vue_vue_type_style_index_0_scoped_4735c9ae_lang = "", Form_vue_vue_type_style_index_1_lang = "", _hoisted_1$m = {
56874
+ }), Form_vue_vue_type_style_index_0_scoped_43e53f51_lang = "", Form_vue_vue_type_style_index_1_lang = "", _hoisted_1$m = {
56779
56875
  key: 0,
56780
56876
  class: "mask"
56781
56877
  }, _hoisted_2$h = ["innerHTML"];
@@ -57178,7 +57274,7 @@ function _sfc_render$j(Ff, kh, tAe, oAe, uAe, pAe) {
57178
57274
  _: 3
57179
57275
  }, 8, ["locale"]);
57180
57276
  }
57181
- const Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$j], ["__scopeId", "data-v-4735c9ae"]]), _hoisted_1$l = {
57277
+ const Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$j], ["__scopeId", "data-v-43e53f51"]]), _hoisted_1$l = {
57182
57278
  viewBox: "0 0 1024 1024",
57183
57279
  width: "1.2em",
57184
57280
  height: "1.2em"
@@ -128879,7 +128975,8 @@ const _sfc_main$h = defineComponent({
128879
128975
  service({
128880
128976
  url: store.state._BASE_URL + eme.url,
128881
128977
  [fme]: ime,
128882
- method: eme.method || "POST"
128978
+ method: eme.method || "POST",
128979
+ ...withTraceAction(eme.traceAction, eme.headers)
128883
128980
  }).then((Cme) => {
128884
128981
  dme[$Ae] = JAe, lme && lme(dme, Cme);
128885
128982
  });
@@ -131729,7 +131826,12 @@ const analyzeResourceLoadTime = () => {
131729
131826
  Object.keys(store[pAe]).forEach((hAe) => {
131730
131827
  kh.store[pAe][hAe] = store[pAe][hAe];
131731
131828
  });
131732
- }), kh.store._mutations && (kh.store._mutations.setUploadDownloadDialogVisible = store._mutations.setUploadDownloadDialogVisible), store.commit("saveUrl", kh.baseUrl), kh.systemSource && store.commit("saveSystemSource", kh.systemSource), store.commit("saveLocale", kh.locale), store.commit("saveEnv", kh.env), kh.store.state._CONFIG_DATA = store.state._CONFIG_DATA, kh.store.state._BASE_URL = kh.baseUrl, store._mutations.setLoading = kh.store._mutations.setLoading, install(Ff), Ff.component("DfsPageConfig", Page);
131829
+ }), kh.store._mutations && (kh.store._mutations.setUploadDownloadDialogVisible = store._mutations.setUploadDownloadDialogVisible), store.commit("saveUrl", kh.baseUrl), kh.systemSource && store.commit("saveSystemSource", kh.systemSource), store.commit("saveLocale", kh.locale), store.commit("saveEnv", kh.env), kh.store.state._CONFIG_DATA = store.state._CONFIG_DATA, kh.store.state._BASE_URL = kh.baseUrl, store._mutations.setLoading = kh.store._mutations.setLoading, installOpTrace(service, {
131830
+ busy: {
131831
+ isBusy: () => !!kh.store.state.loading,
131832
+ setBusy: (pAe) => kh.store.commit("setLoading", pAe)
131833
+ }
131834
+ }), install(Ff), Ff.component("DfsPageConfig", Page);
131733
131835
  const tAe = () => ({
131734
131836
  t: (pAe) => pAe
131735
131837
  });