el-plus 0.0.47 → 0.0.51

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 (113) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/index.css +1 -1
  3. package/dist/index.full.js +496 -285
  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 +496 -285
  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/custom-column/src/custom-column.vue2.mjs +1 -1
  20. package/es/components/custom-column/src/custom-column.vue2.mjs.map +1 -1
  21. package/es/components/header/index.d.ts +15 -0
  22. package/es/components/header/src/header.d.ts +4 -0
  23. package/es/components/header/src/header.mjs +6 -1
  24. package/es/components/header/src/header.mjs.map +1 -1
  25. package/es/components/header/src/header.vue.d.ts +9 -0
  26. package/es/components/header/src/header.vue2.mjs +6 -1
  27. package/es/components/header/src/header.vue2.mjs.map +1 -1
  28. package/es/components/header/src/use-header.mjs +42 -44
  29. package/es/components/header/src/use-header.mjs.map +1 -1
  30. package/es/components/search-list-page/index.d.ts +11 -3
  31. package/es/components/search-list-page/index.mjs.map +1 -1
  32. package/es/components/search-list-page/src/search-list-page.vue.d.ts +3 -1
  33. package/es/components/search-list-page/src/use-search-list-page.d.ts +3 -1
  34. package/es/components/search-list-page/src/use-search-list-page.mjs +1 -1
  35. package/es/components/search-list-page/src/use-search-list-page.mjs.map +1 -1
  36. package/es/components/table/index.d.ts +3 -0
  37. package/es/components/table/src/table.vue.d.ts +1 -0
  38. package/es/components/table/src/table.vue2.mjs +2 -0
  39. package/es/components/table/src/table.vue2.mjs.map +1 -1
  40. package/es/components/table/src/use-table.d.ts +1 -0
  41. package/es/components/table/src/use-table.mjs +4 -0
  42. package/es/components/table/src/use-table.mjs.map +1 -1
  43. package/es/hooks/dialog/use-choose-dialog.mjs +18 -3
  44. package/es/hooks/dialog/use-choose-dialog.mjs.map +1 -1
  45. package/es/hooks/dialog/use-dialog.mjs.map +1 -1
  46. package/es/hooks/dialog/use-form-dialog.mjs +14 -2
  47. package/es/hooks/dialog/use-form-dialog.mjs.map +1 -1
  48. package/es/hooks/use-request.mjs +4 -3
  49. package/es/hooks/use-request.mjs.map +1 -1
  50. package/es/locale/lang/en.d.ts +12 -0
  51. package/es/locale/lang/en.mjs +12 -0
  52. package/es/locale/lang/en.mjs.map +1 -1
  53. package/es/locale/lang/zh-cn.d.ts +12 -0
  54. package/es/locale/lang/zh-cn.mjs +12 -0
  55. package/es/locale/lang/zh-cn.mjs.map +1 -1
  56. package/es/package.json.mjs +1 -1
  57. package/es/utils/file.d.ts +1 -1
  58. package/es/utils/file.mjs.map +1 -1
  59. package/lib/components/attachment/index.d.ts +24 -3
  60. package/lib/components/attachment/src/attachment.d.ts +4 -0
  61. package/lib/components/attachment/src/attachment.js +5 -0
  62. package/lib/components/attachment/src/attachment.js.map +1 -1
  63. package/lib/components/attachment/src/attachment.vue.d.ts +12 -1
  64. package/lib/components/attachment/src/attachment.vue2.js +68 -28
  65. package/lib/components/attachment/src/attachment.vue2.js.map +1 -1
  66. package/lib/components/attachment/src/use-attachment.d.ts +32 -24
  67. package/lib/components/attachment/src/use-attachment.js +63 -10
  68. package/lib/components/attachment/src/use-attachment.js.map +1 -1
  69. package/lib/components/custom-column/src/custom-column.vue2.js +1 -1
  70. package/lib/components/custom-column/src/custom-column.vue2.js.map +1 -1
  71. package/lib/components/header/index.d.ts +15 -0
  72. package/lib/components/header/src/header.d.ts +4 -0
  73. package/lib/components/header/src/header.js +6 -1
  74. package/lib/components/header/src/header.js.map +1 -1
  75. package/lib/components/header/src/header.vue.d.ts +9 -0
  76. package/lib/components/header/src/header.vue2.js +6 -1
  77. package/lib/components/header/src/header.vue2.js.map +1 -1
  78. package/lib/components/header/src/use-header.js +42 -44
  79. package/lib/components/header/src/use-header.js.map +1 -1
  80. package/lib/components/search-list-page/index.d.ts +11 -3
  81. package/lib/components/search-list-page/index.js.map +1 -1
  82. package/lib/components/search-list-page/src/search-list-page.vue.d.ts +3 -1
  83. package/lib/components/search-list-page/src/use-search-list-page.d.ts +3 -1
  84. package/lib/components/search-list-page/src/use-search-list-page.js +1 -1
  85. package/lib/components/search-list-page/src/use-search-list-page.js.map +1 -1
  86. package/lib/components/table/index.d.ts +3 -0
  87. package/lib/components/table/src/table.vue.d.ts +1 -0
  88. package/lib/components/table/src/table.vue2.js +2 -0
  89. package/lib/components/table/src/table.vue2.js.map +1 -1
  90. package/lib/components/table/src/use-table.d.ts +1 -0
  91. package/lib/components/table/src/use-table.js +4 -0
  92. package/lib/components/table/src/use-table.js.map +1 -1
  93. package/lib/hooks/dialog/use-choose-dialog.js +17 -2
  94. package/lib/hooks/dialog/use-choose-dialog.js.map +1 -1
  95. package/lib/hooks/dialog/use-dialog.js.map +1 -1
  96. package/lib/hooks/dialog/use-form-dialog.js +14 -2
  97. package/lib/hooks/dialog/use-form-dialog.js.map +1 -1
  98. package/lib/hooks/use-request.js +4 -3
  99. package/lib/hooks/use-request.js.map +1 -1
  100. package/lib/locale/lang/en.d.ts +12 -0
  101. package/lib/locale/lang/en.js +12 -0
  102. package/lib/locale/lang/en.js.map +1 -1
  103. package/lib/locale/lang/zh-cn.d.ts +12 -0
  104. package/lib/locale/lang/zh-cn.js +12 -0
  105. package/lib/locale/lang/zh-cn.js.map +1 -1
  106. package/lib/package.json.js +1 -1
  107. package/lib/utils/file.d.ts +1 -1
  108. package/lib/utils/file.js.map +1 -1
  109. package/package.json +1 -1
  110. package/theme-chalk/attachment.css +1 -0
  111. package/theme-chalk/index.css +1 -1
  112. package/theme-chalk/src/attachment.scss +37 -0
  113. package/theme-chalk/src/index.scss +2 -1
