el-plus 0.0.47 → 0.0.50

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 (71) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.css +1 -1
  3. package/dist/index.full.js +453 -276
  4. package/dist/index.full.min.js +1 -1
  5. package/dist/index.full.min.js.map +1 -1
  6. package/dist/index.full.min.mjs +1 -1
  7. package/dist/index.full.min.mjs.map +1 -1
  8. package/dist/index.full.mjs +453 -276
  9. package/es/components/attachment/index.d.ts +24 -3
  10. package/es/components/attachment/src/attachment.d.ts +4 -0
  11. package/es/components/attachment/src/attachment.mjs +5 -0
  12. package/es/components/attachment/src/attachment.mjs.map +1 -1
  13. package/es/components/attachment/src/attachment.vue.d.ts +12 -1
  14. package/es/components/attachment/src/attachment.vue2.mjs +69 -29
  15. package/es/components/attachment/src/attachment.vue2.mjs.map +1 -1
  16. package/es/components/attachment/src/use-attachment.d.ts +32 -24
  17. package/es/components/attachment/src/use-attachment.mjs +65 -12
  18. package/es/components/attachment/src/use-attachment.mjs.map +1 -1
  19. package/es/components/header/index.d.ts +15 -0
  20. package/es/components/header/src/header.d.ts +4 -0
  21. package/es/components/header/src/header.mjs +6 -1
  22. package/es/components/header/src/header.mjs.map +1 -1
  23. package/es/components/header/src/header.vue.d.ts +9 -0
  24. package/es/components/header/src/header.vue2.mjs +6 -1
  25. package/es/components/header/src/header.vue2.mjs.map +1 -1
  26. package/es/components/header/src/use-header.mjs +42 -44
  27. package/es/components/header/src/use-header.mjs.map +1 -1
  28. package/es/hooks/dialog/use-dialog.mjs.map +1 -1
  29. package/es/locale/lang/en.d.ts +12 -0
  30. package/es/locale/lang/en.mjs +12 -0
  31. package/es/locale/lang/en.mjs.map +1 -1
  32. package/es/locale/lang/zh-cn.d.ts +12 -0
  33. package/es/locale/lang/zh-cn.mjs +12 -0
  34. package/es/locale/lang/zh-cn.mjs.map +1 -1
  35. package/es/package.json.mjs +1 -1
  36. package/es/utils/file.d.ts +1 -1
  37. package/es/utils/file.mjs.map +1 -1
  38. package/lib/components/attachment/index.d.ts +24 -3
  39. package/lib/components/attachment/src/attachment.d.ts +4 -0
  40. package/lib/components/attachment/src/attachment.js +5 -0
  41. package/lib/components/attachment/src/attachment.js.map +1 -1
  42. package/lib/components/attachment/src/attachment.vue.d.ts +12 -1
  43. package/lib/components/attachment/src/attachment.vue2.js +68 -28
  44. package/lib/components/attachment/src/attachment.vue2.js.map +1 -1
  45. package/lib/components/attachment/src/use-attachment.d.ts +32 -24
  46. package/lib/components/attachment/src/use-attachment.js +63 -10
  47. package/lib/components/attachment/src/use-attachment.js.map +1 -1
  48. package/lib/components/header/index.d.ts +15 -0
  49. package/lib/components/header/src/header.d.ts +4 -0
  50. package/lib/components/header/src/header.js +6 -1
  51. package/lib/components/header/src/header.js.map +1 -1
  52. package/lib/components/header/src/header.vue.d.ts +9 -0
  53. package/lib/components/header/src/header.vue2.js +6 -1
  54. package/lib/components/header/src/header.vue2.js.map +1 -1
  55. package/lib/components/header/src/use-header.js +42 -44
  56. package/lib/components/header/src/use-header.js.map +1 -1
  57. package/lib/hooks/dialog/use-dialog.js.map +1 -1
  58. package/lib/locale/lang/en.d.ts +12 -0
  59. package/lib/locale/lang/en.js +12 -0
  60. package/lib/locale/lang/en.js.map +1 -1
  61. package/lib/locale/lang/zh-cn.d.ts +12 -0
  62. package/lib/locale/lang/zh-cn.js +12 -0
  63. package/lib/locale/lang/zh-cn.js.map +1 -1
  64. package/lib/package.json.js +1 -1
  65. package/lib/utils/file.d.ts +1 -1
  66. package/lib/utils/file.js.map +1 -1
  67. package/package.json +1 -1
  68. package/theme-chalk/attachment.css +1 -0
  69. package/theme-chalk/index.css +1 -1
  70. package/theme-chalk/src/attachment.scss +37 -0
  71. package/theme-chalk/src/index.scss +2 -1
