el-plus 0.0.30 → 0.0.33

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 (109) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.full.js +283 -49
  3. package/dist/index.full.min.js +1 -1
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +1 -1
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +280 -47
  8. package/es/components/attachment/index.d.ts +174 -0
  9. package/es/components/attachment/index.mjs +8 -0
  10. package/es/components/attachment/index.mjs.map +1 -0
  11. package/es/components/attachment/src/attachment.d.ts +23 -0
  12. package/es/components/attachment/src/attachment.mjs +31 -0
  13. package/es/components/attachment/src/attachment.mjs.map +1 -0
  14. package/es/components/attachment/src/attachment.vue.d.ts +71 -0
  15. package/es/components/attachment/src/attachment.vue.mjs +6 -0
  16. package/es/components/attachment/src/attachment.vue.mjs.map +1 -0
  17. package/es/components/attachment/src/attachment.vue2.mjs +65 -0
  18. package/es/components/attachment/src/attachment.vue2.mjs.map +1 -0
  19. package/es/components/attachment/src/use-attachment.d.ts +212 -0
  20. package/es/components/attachment/src/use-attachment.mjs +80 -0
  21. package/es/components/attachment/src/use-attachment.mjs.map +1 -0
  22. package/es/components/attachment/style/css.d.ts +2 -0
  23. package/es/components/attachment/style/css.mjs +5 -0
  24. package/es/components/attachment/style/css.mjs.map +1 -0
  25. package/es/components/attachment/style/index.d.ts +2 -0
  26. package/es/components/attachment/style/index.mjs +5 -0
  27. package/es/components/attachment/style/index.mjs.map +1 -0
  28. package/es/components/form/src/hooks/use-form-item.mjs +9 -12
  29. package/es/components/form/src/hooks/use-form-item.mjs.map +1 -1
  30. package/es/components/index.d.ts +1 -0
  31. package/es/components/index.mjs +2 -0
  32. package/es/components/index.mjs.map +1 -1
  33. package/es/components/search-list-page/index.d.ts +213 -192
  34. package/es/components/search-list-page/src/search-list-page.d.ts +1 -1
  35. package/es/components/search-list-page/src/search-list-page.vue.d.ts +54 -49
  36. package/es/components/search-list-page/src/use-search-list-page.d.ts +52 -47
  37. package/es/components/table/index.d.ts +51 -46
  38. package/es/components/table/src/table.d.ts +1 -1
  39. package/es/components/table/src/table.mjs.map +1 -1
  40. package/es/components/table/src/table.vue.d.ts +12 -11
  41. package/es/components/table/src/table.vue2.mjs +1 -2
  42. package/es/components/table/src/table.vue2.mjs.map +1 -1
  43. package/es/components/table/src/use-table.d.ts +1 -71
  44. package/es/components/table/src/use-table.mjs +7 -9
  45. package/es/components/table/src/use-table.mjs.map +1 -1
  46. package/es/components.mjs +3 -1
  47. package/es/components.mjs.map +1 -1
  48. package/es/index.mjs +2 -0
  49. package/es/index.mjs.map +1 -1
  50. package/es/package.json.mjs +1 -1
  51. package/es/utils/env.d.ts +2 -1
  52. package/es/utils/env.mjs +9 -1
  53. package/es/utils/env.mjs.map +1 -1
  54. package/es/utils/file.d.ts +2 -0
  55. package/es/utils/file.mjs +13 -3
  56. package/es/utils/file.mjs.map +1 -1
  57. package/es/utils/index.mjs +1 -1
  58. package/lib/components/attachment/index.d.ts +174 -0
  59. package/lib/components/attachment/index.js +14 -0
  60. package/lib/components/attachment/index.js.map +1 -0
  61. package/lib/components/attachment/src/attachment.d.ts +23 -0
  62. package/lib/components/attachment/src/attachment.js +33 -0
  63. package/lib/components/attachment/src/attachment.js.map +1 -0
  64. package/lib/components/attachment/src/attachment.vue.d.ts +71 -0
  65. package/lib/components/attachment/src/attachment.vue.js +10 -0
  66. package/lib/components/attachment/src/attachment.vue.js.map +1 -0
  67. package/lib/components/attachment/src/attachment.vue2.js +69 -0
  68. package/lib/components/attachment/src/attachment.vue2.js.map +1 -0
  69. package/lib/components/attachment/src/use-attachment.d.ts +212 -0
  70. package/lib/components/attachment/src/use-attachment.js +82 -0
  71. package/lib/components/attachment/src/use-attachment.js.map +1 -0
  72. package/lib/components/attachment/style/css.d.ts +2 -0
  73. package/lib/components/attachment/style/css.js +7 -0
  74. package/lib/components/attachment/style/css.js.map +1 -0
  75. package/lib/components/attachment/style/index.d.ts +2 -0
  76. package/lib/components/attachment/style/index.js +7 -0
  77. package/lib/components/attachment/style/index.js.map +1 -0
  78. package/lib/components/form/src/hooks/use-form-item.js +9 -12
  79. package/lib/components/form/src/hooks/use-form-item.js.map +1 -1
  80. package/lib/components/index.d.ts +1 -0
  81. package/lib/components/index.js +4 -0
  82. package/lib/components/index.js.map +1 -1
  83. package/lib/components/search-list-page/index.d.ts +213 -192
  84. package/lib/components/search-list-page/src/search-list-page.d.ts +1 -1
  85. package/lib/components/search-list-page/src/search-list-page.vue.d.ts +54 -49
  86. package/lib/components/search-list-page/src/use-search-list-page.d.ts +52 -47
  87. package/lib/components/table/index.d.ts +51 -46
  88. package/lib/components/table/src/table.d.ts +1 -1
  89. package/lib/components/table/src/table.js.map +1 -1
  90. package/lib/components/table/src/table.vue.d.ts +12 -11
  91. package/lib/components/table/src/table.vue2.js +1 -2
  92. package/lib/components/table/src/table.vue2.js.map +1 -1
  93. package/lib/components/table/src/use-table.d.ts +1 -71
  94. package/lib/components/table/src/use-table.js +7 -9
  95. package/lib/components/table/src/use-table.js.map +1 -1
  96. package/lib/components.js +3 -1
  97. package/lib/components.js.map +1 -1
  98. package/lib/index.js +10 -6
  99. package/lib/index.js.map +1 -1
  100. package/lib/package.json.js +1 -1
  101. package/lib/utils/env.d.ts +2 -1
  102. package/lib/utils/env.js +9 -0
  103. package/lib/utils/env.js.map +1 -1
  104. package/lib/utils/file.d.ts +2 -0
  105. package/lib/utils/file.js +13 -1
  106. package/lib/utils/file.js.map +1 -1
  107. package/lib/utils/index.js +1 -0
  108. package/lib/utils/index.js.map +1 -1
  109. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- /*! ElPlus v0.0.30 */
