@lemon30_npm/csit-vue3 1.0.44 → 1.0.46

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.
Files changed (39) hide show
  1. package/README.dev.md +146 -87
  2. package/dist/csit-vue3.js +769 -890
  3. package/dist/index.css +1 -1
  4. package/dist/lib/ci-common-list/ci-common-list-layout/index.css +1 -1
  5. package/dist/lib/ci-common-list/ci-common-list-layout/index.vue.js +1 -1
  6. package/dist/lib/ci-common-list/ci-common-list-layout/index.vue2.js +20 -19
  7. package/dist/lib/ci-dictionary-select/index.vue.js +2 -2
  8. package/dist/lib/ci-dictionary-select/index.vue2.js +78 -42
  9. package/dist/lib/ci-upload/hooks/useUpload.js +24 -23
  10. package/dist/lib/ci-upload/hooks/useUploadRetry.js +26 -16
  11. package/dist/lib/ci-upload/index.css +1 -1
  12. package/dist/lib/ci-upload/index.vue.js +2 -2
  13. package/dist/lib/ci-upload/index.vue2.js +78 -69
  14. package/dist/lib/ci-upload/props/index.js +6 -0
  15. package/dist/lib/ci-upload/utils/appendFormData.js +9 -0
  16. package/dist/types/src/components/components-project/ci-dictionary-select/index.vue.d.ts +11 -1
  17. package/dist/types/src/components/components-project/ci-dictionary-select/type.d.ts +16 -1
  18. package/dist/types/src/components/components-project/ci-upload/index.vue.d.ts +6 -1
  19. package/dist/types/src/components/components-project/ci-upload/props/index.d.ts +3 -0
  20. package/dist/types/src/components/components-project/ci-upload/type.d.ts +3 -0
  21. package/dist/types/src/components/components-project/ci-upload/utils/appendFormData.d.ts +6 -0
  22. package/package.json +1 -1
  23. package/dist/lib/axios/index.js +0 -67
  24. package/dist/lib/axios/middlewares/middleware-executor.js +0 -15
  25. package/dist/lib/axios/middlewares/request-middlewares/addXRequestedWith.js +0 -12
  26. package/dist/lib/axios/middlewares/request-middlewares/dafeiyiqi-disposeGetUrlParams.js +0 -17
  27. package/dist/lib/axios/middlewares/request-middlewares/logRequest.js +0 -7
  28. package/dist/lib/axios/middlewares/response-middlewares/formatResponseData.js +0 -7
  29. package/dist/lib/axios/middlewares/response-middlewares/handle-error/errorMessages.js +0 -14
  30. package/dist/lib/axios/middlewares/response-middlewares/handle-error/handleError.js +0 -35
  31. package/dist/lib/axios/middlewares/response-middlewares/handle-success/handleFileStream.js +0 -11
  32. package/dist/lib/axios/middlewares/response-middlewares/handle-success/handleSuccess.js +0 -20
  33. package/dist/lib/axios/middlewares/response-middlewares/handle-success/handleTokenInvalidToLogin.js +0 -18
  34. package/dist/lib/axios/middlewares/response-middlewares/logResponse.js +0 -13
  35. package/dist/lib/ci-dictionary-select/config.js +0 -18
  36. package/dist/lib/config/env-config/index.js +0 -4
  37. package/dist/lib/config/system-config/projectSettings.js +0 -7
  38. package/dist/lib/utils/system/useSystem.js +0 -9
  39. /package/dist/lib/{ci-common-list/ci-common-list-pagination → ci-dictionary-select}/index.css +0 -0
@@ -1,7 +1,7 @@
1
1
  import o from "./index.vue2.js";
2
2
  /* empty css */
3
- import f from "../_virtual/_plugin-vue_export-helper.js";
4
- const _ = /* @__PURE__ */ f(o, [["__scopeId", "data-v-0cc92fff"]]);
3
+ import a from "../_virtual/_plugin-vue_export-helper.js";
4
+ const _ = /* @__PURE__ */ a(o, [["__scopeId", "data-v-7aa07b75"]]);
5
5
  export {
6
6
  _ as default
7
7
  };
@@ -1,33 +1,33 @@
1
1
  import { ElUpload as se, ElButton as le, ElLink as ae, ElDivider as ne, ElTooltip as ie } from "element-plus/es";
