@vipl520/dk-ui 1.0.23 → 1.0.24

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.
package/dist/index.js CHANGED
@@ -11813,7 +11813,7 @@
11813
11813
  const _hoisted_8$9 = { class: "attachment-group" };
11814
11814
  const _hoisted_9$7 = { class: "group_list" };
11815
11815
  const _hoisted_10$6 = ["onClick"];
11816
- const _hoisted_11$5 = { class: "ml-10px" };
11816
+ const _hoisted_11$6 = { class: "ml-10px" };
11817
11817
  const _hoisted_12$5 = { class: "op" };
11818
11818
  const _hoisted_13$4 = { class: "attachment-container" };
11819
11819
  const _hoisted_14$4 = {
@@ -12190,7 +12190,7 @@
12190
12190
  })),
12191
12191
  require$$0.createElementVNode(
12192
12192
  "span",
12193
- _hoisted_11$5,
12193
+ _hoisted_11$6,
12194
12194
  require$$0.toDisplayString(item.name),
12195
12195
  1
12196
12196
  /* TEXT */
@@ -14397,7 +14397,7 @@
14397
14397
  const _hoisted_8$8 = ["title", "onDblclick"];
14398
14398
  const _hoisted_9$6 = ["onUpdate:modelValue", "onBlur"];
14399
14399
  const _hoisted_10$5 = ["width", "height", "viewBox", "data-link-anchor", "innerHTML"];
14400
- const _hoisted_11$4 = /* @__PURE__ */ require$$0.createElementVNode(
14400
+ const _hoisted_11$5 = /* @__PURE__ */ require$$0.createElementVNode(
14401
14401
  "div",
14402
14402
  { style: { "position": "absolute", "display": "none", "width": "100%", "height": "100%" } },
14403
14403
  null,
@@ -14820,7 +14820,7 @@
14820
14820
  /* KEYED_FRAGMENT */
14821
14821
  ))
14822
14822
  ]),
14823
- _hoisted_11$4,
14823
+ _hoisted_11$5,
14824
14824
  require$$0.createElementVNode("div", _hoisted_12$4, [
14825
14825
  (require$$0.openBlock(), require$$0.createElementBlock(
14826
14826
  require$$0.Fragment,
@@ -17854,7 +17854,7 @@
17854
17854
  );
17855
17855
  const _hoisted_9$5 = { class: "phone-title" };
17856
17856
  const _hoisted_10$4 = { class: "phone-title-icon" };
17857
- const _hoisted_11$3 = /* @__PURE__ */ require$$0.createElementVNode(
17857
+ const _hoisted_11$4 = /* @__PURE__ */ require$$0.createElementVNode(
17858
17858
  "div",
17859
17859
  null,
17860
17860
  "\u9875\u9762\u6807\u9898",
@@ -18023,7 +18023,7 @@
18023
18023
  /* STABLE */
18024
18024
  })
18025
18025
  ]),
18026
- _hoisted_11$3,
18026
+ _hoisted_11$4,
18027
18027
  require$$0.createElementVNode("div", _hoisted_12$3, [
18028
18028
  require$$0.createVNode(_component_el_popover, {
18029
18029
  placement: "bottom",
@@ -22933,7 +22933,7 @@
22933
22933
  key: 0,
22934
22934
  class: "tag"
22935
22935
  };
22936
- const _hoisted_11$2 = {
22936
+ const _hoisted_11$3 = {
22937
22937
  key: 1,
22938
22938
  class: "tag"
22939
22939
  };
@@ -23137,7 +23137,7 @@
23137
23137
  ]))
23138
23138
  : require$$0.createCommentVNode("v-if", true),
23139
23139
  (item.down_count > 100)
23140
- ? (require$$0.openBlock(), require$$0.createElementBlock("span", _hoisted_11$2, [
23140
+ ? (require$$0.openBlock(), require$$0.createElementBlock("span", _hoisted_11$3, [
23141
23141
  require$$0.createVNode(_component_van_icon, { name: "fire" }),
23142
23142
  require$$0.createTextVNode("热门")
23143
23143
  ]))
@@ -24761,6 +24761,12 @@
24761
24761
  return {};
24762
24762
  },
24763
24763
  type: Object
24764
+ },
24765
+ buttons: {
24766
+ default: () => {
24767
+ return ["refresh", "add", "export_csv", "edit", "delete", "comSearch", "quickSearch", "columnDisplay"];
24768
+ },
24769
+ type: Array
24764
24770
  }
24765
24771
  // ...ElTableNext.props,
24766
24772
  };
@@ -28333,6 +28339,36 @@
28333
28339
  this.runAfter("onTableDblclick", { row, column });
28334
28340
  }
28335
28341
  };
