dfs-page-config 0.9.5 → 0.9.7
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 +101 -106
- package/dist/dfs-page-config.umd.cjs +4 -4
- package/dist/op-trace.cjs +1 -1
- package/dist/op-trace.js +37 -42
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/dfs-page-config.js
CHANGED
|
@@ -31651,100 +31651,6 @@ 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
|
-
}
|
|
31748
31654
|
let componentsArr = [];
|
|
31749
31655
|
function getComp(Ff) {
|
|
31750
31656
|
return Ff.forEach((kh) => {
|
|
@@ -31857,12 +31763,6 @@ const store = createStore({
|
|
|
31857
31763
|
}
|
|
31858
31764
|
}
|
|
31859
31765
|
});
|
|
31860
|
-
installOpTrace(service, {
|
|
31861
|
-
busy: {
|
|
31862
|
-
isBusy: () => store.state.loading,
|
|
31863
|
-
setBusy: (Ff) => store.commit("setLoading", Ff)
|
|
31864
|
-
}
|
|
31865
|
-
});
|
|
31866
31766
|
function initData(Ff, kh, tAe) {
|
|
31867
31767
|
kh.forEach((oAe) => {
|
|
31868
31768
|
if (oAe.children && initData(Ff, oAe.children), oAe.type == "Form") {
|
|
@@ -56844,7 +56744,7 @@ const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["
|
|
|
56844
56744
|
url: oAe.state._BASE_URL + pAe.url,
|
|
56845
56745
|
[MAe]: typeof FAe == "object" ? FAe : pAe.formData || {},
|
|
56846
56746
|
method: pAe.method || "POST",
|
|
56847
|
-
|
|
56747
|
+
traceAction: pAe.traceAction
|
|
56848
56748
|
}).then((kAe) => {
|
|
56849
56749
|
if (pAe.submitAfter) {
|
|
56850
56750
|
let _Ae = {};
|
|
@@ -56876,7 +56776,7 @@ const __unplugin_components_1$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["
|
|
|
56876
56776
|
fileUrlInfo: bAe
|
|
56877
56777
|
};
|
|
56878
56778
|
}
|
|
56879
|
-
}),
|
|
56779
|
+
}), Form_vue_vue_type_style_index_0_scoped_201e7fe1_lang = "", Form_vue_vue_type_style_index_1_lang = "", _hoisted_1$m = {
|
|
56880
56780
|
key: 0,
|
|
56881
56781
|
class: "mask"
|
|
56882
56782
|
}, _hoisted_2$h = ["innerHTML"];
|
|
@@ -57279,7 +57179,7 @@ function _sfc_render$j(Ff, kh, tAe, oAe, uAe, pAe) {
|
|
|
57279
57179
|
_: 3
|
|
57280
57180
|
}, 8, ["locale"]);
|
|
57281
57181
|
}
|
|
57282
|
-
const Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$j], ["__scopeId", "data-v-
|
|
57182
|
+
const Form = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["render", _sfc_render$j], ["__scopeId", "data-v-201e7fe1"]]), _hoisted_1$l = {
|
|
57283
57183
|
viewBox: "0 0 1024 1024",
|
|
57284
57184
|
width: "1.2em",
|
|
57285
57185
|
height: "1.2em"
|
|
@@ -128981,7 +128881,7 @@ const _sfc_main$h = defineComponent({
|
|
|
128981
128881
|
url: store.state._BASE_URL + eme.url,
|
|
128982
128882
|
[fme]: ime,
|
|
128983
128883
|
method: eme.method || "POST",
|
|
128984
|
-
|
|
128884
|
+
traceAction: eme.traceAction
|
|
128985
128885
|
}).then((Cme) => {
|
|
128986
128886
|
dme[$Ae] = JAe, lme && lme(dme, Cme);
|
|
128987
128887
|
});
|
|
@@ -131825,13 +131725,108 @@ const analyzeResourceLoadTime = () => {
|
|
|
131825
131725
|
}, 5e3), tAe),
|
|
131826
131726
|
(tAe) => Promise.reject(tAe.data)
|
|
131827
131727
|
);
|
|
131828
|
-
},
|
|
131728
|
+
}, DEFAULTS = {
|
|
131729
|
+
title: "操作留痕",
|
|
131730
|
+
message: "请填写操作原因",
|
|
131731
|
+
batchMessage: "请填写本次批量操作原因",
|
|
131732
|
+
placeholder: "必填,将随本次操作记录",
|
|
131733
|
+
confirmText: "确认",
|
|
131734
|
+
cancelText: "取消",
|
|
131735
|
+
reasonHeader: "X-Op-Reason",
|
|
131736
|
+
actionHeader: "X-Op-Action",
|
|
131737
|
+
required: !0,
|
|
131738
|
+
requiredMessage: "请输入操作原因"
|
|
131739
|
+
}, runtimes = /* @__PURE__ */ new WeakMap();
|
|
131740
|
+
function eject(Ff, kh) {
|
|
131741
|
+
var tAe, oAe;
|
|
131742
|
+
kh !== null && ((oAe = (tAe = Ff.interceptors) == null ? void 0 : tAe.request) == null || oAe.eject(kh));
|
|
131743
|
+
}
|
|
131744
|
+
function setHeader(Ff, kh, tAe) {
|
|
131745
|
+
Ff.headers = Ff.headers || {}, Ff.headers[kh] = tAe;
|
|
131746
|
+
}
|
|
131747
|
+
function askReason(Ff, kh) {
|
|
131748
|
+
const { config: tAe } = Ff;
|
|
131749
|
+
return ElMessageBox.prompt(kh, tAe.title, {
|
|
131750
|
+
inputType: "textarea",
|
|
131751
|
+
inputPlaceholder: tAe.placeholder,
|
|
131752
|
+
confirmButtonText: tAe.confirmText,
|
|
131753
|
+
cancelButtonText: tAe.cancelText,
|
|
131754
|
+
...tAe.required && {
|
|
131755
|
+
inputPattern: /\S+/,
|
|
131756
|
+
inputErrorMessage: tAe.requiredMessage
|
|
131757
|
+
}
|
|
131758
|
+
}).then((oAe) => (oAe == null ? void 0 : oAe.value) || "");
|
|
131759
|
+
}
|
|
131760
|
+
async function withBusyPaused(Ff, kh) {
|
|
131761
|
+
var oAe;
|
|
131762
|
+
let tAe = !1;
|
|
131763
|
+
try {
|
|
131764
|
+
(oAe = Ff.busy) != null && oAe.isBusy() && (Ff.busy.setBusy(!1), tAe = !0);
|
|
131765
|
+
} catch {
|
|
131766
|
+
}
|
|
131767
|
+
try {
|
|
131768
|
+
return await kh();
|
|
131769
|
+
} finally {
|
|
131770
|
+
if (tAe)
|
|
131771
|
+
try {
|
|
131772
|
+
Ff.busy.setBusy(!0);
|
|
131773
|
+
} catch {
|
|
131774
|
+
}
|
|
131775
|
+
}
|
|
131776
|
+
}
|
|
131777
|
+
async function intercept(Ff, kh) {
|
|
131778
|
+
if (!Ff.enabled)
|
|
131779
|
+
return kh;
|
|
131780
|
+
const tAe = kh.traceAction;
|
|
131781
|
+
if (tAe && setHeader(kh, Ff.config.actionHeader, tAe), Ff.pendingReason)
|
|
131782
|
+
return setHeader(kh, Ff.config.reasonHeader, Ff.pendingReason), kh;
|
|
131783
|
+
if (!tAe)
|
|
131784
|
+
return kh;
|
|
131785
|
+
const oAe = await withBusyPaused(Ff, () => askReason(Ff, Ff.config.message));
|
|
131786
|
+
return setHeader(kh, Ff.config.reasonHeader, encodeURIComponent(oAe.trim())), kh;
|
|
131787
|
+
}
|
|
131788
|
+
function installOpTrace(Ff, kh = {}) {
|
|
131789
|
+
var hAe, AAe;
|
|
131790
|
+
if (typeof ((AAe = (hAe = Ff == null ? void 0 : Ff.interceptors) == null ? void 0 : hAe.request) == null ? void 0 : AAe.use) != "function")
|
|
131791
|
+
throw new Error("[op-trace] installOpTrace 需要一个 axios 实例作为第一个参数");
|
|
131792
|
+
const tAe = runtimes.get(Ff);
|
|
131793
|
+
tAe && (eject(Ff, tAe.interceptorId), runtimes.delete(Ff));
|
|
131794
|
+
const { busy: oAe, ...uAe } = kh, pAe = {
|
|
131795
|
+
config: { ...DEFAULTS, ...uAe },
|
|
131796
|
+
busy: oAe,
|
|
131797
|
+
enabled: !0,
|
|
131798
|
+
pendingReason: null,
|
|
131799
|
+
interceptorId: null
|
|
131800
|
+
};
|
|
131801
|
+
return runtimes.set(Ff, pAe), pAe.interceptorId = Ff.interceptors.request.use((vAe) => intercept(pAe, vAe)), {
|
|
131802
|
+
isEnabled: () => pAe.enabled,
|
|
131803
|
+
enable(vAe) {
|
|
131804
|
+
return pAe.enabled = vAe, vAe || (pAe.pendingReason = null), this;
|
|
131805
|
+
},
|
|
131806
|
+
destroy() {
|
|
131807
|
+
pAe.pendingReason = null, pAe.enabled = !1, eject(Ff, pAe.interceptorId), pAe.interceptorId = null, runtimes.delete(Ff);
|
|
131808
|
+
},
|
|
131809
|
+
async confirmReason() {
|
|
131810
|
+
const vAe = await askReason(pAe, pAe.config.batchMessage);
|
|
131811
|
+
return pAe.pendingReason = encodeURIComponent(vAe.trim()), vAe;
|
|
131812
|
+
},
|
|
131813
|
+
clearReason: () => {
|
|
131814
|
+
pAe.pendingReason = null;
|
|
131815
|
+
}
|
|
131816
|
+
};
|
|
131817
|
+
}
|
|
131818
|
+
const index = (Ff, kh) => {
|
|
131829
131819
|
var oAe, uAe;
|
|
131830
131820
|
kh.env || console.error('缺少环境变量,请在main.ts中注册"DfsPageConfig"时配置env【app.use(DfsPageConfig, {..., env: {"VITE_NODE_ENV":"production","VITE_APP_API":"https://gateway-tob-is.prod.doublefs.com","BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}})】'), ["getters", "_actions"].forEach((pAe) => {
|
|
131831
131821
|
Object.keys(store[pAe]).forEach((hAe) => {
|
|
131832
131822
|
kh.store[pAe][hAe] = store[pAe][hAe];
|
|
131833
131823
|
});
|
|
131834
|
-
}), 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,
|
|
131824
|
+
}), 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, {
|
|
131825
|
+
busy: {
|
|
131826
|
+
isBusy: () => !!kh.store.state.loading,
|
|
131827
|
+
setBusy: (pAe) => kh.store.commit("setLoading", pAe)
|
|
131828
|
+
}
|
|
131829
|
+
}), install(Ff), Ff.component("DfsPageConfig", Page);
|
|
131835
131830
|
const tAe = () => ({
|
|
131836
131831
|
t: (pAe) => pAe
|
|
131837
131832
|
});
|