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
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus'), require('@vue/shared'), require('axios'), require('js-cookie'), require('defu'), require('qs'), require('element-plus/es/components/table/src/table/defaults'), require('@element-plus/icons-vue'), require('mitt'), require('lodash-unified'), require('@vueuse/core'), require('vue-router'), require('js-base64'), require('vue2'), require('vue-router3')) :
@@ -289,6 +289,18 @@
289
289
  notFound: "\u672A\u627E\u5230, \u8BF7\u6C42\u7684\u8D44\u6E90\u4E0D\u5B58\u5728",
290
290
  //
291
291
  serverError: "\u5185\u90E8\u670D\u52A1\u5668\u9519\u8BEF\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"
292
+ },
293
+ attachment: {
294
+ addAttachment: "\u6DFB\u52A0\u9644\u4EF6",
295
+ manageAttachment: "\u9644\u4EF6\u7BA1\u7406",
296
+ operation: "\u64CD\u4F5C",
297
+ download: "\u4E0B\u8F7D",
298
+ delete: "\u5220\u9664",
299
+ attachmentType: "\u9644\u4EF6\u7C7B\u578B",
300
+ fileName: "\u6587\u4EF6\u540D\u79F0",
301
+ creator: "\u521B\u5EFA\u4EBA",
302
+ createTime: "\u521B\u5EFA\u65F6\u95F4",
303
+ description: "\u8BF4\u660E"
292
304
  }
293
305
  }
294
306
  };
@@ -3171,7 +3183,12 @@
3171
3183
  default: () => []
3172
3184
  },
3173
3185
  // 工作流id
3174
- workflowId: String
3186
+ workflowId: String,
3187
+ // 是否显示附件按钮
3188
+ isShowAttachmentButton: {
3189
+ type: Boolean,
3190
+ default: false
3191
+ }
3175
3192
  };
3176
3193
  const headerEmits = {};
3177
3194
 
@@ -3270,67 +3287,452 @@
3270
3287
  };
3271
3288
  };