28342
+ exportCsv = () => {
28343
+ const header = this.table.column;
28344
+ const headerMap = new Map(
28345
+ header.filter((item) => item !== void 0 && item.label !== void 0 && item.export).map((item) => [item.label, item.prop])
28346
+ );
28347
+ const headerLabels = Array.from(headerMap.keys());
28348
+ function jsonToCsv(data) {
28349
+ let csvContent = headerLabels.join(",") + "\n";
28350
+ data.forEach((row) => {
28351
+ const line = [];
28352
+ headerLabels.forEach((label) => {
28353
+ const prop = headerMap.get(label);
28354
+ const value = String(row[prop]);
28355
+ line.push(`"${value.replace(/"/g, '""').replace(/[\n\r]/g, " ")}"`);
28356
+ });
28357
+ csvContent += line.join(",") + "\n";
28358
+ });
28359
+ return csvContent;
28360
+ }
28361
+ function downloadCsv(csvContent, fileName) {
28362
+ const link = document.createElement("a");
28363
+ link.setAttribute("href", "data:text/csv;charset=utf-8," + encodeURIComponent(csvContent));
28364
+ link.setAttribute("download", fileName + ".csv");
28365
+ document.body.appendChild(link);
28366
+ link.click();
28367
+ document.body.removeChild(link);
28368
+ }
28369
+ const csvStr = jsonToCsv(this.table.selection);
28370
+ downloadCsv(csvStr, "export_data");
28371
+ };
28336
28372
  /**
28337
28373
  * 打开表单
28338
28374
  * @param operate 操作:Add=添加,Edit=编辑
@@ -28424,6 +28460,12 @@
28424
28460
  this.toggleForm("Add");
28425
28461
  }
28426
28462
  ],
28463
+ [
28464
+ "export_csv",
28465
+ () => {
28466
+ this.exportCsv();
28467
+ }
28468
+ ],
28427
28469
  [
28428
28470
  "edit",
28429
28471
  () => {
@@ -29421,7 +29463,7 @@
29421
29463
  };
29422
29464
  const _hoisted_9$3 = { class: "com-search-col-input-range" };
29423
29465
  const _hoisted_10$2 = { class: "com-search-col" };
29424
- const _hoisted_11$1 = {
29466
+ const _hoisted_11$2 = {
29425
29467
  key: 0,
29426
29468
  class: "com-search-col-label"
29427
29469
  };
@@ -29684,7 +29726,7 @@
29684
29726
  require$$0.createElementVNode("div", _hoisted_10$2, [
29685
29727
  item.comSearchShowLabel !== false ? (require$$0.openBlock(), require$$0.createElementBlock(
29686
29728
  "div",
29687
- _hoisted_11$1,
29729
+ _hoisted_11$2,
29688
29730
  require$$0.toDisplayString(item.label),
29689
29731
  1
29690
29732
  /* TEXT */
@@ -29932,31 +29974,38 @@
29932
29974
  /* HOISTED */
29933
29975
  );
29934
29976
  const _hoisted_3$6 = /* @__PURE__ */ require$$0.createElementVNode(
29977
+ "span",
29978
+ { class: "m-l-5px" },
29979
+ "\u5BFC\u51FA",
29980
+ -1
29981
+ /* HOISTED */
29982
+ );
29983
+ const _hoisted_4$6 = /* @__PURE__ */ require$$0.createElementVNode(
29935
29984
  "span",
29936
29985
  { class: "m-l-5px" },
29937
29986
  "\u7F16\u8F91",
29938
29987
  -1
29939
29988
  /* HOISTED */
29940
29989
  );