@@ -1,4 +1,4 @@
1
- /*! ElPlus v0.0.47 */
1
+ /*! ElPlus v0.0.50 */
2
2
 
3
3
  import { useAttrs, getCurrentInstance, inject, provide, ref, nextTick, defineComponent, computed, createVNode, Fragment, withDirectives, resolveComponent, mergeProps, resolveDirective, useTemplateRef, createTextVNode, h, mergeModels, useModel, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, withCtx, renderSlot, renderList, createBlock, vShow, toDisplayString, reactive, useSlots, watch, onMounted, createSlots, normalizeProps, guardReactiveProps, markRaw, Transition, shallowReactive, isVNode, render, createElementVNode, toRaw } from 'vue';
4
4
  import { buttonProps, useLocale as useLocale$1, ElLoading, ElMessage, ElMessageBox, formProps as formProps$1, formEmits as formEmits$1, ElTooltip, formItemProps as formItemProps$1, ElFormItem, ElForm, ElRow, ElCol, inputProps as inputProps$1, inputEmits as inputEmits$1, configProviderContextKey, ElConfigProvider, ElDialog, ElButton, ElTable, ElIcon, selectProps as selectProps$1, selectEmits as selectEmits$1, ElPageHeader, datePickerProps, linkProps as linkProps$1, ElSkeleton } from 'element-plus';
@@ -281,6 +281,18 @@ var zhCn = {
281
281
  notFound: "\u672A\u627E\u5230, \u8BF7\u6C42\u7684\u8D44\u6E90\u4E0D\u5B58\u5728",
282
282
  //
283
283
  serverError: "\u5185\u90E8\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"
284
+ },
285
+ attachment: {
286
+ addAttachment: "\u6DFB\u52A0\u9644\u4EF6",
287
+ manageAttachment: "\u9644\u4EF6\u7BA1\u7406",
288
+ operation: "\u64CD\u4F5C",
289
+ download: "\u4E0B\u8F7D",
290
+ delete: "\u5220\u9664",
291
+ attachmentType: "\u9644\u4EF6\u7C7B\u578B",
292
+ fileName: "\u6587\u4EF6\u540D\u79F0",
293
+ creator: "\u521B\u5EFA\u4EBA",
294
+ createTime: "\u521B\u5EFA\u65F6\u95F4",
295
+ description: "\u8BF4\u660E"
284
296
  }
285
297
  }
286
298
  };
@@ -3163,7 +3175,12 @@ const headerProps = {
3163
3175
  default: () => []
3164
3176
  },
3165
3177
  // 工作流id
3166
- workflowId: String
3178
+ workflowId: String,
3179
+ // 是否显示附件按钮
3180
+ isShowAttachmentButton: {
3181
+ type: Boolean,
3182
+ default: false
3183
+ }
3167
3184
  };
3168
3185
  const headerEmits = {};
3169
3186
 
@@ -3262,67 +3279,452 @@ const useHeader = (props, emit) => {
3262
3279
  };
3263
3280
  };