2
- import { defineComponent as re, mergeDefaults as de, useSlots as ue, ref as L, watch as ce, createElementBlock as l, openBlock as s, createBlock as _, createCommentVNode as n, mergeProps as pe, unref as y, createSlots as me, withCtx as c, renderSlot as C, Fragment as m, createElementVNode as a, toDisplayString as v, renderList as R, normalizeProps as fe, guardReactiveProps as ge, normalizeClass as S, createVNode as h, createTextVNode as B, normalizeStyle as D, nextTick as $ } from "vue";
2
+ import { defineComponent as re, mergeDefaults as de, useSlots as ue, ref as D, watch as ce, createElementBlock as l, openBlock as s, createBlock as C, createCommentVNode as n, mergeProps as pe, unref as y, createSlots as me, withCtx as c, renderSlot as _, Fragment as m, createElementVNode as a, toDisplayString as v, renderList as N, normalizeProps as fe, guardReactiveProps as ge, normalizeClass as S, createVNode as h, createTextVNode as B, normalizeStyle as R, nextTick as L } from "vue";
3
3
  import I from "./icons/icon-upload-btn.svg.js";
4
4
  import T from "./icons/icon-upload-btn-hover.svg.js";
5
5
  import K from "./icons/icon-upload-btn-disabled.svg.js";
6
6
  import ye from "./icons/icon-loading-blue.svg.js";
7
7
  import ve from "./icons/icon-upload-success.svg.js";
8
- import ke from "./icons/icon-upload-retry.svg.js";
9
- import we from "./icons/icon-upload-fail.svg.js";
10
- import { ElMessageBox as he, ElMessage as E } from "element-plus";
8
+ import we from "./icons/icon-upload-retry.svg.js";
9
+ import ke from "./icons/icon-upload-fail.svg.js";
10
+ import { ElMessageBox as he, ElMessage as $ } from "element-plus";
11
11
  import { useUpload as be } from "./hooks/useUpload.js";
12
12
  import { useUploadRetry as Be } from "./hooks/useUploadRetry.js";
13
- import { downloadFileWithAxios as _e } from "./utils/file.js";
14
- import { getFileIconByName as Ce } from "./utils/file-icon-maps.js";
13
+ import { downloadFileWithAxios as Ce } from "./utils/file.js";
14
+ import { getFileIconByName as _e } from "./utils/file-icon-maps.js";
15
15
  import { useExposeMethods as Se } from "./expose/index.js";
16
16
  import { useCiUploadComputed as ze } from "./computed/index.js";