29941
- const _hoisted_4$6 = { class: "m-l-5px" };
29942
- const _hoisted_5$4 = /* @__PURE__ */ require$$0.createElementVNode(
29990
+ const _hoisted_5$4 = { class: "m-l-5px" };
29991
+ const _hoisted_6$4 = /* @__PURE__ */ require$$0.createElementVNode(
29943
29992
  "span",
29944
29993
  { class: "m-l-5px" },
29945
29994
  "\u5220\u9664",
29946
29995
  -1
29947
29996
  /* HOISTED */
29948
29997
  );
29949
- const _hoisted_6$4 = { class: "table-header-operate-text" };
29950
- const _hoisted_7$4 = /* @__PURE__ */ require$$0.createElementVNode(
29998
+ const _hoisted_7$4 = { class: "table-header-operate-text" };
29999
+ const _hoisted_8$3 = /* @__PURE__ */ require$$0.createElementVNode(
29951
30000
  "span",
29952
30001
  { class: "table-header-operate-text" },
29953
30002
  " \u56DE\u6536\u7AD9 ",
29954
30003
  -1
29955
30004
  /* HOISTED */
29956
30005
  );
29957
- const _hoisted_8$3 = { class: "table-search" };
29958
- const _hoisted_9$2 = { class: "mr-1" };
29959
- const _hoisted_10$1 = { class: "table-search-button-group" };
30006
+ const _hoisted_9$2 = { class: "table-search" };
30007
+ const _hoisted_10$1 = { class: "mr-1" };
30008
+ const _hoisted_11$1 = { class: "table-search-button-group" };
29960
30009
  const __default__$d = require$$0.defineComponent({
29961
30010
  name: "DkTableHeader"
29962
30011
  });
@@ -29969,7 +30018,7 @@
29969
30018
  },
29970
30019
  buttons: {
29971
30020
  default: () => {
29972
- return ["refresh", "add", "edit", "delete", "comSearch", "quickSearch", "columnDisplay"];
30021
+ return ["refresh", "add", "export_csv", "edit", "delete", "comSearch", "quickSearch", "columnDisplay"];
29973
30022
  },
29974
30023
  type: Array
29975
30024
  },
@@ -30103,8 +30152,33 @@
30103
30152
  _: 1
30104
30153
  /* STABLE */
30105
30154
  })) : require$$0.createCommentVNode("v-if", true),
30106
- props.buttons.includes("edit") && require$$0.unref(DkTable).auth("edit") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30155
+ props.buttons.includes("export_csv") && require$$0.unref(DkTable).auth("export_csv") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30107
30156
  key: 2,
30157
+ content: "\u5BFC\u51FA\u9009\u4E2D\u884C",
30158
+ placement: "top"
30159
+ }, {
30160
+ default: require$$0.withCtx(() => [
30161
+ require$$0.withDirectives((require$$0.openBlock(), require$$0.createBlock(_component_el_button, {
30162
+ disabled: !enableBatchOpt.value,
30163
+ class: "table-header-operate",
30164
+ type: "primary",
30165
+ onClick: _cache[2] || (_cache[2] = ($event) => onAction("export_csv"))
30166
+ }, {
30167
+ default: require$$0.withCtx(() => [
30168
+ require$$0.createVNode(_component_dk_icon, { icon: "typcn:download" }),
30169
+ _hoisted_3$6
30170
+ ]),
30171
+ _: 1
30172
+ /* STABLE */
30173
+ }, 8, ["disabled"])), [
30174
+ [_directive_blur]
30175
+ ])
30176
+ ]),
30177
+ _: 1
30178
+ /* STABLE */
30179
+ })) : require$$0.createCommentVNode("v-if", true),
30180
+ props.buttons.includes("edit") && require$$0.unref(DkTable).auth("edit") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30181
+ key: 3,
30108
30182
  content: "\u7F16\u8F91\u9009\u4E2D\u884C",
30109
30183
  placement: "top"
30110
30184
  }, {
@@ -30113,11 +30187,11 @@
30113
30187
  disabled: !enableBatchOpt.value,
30114
30188
  class: "table-header-operate",
30115
30189
  type: "primary",
30116
- onClick: _cache[2] || (_cache[2] = ($event) => onAction("edit"))
30190
+ onClick: _cache[3] || (_cache[3] = ($event) => onAction("edit"))
30117
30191
  }, {
30118
30192
  default: require$$0.withCtx(() => [
30119
30193
  require$$0.createVNode(_component_dk_icon, { icon: "typcn:edit" }),
30120
- _hoisted_3$6
30194
+ _hoisted_4$6
30121
30195
  ]),
30122
30196
  _: 1
30123
30197
  /* STABLE */
@@ -30129,16 +30203,16 @@
30129
30203
  /* STABLE */
30130
30204
  })) : require$$0.createCommentVNode("v-if", true),