@@ -1,4 +1,4 @@
1
- /*! ElPlus v0.0.47 */
1
+ /*! ElPlus v0.0.51 */
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
  };
@@ -1564,9 +1576,10 @@
1564
1576
  ...reqParams,
1565
1577
  ...config.params
1566
1578
  };
1567
- if (data.$query) {
1568
- config.data[data.$query] = data.$searchValue;
1569
- delete data.$searchValue;
1579
+ if (config.data.$query) {
1580
+ config.data[config.data.$query] = data.$searchValue;
1581
+ delete config.data.$searchValue;
1582
+ delete config.data.$query;
1570
1583
  }
1571
1584
  if (reqBefore) {
1572
1585
  reqBefore(config);
@@ -1812,7 +1825,7 @@
1812
1825
  size: "small",
1813
1826
  onClick: open
1814
1827
  }, {
1815
- default: vue.withCtx(() => [vue.createTextVNode(vue.toDisplayString(vue.unref(t)("ep.customColumn.defineColumn")), 1)]),
1828
+ default: vue.withCtx(() => [vue.createTextVNode(vue.toDisplayString(vue.unref(t)("ep.customColumn.columnSettings")), 1)]),
1816
1829
  _: 1
1817
1830
  }, 8, ["class"])) : vue.createCommentVNode("", true), vue.createVNode(vue.unref(CustomColumnDialog), null, {
1818
1831
  default: vue.withCtx(() => [vue.createVNode(_component_el_transfer, {
@@ -1965,7 +1978,14 @@
1965
1978
  ...formProps
1966
1979
  } = options;
1967
1980
  const formRef = vue.ref();
1968
- let formData = formProps.formData || vue.reactive({});
1981
+ const isUseComFormData = !formProps.formData;
1982
+ let formData = isUseComFormData ? vue.reactive({}) : formProps.formData;
1983
+ const isDestroy = dialogProps?.destroyOnClose;
1984
+ const resetForm = async () => {
1985
+ if (isDestroy) {
1986
+ await formRef.value?.resetFields();
1987
+ }
1988
+ };
1969
1989
  return useDialog({
1970
1990
  class: bem$1.b(),
1971
1991
  width: "80%",
@@ -1983,7 +2003,12 @@
1983
2003
  },
1984
2004
  onConfirm: async (resolve) => {
1985
2005
  await formRef.value.validate();
1986
- resolve(formData);
2006
+ resolve(JSON.parse(JSON.stringify(formData)));
2007
+ resetForm();
2008
+ },
2009
+ onCancel: async (resolve) => {
2010
+ await resetForm();
2011
+ resolve("cancel");
1987
2012
  },
1988
2013
  ...dialogProps
1989
2014
  });
@@ -2086,6 +2111,9 @@
2086
2111
  const resetFields = (props2) => {
2087
2112
  return elFormRef.value.resetFields(props2);
2088
2113
  };
2114
+ const clearSelection = () => {
2115
+ return elTableRef.value.clearSelection();
2116
+ };
2089
2117
  const clearValidate = (props2) => {
2090
2118
  return elFormRef.value.clearValidate(props2);
2091
2119
  };
@@ -2104,6 +2132,7 @@
2104
2132
  pagination,
2105
2133
  paginationProps,
2106
2134
  validate,
2135
+ clearSelection,
2107
2136
  resetFields,
2108
2137
  clearValidate,
2109
2138
  elFormRef,
@@ -2357,6 +2386,7 @@
2357
2386
  validate,
2358
2387
  resetFields,
2359
2388
  clearValidate,
2389
+ clearSelection,
2360
2390
  loading,
2361
2391
  search,
2362
2392
  elFormRef,
@@ -2377,6 +2407,7 @@
2377
2407
  validate,
2378
2408
  resetFields,
2379
2409
  clearValidate,
2410
+ clearSelection,
2380
2411
  search,
2381
2412
  openCustomColumnDialog: () => {
2382
2413
  customColumnRef.value?.open();
@@ -2710,7 +2741,7 @@
2710
2741
  const list = mergeListByKey(defaultButtons, props.leftButtons);
2711
2742
  if (props.customColumnModule) {
2712
2743
  list.push({
2713
- name: t("ep.customColumn.defineColumn"),
2744
+ name: t("ep.customColumn.columnSettings"),
2714
2745
  prop: "customColumn",
2715
2746
  type: "primary",
2716
2747
  onClick: () => {
@@ -3171,7 +3202,12 @@
3171
3202
  default: () => []
3172
3203
  },
3173
3204
  // 工作流id
3174
- workflowId: String
3205
+ workflowId: String,
3206
+ // 是否显示附件按钮
3207
+ isShowAttachmentButton: {
3208
+ type: Boolean,
3209
+ default: false
3210
+ }
3175
3211
  };
3176
3212
  const headerEmits = {};
3177
3213
 
@@ -3270,67 +3306,452 @@
3270
3306
  };
3271
3307
  };
3272
3308
  const useButtons = (props, emit) => {
3273
- const { t } = useLocale();
3309
+ const {
3310
+ t
3311
+ } = useLocale();
3312
+ const {
3313
+ mode: defaultMode
3314
+ } = useNavigation();
3315
+ const mode = vue.computed(() => {
3316
+ return props.mode || defaultMode.value;
3317
+ });
3318
+ let defaultButtons = [{
3319
+ name: t("ep.header.edit"),
3320
+ prop: "modify",
3321
+ permission: props.name ? `${props.name}:UPDATE` : "",
3322
+ disabled: () => {
3323
+ return mode.value !== "browse";
3324
+ }
3325
+ }, {
3326
+ name: t("ep.header.save"),
3327
+ prop: "save",
3328
+ permission: props.name ? `${props.name}:SAVE` : "",
3329
+ disabled: () => {
3330
+ return !(mode.value === "edit" || mode.value === "add");
3331
+ }
3332
+ }, {
3333
+ name: t("ep.header.cancel"),
3334
+ prop: "cancel",
3335
+ disabled: () => {
3336
+ return mode.value !== "edit";
3337
+ }
3338
+ }, {
3339
+ name: t("ep.header.refresh"),
3340
+ prop: "refresh",
3341
+ permission: props.name ? `${props.name}:REFRESH` : "",
3342
+ disabled: () => {
3343
+ return mode.value !== "browse";
3344
+ }
3345
+ }, {
3346
+ name: t("ep.header.approvalLog"),
3347
+ prop: "approvalLog",
3348
+ permission: props.name ? `${props.name}:APPROVALLOG` : "",
3349
+ show: () => {
3350
+ return !!props.workflowId;
3351
+ },
3352
+ onClick: () => {
3353
+ gotoTaskTrace(props.workflowId);
3354
+ }
3355
+ }];
3356
+ if (props.defaultButtons.length) {
3357
+ defaultButtons = defaultButtons.filter((item) => {
3358
+ return props.defaultButtons.some((item1) => item1 === item.prop);
3359
+ });
3360
+ }
3361
+ const buttons = mergeListByKey(defaultButtons, props.buttons);
3362
+ return {
3363
+ buttons
3364
+ };
3365
+ };
3366
+
3367
+ const attachmentProps = {
3368
+ // 格式化列
3369
+ formatColumns: {
3370
+ ...tableProps.formatColumns
3371
+ },
3372
+ // 页面模式
3373
+ mode: {
3374
+ ...headerProps.mode
3375
+ },
3376
+ // 展示模式
3377
+ openType: {
3378
+ type: String,
3379
+ default: "dialog"
3380
+ },
3381
+ // 是否需要类型
3382
+ isType: {
3383
+ type: Boolean,
3384
+ default: true
3385
+ },
3386
+ // 是否需要备注
3387
+ isNote: {
3388
+ type: Boolean,
3389
+ default: false
3390
+ },
3391
+ // 是否需要打开弹窗按钮
3392
+ isShowOpenDialogButton: {
3393
+ type: Boolean,
3394
+ default: false
3395
+ }
3396
+ };
3397
+
3398
+ const getFullUrl = (filePath) => {
3399
+ return filePath.indexOf("hongxinshop.com") > -1 ? filePath : `${window.location.protocol}${getEnv() === "local" ? `//${getLocationEnv()}-hxjf.hongxinshop.com` : ""}/image/${filePath}`;
3400
+ };
3401
+ const downloadSrc = ({
3402
+ src,
3403
+ fileName,
3404
+ blob
3405
+ }) => {
3406
+ if (src) {
3407
+ fileName = fileName || src.split("/")[src.split("/").length - 1];
3408
+ const a = document.createElement("a");
3409
+ a.style.display = "none";
3410
+ document.body.appendChild(a);
3411
+ const event = new MouseEvent("click");
3412
+ a.download = fileName;
3413
+ a.href = blob ? src : getFullUrl(src);
3414
+ a.target = "_blank";
3415
+ a.dispatchEvent(event);
3416
+ document.body.removeChild(a);
3417
+ }
3418
+ };
3419
+ async function downloadFile({
3420
+ api = "",
3421
+ blob,
3422
+ data = {},
3423
+ src,
3424
+ fileName = "",
3425
+ config = {}
3426
+ }) {
3427
+ if (src) {
3428
+ downloadSrc({ src, fileName });
3429
+ return;
3430
+ }
3431
+ http.request(api, {
3432
+ method: config.method || "post",
3433
+ data,
3434
+ loading: true,
3435
+ responseType: blob ? "blob" : void 0,
3436
+ responseReturn: "raw",
3437
+ ...config
3438
+ }).then((res) => {
3439
+ const { headers } = res;
3440
+ if (!res.data.success) {
3441
+ return elementPlus.ElMessage.error(res.data.msg);
3442
+ }
3443
+ const data2 = res.data?.data || res.data?.data?.url || "";
3444
+ const lowerHeaders = {};
3445
+ for (const key in headers) {
3446
+ lowerHeaders[key.toLowerCase()] = headers[key];
3447
+ }
3448
+ let src2 = "";
3449
+ if (blob) {
3450
+ const contentDisposition = lowerHeaders["content-disposition"] || "";
3451
+ fileName = fileName || decodeURIComponent(contentDisposition.split("filename=")[1]);
3452
+ const blob2 = new Blob([data2], {
3453
+ type: headers["content-type"]
3454
+ });
3455
+ src2 = window.URL.createObjectURL(blob2);
3456
+ setTimeout(() => window.URL.revokeObjectURL(src2), 100);
3457
+ } else {
3458
+ src2 = data2;
3459
+ }
3460
+ downloadSrc({ src: src2, fileName, blob });
3461
+ });
3462
+ }
3463
+ const importFile = async ({
3464
+ accept = "*",
3465
+ multiple = false,
3466
+ fieldName = "file",
3467
+ failedFileName = "",
3468
+ extraData = {},
3469
+ api = ""
3470
+ }) => {
3471
+ return new Promise((resolve, reject) => {
3472
+ const input = document.createElement("input");
3473
+ input.type = "file";
3474
+ input.accept = accept;
3475
+ input.multiple = multiple;
3476
+ const formData = new FormData();
3477
+ Object.keys(extraData).forEach((key) => {
3478
+ formData.append(key, extraData[key]);
3479
+ });
3480
+ input.onchange = async (event) => {
3481
+ const target = event.target;
3482
+ const files = target.files;
3483
+ if (files && files.length > 0) {
3484
+ if (!multiple) {
3485
+ formData.append(fieldName, files[0]);
3486
+ } else {
3487
+ Array.from(files).forEach((file, index) => {
3488
+ formData.append(`${fieldName}${index}`, file);
3489
+ });
3490
+ }
3491
+ try {
3492
+ const { data } = await http.request(api, {
3493
+ method: "post",
3494
+ data: formData,
3495
+ loading: true,
3496
+ responseReturn: "raw",
3497
+ transformRequest: [
3498
+ function(data2) {
3499
+ return data2;
3500
+ }
3501
+ ]
3502
+ });
3503
+ if (data.success) {
3504
+ return resolve(data.data);
3505
+ }
3506
+ if (data.code === -2) {
3507
+ const fileName = failedFileName || data.data.split("/")[data.data.split("/").length - 1];
3508
+ const url = `${window.location.origin}/image/${data.data}`;
3509
+ 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>`;
3510
+ elementPlus.ElMessageBox.alert(failedHtml, "\u63D0\u793A", {
3511
+ confirmButtonText: "\u786E\u5B9A",
3512
+ type: "error",
3513
+ dangerouslyUseHTMLString: true
3514
+ });
3515
+ return;
3516
+ }
3517
+ return elementPlus.ElMessage.error(data.msg);
3518
+ } catch (error) {
3519
+ console.error(error);
3520
+ }
3521
+ input.onchange = null;
3522
+ }
3523
+ };
3524
+ input.click();
3525
+ });
3526
+ };
3527
+ const previewFile = (url) => {
3528
+ url = getFullUrl(url);
3529
+ const origin = getFullUrl("").replace("/image/", "");
3530
+ const previewUrl = `${origin}/kfv/onlinePreview?url=${jsBase64.encode(url)}`;
3531
+ window.open(previewUrl, "_blank");
3532
+ };
3533
+
3534
+ const useAttachment = (props, { data }) => {
3274
3535
  const { mode: defaultMode } = useNavigation();
3536
+ const { t } = useLocale();
3275
3537
  const mode = vue.computed(() => {
3276
3538
  return props.mode || defaultMode.value;
3277
3539
  });
3278
- let defaultButtons = [
3540
+ const tableRef = vue.useTemplateRef("tableRef");
3541
+ const isNormalOpen = props.openType === "normal";
3542
+ const isDialogOpen = props.openType === "dialog";
3543
+ let toBeConfirmData = [];
3544
+ let toBeDeleteData = {};
3545
+ const columns = vue.ref([
3279
3546
  {
3280
- name: t("ep.header.edit"),
3281
- prop: "modify",
3282
- permission: props.name ? `${props.name}:UPDATE` : "",
3283
- disabled: () => {
3284
- return mode.value !== "browse";
3547
+ type: "EpButtons",
3548
+ label: t("ep.attachment.operation"),
3549
+ width: "120px",
3550
+ props: {
3551
+ type: "text",
3552
+ list: [
3553
+ {
3554
+ name: t("ep.attachment.download"),
3555
+ onClick({ row }) {
3556
+ downloadFile({
3557
+ src: row.filePath,
3558
+ fileName: row.originalFilename || row.originalFileName
3559
+ });
3560
+ }
3561
+ },
3562
+ {
3563
+ name: t("ep.attachment.delete"),
3564
+ disabled: () => {
3565
+ return mode.value === "browse";
3566
+ },
3567
+ onClick: ({ $index, row }) => {
3568
+ if (isDialogOpen) {
3569
+ toBeDeleteData[$index] = row;
3570
+ }
3571
+ data.value.splice($index, 1);
3572
+ }
3573
+ }
3574
+ ]
3285
3575
  }
3286
3576
  },
3287
3577
  {
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");
3578
+ label: t("ep.attachment.attachmentType"),
3579
+ prop: "type",
3580
+ type: "EpSelect",
3581
+ required: true,
3582
+ show: () => props.isType,
3583
+ props: {
3584
+ desc: ({ row }) => {
3585
+ return row.typeDesc;
3586
+ }
3293
3587
  }
3294
3588
  },
3295
3589
  {
3296
- name: t("ep.header.cancel"),
3297
- prop: "cancel",
3298
- disabled: () => {
3299
- return mode.value !== "edit";
3590
+ label: t("ep.attachment.fileName"),
3591
+ prop: "originalFilename",
3592
+ type: "EpLink",
3593
+ onClick({ row }) {
3594
+ previewFile(row.filePath);
3300
3595
  }
3301
3596
  },
3302
3597
  {
3303
- name: t("ep.header.refresh"),
3304
- prop: "refresh",
3305
- permission: props.name ? `${props.name}:REFRESH` : "",
3306
- disabled: () => {
3307
- return mode.value !== "browse";
3308
- }
3598
+ label: t("ep.attachment.creator"),
3599
+ prop: "createBy"
3309
3600
  },
3310
3601
  {
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
- }
3602
+ label: t("ep.attachment.createTime"),
3603
+ prop: "createTime"
3604
+ },
3605
+ {
3606
+ label: t("ep.attachment.description"),
3607
+ prop: "note",
3608
+ type: "EpInput",
3609
+ show: () => props.isNote
3320
3610
  }
3321
- ];
3322
- if (props.defaultButtons.length) {
3323
- defaultButtons = defaultButtons.filter((item) => {
3324
- return props.defaultButtons.some((item1) => item1 === item.prop);
3611
+ ]);
3612
+ const addAttachment = async () => {
3613
+ toBeConfirmData = [];
3614
+ const fileData = await importFile({
3615
+ api: "api-f/fast/files/save",
3616
+ extraData: {
3617
+ createBy: Cookies.get("accountName") || ""
3618
+ }
3325
3619
  });
3326
- }
3327
- const buttons = mergeListByKey(defaultButtons, props.buttons);
3620
+ fileData.fileId = fileData.id;
3621
+ delete fileData.id;
3622
+ if (isDialogOpen) {
3623
+ toBeConfirmData.push(fileData);
3624
+ }
3625
+ data.value.push(fileData);
3626
+ };
3627
+ const onConfirm = async (resolve) => {
3628
+ await tableRef.value?.validate();
3629
+ resolve(data.value);
3630
+ };
3631
+ const onCancel = (resolve) => {
3632
+ if (toBeConfirmData.length) {
3633
+ const index = data.value.findIndex((item) => {
3634
+ return item.fileId === toBeConfirmData[0].fileId;
3635
+ });
3636
+ if (index !== -1) {
3637
+ data.value.splice(index, 1);
3638
+ }
3639
+ toBeConfirmData = [];
3640
+ }
3641
+ if (Object.keys(toBeDeleteData).length) {
3642
+ Object.keys(toBeDeleteData).forEach((oldIndex) => {
3643
+ data.value.splice(Number(oldIndex), 0, toBeDeleteData[oldIndex]);
3644
+ });
3645
+ toBeDeleteData = {};
3646
+ }
3647
+ resolve();
3648
+ };
3328
3649
  return {
3329
- buttons
3650
+ columns,
3651
+ addAttachment,
3652
+ isNormalOpen,
3653
+ isDialogOpen,
3654
+ onConfirm,
3655
+ onCancel
3330
3656
  };
3331
3657
  };
3332
3658
 
3333
3659
  var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
3660
+ ...{
3661
+ name: "EpAttachment",
3662
+ inheritAttrs: false
3663
+ },
3664
+ __name: "attachment",
3665
+ props: /* @__PURE__ */ vue.mergeModels(attachmentProps, {
3666
+ "modelValue": {},
3667
+ "modelModifiers": {}
3668
+ }),
3669
+ emits: ["update:modelValue"],
3670
+ setup(__props, { expose: __expose }) {
3671
+ const { t } = useLocale();
3672
+ const bem = createNameSpace("attachment");
3673
+ const props = __props;
3674
+ const modelValue = vue.useModel(__props, "modelValue");
3675
+ const { columns, addAttachment, isNormalOpen, onConfirm, onCancel } = useAttachment(props, {
3676
+ data: modelValue
3677
+ });
3678
+ const AttachmentDialog = useDialog({
3679
+ width: 850,
3680
+ center: true,
3681
+ title: isNormalOpen ? "" : t("ep.attachment.manageAttachment"),
3682
+ modal: !isNormalOpen,
3683
+ showClose: !isNormalOpen,
3684
+ showFooter: !isNormalOpen,
3685
+ transition: isNormalOpen ? "" : "dialog-fade",
3686
+ modalClass: bem.em(
3687
+ "dialog",
3688
+ props.openType === "normal" ? props.openType : ""
3689
+ ),
3690
+ onConfirm: async (resolve) => {
3691
+ onConfirm(resolve);
3692
+ },
3693
+ onCancel: (resolve) => {
3694
+ onCancel(resolve);
3695
+ }
3696
+ });
3697
+ const open = AttachmentDialog.open;
3698
+ if (isNormalOpen) {
3699
+ open();
3700
+ }
3701
+ __expose({
3702
+ open
3703
+ });
3704
+ return (_ctx, _cache) => {
3705
+ const _component_EpButtons = vue.resolveComponent("EpButtons");
3706
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
3707
+ _ctx.isShowOpenDialogButton ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
3708
+ key: 0,
3709
+ type: "primary",
3710
+ plain: "",
3711
+ size: "small",
3712
+ class: vue.normalizeClass(vue.unref(bem).e("handler")),
3713
+ onClick: vue.unref(open)
3714
+ }, {
3715
+ default: vue.withCtx(() => [
3716
+ vue.createTextVNode(vue.toDisplayString(vue.unref(t)("ep.attachment.manageAttachment")) + "(" + vue.toDisplayString(modelValue.value?.length || 0) + ") ", 1)
3717
+ ]),
3718
+ _: 1
3719
+ }, 8, ["class", "onClick"])) : vue.createCommentVNode("", true),
3720
+ vue.createVNode(vue.unref(AttachmentDialog), null, {
3721
+ default: vue.withCtx(() => [
3722
+ vue.createElementVNode("div", { style: { "margin-bottom": "10px", "text-align": "right" } }, [
3723
+ _ctx.openType === "dialog" ? (vue.openBlock(), vue.createBlock(_component_EpButtons, {
3724
+ key: 0,
3725
+ type: "primary",
3726
+ list: [
3727
+ {
3728
+ name: vue.unref(t)("ep.attachment.addAttachment"),
3729
+ type: "primary",
3730
+ onClick: vue.unref(addAttachment)
3731
+ }
3732
+ ]
3733
+ }, null, 8, ["list"])) : vue.createCommentVNode("", true)
3734
+ ]),
3735
+ vue.createVNode(vue.unref(EpTable), vue.mergeProps({
3736
+ ref: "tableRef",
3737
+ class: `${vue.unref(bem).b()} ${vue.unref(prepareClassNames)()}`,
3738
+ style: {
3739
+ ...vue.unref(prepareStyles)()
3740
+ },
3741
+ columns: vue.unref(columns),
3742
+ data: modelValue.value
3743
+ }, props), null, 16, ["class", "style", "columns", "data"])
3744
+ ]),
3745
+ _: 1
3746
+ })
3747
+ ], 64);
3748
+ };
3749
+ }
3750
+ });
3751
+
3752
+ const EpAttachment = withInstall(_sfc_main$4);
3753
+
3754
+ var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3334
3755
  ...{
3335
3756
  name: "EpHeader",
3336
3757
  inheritAttrs: false
@@ -3357,13 +3778,17 @@
3357
3778
  content: vue.withCtx(() => []),
3358
3779
  _: 1
3359
3780
  }, 8, ["onBack"])) : vue.createCommentVNode("", true),
3360
- vue.createVNode(vue.unref(EpButtons), { list: vue.unref(buttons) }, null, 8, ["list"])
3781
+ vue.createVNode(vue.unref(EpButtons), { list: vue.unref(buttons) }, null, 8, ["list"]),
3782
+ props.isShowAttachmentButton ? (vue.openBlock(), vue.createBlock(vue.unref(EpAttachment), {
3783
+ key: 1,
3784
+ "is-show-open-dialog-button": ""
3785
+ })) : vue.createCommentVNode("", true)
3361
3786
  ], 6);
3362
3787
  };
3363
3788
  }
3364
3789
  });
3365
3790
 
3366
- const EpHeader = withInstall(_sfc_main$4);
3791
+ const EpHeader = withInstall(_sfc_main$3);
3367
3792
 
3368
3793
  const { t } = useLocale();
3369
3794
  const datePickerRangeProps = {
@@ -3433,7 +3858,7 @@
3433
3858
  };
3434
3859
  const datePickerRangeEmits = {};
3435
3860
 
3436
- var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3861
+ var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3437
3862
  ...{
3438
3863
  name: "EpDatePickerRange",
3439
3864
  inheritAttrs: false
@@ -3489,7 +3914,7 @@
3489
3914
  }
3490
3915
  });
3491
3916
 
3492
- const EpDatePickerRange = withInstall(_sfc_main$3);
3917
+ const EpDatePickerRange = withInstall(_sfc_main$2);
3493
3918
 
3494
3919
  const linkProps = {
3495
3920
  ...elementPlus.linkProps,
@@ -3506,7 +3931,7 @@
3506
3931
  }
3507
3932
  };
3508
3933
 
3509
- var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3934
+ var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
3510
3935
  ...{
3511
3936
  name: "EpLink",
3512
3937
  inheritAttrs: false
@@ -3551,236 +3976,7 @@
3551
3976
  }
3552
3977
  });
3553
3978
 
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);
3979
+ const EpLink = withInstall(_sfc_main$1);
3784
3980
 
3785
3981
  const componentType = ["bpm", "address"];
3786
3982
  const uniVueProps = {
@@ -3971,7 +4167,7 @@
3971
4167
  EpUniVue
3972
4168
  ];
3973
4169
 
3974
- var version = "0.0.47";
4170
+ var version = "0.0.51";
3975
4171
 
3976
4172
  var globalProperties = {
3977
4173
  install(app) {
@@ -4005,6 +4201,11 @@
4005
4201
  }, [t("ep.chooseDialog.selected"), selections.value.length, t("ep.chooseDialog.unit")]);
4006
4202
  };
4007
4203
  }
4204
+ const clearSelections = async () => {
4205
+ selections.value = [];
4206
+ searchListPageRef.value?.tableRef?.clearSelection();
4207
+ };
4208
+ let searchListPageRef;
4008
4209
  return useDialog({
4009
4210
  class: bem.b(),
4010
4211
  width: "80%",
@@ -4013,12 +4214,22 @@
4013
4214
  title,
4014
4215
  onConfirm: (resolve) => {
4015
4216
  resolve(JSON.parse(JSON.stringify(selections.value)));
4217
+ clearSelections();
4218
+ },
4219
+ onCancel: async (resolve) => {
4220
+ clearSelections();
4221
+ resolve();
4016
4222
  },
4017
4223
  render: ({
4018
4224
  resolve
4019
4225
  }) => {
4226
+ if (!searchListPageRef) {
4227
+ searchListPageRef = vue.useTemplateRef("searchListPage");
4228
+ }
4020
4229
  const formData = rest.formData || vue.reactive({});
4021
- return vue.createVNode(EpSearchListPage, {
4230
+ return vue.createVNode(EpSearchListPage, vue.mergeProps({
4231
+ "ref": "searchListPage"
4232
+ }, {
4022
4233
  showSelectionCol: multiple,
4023
4234
  showSingleSelectionCol,
4024
4235
  formData,
@@ -4037,7 +4248,7 @@
4037
4248
  resolve(vue.toRaw(selections));
4038
4249
  }
4039
4250
  }
4040
- }, null);
4251
+ }), null);
4041
4252
  },
4042
4253
  ...dialogProps
4043
4254
  });