3264
3281
  const useButtons = (props, emit) => {
3265
- const { t } = useLocale();
3282
+ const {
3283
+ t
3284
+ } = useLocale();
3285
+ const {
3286
+ mode: defaultMode
3287
+ } = useNavigation();
3288
+ const mode = computed(() => {
3289
+ return props.mode || defaultMode.value;
3290
+ });
3291
+ let defaultButtons = [{
3292
+ name: t("ep.header.edit"),
3293
+ prop: "modify",
3294
+ permission: props.name ? `${props.name}:UPDATE` : "",
3295
+ disabled: () => {
3296
+ return mode.value !== "browse";
3297
+ }
3298
+ }, {
3299
+ name: t("ep.header.save"),
3300
+ prop: "save",
3301
+ permission: props.name ? `${props.name}:SAVE` : "",
3302
+ disabled: () => {
3303
+ return !(mode.value === "edit" || mode.value === "add");
3304
+ }
3305
+ }, {
3306
+ name: t("ep.header.cancel"),
3307
+ prop: "cancel",
3308
+ disabled: () => {
3309
+ return mode.value !== "edit";
3310
+ }
3311
+ }, {
3312
+ name: t("ep.header.refresh"),
3313
+ prop: "refresh",
3314
+ permission: props.name ? `${props.name}:REFRESH` : "",
3315
+ disabled: () => {
3316
+ return mode.value !== "browse";
3317
+ }
3318
+ }, {
3319
+ name: t("ep.header.approvalLog"),
3320
+ prop: "approvalLog",
3321
+ permission: props.name ? `${props.name}:APPROVALLOG` : "",
3322
+ show: () => {
3323
+ return !!props.workflowId;
3324
+ },
3325
+ onClick: () => {
3326
+ gotoTaskTrace(props.workflowId);
3327
+ }
3328
+ }];
3329
+ if (props.defaultButtons.length) {
3330
+ defaultButtons = defaultButtons.filter((item) => {
3331
+ return props.defaultButtons.some((item1) => item1 === item.prop);
3332
+ });
3333
+ }
3334
+ const buttons = mergeListByKey(defaultButtons, props.buttons);
3335
+ return {
3336
+ buttons
3337
+ };
3338
+ };
3339
+
3340
+ const attachmentProps = {
3341
+ // 格式化列
3342
+ formatColumns: {
3343
+ ...tableProps.formatColumns
3344
+ },
3345
+ // 页面模式
3346
+ mode: {
3347
+ ...headerProps.mode
3348
+ },
3349
+ // 展示模式
3350
+ openType: {
3351
+ type: String,
3352
+ default: "dialog"
3353
+ },
3354
+ // 是否需要类型
3355
+ isType: {
3356
+ type: Boolean,
3357
+ default: true
3358
+ },
3359
+ // 是否需要备注
3360
+ isNote: {
3361
+ type: Boolean,
3362
+ default: false
3363
+ },
3364
+ // 是否需要打开弹窗按钮
3365
+ isShowOpenDialogButton: {
3366
+ type: Boolean,
3367
+ default: false
3368
+ }
3369
+ };
3370
+
3371
+ const getFullUrl = (filePath) => {
3372
+ return filePath.indexOf("hongxinshop.com") > -1 ? filePath : `${window.location.protocol}${getEnv() === "local" ? `//${getLocationEnv()}-hxjf.hongxinshop.com` : ""}/image/${filePath}`;
3373
+ };
3374
+ const downloadSrc = ({
3375
+ src,
3376
+ fileName,
3377
+ blob
3378
+ }) => {
3379
+ if (src) {
3380
+ fileName = fileName || src.split("/")[src.split("/").length - 1];
3381
+ const a = document.createElement("a");
3382
+ a.style.display = "none";
3383
+ document.body.appendChild(a);
3384
+ const event = new MouseEvent("click");
3385
+ a.download = fileName;
3386
+ a.href = blob ? src : getFullUrl(src);
3387
+ a.target = "_blank";
3388
+ a.dispatchEvent(event);
3389
+ document.body.removeChild(a);
3390
+ }
3391
+ };
3392
+ async function downloadFile({
3393
+ api = "",
3394
+ blob,
3395
+ data = {},
3396
+ src,
3397
+ fileName = "",
3398
+ config = {}
3399
+ }) {
3400
+ if (src) {
3401
+ downloadSrc({ src, fileName });
3402
+ return;
3403
+ }
3404
+ http.request(api, {
3405
+ method: config.method || "post",
3406
+ data,
3407
+ loading: true,
3408
+ responseType: blob ? "blob" : void 0,
3409
+ responseReturn: "raw",
3410
+ ...config
3411
+ }).then((res) => {
3412
+ const { headers } = res;
3413
+ if (!res.data.success) {
3414
+ return ElMessage.error(res.data.msg);
3415
+ }
3416
+ const data2 = res.data?.data || res.data?.data?.url || "";
3417
+ const lowerHeaders = {};
3418
+ for (const key in headers) {
3419
+ lowerHeaders[key.toLowerCase()] = headers[key];
3420
+ }
3421
+ let src2 = "";
3422
+ if (blob) {
3423
+ const contentDisposition = lowerHeaders["content-disposition"] || "";
3424
+ fileName = fileName || decodeURIComponent(contentDisposition.split("filename=")[1]);
3425
+ const blob2 = new Blob([data2], {
3426
+ type: headers["content-type"]
3427
+ });
3428
+ src2 = window.URL.createObjectURL(blob2);
3429
+ setTimeout(() => window.URL.revokeObjectURL(src2), 100);
3430
+ } else {
3431
+ src2 = data2;
3432
+ }
3433
+ downloadSrc({ src: src2, fileName, blob });
3434
+ });
3435
+ }
3436
+ const importFile = async ({
3437
+ accept = "*",
3438
+ multiple = false,
3439
+ fieldName = "file",
3440
+ failedFileName = "",
3441
+ extraData = {},
3442
+ api = ""
3443
+ }) => {
3444
+ return new Promise((resolve, reject) => {
3445
+ const input = document.createElement("input");
3446
+ input.type = "file";
3447
+ input.accept = accept;
3448
+ input.multiple = multiple;
3449
+ const formData = new FormData();
3450
+ Object.keys(extraData).forEach((key) => {
3451
+ formData.append(key, extraData[key]);
3452
+ });
3453
+ input.onchange = async (event) => {
3454
+ const target = event.target;
3455
+ const files = target.files;
3456
+ if (files && files.length > 0) {
3457
+ if (!multiple) {
3458
+ formData.append(fieldName, files[0]);
3459
+ } else {
3460
+ Array.from(files).forEach((file, index) => {
3461
+ formData.append(`${fieldName}${index}`, file);
3462
+ });
3463
+ }
3464
+ try {
3465
+ const { data } = await http.request(api, {
3466
+ method: "post",
3467
+ data: formData,
3468
+ loading: true,
3469
+ responseReturn: "raw",
3470
+ transformRequest: [
3471
+ function(data2) {
3472
+ return data2;
3473
+ }
3474
+ ]
3475
+ });
3476
+ if (data.success) {
3477
+ return resolve(data.data);
3478
+ }
3479
+ if (data.code === -2) {
3480
+ const fileName = failedFileName || data.data.split("/")[data.data.split("/").length - 1];
3481
+ const url = `${window.location.origin}/image/${data.data}`;
3482
+ const failedHtml = `<div style="word-break: break-all;">\u5931\u8D25\u8BE6\u60C5\uFF1A<a style="color:#409EFF;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap" title="${url}" href="${url}" download="${fileName}">${url}</a></div>`;
3483
+ ElMessageBox.alert(failedHtml, "\u63D0\u793A", {
3484
+ confirmButtonText: "\u786E\u5B9A",
3485
+ type: "error",
3486
+ dangerouslyUseHTMLString: true
3487
+ });
3488
+ return;
3489
+ }
3490
+ return ElMessage.error(data.msg);
3491
+ } catch (error) {
3492
+ console.error(error);
3493
+ }
3494
+ input.onchange = null;
3495
+ }
3496
+ };
3497
+ input.click();
3498
+ });
3499
+ };
3500
+ const previewFile = (url) => {
3501
+ url = getFullUrl(url);
3502
+ const origin = getFullUrl("").replace("/image/", "");
3503
+ const previewUrl = `${origin}/kfv/onlinePreview?url=${encode(url)}`;
3504
+ window.open(previewUrl, "_blank");
3505
+ };
3506
+
3507
+ const useAttachment = (props, { data }) => {
3266
3508
  const { mode: defaultMode } = useNavigation();
3509
+ const { t } = useLocale();
3267
3510
  const mode = computed(() => {
3268
3511
  return props.mode || defaultMode.value;
3269
3512
  });
3270
- let defaultButtons = [
3513
+ const tableRef = useTemplateRef("tableRef");
3514
+ const isNormalOpen = props.openType === "normal";
3515
+ const isDialogOpen = props.openType === "dialog";
3516
+ let toBeConfirmData = [];
3517
+ let toBeDeleteData = {};
3518
+ const columns = ref([
3271
3519
  {
3272
- name: t("ep.header.edit"),
3273
- prop: "modify",
3274
- permission: props.name ? `${props.name}:UPDATE` : "",
3275
- disabled: () => {
3276
- return mode.value !== "browse";
3520
+ type: "EpButtons",
3521
+ label: t("ep.attachment.operation"),
3522
+ width: "120px",
3523
+ props: {
3524
+ type: "text",
3525
+ list: [
3526
+ {
3527
+ name: t("ep.attachment.download"),
3528
+ onClick({ row }) {
3529
+ downloadFile({
3530
+ src: row.filePath,
3531
+ fileName: row.originalFilename || row.originalFileName
3532
+ });
3533
+ }
3534
+ },
3535
+ {
3536
+ name: t("ep.attachment.delete"),
3537
+ disabled: () => {
3538
+ return mode.value === "browse";
3539
+ },
3540
+ onClick: ({ $index, row }) => {
3541
+ if (isDialogOpen) {
3542
+ toBeDeleteData[$index] = row;
3543
+ }
3544
+ data.value.splice($index, 1);
3545
+ }
3546
+ }
3547
+ ]
3277
3548
  }
3278
3549
  },
3279
3550
  {
3280
- name: t("ep.header.save"),
3281
- prop: "save",
3282
- permission: props.name ? `${props.name}:SAVE` : "",
3283
- disabled: () => {
3284
- return !(mode.value === "edit" || mode.value === "add");
3551
+ label: t("ep.attachment.attachmentType"),
3552
+ prop: "type",
3553
+ type: "EpSelect",
3554
+ required: true,
3555
+ show: () => props.isType,
3556
+ props: {
3557
+ desc: ({ row }) => {
3558
+ return row.typeDesc;
3559
+ }
3285
3560
  }
3286
3561
  },
3287
3562
  {
3288
- name: t("ep.header.cancel"),
3289
- prop: "cancel",
3290
- disabled: () => {
3291
- return mode.value !== "edit";
3563
+ label: t("ep.attachment.fileName"),
3564
+ prop: "originalFilename",
3565
+ type: "EpLink",
3566
+ onClick({ row }) {
3567
+ previewFile(row.filePath);
3292
3568
  }
3293
3569
  },
3294
3570
  {
3295
- name: t("ep.header.refresh"),
3296
- prop: "refresh",
3297
- permission: props.name ? `${props.name}:REFRESH` : "",
3298
- disabled: () => {
3299
- return mode.value !== "browse";
3300
- }
3571
+ label: t("ep.attachment.creator"),
3572
+ prop: "createBy"
3301
3573
  },
3302
3574
  {
3303
- name: t("ep.header.approvalLog"),
3304
- prop: "approvalLog",
3305
- permission: props.name ? `${props.name}:APPROVALLOG` : "",
3306
- show: () => {
3307
- return !!props.workflowId;
3308
- },
3309
- onClick: () => {
3310
- gotoTaskTrace(props.workflowId);
3311
- }
3575
+ label: t("ep.attachment.createTime"),
3576
+ prop: "createTime"
3577
+ },
3578
+ {
3579
+ label: t("ep.attachment.description"),
3580
+ prop: "note",
3581
+ type: "EpInput",
3582
+ show: () => props.isNote
3312
3583
  }
3313
- ];
3314
- if (props.defaultButtons.length) {
3315
- defaultButtons = defaultButtons.filter((item) => {
3316
- return props.defaultButtons.some((item1) => item1 === item.prop);
3584
+ ]);
3585
+ const addAttachment = async () => {
3586
+ toBeConfirmData = [];
3587
+ const fileData = await importFile({
3588
+ api: "api-f/fast/files/save",
3589
+ extraData: {
3590
+ createBy: Cookies.get("accountName") || ""
3591
+ }
3317
3592
  });
3318
- }
3319
- const buttons = mergeListByKey(defaultButtons, props.buttons);
3593
+ fileData.fileId = fileData.id;
3594
+ delete fileData.id;
3595
+ if (isDialogOpen) {
3596
+ toBeConfirmData.push(fileData);
3597
+ }
3598
+ data.value.push(fileData);
3599
+ };
3600
+ const onConfirm = async (resolve) => {
3601
+ await tableRef.value?.validate();
3602
+ resolve(data.value);
3603
+ };
3604
+ const onCancel = (resolve) => {
3605
+ if (toBeConfirmData.length) {
3606
+ const index = data.value.findIndex((item) => {
3607
+ return item.fileId === toBeConfirmData[0].fileId;
3608
+ });
3609
+ if (index !== -1) {
3610
+ data.value.splice(index, 1);
3611
+ }
3612
+ toBeConfirmData = [];
3613
+ }
3614
+ if (Object.keys(toBeDeleteData).length) {
3615
+ Object.keys(toBeDeleteData).forEach((oldIndex) => {
3616
+ data.value.splice(Number(oldIndex), 0, toBeDeleteData[oldIndex]);
3617
+ });
3618
+ toBeDeleteData = {};
3619
+ }
3620
+ resolve();
3621
+ };
3320
3622
  return {
3321
- buttons
3623
+ columns,
3624
+ addAttachment,
3625
+ isNormalOpen,
3626
+ isDialogOpen,
3627
+ onConfirm,
3628
+ onCancel
3322
3629
  };
3323
3630
  };
3324
3631
 
3325
3632
  var _sfc_main$4 = /* @__PURE__ */ defineComponent({
3633
+ ...{
3634
+ name: "EpAttachment",
3635
+ inheritAttrs: false
3636
+ },
3637
+ __name: "attachment",
3638
+ props: /* @__PURE__ */ mergeModels(attachmentProps, {
3639
+ "modelValue": {},
3640
+ "modelModifiers": {}
3641
+ }),
3642
+ emits: ["update:modelValue"],
3643
+ setup(__props, { expose: __expose }) {
3644
+ const { t } = useLocale();
3645
+ const bem = createNameSpace("attachment");
3646
+ const props = __props;
3647
+ const modelValue = useModel(__props, "modelValue");
3648
+ const { columns, addAttachment, isNormalOpen, onConfirm, onCancel } = useAttachment(props, {
3649
+ data: modelValue
3650
+ });
3651
+ const AttachmentDialog = useDialog({
3652
+ width: 850,
3653
+ center: true,
3654
+ title: isNormalOpen ? "" : t("ep.attachment.manageAttachment"),
3655
+ modal: !isNormalOpen,
3656
+ showClose: !isNormalOpen,
3657
+ showFooter: !isNormalOpen,
3658
+ transition: isNormalOpen ? "" : "dialog-fade",
3659
+ modalClass: bem.em(
3660
+ "dialog",
3661
+ props.openType === "normal" ? props.openType : ""
3662
+ ),
3663
+ onConfirm: async (resolve) => {
3664
+ onConfirm(resolve);
3665
+ },
3666
+ onCancel: (resolve) => {
3667
+ onCancel(resolve);
3668
+ }
3669
+ });
3670
+ const open = AttachmentDialog.open;
3671
+ if (isNormalOpen) {
3672
+ open();
3673
+ }
3674
+ __expose({
3675
+ open
3676
+ });
3677
+ return (_ctx, _cache) => {
3678
+ const _component_EpButtons = resolveComponent("EpButtons");
3679
+ return openBlock(), createElementBlock(Fragment, null, [
3680
+ _ctx.isShowOpenDialogButton ? (openBlock(), createBlock(unref(ElButton), {
3681
+ key: 0,
3682
+ type: "primary",
3683
+ plain: "",
3684
+ size: "small",
3685
+ class: normalizeClass(unref(bem).e("handler")),
3686
+ onClick: unref(open)
3687
+ }, {
3688
+ default: withCtx(() => [
3689
+ createTextVNode(toDisplayString(unref(t)("ep.attachment.manageAttachment")) + "(" + toDisplayString(modelValue.value?.length || 0) + ") ", 1)
3690
+ ]),
3691
+ _: 1
3692
+ }, 8, ["class", "onClick"])) : createCommentVNode("", true),
3693
+ createVNode(unref(AttachmentDialog), null, {
3694
+ default: withCtx(() => [
3695
+ createElementVNode("div", { style: { "margin-bottom": "10px", "text-align": "right" } }, [
3696
+ _ctx.openType === "dialog" ? (openBlock(), createBlock(_component_EpButtons, {
3697
+ key: 0,
3698
+ type: "primary",
3699
+ list: [
3700
+ {
3701
+ name: unref(t)("ep.attachment.addAttachment"),
3702
+ type: "primary",
3703
+ onClick: unref(addAttachment)
3704
+ }
3705
+ ]
3706
+ }, null, 8, ["list"])) : createCommentVNode("", true)
3707
+ ]),
3708
+ createVNode(unref(EpTable), mergeProps({
3709
+ ref: "tableRef",
3710
+ class: `${unref(bem).b()} ${unref(prepareClassNames)()}`,
3711
+ style: {
3712
+ ...unref(prepareStyles)()
3713
+ },
3714
+ columns: unref(columns),
3715
+ data: modelValue.value
3716
+ }, props), null, 16, ["class", "style", "columns", "data"])
3717
+ ]),
3718
+ _: 1
3719
+ })
3720
+ ], 64);
3721
+ };
3722
+ }
3723
+ });
3724
+
3725
+ const EpAttachment = withInstall(_sfc_main$4);
3726
+
3727
+ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3326
3728
  ...{
3327
3729
  name: "EpHeader",
3328
3730
  inheritAttrs: false
@@ -3349,13 +3751,17 @@ var _sfc_main$4 = /* @__PURE__ */ defineComponent({
3349
3751
  content: withCtx(() => []),
3350
3752
  _: 1
3351
3753
  }, 8, ["onBack"])) : createCommentVNode("", true),
3352
- createVNode(unref(EpButtons), { list: unref(buttons) }, null, 8, ["list"])
3754
+ createVNode(unref(EpButtons), { list: unref(buttons) }, null, 8, ["list"]),
3755
+ props.isShowAttachmentButton ? (openBlock(), createBlock(unref(EpAttachment), {
3756
+ key: 1,
3757
+ "is-show-open-dialog-button": ""
3758
+ })) : createCommentVNode("", true)
3353
3759
  ], 6);
3354
3760
  };
3355
3761
  }
3356
3762
  });