30131
30205
  props.buttons.includes("delete") && require$$0.unref(DkTable).auth("del") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_popconfirm, {
30132
- key: 3,
30206
+ key: 4,
30133
30207
  "confirm-button-text": "\u5220\u9664",
30134
30208
  "cancel-button-text": "\u53D6\u6D88",
30135
30209
  "confirm-button-type": "danger",
30136
30210
  title: "\u60A8\u786E\u5B9A\u8981\u5220\u9664\u6240\u9009\u8BB0\u5F55\u5417\uFF1F",
30137
30211
  disabled: !enableBatchOpt.value,
30138
- onConfirm: _cache[3] || (_cache[3] = ($event) => onAction("delete"))
30212
+ onConfirm: _cache[4] || (_cache[4] = ($event) => onAction("delete"))
30139
30213
  }, {
30140
30214
  reference: require$$0.withCtx(() => [
30141
- require$$0.createElementVNode("div", _hoisted_4$6, [
30215
+ require$$0.createElementVNode("div", _hoisted_5$4, [
30142
30216
  require$$0.createVNode(_component_el_tooltip, {
30143
30217
  content: "\u5220\u9664\u6240\u9009\u884C",
30144
30218
  placement: "top"
@@ -30152,7 +30226,7 @@
30152
30226
  default: require$$0.withCtx(() => [
30153
30227
  require$$0.createCommentVNode(' <Icon name="fa fa-trash" />'),
30154
30228
  require$$0.createVNode(_component_dk_icon, { icon: "typcn:trash" }),
30155
- _hoisted_5$4
30229
+ _hoisted_6$4
30156
30230
  ]),
30157
30231
  _: 1
30158
30232
  /* STABLE */
@@ -30169,7 +30243,7 @@
30169
30243
  /* STABLE */
30170
30244
  }, 8, ["disabled"])) : require$$0.createCommentVNode("v-if", true),
30171
30245
  props.buttons.includes("unfold") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_tooltip, {
30172
- key: 4,
30246
+ key: 5,
30173
30247
  content: (require$$0.unref(DkTable).table.expandAll ? "\u6536\u7F29" : "\u5C55\u5F00") + "\u6240\u6709\u5B50\u83DC\u5355",
30174
30248
  placement: "top"
30175
30249
  }, {
@@ -30177,14 +30251,14 @@
30177
30251
  require$$0.withDirectives((require$$0.openBlock(), require$$0.createBlock(_component_el_button, {
30178
30252
  class: "table-header-operate",
30179
30253
  type: require$$0.unref(DkTable).table.expandAll ? "danger" : "warning",
30180
- onClick: _cache[4] || (_cache[4] = ($event) => require$$0.unref(DkTable).onTableHeaderAction("unfold", {
30254
+ onClick: _cache[5] || (_cache[5] = ($event) => require$$0.unref(DkTable).onTableHeaderAction("unfold", {
30181
30255
  unfold: !require$$0.unref(DkTable).table.expandAll
30182
30256
  }))
30183
30257
  }, {
30184
30258
  default: require$$0.withCtx(() => [
30185
30259
  require$$0.createElementVNode(
30186
30260
  "span",
30187
- _hoisted_6$4,
30261
+ _hoisted_7$4,
30188
30262
  require$$0.toDisplayString(require$$0.unref(DkTable).table.expandAll ? "\u6536\u7F29\u6240\u6709" : "\u5C55\u5F00\u6240\u6709"),
30189
30263
  1
30190
30264
  /* TEXT */
@@ -30208,10 +30282,10 @@
30208
30282
  class: "table-header-operate m-l-5px",
30209
30283
  type: "warning",
30210
30284
  loading: require$$0.unref(DkTable).recycleTable.showDialogLoading,
30211
- onClick: _cache[5] || (_cache[5] = ($event) => onAction("recycle"))
30285
+ onClick: _cache[6] || (_cache[6] = ($event) => onAction("recycle"))
30212
30286
  }, {
30213
30287
  default: require$$0.withCtx(() => [
30214
- _hoisted_7$4
30288
+ _hoisted_8$3
30215
30289
  ]),
30216
30290
  _: 1
30217
30291
  /* STABLE */
@@ -30222,18 +30296,18 @@
30222
30296
  _: 1
30223
30297
  /* STABLE */
30224
30298
  }),
30225
- require$$0.createElementVNode("div", _hoisted_8$3, [
30226
- require$$0.createElementVNode("div", _hoisted_9$2, [
30299
+ require$$0.createElementVNode("div", _hoisted_9$2, [
30300
+ require$$0.createElementVNode("div", _hoisted_10$1, [
30227
30301
  require$$0.createVNode(_component_el_input, {
30228
30302
  modelValue: require$$0.unref(DkTable).table.filter.quickSearch,
30229
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => require$$0.unref(DkTable).table.filter.quickSearch = $event),
30303
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => require$$0.unref(DkTable).table.filter.quickSearch = $event),
30230
30304
  placeholder: "\u8BF7\u8F93\u5165",
30231
30305
  "prefix-icon": "Search",
30232
30306
  size: __props.size,
30233
- onInput: _cache[7] || (_cache[7] = ($event) => require$$0.unref(debounce)(onSearchInput, 500)())
30307
+ onInput: _cache[8] || (_cache[8] = ($event) => require$$0.unref(debounce)(onSearchInput, 500)())
30234
30308
  }, null, 8, ["modelValue", "size"])
30235
30309
  ]),
30236
- require$$0.createElementVNode("div", _hoisted_10$1, [
30310
+ require$$0.createElementVNode("div", _hoisted_11$1, [
30237
30311
  props.buttons.includes("columnDisplay") ? (require$$0.openBlock(), require$$0.createBlock(_component_el_dropdown, {
30238
30312
  key: 0,
30239
30313
  "max-height": 380,
@@ -30303,7 +30377,7 @@
30303
30377
  require$$0.withDirectives((require$$0.openBlock(), require$$0.createBlock(_component_el_button, {
30304
30378
  size: __props.size,
30305
30379
  class: "table-search-button-item",
30306
- onClick: _cache[8] || (_cache[8] = ($event) => require$$0.unref(DkTable).table.showComSearch = !require$$0.unref(DkTable).table.showComSearch)
30380
+ onClick: _cache[9] || (_cache[9] = ($event) => require$$0.unref(DkTable).table.showComSearch = !require$$0.unref(DkTable).table.showComSearch)
30307
30381
  }, {
30308
30382
  default: require$$0.withCtx(() => [
30309
30383
  require$$0.createVNode(_component_dk_icon, { icon: "Search" })
@@ -31185,25 +31259,22 @@
31185
31259
  [
31186
31260
  require$$0.createElementVNode("div", _hoisted_1$8, [
31187
31261
  require$$0.createCommentVNode("\u9876\u90E8\u83DC\u5355"),
31188
- require$$0.createVNode(
31189
- DkTableHeader,
31190
- { size: "default" },
31191
- require$$0.createSlots({
31192
- _: 2
31193
- /* DYNAMIC */
31194
- }, [
31195
- require$$0.renderList(_ctx.$slots, (slot, idx) => {
31196
- return {
31197
- name: idx,
31198
- fn: require$$0.withCtx(() => [
31199
- require$$0.renderSlot(_ctx.$slots, idx)
31200
- ])
31201
- };
31202
- })
31203
- ]),
31204
- 1024
31205
- /* DYNAMIC_SLOTS */
31206
- ),
31262
+ require$$0.createVNode(DkTableHeader, {
31263
+ size: "default",
31264
+ buttons: _ctx.buttons
31265
+ }, require$$0.createSlots({
31266
+ _: 2
31267
+ /* DYNAMIC */
31268
+ }, [
31269
+ require$$0.renderList(_ctx.$slots, (slot, idx) => {
31270
+ return {
31271
+ name: idx,
31272
+ fn: require$$0.withCtx(() => [
31273
+ require$$0.renderSlot(_ctx.$slots, idx)
31274
+ ])
31275
+ };
31276
+ })
31277
+ ]), 1032, ["buttons"]),
31207
31278
  require$$0.createCommentVNode("\u8868\u683C"),
31208
31279
  require$$0.withDirectives((require$$0.openBlock(), require$$0.createBlock(_component_el_table, require$$0.mergeProps({
31209
31280
  ref_key: "TableRef",