3272
3289
  const useButtons = (props, emit) => {
3273
- const { t } = useLocale();
3290
+ const {
3291
+ t
3292
+ } = useLocale();
3293
+ const {
3294
+ mode: defaultMode
3295
+ } = useNavigation();
3296
+ const mode = vue.computed(() => {
3297
+ return props.mode || defaultMode.value;
3298
+ });
3299
+ let defaultButtons = [{
3300
+ name: t("ep.header.edit"),
3301
+ prop: "modify",
3302
+ permission: props.name ? `${props.name}:UPDATE` : "",
3303
+ disabled: () => {
3304
+ return mode.value !== "browse";
3305
+ }
3306
+ }, {
3307
+ name: t("ep.header.save"),
3308
+ prop: "save",
3309
+ permission: props.name ? `${props.name}:SAVE` : "",
3310
+ disabled: () => {
3311
+ return !(mode.value === "edit" || mode.value === "add");
3312
+ }
3313
+ }, {
3314
+ name: t("ep.header.cancel"),
3315
+ prop: "cancel",
3316
+ disabled: () => {
3317
+ return mode.value !== "edit";
3318
+ }
3319
+ }, {
3320
+ name: t("ep.header.refresh"),
3321
+ prop: "refresh",
3322
+ permission: props.name ? `${props.name}:REFRESH` : "",
3323
+ disabled: () => {
3324
+ return mode.value !== "browse";
3325
+ }
3326
+ }, {
3327
+ name: t("ep.header.approvalLog"),
3328
+ prop: "approvalLog",
3329
+ permission: props.name ? `${props.name}:APPROVALLOG` : "",
3330
+ show: () => {
3331
+ return !!props.workflowId;
3332
+ },
3333
+ onClick: () => {
3334
+ gotoTaskTrace(props.workflowId);
3335
+ }
3336
+ }];
3337
+ if (props.defaultButtons.length) {
3338
+ defaultButtons = defaultButtons.filter((item) => {
3339
+ return props.defaultButtons.some((item1) => item1 === item.prop);
3340
+ });
3341
+ }
3342
+ const buttons = mergeListByKey(defaultButtons, props.buttons);
3343
+ return {
3344
+ buttons
3345
+ };
3346
+ };
3347
+
3348
+ const attachmentProps = {
3349
+ // 格式化列
3350
+ formatColumns: {
3351
+ ...tableProps.formatColumns
3352
+ },
3353
+ // 页面模式
3354
+ mode: {
3355
+ ...headerProps.mode
3356
+ },
3357
+ // 展示模式
3358
+ openType: {
3359
+ type: String,
3360
+ default: "dialog"
3361
+ },
3362
+ // 是否需要类型
3363
+ isType: {
3364
+ type: Boolean,
3365
+ default: true
3366
+ },
3367
+ // 是否需要备注
3368
+ isNote: {
3369
+ type: Boolean,
3370
+ default: false
3371
+ },
3372
+ // 是否需要打开弹窗按钮
3373
+ isShowOpenDialogButton: {
3374
+ type: Boolean,
3375
+ default: false
3376
+ }
3377
+ };
3378
+
3379
+ const getFullUrl = (filePath) => {
3380
+ return filePath.indexOf("hongxinshop.com") > -1 ? filePath : `${window.location.protocol}${getEnv() === "local" ? `//${getLocationEnv()}-hxjf.hongxinshop.com` : ""}/image/${filePath}`;
3381
+ };
3382
+ const downloadSrc = ({
3383
+ src,
3384
+ fileName,
3385
+ blob
3386
+ }) => {
3387
+ if (src) {
3388
+ fileName = fileName || src.split("/")[src.split("/").length - 1];
3389
+ const a = document.createElement("a");
3390
+ a.style.display = "none";
3391
+ document.body.appendChild(a);
3392
+ const event = new MouseEvent("click");
3393
+ a.download = fileName;
3394
+ a.href = blob ? src : getFullUrl(src);
3395
+ a.target = "_blank";
3396
+ a.dispatchEvent(event);
3397
+ document.body.removeChild(a);
3398
+ }
3399
+ };
3400
+ async function downloadFile({
3401
+ api = "",
3402
+ blob,
3403
+ data = {},
3404
+ src,
3405
+ fileName = "",
3406
+ config = {}
3407
+ }) {
3408
+ if (src) {
3409
+ downloadSrc({ src, fileName });
3410
+ return;
3411
+ }
3412
+ http.request(api, {
3413
+ method: config.method || "post",
3414
+ data,
3415
+ loading: true,
3416
+ responseType: blob ? "blob" : void 0,
3417
+ responseReturn: "raw",
3418
+ ...config
3419
+ }).then((res) => {
3420
+ const { headers } = res;
3421
+ if (!res.data.success) {
3422
+ return elementPlus.ElMessage.error(res.data.msg);
3423
+ }
3424
+ const data2 = res.data?.data || res.data?.data?.url || "";
3425
+ const lowerHeaders = {};
3426
+ for (const key in headers) {
3427
+ lowerHeaders[key.toLowerCase()] = headers[key];
3428
+ }
3429
+ let src2 = "";
3430
+ if (blob) {
3431
+ const contentDisposition = lowerHeaders["content-disposition"] || "";
3432
+ fileName = fileName || decodeURIComponent(contentDisposition.split("filename=")[1]);
3433
+ const blob2 = new Blob([data2], {
3434
+ type: headers["content-type"]
3435
+ });
3436
+ src2 = window.URL.createObjectURL(blob2);
3437
+ setTimeout(() => window.URL.revokeObjectURL(src2), 100);
3438
+ } else {
3439
+ src2 = data2;
3440
+ }
3441
+ downloadSrc({ src: src2, fileName, blob });
3442
+ });
3443
+ }
3444
+ const importFile = async ({
3445
+ accept = "*",
3446
+ multiple = false,
3447
+ fieldName = "file",
3448
+ failedFileName = "",
3449
+ extraData = {},
3450
+ api = ""
3451
+ }) => {
3452
+ return new Promise((resolve, reject) => {
3453
+ const input = document.createElement("input");
3454
+ input.type = "file";
3455
+ input.accept = accept;
3456
+ input.multiple = multiple;
3457
+ const formData = new FormData();
3458
+ Object.keys(extraData).forEach((key) => {
3459
+ formData.append(key, extraData[key]);
3460
+ });
3461
+ input.onchange = async (event) => {
3462
+ const target = event.target;
3463
+ const files = target.files;
3464
+ if (files && files.length > 0) {
3465
+ if (!multiple) {
3466
+ formData.append(fieldName, files[0]);
3467
+ } else {
3468
+ Array.from(files).forEach((file, index) => {
3469
+ formData.append(`${fieldName}${index}`, file);
3470
+ });
3471
+ }
3472
+ try {
3473
+ const { data } = await http.request(api, {
3474
+ method: "post",
3475
+ data: formData,
3476
+ loading: true,
3477
+ responseReturn: "raw",
3478
+ transformRequest: [
3479
+ function(data2) {
3480
+ return data2;
3481
+ }
3482
+ ]
3483
+ });
3484
+ if (data.success) {
3485
+ return resolve(data.data);
3486
+ }
3487
+ if (data.code === -2) {
3488
+ const fileName = failedFileName || data.data.split("/")[data.data.split("/").length - 1];
3489
+ const url = `${window.location.origin}/image/${data.data}`;
3490
+ 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>`;
3491
+ elementPlus.ElMessageBox.alert(failedHtml, "\u63D0\u793A", {
3492
+ confirmButtonText: "\u786E\u5B9A",
3493
+ type: "error",
3494
+ dangerouslyUseHTMLString: true
3495
+ });
3496
+ return;
3497
+ }
3498
+ return elementPlus.ElMessage.error(data.msg);
3499
+ } catch (error) {
3500
+ console.error(error);
3501
+ }
3502
+ input.onchange = null;
3503
+ }
3504
+ };
3505
+ input.click();
3506
+ });
3507
+ };
3508
+ const previewFile = (url) => {
3509
+ url = getFullUrl(url);
3510
+ const origin = getFullUrl("").replace("/image/", "");
3511
+ const previewUrl = `${origin}/kfv/onlinePreview?url=${jsBase64.encode(url)}`;
3512
+ window.open(previewUrl, "_blank");
3513
+ };
3514
+
3515
+ const useAttachment = (props, { data }) => {
3274
3516
  const { mode: defaultMode } = useNavigation();
3517
+ const { t } = useLocale();
3275
3518
  const mode = vue.computed(() => {
3276
3519
  return props.mode || defaultMode.value;
3277
3520
  });
3278
- let defaultButtons = [
3521
+ const tableRef = vue.useTemplateRef("tableRef");
3522
+ const isNormalOpen = props.openType === "normal";
3523
+ const isDialogOpen = props.openType === "dialog";
3524
+ let toBeConfirmData = [];
3525
+ let toBeDeleteData = {};
3526
+ const columns = vue.ref([
3279
3527
  {
3280
- name: t("ep.header.edit"),
3281
- prop: "modify",
3282
- permission: props.name ? `${props.name}:UPDATE` : "",
3283
- disabled: () => {
3284
- return mode.value !== "browse";
3528
+ type: "EpButtons",
3529
+ label: t("ep.attachment.operation"),
3530
+ width: "120px",
3531
+ props: {
3532
+ type: "text",
3533
+ list: [
3534
+ {
3535
+ name: t("ep.attachment.download"),
3536
+ onClick({ row }) {
3537
+ downloadFile({
3538
+ src: row.filePath,
3539
+ fileName: row.originalFilename || row.originalFileName
3540
+ });
3541
+ }
3542
+ },
3543
+ {
3544
+ name: t("ep.attachment.delete"),
3545
+ disabled: () => {
3546
+ return mode.value === "browse";
3547
+ },
3548
+ onClick: ({ $index, row }) => {
3549
+ if (isDialogOpen) {
3550
+ toBeDeleteData[$index] = row;
3551
+ }
3552
+ data.value.splice($index, 1);
3553
+ }
3554
+ }
3555
+ ]
3285
3556
  }
3286
3557
  },
3287
3558
  {
3288
- name: t("ep.header.save"),
3289
- prop: "save",
3290
- permission: props.name ? `${props.name}:SAVE` : "",
3291
- disabled: () => {
3292
- return !(mode.value === "edit" || mode.value === "add");
3559
+ label: t("ep.attachment.attachmentType"),
3560
+ prop: "type",
3561
+ type: "EpSelect",
3562
+ required: true,
3563
+ show: () => props.isType,
3564
+ props: {
3565
+ desc: ({ row }) => {
3566
+ return row.typeDesc;
3567
+ }
3293
3568
  }
3294
3569
  },
3295
3570
  {
3296
- name: t("ep.header.cancel"),
3297
- prop: "cancel",
3298
- disabled: () => {
3299
- return mode.value !== "edit";
3571
+ label: t("ep.attachment.fileName"),
3572
+ prop: "originalFilename",
3573
+ type: "EpLink",
3574
+ onClick({ row }) {
3575
+ previewFile(row.filePath);
3300
3576
  }
3301
3577
  },
3302
3578
  {
3303
- name: t("ep.header.refresh"),
3304
- prop: "refresh",
3305
- permission: props.name ? `${props.name}:REFRESH` : "",
3306
- disabled: () => {
3307
- return mode.value !== "browse";
3308
- }
3579
+ label: t("ep.attachment.creator"),
3580
+ prop: "createBy"
3309
3581
  },
3310
3582
  {
3311
- name: t("ep.header.approvalLog"),
3312
- prop: "approvalLog",
3313
- permission: props.name ? `${props.name}:APPROVALLOG` : "",
3314
- show: () => {
3315
- return !!props.workflowId;
3316
- },
3317
- onClick: () => {
3318
- gotoTaskTrace(props.workflowId);
3319
- }
3583
+ label: t("ep.attachment.createTime"),
3584
+ prop: "createTime"
3585
+ },
3586
+ {
3587
+ label: t("ep.attachment.description"),
3588
+ prop: "note",
3589
+ type: "EpInput",
3590
+ show: () => props.isNote
3320
3591
  }
3321
- ];
3322
- if (props.defaultButtons.length) {
3323
- defaultButtons = defaultButtons.filter((item) => {
3324
- return props.defaultButtons.some((item1) => item1 === item.prop);
3592
+ ]);
3593
+ const addAttachment = async () => {
3594
+ toBeConfirmData = [];
3595
+ const fileData = await importFile({
3596
+ api: "api-f/fast/files/save",
3597
+ extraData: {
3598
+ createBy: Cookies.get("accountName") || ""
3599
+ }
3325
3600
  });
3326
- }
3327
- const buttons = mergeListByKey(defaultButtons, props.buttons);
3601
+ fileData.fileId = fileData.id;
3602
+ delete fileData.id;
3603
+ if (isDialogOpen) {
3604
+ toBeConfirmData.push(fileData);
3605
+ }
3606
+ data.value.push(fileData);
3607
+ };
3608
+ const onConfirm = async (resolve) => {
3609
+ await tableRef.value?.validate();
3610
+ resolve(data.value);
3611
+ };
3612
+ const onCancel = (resolve) => {
3613
+ if (toBeConfirmData.length) {
3614
+ const index = data.value.findIndex((item) => {
3615
+ return item.fileId === toBeConfirmData[0].fileId;
3616
+ });
3617
+ if (index !== -1) {
3618
+ data.value.splice(index, 1);
3619
+ }
3620
+ toBeConfirmData = [];
3621
+ }
3622
+ if (Object.keys(toBeDeleteData).length) {
3623
+ Object.keys(toBeDeleteData).forEach((oldIndex) => {
3624
+ data.value.splice(Number(oldIndex), 0, toBeDeleteData[oldIndex]);
3625
+ });
3626
+ toBeDeleteData = {};
3627
+ }
3628
+ resolve();
3629
+ };
3328
3630
  return {
3329
- buttons
3631
+ columns,
3632
+ addAttachment,
3633
+ isNormalOpen,
3634
+ isDialogOpen,
3635
+ onConfirm,
3636
+ onCancel
3330
3637
  };
3331
3638
  };
3332
3639
 
3333
3640
  var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
3641
+ ...{
3642
+ name: "EpAttachment",
3643
+ inheritAttrs: false
3644
+ },
3645
+ __name: "attachment",
3646
+ props: /* @__PURE__ */ vue.mergeModels(attachmentProps, {
3647
+ "modelValue": {},
3648
+ "modelModifiers": {}
3649
+ }),
3650
+ emits: ["update:modelValue"],
3651
+ setup(__props, { expose: __expose }) {
3652
+ const { t } = useLocale();
3653
+ const bem = createNameSpace("attachment");
3654
+ const props = __props;
3655
+ const modelValue = vue.useModel(__props, "modelValue");
3656
+ const { columns, addAttachment, isNormalOpen, onConfirm, onCancel } = useAttachment(props, {
3657
+ data: modelValue
3658
+ });
3659
+ const AttachmentDialog = useDialog({
3660
+ width: 850,
3661
+ center: true,
3662
+ title: isNormalOpen ? "" : t("ep.attachment.manageAttachment"),
3663
+ modal: !isNormalOpen,
3664
+ showClose: !isNormalOpen,
3665
+ showFooter: !isNormalOpen,
3666
+ transition: isNormalOpen ? "" : "dialog-fade",
3667
+ modalClass: bem.em(
3668
+ "dialog",
3669
+ props.openType === "normal" ? props.openType : ""
3670
+ ),
3671
+ onConfirm: async (resolve) => {
3672
+ onConfirm(resolve);
3673
+ },
3674
+ onCancel: (resolve) => {
3675
+ onCancel(resolve);
3676
+ }
3677
+ });
3678
+ const open = AttachmentDialog.open;
3679
+ if (isNormalOpen) {
3680
+ open();
3681
+ }
3682
+ __expose({
3683
+ open
3684
+ });
3685
+ return (_ctx, _cache) => {
3686
+ const _component_EpButtons = vue.resolveComponent("EpButtons");
3687
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3688
+ _ctx.isShowOpenDialogButton ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
3689
+ key: 0,
3690
+ type: "primary",
3691
+ plain: "",
3692
+ size: "small",
3693
+ class: vue.normalizeClass(vue.unref(bem).e("handler")),
3694
+ onClick: vue.unref(open)
3695
+ }, {
3696
+ default: vue.withCtx(() => [
3697
+ vue.createTextVNode(vue.toDisplayString(vue.unref(t)("ep.attachment.manageAttachment")) + "(" + vue.toDisplayString(modelValue.value?.length || 0) + ") ", 1)
3698
+ ]),
3699
+ _: 1
3700
+ }, 8, ["class", "onClick"])) : vue.createCommentVNode("", true),
3701
+ vue.createVNode(vue.unref(AttachmentDialog), null, {
3702
+ default: vue.withCtx(() => [
3703
+ vue.createElementVNode("div", { style: { "margin-bottom": "10px", "text-align": "right" } }, [
3704
+ _ctx.openType === "dialog" ? (vue.openBlock(), vue.createBlock(_component_EpButtons, {
3705
+ key: 0,
3706
+ type: "primary",
3707
+ list: [
3708
+ {
3709
+ name: vue.unref(t)("ep.attachment.addAttachment"),
3710
+ type: "primary",
3711
+ onClick: vue.unref(addAttachment)
3712
+ }
3713
+ ]
3714
+ }, null, 8, ["list"])) : vue.createCommentVNode("", true)
3715
+ ]),
3716
+ vue.createVNode(vue.unref(EpTable), vue.mergeProps({
3717
+ ref: "tableRef",
3718
+ class: `${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`,
3719
+ style: {
3720
+ ...vue.unref(prepareStyles)()
3721
+ },
3722
+ columns: vue.unref(columns),
3723
+ data: modelValue.value
3724
+ }, props), null, 16, ["class", "style", "columns", "data"])
3725
+ ]),
3726
+ _: 1
3727
+ })
3728
+ ], 64);
3729
+ };
3730
+ }
3731
+ });
3732
+
3733
+ const EpAttachment = withInstall(_sfc_main$4);
3734
+
3735
+ var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3334
3736
  ...{
3335
3737
  name: "EpHeader",
3336
3738
  inheritAttrs: false
@@ -3357,13 +3759,17 @@
3357
3759
  content: vue.withCtx(() => []),
3358
3760
  _: 1
3359
3761
  }, 8, ["onBack"])) : vue.createCommentVNode("", true),
3360
- vue.createVNode(vue.unref(EpButtons), { list: vue.unref(buttons) }, null, 8, ["list"])
3762
+ vue.createVNode(vue.unref(EpButtons), { list: vue.unref(buttons) }, null, 8, ["list"]),
3763
+ props.isShowAttachmentButton ? (vue.openBlock(), vue.createBlock(vue.unref(EpAttachment), {
3764
+ key: 1,
3765
+ "is-show-open-dialog-button": ""
3766
+ })) : vue.createCommentVNode("", true)
3361
3767
  ], 6);
3362
3768
  };
3363
3769
  }
3364
3770
  });
3365
3771
 
3366
- const EpHeader = withInstall(_sfc_main$4);
3772
+ const EpHeader = withInstall(_sfc_main$3);
3367
3773
 
3368
3774
  const { t } = useLocale();
3369
3775
  const datePickerRangeProps = {
@@ -3433,7 +3839,7 @@
3433
3839
  };
3434
3840
  const datePickerRangeEmits = {};
3435
3841
 
3436
- var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3842
+ var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3437
3843
  ...{
3438
3844
  name: "EpDatePickerRange",
3439
3845
  inheritAttrs: false
@@ -3489,7 +3895,7 @@
3489
3895
  }
3490
3896
  });
3491
3897
 
3492
- const EpDatePickerRange = withInstall(_sfc_main$3);
3898
+ const EpDatePickerRange = withInstall(_sfc_main$2);
3493
3899
 
3494
3900
  const linkProps = {
3495
3901
  ...elementPlus.linkProps,
@@ -3506,7 +3912,7 @@
3506
3912
  }
3507
3913
  };
3508
3914
 
3509
- var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3915
+ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3510
3916
  ...{
3511
3917
  name: "EpLink",
3512
3918
  inheritAttrs: false
@@ -3551,236 +3957,7 @@
3551
3957
  }
3552
3958
  });
3553
3959
 
3554
- const EpLink = withInstall(_sfc_main$2);
3555
-
3556
- const attachmentProps = {
3557
- // 格式化列
3558
- formatColumns: {
3559
- ...tableProps.formatColumns
3560
- },
3561
- // 页面模式
3562
- mode: {
3563
- ...headerProps.mode
3564
- },
3565
- // 展示模式
3566
- openType: {
3567
- type: String,
3568
- default: "dialog"
3569
- },
3570
- // 是否需要类型
3571
- isType: {
3572
- type: Boolean,
3573
- default: true
3574
- },
3575
- // 是否需要备注
3576
- isNote: {
3577
- type: Boolean,
3578
- default: false
3579
- }
3580
- };
3581
-
3582
- const getFullUrl = (filePath) => {
3583
- return filePath.indexOf("hongxinshop.com") > -1 ? filePath : `${window.location.protocol}${getEnv() === "local" ? `//${getLocationEnv()}-hxjf.hongxinshop.com` : ""}/image/${filePath}`;
3584
- };
3585
- const downloadSrc = ({
3586
- src,
3587
- fileName,
3588
- blob
3589
- }) => {
3590
- if (src) {
3591
- fileName = fileName || src.split("/")[src.split("/").length - 1];
3592
- const a = document.createElement("a");
3593
- a.style.display = "none";
3594
- document.body.appendChild(a);
3595
- const event = new MouseEvent("click");
3596
- a.download = fileName;
3597
- a.href = blob ? src : getFullUrl(src);
3598
- a.target = "_blank";
3599
- a.dispatchEvent(event);
3600
- document.body.removeChild(a);
3601
- }
3602
- };
3603
- async function downloadFile({
3604
- api = "",
3605
- blob,
3606
- data = {},
3607
- src,
3608
- fileName = "",
3609
- config = {}
3610
- }) {
3611
- if (src) {
3612
- downloadSrc({ src, fileName });
3613
- return;
3614
- }
3615
- http.request(api, {
3616
- method: config.method || "post",
3617
- data,
3618
- loading: true,
3619
- responseType: blob ? "blob" : void 0,
3620
- responseReturn: "raw",
3621
- ...config
3622
- }).then((res) => {
3623
- const { headers } = res;
3624
- if (!res.data.success) {
3625
- return elementPlus.ElMessage.error(res.data.msg);
3626
- }
3627
- const data2 = res.data?.data || res.data?.data?.url || "";
3628
- const lowerHeaders = {};
3629
- for (const key in headers) {
3630
- lowerHeaders[key.toLowerCase()] = headers[key];
3631
- }
3632
- let src2 = "";
3633
- if (blob) {
3634
- const contentDisposition = lowerHeaders["content-disposition"] || "";
3635
- fileName = fileName || decodeURIComponent(contentDisposition.split("filename=")[1]);
3636
- const blob2 = new Blob([data2], {
3637
- type: headers["content-type"]
3638
- });
3639
- src2 = window.URL.createObjectURL(blob2);
3640
- setTimeout(() => window.URL.revokeObjectURL(src2), 100);
3641
- } else {
3642
- src2 = data2;
3643
- }
3644
- downloadSrc({ src: src2, fileName, blob });
3645
- });
3646
- }
3647
- const previewFile = (url) => {
3648
- url = getFullUrl(url);
3649
- const origin = getFullUrl("").replace("/image/", "");
3650
- const previewUrl = `${origin}/kfv/onlinePreview?url=${jsBase64.encode(url)}`;
3651
- window.open(previewUrl, "_blank");
3652
- };
3653
-
3654
- const useAttachment = (props, { data }) => {
3655
- const { mode: defaultMode } = useNavigation();
3656
- const mode = vue.computed(() => {
3657
- return props.mode || defaultMode.value;
3658
- });
3659
- const columns = vue.ref([
3660
- {
3661
- type: "EpButtons",
3662
- label: "\u64CD\u4F5C",
3663
- width: "120px",
3664
- props: {
3665
- type: "text",
3666
- list: [
3667
- {
3668
- name: "\u4E0B\u8F7D",
3669
- onClick({ row }) {
3670
- downloadFile({
3671
- src: row.filePath,
3672
- fileName: row.originalFilename || row.originalFileName
3673
- });
3674
- }
3675
- },
3676
- {
3677
- name: "\u5220\u9664",
3678
- disabled: () => {
3679
- return mode.value === "browse";
3680
- },
3681
- onClick: ({ $index }) => {
3682
- data.value.splice($index, 1);
3683
- }
3684
- }
3685
- ]
3686
- }
3687
- },
3688
- {
3689
- label: "\u9644\u4EF6\u7C7B\u578B",
3690
- prop: "type",
3691
- type: "EpSelect",
3692
- required: true,
3693
- show: () => props.isType,
3694
- props: {
3695
- desc: ({ row }) => {
3696
- return row.typeDesc;
3697
- }
3698
- }
3699
- },
3700
- {
3701
- label: "\u6587\u4EF6\u540D\u79F0",
3702
- prop: "originalFilename",
3703
- type: "EpLink",
3704
- onClick({ row }) {
3705
- previewFile(row.filePath);
3706
- }
3707
- },
3708
- {
3709
- label: "\u521B\u5EFA\u4EBA",
3710
- prop: "createBy"
3711
- },
3712
- {
3713
- label: "\u521B\u5EFA\u65F6\u95F4",
3714
- prop: "createTime"
3715
- },
3716
- {
3717
- label: "\u8BF4\u660E",
3718
- prop: "note",
3719
- type: "EpInput",
3720
- show: () => props.isNote
3721
- }
3722
- ]);
3723
- return {
3724
- columns
3725
- };
3726
- };
3727
-
3728
- var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3729
- ...{
3730
- name: "EpAttachment",
3731
- inheritAttrs: false
3732
- },
3733
- __name: "attachment",
3734
- props: /* @__PURE__ */ vue.mergeModels(attachmentProps, {
3735
- "modelValue": {},
3736
- "modelModifiers": {}
3737
- }),
3738
- emits: ["update:modelValue"],
3739
- setup(__props) {
3740
- const bem = createNameSpace("attachment");
3741
- const props = __props;
3742
- const modelValue = vue.useModel(__props, "modelValue");
3743
- const AttachmentDialog = useDialog({
3744
- class: bem.em("dialog", props.openType === "normal" ? props.openType : ""),
3745
- width: 850,
3746
- center: true,
3747
- title: "\u9644\u4EF6\u7BA1\u7406",
3748
- onConfirm: async (resolve) => {
3749
- }
3750
- });
3751
- const { columns } = useAttachment(props, {
3752
- data: modelValue
3753
- });
3754
- return (_ctx, _cache) => {
3755
- const _component_el_button = vue.resolveComponent("el-button");
3756
- return vue.openBlock(), vue.createBlock(vue.unref(AttachmentDialog), null, {
3757
- default: vue.withCtx(() => [
3758
- _ctx.openType === "dialog" ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3759
- key: 0,
3760
- type: "primary",
3761
- size: "default"
3762
- }, {
3763
- default: vue.withCtx(() => [
3764
- vue.createTextVNode("\u6DFB\u52A0\u9644\u4EF6")
3765
- ]),
3766
- _: 1
3767
- })) : vue.createCommentVNode("", true),
3768
- vue.createVNode(vue.unref(EpTable), vue.mergeProps({
3769
- class: `${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`,
3770
- style: {
3771
- ...vue.unref(prepareStyles)()
3772
- },
3773
- columns: vue.unref(columns),
3774
- data: modelValue.value
3775
- }, props), null, 16, ["class", "style", "columns", "data"])
3776
- ]),
3777
- _: 1
3778
- });
3779
- };
3780
- }
3781
- });
3782
-
3783
- const EpAttachment = withInstall(_sfc_main$1);
3960
+ const EpLink = withInstall(_sfc_main$1);
3784
3961
 
3785
3962
  const componentType = ["bpm", "address"];
3786
3963
  const uniVueProps = {
@@ -3971,7 +4148,7 @@
3971
4148
  EpUniVue
3972
4149
  ];
3973
4150
 
3974
- var version = "0.0.47";
4151
+ var version = "0.0.50";
3975
4152
 
3976
4153
  var globalProperties = {
3977
4154
  install(app) {