17
- import { defaultProps as Le } from "./props/index.js";
18
- const $e = { class: "CiUpload" }, Ee = {
17
+ import { defaultProps as De } from "./props/index.js";
18
+ const Le = { class: "CiUpload" }, $e = {
19
19
  key: 0,
20
20
  class: "tip-slot-textInfo"
21
- }, Ue = {
21
+ }, Ee = {
22
22
  key: 1,
23
23
  class: "default-tip-slot-textInfo"
24
- }, Ne = { class: "upload-btn-text" }, Pe = {
24
+ }, Pe = { class: "upload-btn-text" }, Ue = {
25
25
  key: 0,
26
26
  class: "tip-slot-textInfo"
27
- }, Re = {
27
+ }, Ne = {
28
28
  key: 1,
29
29
  class: "default-tip-slot-textInfo"
30
- }, De = { class: "file-item-top" }, Ie = { class: "file-name-file-icon" }, Te = ["src"], Ke = { class: "top-right" }, Me = {
30
+ }, Re = { class: "file-item-top" }, Ie = { class: "file-name-file-icon" }, Te = ["src"], Ke = { class: "top-right" }, Me = {
31
31
  key: 0,
32
32
  class: "file-size"
33
33
  }, Ve = {
@@ -46,6 +46,8 @@ const $e = { class: "CiUpload" }, Ee = {
46
46
  props: /* @__PURE__ */ de({
47
47
  action: {},
48
48
  downloadUrl: {},
49
+ data: {},
50
+ headers: {},
49
51
  uploadBtnText: {},
50
52
  maxSize: {},
51
53
  multiple: { type: Boolean },
@@ -60,30 +62,35 @@ const $e = { class: "CiUpload" }, Ee = {
60
62
  showPreviewBtn: { type: Boolean },
61
63
  showDownloadBtn: { type: Boolean },
62
64
  showDeleteBtn: { type: Boolean },
65
+ customDownload: { type: Boolean },
63
66
  drag: { type: Boolean },
64
67
  disabled: { type: Boolean },
65
68
  readonly: { type: Boolean },
66
69
  axiosInstance: {}
67
- }, Le),
68
- emits: ["update:fileList", "onSuccess", "onRemove", "onChange", "onError"],
70
+ }, De),
71
+ emits: ["update:fileList", "onSuccess", "onRemove", "onChange", "onError", "onCustomDownload"],
69
72
  setup(M, { expose: V, emit: q }) {
70
- const A = ue(), U = L(), b = L(!1), k = L([]), { checkUploadStatus: H } = Se(k), r = M, { customHttpRequest: W } = be(r.axiosInstance), d = q;
73
+ const A = ue(), E = D(), b = D(!1), w = D([]), { checkUploadStatus: H } = Se(w), r = M, { customHttpRequest: W } = be(r.axiosInstance), d = q;
71
74
  V({
72
75
  checkUploadStatus: H
73
76
  });
74
- const { retryUpload: F } = Be(k, d, r);
77
+ const { retryUpload: F } = Be(w, d, r);
75
78
  ce(
76
79
  () => r.fileList,
77
80
  (e) => {
78
- k.value = e.map((t) => ({ ...t }));
81
+ w.value = e.map((t) => ({ ...t }));
79
82
  },
80
83
  { immediate: !0 }
81
84
  );
82
85
  const z = (e) => {
83
86
  var t;
84
- (t = U.value) == null || t.handleRemove(e);
85
- }, N = (e) => {
86
- e.downloadPercentage = 0, e.status = "downloading", _e(
87
+ (t = E.value) == null || t.handleRemove(e);
88
+ }, P = (e) => {
89
+ if (r.customDownload) {
90
+ d("onCustomDownload", e);
91
+ return;
92
+ }
93
+ e.downloadPercentage = 0, e.status = "downloading", Ce(
87
94
  {
88
95
  fileKey: e.fileKey || "当前此条数据没有fileKey字段",
89
96
  fileName: e.fileName || "当前此条数据没有fileName字段"
@@ -99,10 +106,10 @@ const $e = { class: "CiUpload" }, Ee = {
99
106
  );
100
107
  }, O = (e) => {
101
108
  const t = r.accept.split(",").map((i) => i.trim().toLowerCase()), u = e.type.toLowerCase(), f = e.name.toLowerCase();
102
- return t.some((i) => u === i || f.endsWith(i)) ? e.size <= r.maxSize ? !0 : (E.error(`文件大小超出限制,最大文件大小为${ee.value}`), b.value = !0, $(() => {
109
+ return t.some((i) => u === i || f.endsWith(i)) ? e.size <= r.maxSize ? !0 : ($.error(`文件大小超出限制,最大文件大小为${ee.value}`), b.value = !0, L(() => {
103
110
  const i = r.fileList.filter((o) => o.uid !== e.uid);
104
111
  d("update:fileList", i), b.value = !1;
105
- }), !1) : (E.error("不支持上传该类型文件"), b.value = !0, $(() => {
112
+ }), !1) : ($.error("不支持上传该类型文件"), b.value = !0, L(() => {
106
113
  const i = r.fileList.filter((o) => o.uid !== e.uid);
107
114
  d("update:fileList", i), b.value = !1;
108
115
  }), !1);
@@ -119,49 +126,51 @@ const $e = { class: "CiUpload" }, Ee = {
119
126
  // 用户点击“确定”按钮,允许删除
120
127
  () => !1
121
128
  // 用户点击“取消”按钮,取消删除
122
- ), x = (e, t) => {
123
- E.error(`文件数量超出限制,最大文件数量为${r.limit}个`);
124
- }, G = (e, t, u) => {
125
- t.status = "fail", t.percentage = 0, $(() => {
129
+ ), G = (e, t) => {
130
+ $.error(`文件数量超出限制,最大文件数量为${r.limit}个`);
131
+ }, J = (e, t, u) => {
132
+ t.status = "fail", t.percentage = 0, L(() => {
126
133
  d("update:fileList", [...u, t]), d("onError", t, u);
127
134
  });
128
- }, J = (e, t, u) => {
129
- var p, w, i;
135
+ }, Q = (e, t, u) => {
136
+ var p, k, i;
130
137
  if (!e) return;
131
138
  const f = u.find((o) => o.uid === t.uid);
132
- f && (f.fileName = ((p = e == null ? void 0 : e.data) == null ? void 0 : p.fileName) || t.name, f.fileKey = ((w = e == null ? void 0 : e.data) == null ? void 0 : w.fileKey) || "当前接口没有返回fileKey字段", f.fileSize = ((i = e == null ? void 0 : e.data) == null ? void 0 : i.fileSize) || t.size), d("update:fileList", u), d("onSuccess", t, u);
133
- }, Q = (e, t) => {
134
- e.status === "success" && !e.response || (d("update:fileList", t), d("onChange", e, t));
139
+ f && (f.fileName = ((p = e == null ? void 0 : e.data) == null ? void 0 : p.fileName) || t.name, f.fileKey = ((k = e == null ? void 0 : e.data) == null ? void 0 : k.fileKey) || "当前接口没有返回fileKey字段", f.fileSize = ((i = e == null ? void 0 : e.data) == null ? void 0 : i.fileSize) || t.size), d("update:fileList", u), d("onSuccess", t, u);
135
140
  }, X = (e, t) => {
141
+ e.status === "success" && !e.response || (d("update:fileList", t), d("onChange", e, t));
142
+ }, Y = (e, t) => {
136
143
  d("update:fileList", t), d("onRemove", e, t);
137
- }, { hasRealDefaultSlot: Y, finalBeforeUpload: Z, maxSizeInMB: ee, defaultTipSlotTextInfo: P, otherSlots: te } = ze(r, A, O);
144
+ }, { hasRealDefaultSlot: Z, finalBeforeUpload: x, maxSizeInMB: ee, defaultTipSlotTextInfo: U, otherSlots: te } = ze(r, A, O);
138
145
  return (e, t) => {
139
- const u = le, f = se, p = ae, w = ne, i = ie;
140
- return s(), l("div", $e, [
141
- e.readonly ? n("", !0) : (s(), _(f, pe({
146
+ const u = le, f = se, p = ae, k = ne, i = ie;
147
+ return s(), l("div", Le, [
148
+ e.readonly ? n("", !0) : (s(), C(f, pe({
142
149
  key: 0,
143
150
  class: ["ci-el-upload-component", { "is-disabled": e.disabled }],
144
151
  ref_key: "uploadRef",
145
- ref: U,
152
+ ref: E,
146
153
  action: e.action,
147
- "file-list": k.value,
154
+ data: e.data,
155
+ headers: e.headers,
156
+ "file-list": w.value,
148
157
  accept: e.accept,
149
158
  limit: e.limit,
150
159
  multiple: e.multiple,
151
160
  drag: e.drag,
152
161
  disabled: e.disabled,
153
- "before-upload": y(Z),
162
+ "before-upload": y(x),
154
163
  "before-remove": j,
155
- "on-success": J,
156
- "on-change": Q,
157
- "on-remove": X,
158
- "on-exceed": x,
159
- "on-error": G,
164
+ "on-success": Q,
165
+ "on-change": X,
166
+ "on-remove": Y,
167
+ "on-exceed": G,
168
+ "on-error": J,
160
169
  "http-request": y(W),
161
170
  "show-file-list": !1
162
171
  }, e.$attrs), me({
163
172
  default: c(() => [
164
- y(Y) ? C(e.$slots, "default", { key: 0 }, void 0, !0) : (s(), l(m, { key: 1 }, [
173
+ y(Z) ? _(e.$slots, "default", { key: 0 }, void 0, !0) : (s(), l(m, { key: 1 }, [
165
174
  e.drag ? (s(), l(m, { key: 0 }, [
166
175
  t[0] || (t[0] = a("img", {
167
176
  class: "upload-btn-icon",
@@ -182,10 +191,10 @@ const $e = { class: "CiUpload" }, Ee = {
182
191
  a("span", { class: "drag-text-info-click" }, "点击上传"),
183
192
  a("span", { class: "drag-text-info-black" }, "或将文件拖拽到这里上传")
184
193
  ], -1)),
185
- e.$slots.tip ? (s(), l("div", Ee, [
186
- C(e.$slots, "tip", {}, void 0, !0)
187
- ])) : (s(), l("div", Ue, v(y(P)), 1))
188
- ], 64)) : (s(), _(u, {
194
+ e.$slots.tip ? (s(), l("div", $e, [
195
+ _(e.$slots, "tip", {}, void 0, !0)
196
+ ])) : (s(), l("div", Ee, v(y(U)), 1))
197
+ ], 64)) : (s(), C(u, {
189
198
  key: 1,
190
199
  class: "upload-btn",
191
200
  disabled: e.disabled
@@ -206,7 +215,7 @@ const $e = { class: "CiUpload" }, Ee = {
206
215
  src: K,
207
216
  alt: ""
208
217
  }, null, -1)),
209
- a("span", Ne, v(e.uploadBtnText), 1)
218
+ a("span", Pe, v(e.uploadBtnText), 1)
210
219
  ]),
211
220
  _: 1,
212
221
  __: [4, 5, 6]
@@ -218,38 +227,38 @@ const $e = { class: "CiUpload" }, Ee = {
218
227
  e.drag ? void 0 : {
219
228
  name: "tip",
220
229
  fn: c(() => [
221
- e.$slots.tip ? (s(), l("div", Pe, [
222
- C(e.$slots, "tip", {}, void 0, !0)
223
- ])) : (s(), l("div", Re, v(y(P)), 1))
230
+ e.$slots.tip ? (s(), l("div", Ue, [
231
+ _(e.$slots, "tip", {}, void 0, !0)
232
+ ])) : (s(), l("div", Ne, v(y(U)), 1))
224
233
  ]),
225
234
  key: "0"
226
235
  },
227
- R(y(te), (o, g) => ({
236
+ N(y(te), (o, g) => ({
228
237
  name: g,
229
238
  fn: c((oe) => [
230
- C(e.$slots, g, fe(ge(oe || {})), void 0, !0)
239
+ _(e.$slots, g, fe(ge(oe || {})), void 0, !0)
231
240
  ])
232
241
  }))
233
- ]), 1040, ["class", "action", "file-list", "accept", "limit", "multiple", "drag", "disabled", "before-upload", "http-request"])),
234
- k.value.length ? (s(), l("div", {
242
+ ]), 1040, ["class", "action", "data", "headers", "file-list", "accept", "limit", "multiple", "drag", "disabled", "before-upload", "http-request"])),
243
+ w.value.length ? (s(), l("div", {
235
244
  key: 1,
236
245
  class: S(["custom-file-list-default", { "is-readonly": e.readonly }])
237
246
  }, [
238
- (s(!0), l(m, null, R(k.value, (o) => (s(), l("div", {
247
+ (s(!0), l(m, null, N(w.value, (o) => (s(), l("div", {
239
248
  class: "file-item-wrapper",
240
249
  key: o.uid
241
250
  }, [
242
- a("div", De, [
251
+ a("div", Re, [
243
252
  a("div", Ie, [
244
253
  e.showFileExtIcon ? (s(), l("img", {
245
254
  key: 0,
246
255
  class: "file-icon",
247
- src: y(Ce)(o.fileName || o.name)
256
+ src: y(_e)(o.fileName || o.name)
248
257
  }, null, 8, Te)) : n("", !0),
249
258
  h(p, {
250
259
  class: "top-left file-name",
251
260
  disabled: o.status === "downloading" || o.status === "uploading",
252
- onClick: (g) => N(o)
261
+ onClick: (g) => P(o)
253
262
  }, {
254
263
  default: c(() => [
255
264
  B(v(o.fileName || o.name), 1)
@@ -271,24 +280,24 @@ const $e = { class: "CiUpload" }, Ee = {
271
280
  _: 2,
272
281
  __: [7]
273
282
  }, 1032, ["onClick"]),
274
- h(w, { direction: "vertical" })
283
+ h(k, { direction: "vertical" })
275
284
  ], 64)) : n("", !0),
276
285
  e.showDownloadBtn ? (s(), l(m, { key: 1 }, [
277
286
  h(p, {
278
287
  disabled: o.status === "downloading",
279
- onClick: (g) => N(o)
288
+ onClick: (g) => P(o)
280
289
  }, {
281
290
  default: c(() => [
282
- B(v(o.status === "downloading" ? `下载中...${o.downloadPercentage || 0}%` : "下载"), 1)
291
+ B(v(o.status === "downloading" && e.showDownloadProgress && e.customDownload ? `下载中...${o.downloadPercentage || 0}%` : "下载"), 1)
283
292
  ]),
284
293
  _: 2
285
294
  }, 1032, ["disabled", "onClick"]),
286
- e.showDeleteBtn && !e.readonly ? (s(), _(w, {
295
+ e.showDeleteBtn && !e.readonly ? (s(), C(k, {
287
296
  key: 0,
288
297
  direction: "vertical"
289
298
  })) : n("", !0)
290
299
  ], 64)) : n("", !0),
291
- e.showDeleteBtn && !e.readonly ? (s(), _(p, {
300
+ e.showDeleteBtn && !e.readonly ? (s(), C(p, {
292
301
  key: 2,
293
302
  onClick: (g) => z(o)
294
303
  }, {
@@ -343,7 +352,7 @@ const $e = { class: "CiUpload" }, Ee = {
343
352
  default: c(() => [
344
353
  a("img", {
345
354
  class: "retry-icon",
346
- src: ke,
355
+ src: we,
347
356
  onClick: (g) => y(F)(o)
348
357
  }, null, 8, He)
349
358
  ]),
@@ -351,7 +360,7 @@ const $e = { class: "CiUpload" }, Ee = {
351
360
  }, 1024),
352
361
  t[12] || (t[12] = a("img", {
353
362
  class: "fail-icon",
354
- src: we
363
+ src: ke
355
364
  }, null, -1))
356
365
  ], 2)) : n("", !0)
357
366
  ])
@@ -361,7 +370,7 @@ const $e = { class: "CiUpload" }, Ee = {
361
370
  o.status === "uploading" ? (s(), l("div", We, [
362
371
  a("div", {
363
372
  class: "file-progress-inner",
364
- style: D({ width: (o.percentage || 0) + "%" })
373
+ style: R({ width: (o.percentage || 0) + "%" })
365
374
  }, null, 4)
366
375
  ])) : n("", !0)
367
376
  ], 64)) : n("", !0),
@@ -369,7 +378,7 @@ const $e = { class: "CiUpload" }, Ee = {
369
378
  o.status === "downloading" ? (s(), l("div", Fe, [
370
379
  a("div", {
371
380
  class: "file-progress-inner",
372
- style: D({ width: (o.downloadPercentage || 0) + "%" })
381
+ style: R({ width: (o.downloadPercentage || 0) + "%" })
373
382
  }, null, 4)
374
383
  ])) : n("", !0)
375
384
  ], 64)) : n("", !0)
@@ -3,6 +3,10 @@ const o = {
3
3
  action: "http://localhost:3001/upload",
4
4
  // 下载 URL - 默认值: 是我本机本地跑一个 Node 服务, 提供了一个下载接口
5
5
  downloadUrl: "http://localhost:3001/download-by-key",
6
+ // 上传时附带的额外参数 - 默认值: {}
7
+ data: () => ({}),
8
+ // 设置上传的请求头部 - 默认值: {}
9
+ headers: () => ({}),
6
10
  // 上传按钮文本 - 默认值: 选择附件
7
11
  uploadBtnText: "选择附件",
8
12
  // 限制上传文件的大小(单位: byte) - 默认值: 100.00MB
@@ -30,6 +34,8 @@ const o = {
30
34
  showDownloadBtn: !0,
31
35
  // 是否显示删除按钮 - 默认值: true
32
36
  showDeleteBtn: !0,
37
+ // 是否由开发者自定义下载逻辑 - 默认值: false
38
+ customDownload: !1,
33
39
  // 是否支持拖拽上传 - 默认值: false
34
40
  drag: !1,
35
41
  // 是否禁用上传 - 默认值: false
@@ -0,0 +1,9 @@
1
+ function c(p, e) {
2
+ !e || typeof e != "object" || Object.keys(e).forEach((n) => {
3
+ const o = e[n];
4
+ o instanceof Blob ? p.append(n, o) : p.append(n, String(o));
5
+ });
6
+ }
7
+ export {
8
+ c as appendFormData
9
+ };
@@ -10,5 +10,15 @@ declare const _default: import('vue').DefineComponent<DictionarySelectProps, {},
10
10
  dictionaryCode: string;
11
11
  showRange: Array<string | number>;
12
12
  noShowRange: Array<string | number>;
13
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
13
+ dictionaryUrl: string;
14
+ dictionaryExtraParams: {
15
+ [key: string]: any;
16
+ };
17
+ dictionaryParamKey: string;
18
+ dictionaryRequestMethod: "get" | "post";
19
+ dictionaryLabel: string;
20
+ dictionaryValue: string;
21
+ dictionarySelectWidth: string;
22
+ axiosInstance: any;
23
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
24
  export default _default;
@@ -6,9 +6,24 @@ export interface DictionarySelectProps {
6
6
  collapseTagsTooltip?: boolean;
7
7
  maxCollapseTags?: number;
8
8
  multiple?: boolean;
9
- dictionaryCode?: string;
9
+ dictionaryCode: string;
10
10
  showRange?: Array<string | number>;
11
11
  noShowRange?: Array<string | number>;
12
+ dictionaryUrl?: string;
13
+ dictionaryExtraParams?: {
14
+ [key: string]: any;
15
+ };
16
+ dictionaryParamKey?: string;
17
+ dictionaryRequestMethod?: 'get' | 'post';
18
+ dictionaryLabel?: string;
19
+ dictionaryValue?: string;
20
+ dictionarySelectWidth?: string;
21
+ /**
22
+ * 自定义请求对象:可选传入 axios 实例,用于替代默认 axios - 默认值: axios (场景:如需使用本项目配置过的 axios 实例接管字典项的接口请求)
23
+ * 若传入了:将使用该实例发起请求(支持统一拦截器等配置)
24
+ * 若未传入:则默认使用全局的 axios 对象
25
+ */
26
+ axiosInstance?: any;
12
27
  }
13
28
  export interface InterFaceOptions {
14
29
  label: string;
@@ -15,16 +15,21 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Ci
15
15
  onRemove: (file: CiUploadFile, fileList: CiUploadUserFile[]) => any;
16
16
  onSuccess: (file: CiUploadFile, fileList: CiUploadUserFile[]) => any;
17
17
  "update:fileList": (list: CiUploadUserFile[]) => any;
18
+ onCustomDownload: (file: UploadUserFile) => any;
18
19
  }, string, import('vue').PublicProps, Readonly<CiUploadProps> & Readonly<{
19
20
  onOnChange?: (file: CiUploadFile, fileList: CiUploadUserFile[]) => any;
20
21
  onOnError?: (file: CiUploadFile, fileList: CiUploadUserFile[]) => any;
21
22
  onOnRemove?: (file: CiUploadFile, fileList: CiUploadUserFile[]) => any;
22
23
  onOnSuccess?: (file: CiUploadFile, fileList: CiUploadUserFile[]) => any;
23
24
  "onUpdate:fileList"?: (list: CiUploadUserFile[]) => any;
25
+ onOnCustomDownload?: (file: UploadUserFile) => any;
24
26
  }>, {
25
27
  drag: boolean;
28
+ data: Record<string, any>;
26
29
  multiple: boolean;
30
+ axiosInstance: any;
27
31
  action: string;
32
+ headers: Headers | Record<string, any>;
28
33
  accept: string;
29
34
  fileList: UploadUserFile[];
30
35
  disabled: boolean;
@@ -39,8 +44,8 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Ci
39
44
  showPreviewBtn: boolean;
40
45
  showDownloadBtn: boolean;
41
46
  showDeleteBtn: boolean;
47
+ customDownload: boolean;
42
48
  readonly: boolean;
43
- axiosInstance: any;
44
49
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
45
50
  uploadRef: unknown;
46
51
  }, HTMLDivElement>, Partial<Record<number, (_: any) => any>> & {
@@ -2,6 +2,8 @@ import { UploadUserFile } from 'element-plus';
2
2
  export declare const defaultProps: {
3
3
  action: string;
4
4
  downloadUrl: string;
5
+ data: () => Record<string, any>;
6
+ headers: () => Headers | Record<string, any>;
5
7
  uploadBtnText: string;
6
8
  maxSize: number;
7
9
  multiple: boolean;
@@ -15,6 +17,7 @@ export declare const defaultProps: {
15
17
  showPreviewBtn: boolean;
16
18
  showDownloadBtn: boolean;
17
19
  showDeleteBtn: boolean;
20
+ customDownload: boolean;
18
21
  drag: boolean;
19
22
  disabled: boolean;
20
23
  readonly: boolean;
@@ -2,6 +2,8 @@ import { UploadFile, UploadProps, UploadUserFile } from 'element-plus';
2
2
  export interface CiUploadProps {
3
3
  action?: string;
4
4
  downloadUrl?: string;
5
+ data?: Record<string, any>;
6
+ headers?: Headers | Record<string, any>;
5
7
  uploadBtnText?: string;
6
8
  maxSize?: number;
7
9
  multiple?: boolean;
@@ -16,6 +18,7 @@ export interface CiUploadProps {
16
18
  showPreviewBtn?: boolean;
17
19
  showDownloadBtn?: boolean;
18
20
  showDeleteBtn?: boolean;
21
+ customDownload?: boolean;
19
22
  drag?: boolean;
20
23
  disabled?: boolean;
21
24
  readonly?: boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 将一个普通对象的数据追加到 FormData 中
3
+ * - 支持 string/number 自动转 string
4
+ * - 支持 Blob 直接追加
5
+ */
6
+ export declare function appendFormData(formData: FormData, data: Record<string, any>): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon30_npm/csit-vue3",
3
- "version": "1.0.44",
3
+ "version": "1.0.46",
4
4
  "type": "module",
5
5
  "author": "cuiwq",
6
6
  "license": "MIT",
@@ -1,67 +0,0 @@
1
- import n from "axios";
2
- import { executeAxiosMiddlewares as r } from "./middlewares/middleware-executor.js";
3
- import { logRequest as a } from "./middlewares/request-middlewares/logRequest.js";
4
- import { addXRequestedWith as i } from "./middlewares/request-middlewares/addXRequestedWith.js";
5
- import { disposeGetUrlParams as m } from "./middlewares/request-middlewares/dafeiyiqi-disposeGetUrlParams.js";
6
- import { logResponse as t } from "./middlewares/response-middlewares/logResponse.js";
7
- import { handleTokenInvalidToLogin as c } from "./middlewares/response-middlewares/handle-success/handleTokenInvalidToLogin.js";
8
- import { handleFileStream as p } from "./middlewares/response-middlewares/handle-success/handleFileStream.js";
9
- import { handleSuccess as d } from "./middlewares/response-middlewares/handle-success/handleSuccess.js";
10
- import { formatResponseData as l } from "./middlewares/response-middlewares/formatResponseData.js";
11
- import { handleError as u } from "./middlewares/response-middlewares/handle-error/handleError.js";
12
- const f = [
13
- // 1. 记录请求日志
14
- a,
15
- // 2. 添加通用 X-Requested-With 到请求头
16
- i,
17
- /**
18
- * 3. GET请求,需要处理参数拼接到Url中(目前打非一期列表等一些接口都是用的GET请求)
19
- * PS: 打非二期设计人员设计的接口: 像只入参一个字段的设计成了GET请求(如此不需要中间件处理),其他但凡入参超过一个的全部设计成了post请求(如此更不需要中间件处理)
20
- */
21
- m
22
- ], w = [
23
- // 1. 记录响应日志
24
- t,
25
- // 2. 处理打非系统用户长时间不操作页面token失效自动去往登录页面
26
- c,
27
- // 3. 处理响应成功-文件流
28
- p,
29
- // 4. 处理响应成功
30
- d,
31
- // 5. 格式化响应数据
32
- l
33
- ], x = [
34
- // 1. 记录响应日志
35
- t,
36
- // 2. 处理错误响应
37
- u
38
- ], s = n.create({
39
- // 基础路径
40
- baseURL: "/",
41
- // 超时时间
42
- timeout: 6e4
43
- /**
44
- * 这句话没用,在node.js环境中有用
45
- * 浏览器环境: 在浏览器中,HTTP重定向是由浏览器本身处理的,而不是Axios。即使你配置了 maxRedirects: 0,浏览器会自动遵循重定向,Axios只会接收到重定向后的响应。因此,302状态码不会被Axios捕获。
46
- * 解决方案: 浏览器中无法阻止自动重定向,通常需要后端支持,比如返回非标准的状态码(如299)或其他标志,让前端捕获。
47
- */
48
- // maxRedirects: 0,
49
- });
50
- s.interceptors.request.use(
51
- async (e) => (await r(f, { config: e }), e),
52
- (e) => {
53
- Promise.reject(e);
54
- }
55
- );
56
- s.interceptors.response.use(
57
- async (e) => {
58
- const o = { response: e };
59
- return await r(w, o), o.isFileStream ? (console.log("当前我是文件流数据"), o.response) : o.response.data;
60
- },
61
- async (e) => {
62
- throw await r(x, { error: e }), new Error(e);
63
- }
64
- );
65
- export {
66
- s as default
67
- };
@@ -1,15 +0,0 @@
1
- import "axios";
2
- async function o(n, r) {
3
- let a = -1;
4
- async function t(e) {
5
- if (e <= a)
6
- throw new Error("createdMiddlewareRunner_axios: 中间件不能被重复调用");
7
- a = e;
8
- const i = n[e];
9
- i && await i(r, () => t(e + 1));
10
- }
11
- await t(0);
12
- }
13
- export {
14
- o as executeAxiosMiddlewares
15
- };
@@ -1,12 +0,0 @@
1
- import "axios";
2
- async function s(e, t) {
3
- console.log("axios-请求中间件: 添加通用 X-Requested-With 到请求头已执行"), e.config.headers = {
4
- ...e.config.headers,
5
- // 问题:当用户长时间不操作页面 再次触发接口操作时 需要退出到登录页面 所需要的请求头
6
- // 胡老师,说接口请求要带这个请求头,才能拦截 1001 的超时状态,前端再根据这个1001做登出
7
- "X-Requested-With": "XMLHttpRequest"
8
- }, await t();
9
- }
10
- export {
11
- s as addXRequestedWith
12
- };
@@ -1,17 +0,0 @@
1
- import "axios";
2
- async function l(r, e) {
3
- const { config: o } = r;
4
- if (o.method === "get" && o.params) {
5
- console.log("axios-请求中间件: 当前请求是GET请求,需要处理参数拼接到Url中去,中间件已执行");
6
- let s = o.url;
7
- s += "?";
8
- const t = Object.keys(o.params);
9
- for (const a of t)
10
- o.params[a] !== void 0 && o.params[a] !== null && (s += `${a}=${encodeURIComponent(o.params[a])}&`);
11
- s = s.substring(0, s.length - 1), o.params = {}, o.url = s;
12
- }
13
- await e();
14
- }
15
- export {
16
- l as disposeGetUrlParams
17
- };
@@ -1,7 +0,0 @@
1
- import "axios";
2
- async function s(o, i) {
3
- console.log("axios-请求中间件: 打印请求信息中间件已执行(调试用途)"), console.log("axios-请求中间件: 请求信息为:", o.config), await i();
4
- }
5
- export {
6
- s as logRequest
7
- };
@@ -1,7 +0,0 @@
1
- import "axios";
2
- const e = async (o, s) => {
3
- console.log("axios-响应中间件(成功响应): 响应数据格式化中间件已执行"), o.response, await s();
4
- };
5
- export {
6
- e as formatResponseData
7
- };
@@ -1,14 +0,0 @@
1
- const e = {
2
- 400: "请求参数错误,请检查输入。",
3
- 401: "未授权,请重新登录。",
4
- 403: "禁止访问,您没有权限查看此内容。",
5
- 404: "资源未找到,请检查接口路径。",
6
- 429: "请求过多,请稍后再试。",
7
- 500: "服务器内部错误,请稍后重试。",
8
- 502: "网关错误,请联系管理员。",
9
- 503: "服务不可用,请稍后再试。"
10
- }, r = "发生未知错误,请稍后再试。";
11
- export {
12
- r as defaultErrorMessage,
13
- e as errorMessages
14
- };