1
+ /*! ElPlus v0.0.33 */
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 } from 'element-plus';
@@ -10,9 +10,10 @@ import * as qs from 'qs';
10
10
  import elTableProps from 'element-plus/es/components/table/src/table/defaults';
11
11
  import { ArrowUp, ArrowDown, EditPen } from '@element-plus/icons-vue';
12
12
  import mitt from 'mitt';
13
- import { cloneDeep } from 'lodash-unified';
13
+ import { merge, cloneDeep } from 'lodash-unified';
14
14
  import { useToggle } from '@vueuse/core';
15
15
  import { useRouter, useRoute } from 'vue-router';
16
+ import { encode } from 'js-base64';
16
17
 
17
18
  const apiProps = {
18
19
  api: {
@@ -876,17 +877,10 @@ const useForm$1 = (props) => {
876
877
  const useFormItemSlots = (props) => {
877
878
  const attrs = useAttrs();
878
879
  const {
879
- type,
880
- label,
881
880
  render,
882
- required,
883
881
  labelRender
884
882
  } = props;
885
883
  const prop = props.tableProp || props.prop;
886
- const {
887
- scopedSlots: renderScopedSlots,
888
- ...renderProps
889
- } = props.props || {};
890
884
  const events = {};
891
885
  for (const key in attrs) {
892
886
  if (key.startsWith("on")) {
@@ -901,11 +895,15 @@ const useFormItemSlots = (props) => {
901
895
  };
902
896
  const scopedSlots = {
903
897
  default: () => {
898
+ const {
899
+ scopedSlots: renderScopedSlots,
900
+ ...renderProps
901
+ } = props.props || {};
904
902
  let disabled = props.disabled;
905
903
  if (typeof props.disabled === "function") {
906
904
  disabled = props.disabled(formData);
907
905
  }
908
- return type ? h(resolveComponent(type), {
906
+ return props.type ? h(resolveComponent(props.type), {
909
907
  modelValue: formData[prop],
910
908
  "onUpdate:modelValue": (value) => {
911
909
  formData[prop] = value;
@@ -920,21 +918,21 @@ const useFormItemSlots = (props) => {
920
918
  return createVNode(ElTooltip, {
921
919
  "placement": "top",
922
920
  "effect": "dark",
923
- "content": label,
921
+ "content": props.label,
924
922
  "disabled": !props.isShowLabel || isTipDisabled.value
925
923
  }, {
926
924
  default: () => [createVNode("span", {
927
925
  "onMouseenter": checkOverflow,
928
926
  "style": "display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"
929
- }, [!props.hideRequiredAsterisk && required ? createVNode("span", {
927
+ }, [!props.hideRequiredAsterisk && props.required ? createVNode("span", {
930
928
  "style": "color: var(--el-color-danger);"
931
- }, [createTextVNode("*")]) : null, props.isShowLabel ? createVNode("span", null, [label]) : ""])]
929
+ }, [createTextVNode("*")]) : null, props.isShowLabel ? createVNode("span", null, [props.label]) : ""])]
932
930
  });
933
931
  }
934
932
  };
935
933
  if (labelRender) {
936
934
  scopedSlots.label = () => labelRender({
937
- label
935
+ label: props.label
938
936
  });
939
937
  }
940
938
  if (render) {
@@ -1045,7 +1043,7 @@ var EpFormItem = /* @__PURE__ */ defineComponent({
1045
1043
  }
1046
1044
  });
1047
1045
 
1048
- var _sfc_main$9 = /* @__PURE__ */ defineComponent({
1046
+ var _sfc_main$a = /* @__PURE__ */ defineComponent({
1049
1047
  ...{
1050
1048
  name: "EpForm",
1051
1049
  inheritAttrs: false
@@ -1143,7 +1141,7 @@ var _sfc_main$9 = /* @__PURE__ */ defineComponent({
1143
1141
  }
1144
1142
  });
1145
1143
 
1146
- const EpForm = withInstall(_sfc_main$9);
1144
+ const EpForm = withInstall(_sfc_main$a);
1147
1145
 
1148
1146
  const { t: t$2 } = useLocale();
1149
1147
  const inputProps = {
@@ -1172,7 +1170,7 @@ const inputEmits = {
1172
1170
  };
1173
1171
  const inputEmitsKeys = Object.keys(inputEmits);
1174
1172
 
1175
- var _sfc_main$8 = /* @__PURE__ */ defineComponent({
1173
+ var _sfc_main$9 = /* @__PURE__ */ defineComponent({
1176
1174
  ...{
1177
1175
  name: "EpInput",
1178
1176
  inheritAttrs: false
@@ -1306,7 +1304,7 @@ var _sfc_main$8 = /* @__PURE__ */ defineComponent({
1306
1304
  }
1307
1305
  });
1308
1306
 
1309
- const EpInput = withInstall(_sfc_main$8);
1307
+ const EpInput = withInstall(_sfc_main$9);
1310
1308
 
1311
1309
  function _isSlot$1(s) {
1312
1310
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
@@ -1621,6 +1619,14 @@ const getEnv = (mark = "hxjf", hostname = window.location.hostname) => {
1621
1619
  }
1622
1620
  return tag[0] ? tag[0].replace("-", "") : "production";
1623
1621
  };
1622
+ const getLocationEnv = () => {
1623
+ const urlParams = new URLSearchParams(window.location.search);
1624
+ const devProxy = urlParams.get("devProxy");
1625
+ if (devProxy) {
1626
+ return devProxy.split("-")[0].replace("/", "");
1627
+ }
1628
+ return "";
1629
+ };
1624
1630
 
1625
1631
  const { t: t$1 } = useLocale();
1626
1632
  const gotoTaskTrace = (workflowId) => {
@@ -1636,7 +1642,7 @@ const gotoTaskTrace = (workflowId) => {
1636
1642
  }
1637
1643
  };
1638
1644
 
1639
- var _sfc_main$7 = /* @__PURE__ */ defineComponent({
1645
+ var _sfc_main$8 = /* @__PURE__ */ defineComponent({
1640
1646
  ...{
1641
1647
  name: "EpCustomColumn",
1642
1648
  inheritAttrs: false
@@ -1841,7 +1847,7 @@ var _sfc_main$7 = /* @__PURE__ */ defineComponent({
1841
1847
  }
1842
1848
  });
1843
1849
 
1844
- const EpCustomColumn = withInstall(_sfc_main$7);
1850
+ const EpCustomColumn = withInstall(_sfc_main$8);
1845
1851
 
1846
1852
  const inheritTableProps = {
1847
1853
  ...elTableProps,
@@ -2126,6 +2132,7 @@ const usePagination = function(props, search) {
2126
2132
  const useTableColumn = (props, tableData, customColumns) => {
2127
2133
  const instance = getCurrentInstance();
2128
2134
  const columnProps = (column) => {
2135
+ column.props = column.props || {};
2129
2136
  const attrs = {
2130
2137
  "show-overflow-tooltip": true,
2131
2138
  align: column.align || props.align,
@@ -2205,16 +2212,11 @@ const useTableColumn = (props, tableData, customColumns) => {
2205
2212
  const columnList = computed(() => {
2206
2213
  const columns = props.customColumnModule ? customColumns.value : props.columns;
2207
2214
  return columns.map((column) => {
2208
- let newColumn = {
2209
- ...column
2210
- };
2215
+ const newColumn = columnProps(column);
2211
2216
  if (props.formatColumns.length) {
2212
2217
  const formatColumn = props.formatColumns.find((item) => item.prop === column.prop);
2213
2218
  if (formatColumn) {
2214
- newColumn = {
2215
- ...newColumn,
2216
- ...formatColumn
2217
- };
2219
+ merge(newColumn, formatColumn);
2218
2220
  }
2219
2221
  }
2220
2222
  return newColumn;
@@ -2228,7 +2230,6 @@ const useTableColumn = (props, tableData, customColumns) => {
2228
2230
  });
2229
2231
  });
2230
2232
  return {
2231
- columnProps,
2232
2233
  columnList
2233
2234
  };
2234
2235
  };
@@ -2258,6 +2259,9 @@ const useTableFormItem = (props) => {
2258
2259
  const disabledOption = item.props.disabledOption;
2259
2260
  item.props.disabledOption = (...args) => disabledOption(...args, scope);
2260
2261
  }
2262
+ if ("desc" in item.props && typeof item.props.desc === "function") {
2263
+ item.props.desc = item.props.desc(scope);
2264
+ }
2261
2265
  }
2262
2266
  if (item.type === "EpButtons" && item.props) {
2263
2267
  item.props.list.forEach((btnItem) => {
@@ -2303,7 +2307,7 @@ const useTableFormItem = (props) => {
2303
2307
  };
2304
2308
  };
2305
2309
 
2306
- var _sfc_main$6 = /* @__PURE__ */ defineComponent({
2310
+ var _sfc_main$7 = /* @__PURE__ */ defineComponent({
2307
2311
  ...{
2308
2312
  name: "EpTable",
2309
2313
  inheritAttrs: false
@@ -2348,7 +2352,6 @@ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
2348
2352
  customColumns
2349
2353
  } = useTable$1(props);
2350
2354
  const {
2351
- columnProps,
2352
2355
  columnList
2353
2356
  } = useTableColumn(props, data, customColumns);
2354
2357
  const {
@@ -2450,7 +2453,7 @@ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
2450
2453
  key: index
2451
2454
  }, {
2452
2455
  ref_for: true
2453
- }, unref(columnProps)(item)), {
2456
+ }, item), {
2454
2457
  default: withCtx((scope) => [item.type || item.render ? (openBlock(), createBlock(unref(EpFormItem), mergeProps({
2455
2458
  key: 0,
2456
2459
  "form-data": scope.row,
@@ -2489,7 +2492,7 @@ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
2489
2492
  }
2490
2493
  });
2491
2494
 
2492
- const EpTable = withInstall(_sfc_main$6);
2495
+ const EpTable = withInstall(_sfc_main$7);
2493
2496
 
2494
2497
  const searchListPageProps = {
2495
2498
  ...apiProps,
@@ -2740,7 +2743,7 @@ const useButtons$1 = (props, { validate, resetFields, tableRef }) => {
2740
2743
  };
2741
2744
  };
2742
2745
 
2743
- var _sfc_main$5 = /* @__PURE__ */ defineComponent({
2746
+ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
2744
2747
  ...{ name: "EpSearchListPage" },
2745
2748
  __name: "search-list-page",
2746
2749
  props: searchListPageProps,
@@ -2793,7 +2796,7 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
2793
2796
  }
2794
2797
  });
2795
2798
 
2796
- const EpSearchListPage = withInstall(_sfc_main$5);
2799
+ const EpSearchListPage = withInstall(_sfc_main$6);
2797
2800
 
2798
2801
  const inheritSelectProps = {
2799
2802
  ...selectProps$1,
@@ -2919,7 +2922,7 @@ function useSelect(props, emit) {
2919
2922
  };
2920
2923
  }
2921
2924
 
2922
- var _sfc_main$4 = /* @__PURE__ */ defineComponent({
2925
+ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
2923
2926
  ...{
2924
2927
  name: "EpSelect",
2925
2928
  inheritAttrs: false
@@ -2998,7 +3001,7 @@ var _sfc_main$4 = /* @__PURE__ */ defineComponent({
2998
3001
  }
2999
3002
  });
3000
3003
 
3001
- const EpSelect = withInstall(_sfc_main$4);
3004
+ const EpSelect = withInstall(_sfc_main$5);
3002
3005
 
3003
3006
  const titleProps = {
3004
3007
  // 右侧按钮
@@ -3057,7 +3060,7 @@ const useTitle = (emit) => {
3057
3060
  };
3058
3061
  };
3059
3062
 
3060
- var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3063
+ var _sfc_main$4 = /* @__PURE__ */ defineComponent({
3061
3064
  ...{
3062
3065
  name: "EpTitle",
3063
3066
  inheritAttrs: false
@@ -3121,7 +3124,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3121
3124
  }
3122
3125
  });
3123
3126
 
3124
- const EpTitle = withInstall(_sfc_main$3);
3127
+ const EpTitle = withInstall(_sfc_main$4);
3125
3128
 
3126
3129
  const headerProps = {
3127
3130
  // 页面模式
@@ -3302,7 +3305,7 @@ const useButtons = (props, emit) => {
3302
3305
  };
3303
3306
  };
3304
3307
 
3305
- var _sfc_main$2 = /* @__PURE__ */ defineComponent({
3308
+ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
3306
3309
  ...{
3307
3310
  name: "EpHeader",
3308
3311
  inheritAttrs: false
@@ -3335,7 +3338,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
3335
3338
  }
3336
3339
  });
3337
3340
 
3338
- const EpHeader = withInstall(_sfc_main$2);
3341
+ const EpHeader = withInstall(_sfc_main$3);
3339
3342
 
3340
3343
  const { t } = useLocale();
3341
3344
  const datePickerRangeProps = {
@@ -3405,7 +3408,7 @@ const datePickerRangeProps = {
3405
3408
  };
3406
3409
  const datePickerRangeEmits = {};
3407
3410
 
3408
- var _sfc_main$1 = /* @__PURE__ */ defineComponent({
3411
+ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
3409
3412
  ...{
3410
3413
  name: "EpDatePickerRange",
3411
3414
  inheritAttrs: false
@@ -3461,7 +3464,7 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
3461
3464
  }
3462
3465
  });
3463
3466
 
3464
- const EpDatePickerRange = withInstall(_sfc_main$1);
3467
+ const EpDatePickerRange = withInstall(_sfc_main$2);
3465
3468
 
3466
3469
  const linkProps = {
3467
3470
  ...linkProps$1,
@@ -3478,7 +3481,7 @@ const linkProps = {
3478
3481
  }
3479
3482
  };
3480
3483
 
3481
- var _sfc_main = /* @__PURE__ */ defineComponent({
3484
+ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
3482
3485
  ...{
3483
3486
  name: "EpLink",
3484
3487
  inheritAttrs: false
@@ -3523,7 +3526,236 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
3523
3526
  }
3524
3527
  });
3525
3528
 
3526
- const EpLink = withInstall(_sfc_main);
3529
+ const EpLink = withInstall(_sfc_main$1);
3530
+
3531
+ const attachmentProps = {
3532
+ // 格式化列
3533
+ formatColumns: {
3534
+ ...tableProps.formatColumns
3535
+ },
3536
+ // 页面模式
3537
+ mode: {
3538
+ ...headerProps.mode
3539
+ },
3540
+ // 展示模式
3541
+ openType: {
3542
+ type: String,
3543
+ default: "dialog"
3544
+ },
3545
+ // 是否需要类型
3546
+ isType: {
3547
+ type: Boolean,
3548
+ default: true
3549
+ },
3550
+ // 是否需要备注
3551
+ isNote: {
3552
+ type: Boolean,
3553
+ default: false
3554
+ }
3555
+ };
3556
+
3557
+ const getFullUrl = (filePath) => {
3558
+ return filePath.indexOf("hongxinshop.com") > -1 ? filePath : `${window.location.protocol}${getEnv() === "local" ? `//${getLocationEnv()}-hxjf.hongxinshop.com` : ""}/image/${filePath}`;
3559
+ };
3560
+ const downloadSrc = ({
3561
+ src,
3562
+ fileName,
3563
+ blob
3564
+ }) => {
3565
+ if (src) {
3566
+ fileName = fileName || src.split("/")[src.split("/").length - 1];
3567
+ const a = document.createElement("a");
3568
+ a.style.display = "none";
3569
+ document.body.appendChild(a);
3570
+ const event = new MouseEvent("click");
3571
+ a.download = fileName;
3572
+ a.href = blob ? src : getFullUrl(src);
3573
+ a.target = "_blank";
3574
+ a.dispatchEvent(event);
3575
+ document.body.removeChild(a);
3576
+ }
3577
+ };
3578
+ async function downloadFile({
3579
+ api = "",
3580
+ blob,
3581
+ data = {},
3582
+ src,
3583
+ fileName = "",
3584
+ config = {}
3585
+ }) {
3586
+ if (src) {
3587
+ downloadSrc({ src, fileName });
3588
+ return;
3589
+ }
3590
+ http.request(api, {
3591
+ method: config.method || "post",
3592
+ data,
3593
+ loading: true,
3594
+ responseType: blob ? "blob" : void 0,
3595
+ responseReturn: "raw",
3596
+ ...config
3597
+ }).then((res) => {
3598
+ const { headers } = res;
3599
+ if (!res.data.success) {
3600
+ return ElMessage.error(res.data.msg);
3601
+ }
3602
+ const data2 = res.data?.data || res.data?.data?.url || "";
3603
+ const lowerHeaders = {};
3604
+ for (const key in headers) {
3605
+ lowerHeaders[key.toLowerCase()] = headers[key];
3606
+ }
3607
+ let src2 = "";
3608
+ if (blob) {
3609
+ const contentDisposition = lowerHeaders["content-disposition"] || "";
3610
+ fileName = fileName || decodeURIComponent(contentDisposition.split("filename=")[1]);
3611
+ const blob2 = new Blob([data2], {
3612
+ type: headers["content-type"]
3613
+ });
3614
+ src2 = window.URL.createObjectURL(blob2);
3615
+ setTimeout(() => window.URL.revokeObjectURL(src2), 100);
3616
+ } else {
3617
+ src2 = data2;
3618
+ }
3619
+ downloadSrc({ src: src2, fileName, blob });
3620
+ });
3621
+ }
3622
+ const previewFile = (url) => {
3623
+ url = getFullUrl(url);
3624
+ const origin = getFullUrl("").replace("/image/", "");
3625
+ const previewUrl = `${origin}/kfv/onlinePreview?url=${encode(url)}`;
3626
+ window.open(previewUrl, "_blank");
3627
+ };
3628
+
3629
+ const useAttachment = (props, { data }) => {
3630
+ const { mode: defaultMode } = useNavigation();
3631
+ const mode = computed(() => {
3632
+ return props.mode || defaultMode.value;
3633
+ });
3634
+ const columns = ref([
3635
+ {
3636
+ type: "EpButtons",
3637
+ label: "\u64CD\u4F5C",
3638
+ width: "120px",
3639
+ props: {
3640
+ type: "text",
3641
+ list: [
3642
+ {
3643
+ name: "\u4E0B\u8F7D",
3644
+ onClick({ row }) {
3645
+ downloadFile({
3646
+ src: row.filePath,
3647
+ fileName: row.originalFilename || row.originalFileName
3648
+ });
3649
+ }
3650
+ },
3651
+ {
3652
+ name: "\u5220\u9664",
3653
+ disabled: () => {
3654
+ return mode.value === "browse";
3655
+ },
3656
+ onClick: ({ $index }) => {
3657
+ data.value.splice($index, 1);
3658
+ }
3659
+ }
3660
+ ]
3661
+ }
3662
+ },
3663
+ {
3664
+ label: "\u9644\u4EF6\u7C7B\u578B",
3665
+ prop: "type",
3666
+ type: "EpSelect",
3667
+ required: true,
3668
+ show: () => props.isType,
3669
+ props: {
3670
+ desc: ({ row }) => {
3671
+ return row.typeDesc;
3672
+ }
3673
+ }
3674
+ },
3675
+ {
3676
+ label: "\u6587\u4EF6\u540D\u79F0",
3677
+ prop: "originalFilename",
3678
+ type: "EpLink",
3679
+ onClick({ row }) {
3680
+ previewFile(row.filePath);
3681
+ }
3682
+ },
3683
+ {
3684
+ label: "\u521B\u5EFA\u4EBA",
3685
+ prop: "createBy"
3686
+ },
3687
+ {
3688
+ label: "\u521B\u5EFA\u65F6\u95F4",
3689
+ prop: "createTime"
3690
+ },
3691
+ {
3692
+ label: "\u8BF4\u660E",
3693
+ prop: "note",
3694
+ type: "EpInput",
3695
+ show: () => props.isNote
3696
+ }
3697
+ ]);
3698
+ return {
3699
+ columns
3700
+ };
3701
+ };
3702
+
3703
+ var _sfc_main = /* @__PURE__ */ defineComponent({
3704
+ ...{
3705
+ name: "EpAttachment",
3706
+ inheritAttrs: false
3707
+ },
3708
+ __name: "attachment",
3709
+ props: /* @__PURE__ */ mergeModels(attachmentProps, {
3710
+ "modelValue": {},
3711
+ "modelModifiers": {}
3712
+ }),
3713
+ emits: ["update:modelValue"],
3714
+ setup(__props) {
3715
+ const bem = createNameSpace("attachment");
3716
+ const props = __props;
3717
+ const modelValue = useModel(__props, "modelValue");
3718
+ const AttachmentDialog = useDialog({
3719
+ class: bem.em("dialog", props.openType === "normal" ? props.openType : ""),
3720
+ width: 850,
3721
+ center: true,
3722
+ title: "\u9644\u4EF6\u7BA1\u7406",
3723
+ onConfirm: async (resolve) => {
3724
+ }
3725
+ });
3726
+ const { columns } = useAttachment(props, {
3727
+ data: modelValue
3728
+ });
3729
+ return (_ctx, _cache) => {
3730
+ const _component_el_button = resolveComponent("el-button");
3731
+ return openBlock(), createBlock(unref(AttachmentDialog), null, {
3732
+ default: withCtx(() => [
3733
+ _ctx.openType === "dialog" ? (openBlock(), createBlock(_component_el_button, {
3734
+ key: 0,
3735
+ type: "primary",
3736
+ size: "default"
3737
+ }, {
3738
+ default: withCtx(() => [
3739
+ createTextVNode("\u6DFB\u52A0\u9644\u4EF6")
3740
+ ]),
3741
+ _: 1
3742
+ })) : createCommentVNode("", true),
3743
+ createVNode(unref(EpTable), mergeProps({
3744
+ class: `${unref(bem).b()} ${unref(prepareClassNames)()}`,
3745
+ style: {
3746
+ ...unref(prepareStyles)()
3747
+ },
3748
+ columns: unref(columns),
3749
+ data: modelValue.value
3750
+ }, props), null, 16, ["class", "style", "columns", "data"])
3751
+ ]),
3752
+ _: 1
3753
+ });
3754
+ };
3755
+ }
3756
+ });
3757
+
3758
+ const EpAttachment = withInstall(_sfc_main);
3527
3759
 
3528
3760
  var components = [
3529
3761
  EpButtons,
@@ -3536,10 +3768,11 @@ var components = [
3536
3768
  EpHeader,
3537
3769
  EpDatePickerRange,
3538
3770
  EpCustomColumn,
3539
- EpLink
3771
+ EpLink,
3772
+ EpAttachment
3540
3773
  ];
3541
3774
 
3542
- var version = "0.0.30";
3775
+ var version = "0.0.33";
3543
3776
 
3544
3777
  var globalProperties = {
3545
3778
  install(app) {
@@ -3623,4 +3856,4 @@ const plugin = {
3623
3856
  version
3624
3857
  };
3625
3858
 
3626
- export { EpButtons, EpCustomColumn, EpDatePickerRange, EpForm, EpFormItem, EpHeader, EpInput, EpLink, EpSearchListPage, EpSelect, EpTable, EpTitle, buttonsProps, customColumnEmits, customColumnProps, datePickerRangeEmits, datePickerRangeProps, plugin as default, expandFormItemPropsKeys, expandFormPropsKeys, expandSelectPropsKeys, expandTablePropsKeys, formEmits, formEmitsKeys, formItemProps, formProps, headerEmits, headerProps, inheritSelectProps, inputEmits, inputEmitsKeys, inputProps, install, linkProps, searchListPageProps, selectEmits, selectEmitsKeys, selectProps, tableEmits, tableEmitsKeys, tableProps, titleEmits, titleProps, useChooseDialog, useDialog, useFormDialog, useLocale, useNavigation, useRequest, useTemplatePromise, vPermisson as vPermission, vRepeatClick };
3859
+ export { EpAttachment, EpButtons, EpCustomColumn, EpDatePickerRange, EpForm, EpFormItem, EpHeader, EpInput, EpLink, EpSearchListPage, EpSelect, EpTable, EpTitle, attachmentProps, buttonsProps, customColumnEmits, customColumnProps, datePickerRangeEmits, datePickerRangeProps, plugin as default, expandFormItemPropsKeys, expandFormPropsKeys, expandSelectPropsKeys, expandTablePropsKeys, formEmits, formEmitsKeys, formItemProps, formProps, headerEmits, headerProps, inheritSelectProps, inputEmits, inputEmitsKeys, inputProps, install, linkProps, searchListPageProps, selectEmits, selectEmitsKeys, selectProps, tableEmits, tableEmitsKeys, tableProps, titleEmits, titleProps, useChooseDialog, useDialog, useFormDialog, useLocale, useNavigation, useRequest, useTemplatePromise, vPermisson as vPermission, vRepeatClick };