3357
3763
 
3358
- const EpHeader = withInstall(_sfc_main$4);
3764
+ const EpHeader = withInstall(_sfc_main$3);
3359
3765
 
3360
3766
  const { t } = useLocale();
3361
3767
  const datePickerRangeProps = {
@@ -3425,7 +3831,7 @@ const datePickerRangeProps = {
3425
3831
  };
3426
3832
  const datePickerRangeEmits = {};
3427
3833
 
3428
- var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3834
+ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
3429
3835
  ...{
3430
3836
  name: "EpDatePickerRange",
3431
3837
  inheritAttrs: false
@@ -3481,7 +3887,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3481
3887
  }
3482
3888
  });
3483
3889
 
3484
- const EpDatePickerRange = withInstall(_sfc_main$3);
3890
+ const EpDatePickerRange = withInstall(_sfc_main$2);
3485
3891
 
3486
3892
  const linkProps = {
3487
3893
  ...linkProps$1,
@@ -3498,7 +3904,7 @@ const linkProps = {
3498
3904
  }
3499
3905
  };
3500
3906
 
3501
- var _sfc_main$2 = /* @__PURE__ */ defineComponent({
3907
+ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
3502
3908
  ...{
3503
3909
  name: "EpLink",
3504
3910
  inheritAttrs: false
@@ -3543,236 +3949,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
3543
3949
  }
3544
3950
  });
