dfs-page-config 0.9.4 → 0.9.5
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.
- package/dist/dfs-page-config.js +106 -4
- package/dist/dfs-page-config.umd.cjs +3 -3
- package/dist/op-trace.cjs +1 -0
- package/dist/op-trace.js +100 -0
- package/dist/style.css +1 -1
- package/package.json +10 -6
- /package/{vite-plugin-app-update.cjs → plugins/vite-plugin-app-update.cjs} +0 -0
- /package/{vite-plugin-app-update.js → plugins/vite-plugin-app-update.js} +0 -0
package/dist/dfs-page-config.js
CHANGED
|
@@ -31651,6 +31651,100 @@ function getSlots(Ff) {
|
|
|
31651
31651
|
kh.slot && slotsArr.push(kh), (kh.elementGroup || kh.children) && getSlots(kh);
|
|
31652
31652
|
});
|
|
31653
31653
|
}
|
|
31654
|
+
function withTraceAction(Ff, kh) {
|
|
31655
|
+
return Ff ? {
|
|
31656
|
+
needReason: !0,
|
|
31657
|
+
headers: { ...kh, "X-Op-Action": Ff }
|
|
31658
|
+
} : {};
|
|
31659
|
+
}
|
|
31660
|
+
const DEFAULTS = {
|
|
31661
|
+
title: "操作留痕",
|
|
31662
|
+
message: "请填写操作原因",
|
|
31663
|
+
batchMessage: "请填写本次批量操作原因",
|
|
31664
|
+
placeholder: "必填,将随本次操作记录",
|
|
31665
|
+
confirmText: "确认",
|
|
31666
|
+
cancelText: "取消",
|
|
31667
|
+
reasonHeader: "X-Op-Reason",
|
|
31668
|
+
required: !0,
|
|
31669
|
+
requiredMessage: "请输入操作原因"
|
|
31670
|
+
}, runtimes = /* @__PURE__ */ new WeakMap();
|
|
31671
|
+
function eject(Ff, kh) {
|
|
31672
|
+
var tAe, oAe;
|
|
31673
|
+
kh !== null && ((oAe = (tAe = Ff.interceptors) == null ? void 0 : tAe.request) == null || oAe.eject(kh));
|
|
31674
|
+
}
|
|
31675
|
+
function setReasonHeader(Ff, kh, tAe) {
|
|
31676
|
+
Ff.headers = Ff.headers || {}, Ff.headers[kh] = tAe;
|
|
31677
|
+
}
|
|
31678
|
+
function askReason(Ff, kh) {
|
|
31679
|
+
const { config: tAe } = Ff;
|
|
31680
|
+
return ElMessageBox.prompt(kh, tAe.title, {
|
|
31681
|
+
inputType: "textarea",
|
|
31682
|
+
inputPlaceholder: tAe.placeholder,
|
|
31683
|
+
confirmButtonText: tAe.confirmText,
|
|
31684
|
+
cancelButtonText: tAe.cancelText,
|
|
31685
|
+
...tAe.required && {
|
|
31686
|
+
inputPattern: /\S+/,
|
|
31687
|
+
inputErrorMessage: tAe.requiredMessage
|
|
31688
|
+
}
|
|
31689
|
+
}).then((oAe) => (oAe == null ? void 0 : oAe.value) || "");
|
|
31690
|
+
}
|
|
31691
|
+
async function withBusyPaused(Ff, kh) {
|
|
31692
|
+
var oAe;
|
|
31693
|
+
let tAe = !1;
|
|
31694
|
+
try {
|
|
31695
|
+
(oAe = Ff.busy) != null && oAe.isBusy() && (Ff.busy.setBusy(!1), tAe = !0);
|
|
31696
|
+
} catch {
|
|
31697
|
+
}
|
|
31698
|
+
try {
|
|
31699
|
+
return await kh();
|
|
31700
|
+
} finally {
|
|
31701
|
+
if (tAe)
|
|
31702
|
+
try {
|
|
31703
|
+
Ff.busy.setBusy(!0);
|
|
31704
|
+
} catch {
|
|
31705
|
+
}
|
|
31706
|
+
}
|
|
31707
|
+
}
|
|
31708
|
+
async function intercept(Ff, kh) {
|
|
31709
|
+
if (!Ff.enabled)
|
|
31710
|
+
return kh;
|
|
31711
|
+
if (Ff.pendingReason)
|
|
31712
|
+
return setReasonHeader(kh, Ff.config.reasonHeader, Ff.pendingReason), kh;
|
|
31713
|
+
if (!kh.needReason)
|
|
31714
|
+
return kh;
|
|
31715
|
+
const tAe = await withBusyPaused(Ff, () => askReason(Ff, Ff.config.message));
|
|
31716
|
+
return setReasonHeader(kh, Ff.config.reasonHeader, encodeURIComponent(tAe.trim())), kh;
|
|
31717
|
+
}
|
|
31718
|
+
function installOpTrace(Ff, kh = {}) {
|
|
31719
|
+
var hAe, AAe;
|
|
31720
|
+
if (typeof ((AAe = (hAe = Ff == null ? void 0 : Ff.interceptors) == null ? void 0 : hAe.request) == null ? void 0 : AAe.use) != "function")
|
|
31721
|
+
throw new Error("[op-trace] installOpTrace 需要一个 axios 实例作为第一个参数");
|
|
31722
|
+
const tAe = runtimes.get(Ff);
|
|
31723
|
+
tAe && (eject(Ff, tAe.interceptorId), runtimes.delete(Ff));
|
|
31724
|
+
const { busy: oAe, ...uAe } = kh, pAe = {
|
|
31725
|
+
config: { ...DEFAULTS, ...uAe },
|
|
31726
|
+
busy: oAe,
|
|
31727
|
+
enabled: !0,
|
|
31728
|
+
pendingReason: null,
|
|
31729
|
+
interceptorId: null
|
|
31730
|
+
};
|
|
31731
|
+
return runtimes.set(Ff, pAe), pAe.interceptorId = Ff.interceptors.request.use((vAe) => intercept(pAe, vAe)), {
|
|
31732
|
+
isEnabled: () => pAe.enabled,
|
|
31733
|
+
enable(vAe) {
|
|
31734
|
+
return pAe.enabled = vAe, vAe || (pAe.pendingReason = null), this;
|
|
31735
|
+
},
|
|
31736
|
+
destroy() {
|
|
31737
|
+
pAe.pendingReason = null, pAe.enabled = !1, eject(Ff, pAe.interceptorId), pAe.interceptorId = null, runtimes.delete(Ff);
|
|
31738
|
+
},
|
|
31739
|
+
async confirmReason() {
|
|
31740
|
+
const vAe = await askReason(pAe, pAe.config.batchMessage);
|
|
31741
|
+
return pAe.pendingReason = encodeURIComponent(vAe.trim()), vAe;
|
|
31742
|
+
},
|
|
31743
|
+
clearReason: () => {
|
|
31744
|
+
pAe.pendingReason = null;
|
|
31745
|
+
}
|
|
31746
|
+
};
|
|
31747
|
+
}
|
|
31654
31748
|
let componentsArr = [];
|
|
31655
31749
|
function getComp(Ff) {
|
|
31656
31750
|
return Ff.forEach((kh) => {
|
|
@@ -31763,6 +31857,12 @@ const store = createStore({
|
|
|
31763
31857
|
}
|
|
31764
31858
|
}
|
|
31765
31859
|
});
|
|
31860
|
+
installOpTrace(service, {
|
|
31861
|
+
busy: {
|
|
31862
|
+
isBusy: () => store.state.loading,
|
|
31863
|
+
setBusy: (Ff) => store.commit("setLoading", Ff)
|
|
31864
|
+
}
|
|
31865
|
+
});
|
|
31766
31866
|
function initData(Ff, kh, tAe) {
|
|
31767
31867
|
kh.forEach((oAe) => {
|
|
31768
31868
|
if (oAe.children && initData(Ff, oAe.children), oAe.type == "Form") {
|
|
@@ -56743,7 +56843,8 @@ const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["
|
|
|
56743
56843
|
service({
|
|
56744
56844
|
url: oAe.state._BASE_URL + pAe.url,
|
|
56745
56845
|
[MAe]: typeof FAe == "object" ? FAe : pAe.formData || {},
|
|
56746
|
-
method: pAe.method || "POST"
|
|
56846
|
+
method: pAe.method || "POST",
|
|
56847
|
+
...withTraceAction(pAe.traceAction, pAe.headers)
|
|
56747
56848
|
}).then((kAe) => {
|
|
56748
56849
|
if (pAe.submitAfter) {
|
|
56749
56850
|
let _Ae = {};
|
|
@@ -56775,7 +56876,7 @@ const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["
|
|
|
56775
56876
|
fileUrlInfo: bAe
|
|
56776
56877
|
};
|
|
56777
56878
|
}
|
|
56778
|
-
}),
|
|
56879
|
+
}), Form_vue_vue_type_style_index_0_scoped_43e53f51_lang = "", Form_vue_vue_type_style_index_1_lang = "", _hoisted_1$m = {
|
|
56779
56880
|
key: 0,
|
|
56780
56881
|
class: "mask"
|
|
56781
56882
|
}, _hoisted_2$h = ["innerHTML"];
|
|
@@ -57178,7 +57279,7 @@ function _sfc_render$j(Ff, kh, tAe, oAe, uAe, pAe) {
|
|
|
57178
57279
|
_: 3
|
|
57179
57280
|
}, 8, ["locale"]);
|
|
57180
57281
|
}
|
|
57181
|
-
const Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$j], ["__scopeId", "data-v-
|
|
57282
|
+
const Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$j], ["__scopeId", "data-v-43e53f51"]]), _hoisted_1$l = {
|
|
57182
57283
|
viewBox: "0 0 1024 1024",
|
|
57183
57284
|
width: "1.2em",
|
|
57184
57285
|
height: "1.2em"
|
|
@@ -128879,7 +128980,8 @@ const _sfc_main$h = defineComponent({
|
|
|
128879
128980
|
service({
|
|
128880
128981
|
url: store.state._BASE_URL + eme.url,
|
|
128881
128982
|
[fme]: ime,
|
|
128882
|
-
method: eme.method || "POST"
|
|
128983
|
+
method: eme.method || "POST",
|
|
128984
|
+
...withTraceAction(eme.traceAction, eme.headers)
|
|
128883
128985
|
}).then((Cme) => {
|
|
128884
128986
|
dme[$Ae] = JAe, lme && lme(dme, Cme);
|
|
128885
128987
|
});
|