3545
3951
 
3546
- const EpLink = withInstall(_sfc_main$2);
3547
-
3548
- const attachmentProps = {
3549
- // 格式化列
3550
- formatColumns: {
3551
- ...tableProps.formatColumns
3552
- },
3553
- // 页面模式
3554
- mode: {
3555
- ...headerProps.mode
3556
- },
3557
- // 展示模式
3558
- openType: {
3559
- type: String,
3560
- default: "dialog"
3561
- },
3562
- // 是否需要类型
3563
- isType: {
3564
- type: Boolean,
3565
- default: true
3566
- },
3567
- // 是否需要备注
3568
- isNote: {
3569
- type: Boolean,
3570
- default: false
3571
- }
3572
- };
3573
-
3574
- const getFullUrl = (filePath) => {
3575
- return filePath.indexOf("hongxinshop.com") > -1 ? filePath : `${window.location.protocol}${getEnv() === "local" ? `//${getLocationEnv()}-hxjf.hongxinshop.com` : ""}/image/${filePath}`;
3576
- };
3577
- const downloadSrc = ({
3578
- src,
3579
- fileName,
3580
- blob
3581
- }) => {
3582
- if (src) {
3583
- fileName = fileName || src.split("/")[src.split("/").length - 1];
3584
- const a = document.createElement("a");
3585
- a.style.display = "none";
3586
- document.body.appendChild(a);
3587
- const event = new MouseEvent("click");
3588
- a.download = fileName;
3589
- a.href = blob ? src : getFullUrl(src);
3590
- a.target = "_blank";
3591
- a.dispatchEvent(event);
3592
- document.body.removeChild(a);
3593
- }
3594
- };
3595
- async function downloadFile({
3596
- api = "",
3597
- blob,
3598
- data = {},
3599
- src,
3600
- fileName = "",
3601
- config = {}
3602
- }) {
3603
- if (src) {
3604
- downloadSrc({ src, fileName });
3605
- return;
3606
- }
3607
- http.request(api, {
3608
- method: config.method || "post",
3609
- data,
3610
- loading: true,
3611
- responseType: blob ? "blob" : void 0,
3612
- responseReturn: "raw",
3613
- ...config
3614
- }).then((res) => {
3615
- const { headers } = res;
3616
- if (!res.data.success) {
3617
- return ElMessage.error(res.data.msg);
3618
- }
3619
- const data2 = res.data?.data || res.data?.data?.url || "";
3620
- const lowerHeaders = {};
3621
- for (const key in headers) {
3622
- lowerHeaders[key.toLowerCase()] = headers[key];
3623
- }
3624
- let src2 = "";
3625
- if (blob) {
3626
- const contentDisposition = lowerHeaders["content-disposition"] || "";
3627
- fileName = fileName || decodeURIComponent(contentDisposition.split("filename=")[1]);
3628
- const blob2 = new Blob([data2], {
3629
- type: headers["content-type"]
3630
- });
3631
- src2 = window.URL.createObjectURL(blob2);
3632
- setTimeout(() => window.URL.revokeObjectURL(src2), 100);
3633
- } else {
3634
- src2 = data2;
3635
- }
3636
- downloadSrc({ src: src2, fileName, blob });
3637
- });
3638
- }
3639
- const previewFile = (url) => {
3640
- url = getFullUrl(url);
3641
- const origin = getFullUrl("").replace("/image/", "");
3642
- const previewUrl = `${origin}/kfv/onlinePreview?url=${encode(url)}`;
3643
- window.open(previewUrl, "_blank");
3644
- };
3645
-
3646
- const useAttachment = (props, { data }) => {
3647
- const { mode: defaultMode } = useNavigation();
3648
- const mode = computed(() => {
3649
- return props.mode || defaultMode.value;
3650
- });
3651
- const columns = ref([
3652
- {
3653
- type: "EpButtons",
3654
- label: "\u64CD\u4F5C",
3655
- width: "120px",
3656
- props: {
3657
- type: "text",
3658
- list: [
3659
- {
3660
- name: "\u4E0B\u8F7D",
3661
- onClick({ row }) {
3662
- downloadFile({
3663
- src: row.filePath,
3664
- fileName: row.originalFilename || row.originalFileName
3665
- });
3666
- }
3667
- },
3668
- {
3669
- name: "\u5220\u9664",
3670
- disabled: () => {
3671
- return mode.value === "browse";
3672
- },
3673
- onClick: ({ $index }) => {
3674
- data.value.splice($index, 1);
3675
- }
3676
- }
3677
- ]
3678
- }
3679
- },
3680
- {
3681
- label: "\u9644\u4EF6\u7C7B\u578B",
3682
- prop: "type",
3683
- type: "EpSelect",
3684
- required: true,
3685
- show: () => props.isType,
3686
- props: {
3687
- desc: ({ row }) => {
3688
- return row.typeDesc;
3689
- }
3690
- }
3691
- },
3692
- {
3693
- label: "\u6587\u4EF6\u540D\u79F0",
3694
- prop: "originalFilename",
3695
- type: "EpLink",
3696
- onClick({ row }) {
3697
- previewFile(row.filePath);
3698
- }
3699
- },
3700
- {
3701
- label: "\u521B\u5EFA\u4EBA",
3702
- prop: "createBy"
3703
- },
3704
- {
3705
- label: "\u521B\u5EFA\u65F6\u95F4",
3706
- prop: "createTime"
3707
- },
3708
- {
3709
- label: "\u8BF4\u660E",
3710
- prop: "note",
3711
- type: "EpInput",
3712
- show: () => props.isNote
3713
- }
3714
- ]);
3715
- return {
3716
- columns
3717
- };
3718
- };
3719
-
3720
- var _sfc_main$1 = /* @__PURE__ */ defineComponent({
3721
- ...{
3722
- name: "EpAttachment",
3723
- inheritAttrs: false
3724
- },
3725
- __name: "attachment",
3726
- props: /* @__PURE__ */ mergeModels(attachmentProps, {
3727
- "modelValue": {},
3728
- "modelModifiers": {}
3729
- }),
3730
- emits: ["update:modelValue"],
3731
- setup(__props) {
3732
- const bem = createNameSpace("attachment");
3733
- const props = __props;
3734
- const modelValue = useModel(__props, "modelValue");
3735
- const AttachmentDialog = useDialog({
3736
- class: bem.em("dialog", props.openType === "normal" ? props.openType : ""),
3737
- width: 850,
3738
- center: true,
3739
- title: "\u9644\u4EF6\u7BA1\u7406",
3740
- onConfirm: async (resolve) => {
3741
- }
3742
- });
3743
- const { columns } = useAttachment(props, {
3744
- data: modelValue
3745
- });
3746
- return (_ctx, _cache) => {
3747
- const _component_el_button = resolveComponent("el-button");
3748
- return openBlock(), createBlock(unref(AttachmentDialog), null, {
3749
- default: withCtx(() => [
3750
- _ctx.openType === "dialog" ? (openBlock(), createBlock(_component_el_button, {
3751
- key: 0,
3752
- type: "primary",
3753
- size: "default"
3754
- }, {
3755
- default: withCtx(() => [
3756
- createTextVNode("\u6DFB\u52A0\u9644\u4EF6")
3757
- ]),
3758
- _: 1
3759
- })) : createCommentVNode("", true),
3760
- createVNode(unref(EpTable), mergeProps({
3761
- class: `${unref(bem).b()} ${unref(prepareClassNames)()}`,
3762
- style: {
3763
- ...unref(prepareStyles)()
3764
- },
3765
- columns: unref(columns),
3766
- data: modelValue.value
3767
- }, props), null, 16, ["class", "style", "columns", "data"])
3768
- ]),
3769
- _: 1
3770
- });
3771
- };
3772
- }
3773
- });
3774
-
3775
- const EpAttachment = withInstall(_sfc_main$1);
3952
+ const EpLink = withInstall(_sfc_main$1);
3776
3953
 
3777
3954
  const componentType = ["bpm", "address"];
3778
3955
  const uniVueProps = {
@@ -3963,7 +4140,7 @@ var components = [
3963
4140
  EpUniVue
3964
4141
  ];
3965
4142
 
3966
- var version = "0.0.47";
4143
+ var version = "0.0.50";
3967
4144
 
3968
4145
  var globalProperties = {
3969
4146
  install(app) {