@dt-frames/ui 1.0.24 → 1.0.25

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "test": "THIS IS ENGLISH"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "xxx": "这是页面"
3
+ }
@@ -8,5 +8,10 @@ export declare function useCurd(curdOpt: CrudOptType): {
8
8
  del: ({ row }: Recordable) => void;
9
9
  dels: (ids?: string[]) => void;
10
10
  update: ({ row }: Recordable) => void;
11
+ closeModal: () => void;
12
+ openModal: (data?: {
13
+ data?: Recordable<any>;
14
+ afterClose?: (data: Recordable<any>) => void;
15
+ }, openOnSet?: boolean) => void;
11
16
  setFormValues: (params: Recordable) => void;
12
17
  };
@@ -6,11 +6,10 @@ import { DtForm, useForm, FormButtons } from './forms';
6
6
  import { DtTable, useTable } from './table';
7
7
  import { useSource } from './source';
8
8
  import { useCurd } from './curd';
9
- import { export2Excel } from './excel';
10
9
  import { DtIframe } from './iframe';
11
10
  import { DtUpload } from './upload';
12
11
  import { DtTree } from './tree';
13
12
  export declare function initComponents(): {
14
13
  install(app: App): void;
15
14
  };
16
- export { DtBaseRouter, DtIcon, DtPickIcon, DtModal, DtForm, DtTable, FormButtons, DtIframe, DtUpload, DtTree, useForm, useTable, useSource, useCurd, useModal, useModalOut, export2Excel };
15
+ export { DtBaseRouter, DtIcon, DtPickIcon, DtModal, DtForm, DtTable, FormButtons, DtIframe, DtUpload, DtTree, useForm, useTable, useSource, useCurd, useModal, useModalOut };
@@ -0,0 +1,7 @@
1
+ import { DownloadType } from '../../../table/src/types/tableHeader.type';
2
+ import { Recordable } from '@dt-frames/core';
3
+ export declare function useDownload(exportUrl: string, exportName: string): {
4
+ download: (excelData: DownloadType & {
5
+ params: Recordable;
6
+ }) => void;
7
+ };
@@ -197,7 +197,7 @@
197
197
  .column-select{
198
198
  padding: 20px;
199
199
 
200
- .ant-checkbox-group{
200
+ .ant-row{
201
201
  width: 100%;
202
202
  line-height: 32px;
203
203
  }
@@ -12,6 +12,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
12
12
  getBind: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
13
13
  }, "getBind"> & {
14
14
  getBind: import("vue").ComputedRef<import("../../types/table.type").BasicTableProps>;
15
+ getProps: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
15
16
  };
16
17
  defaultRowSelection: any;
17
18
  inited: boolean;
@@ -10,6 +10,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
10
10
  getBind: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
11
11
  }, "getBind"> & {
12
12
  getBind: import("vue").ComputedRef<import("../../types/table.type").BasicTableProps>;
13
+ getProps: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
13
14
  };
14
15
  handleTitleClick: ({ key }: {
15
16
  key: any;
@@ -1146,10 +1147,10 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
1146
1147
  danger: boolean;
1147
1148
  }>;
1148
1149
  DownloadCtrl: import("vue").DefineComponent<{}, {
1150
+ message: import("ant-design-vue/lib/message").MessageApi;
1149
1151
  state: {
1150
1152
  indeterminate: boolean;
1151
1153
  checkAll: boolean;
1152
- checkedList: any[];
1153
1154
  };
1154
1155
  outRow: import("vue").Ref<any>;
1155
1156
  onCheckAllChange: (e: any) => void;
@@ -1567,52 +1568,6 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
1567
1568
  orientation: "left" | "right" | "center";
1568
1569
  plain: boolean;
1569
1570
  }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("@vue/runtime-core").Plugin;
1570
- CheckboxGroup: import("vue").DefineComponent<{
1571
- defaultValue: {
1572
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
1573
- };
1574
- value: {
1575
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
1576
- };
1577
- onChange: {
1578
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
1579
- };
1580
- 'onUpdate:value': {
1581
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
1582
- };
1583
- name: StringConstructor;
1584
- prefixCls: StringConstructor;
1585
- options: {
1586
- type: import("vue").PropType<(string | number | import("ant-design-vue").CheckboxOptionType)[]>;
1587
- default: () => (string | number | import("ant-design-vue").CheckboxOptionType)[];
1588
- };
1589
- disabled: BooleanConstructor;
1590
- id: StringConstructor;
1591
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
1592
- defaultValue: {
1593
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
1594
- };
1595
- value: {
1596
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
1597
- };
1598
- onChange: {
1599
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
1600
- };
1601
- 'onUpdate:value': {
1602
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
1603
- };
1604
- name: StringConstructor;
1605
- prefixCls: StringConstructor;
1606
- options: {
1607
- type: import("vue").PropType<(string | number | import("ant-design-vue").CheckboxOptionType)[]>;
1608
- default: () => (string | number | import("ant-design-vue").CheckboxOptionType)[];
1609
- };
1610
- disabled: BooleanConstructor;
1611
- id: StringConstructor;
1612
- }>>, {
1613
- disabled: boolean;
1614
- options: (string | number | import("ant-design-vue").CheckboxOptionType)[];
1615
- }>;
1616
1571
  Row: {
1617
1572
  new (...args: any[]): {
1618
1573
  $: import("vue").ComponentInternalInstance;
@@ -1,8 +1,8 @@
1
1
  declare const _sfc_main: import("vue").DefineComponent<{}, {
2
+ message: import("ant-design-vue/lib/message").MessageApi;
2
3
  state: {
3
4
  indeterminate: boolean;
4
5
  checkAll: boolean;
5
- checkedList: any[];
6
6
  };
7
7
  outRow: import("vue").Ref<any>;
8
8
  onCheckAllChange: (e: any) => void;
@@ -420,52 +420,6 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
420
420
  orientation: "left" | "right" | "center";
421
421
  plain: boolean;
422
422
  }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("@vue/runtime-core").Plugin;
423
- CheckboxGroup: import("vue").DefineComponent<{
424
- defaultValue: {
425
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
426
- };
427
- value: {
428
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
429
- };
430
- onChange: {
431
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
432
- };
433
- 'onUpdate:value': {
434
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
435
- };
436
- name: StringConstructor;
437
- prefixCls: StringConstructor;
438
- options: {
439
- type: import("vue").PropType<(string | number | import("ant-design-vue").CheckboxOptionType)[]>;
440
- default: () => (string | number | import("ant-design-vue").CheckboxOptionType)[];
441
- };
442
- disabled: BooleanConstructor;
443
- id: StringConstructor;
444
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
445
- defaultValue: {
446
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
447
- };
448
- value: {
449
- type: import("vue").PropType<import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]>;
450
- };
451
- onChange: {
452
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
453
- };
454
- 'onUpdate:value': {
455
- type: import("vue").PropType<(checkedValue: import("ant-design-vue/lib/checkbox/interface").CheckboxValueType[]) => void>;
456
- };
457
- name: StringConstructor;
458
- prefixCls: StringConstructor;
459
- options: {
460
- type: import("vue").PropType<(string | number | import("ant-design-vue").CheckboxOptionType)[]>;
461
- default: () => (string | number | import("ant-design-vue").CheckboxOptionType)[];
462
- };
463
- disabled: BooleanConstructor;
464
- id: StringConstructor;
465
- }>>, {
466
- disabled: boolean;
467
- options: (string | number | import("ant-design-vue").CheckboxOptionType)[];
468
- }>;
469
423
  Row: {
470
424
  new (...args: any[]): {
471
425
  $: import("vue").ComponentInternalInstance;
@@ -4,6 +4,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
4
4
  getBind: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
5
5
  }, "getBind"> & {
6
6
  getBind: import("vue").ComputedRef<import("../../types/table.type").BasicTableProps>;
7
+ getProps: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
7
8
  };
8
9
  wrapEl: any;
9
10
  toggle: () => Promise<void>;
@@ -7,6 +7,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
7
7
  getBind: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
8
8
  }, "getBind"> & {
9
9
  getBind: import("vue").ComputedRef<import("../../types/table.type").BasicTableProps>;
10
+ getProps: import("vue").ComputedRef<import("@dt-frames/core").Recordable<any>>;
10
11
  };
11
12
  selectedKeysRef: import("vue").Ref<SizeType[]>;
12
13
  handleTitleClick: ({ key }: MenuInfo) => void;
@@ -7,6 +7,7 @@ declare type Instance = TableActionType & {
7
7
  };
8
8
  declare type RetInstance = Omit<Instance, 'getBind'> & {
9
9
  getBind: ComputedRef<BasicTableProps>;
10
+ getProps: ComputedRef<Recordable>;
10
11
  };
11
12
  export declare function createTableInstance(instance: Instance): void;
12
13
  export declare function getTableInstance(): RetInstance;
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, resolveComponent, openBlock, createBlock, computed, unref, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, ref, watch, Fragment, renderList, createTextVNode, toDisplayString, KeepAlive, createVNode, withCtx, reactive, toRaw, getCurrentInstance, watchEffect, nextTick, toRefs, isVNode, inject, onUnmounted, h, provide, onMounted, onBeforeUnmount, resolveDynamicComponent, renderSlot, createCommentVNode, mergeProps, readonly, isRef, useAttrs as useAttrs$1, normalizeProps, guardReactiveProps, withDirectives, resolveDirective, render, createSlots, useSlots as useSlots$1, withModifiers, vShow, toRef, Transition } from "vue";
2
- import { isString, isArray as isArray$1, isObject, isFunction, error, useTimeoutFn, useAttrs, useSlots, dispatchResize, BAR_MAP, off, renderThumbStyle, on, useAppStore, addResizeListener, removeResizeListener, windowResizeFn, isNumber, isBoolean, isNull, DtCache, CacheKey, deepMerge, http, getDynamicProps, getDictValueByCode, formatNumber, isVnode, getPopupContainer, isNullAndUnDef, dateFormat, useMessage, isEmpty, useTheme, useMenu, useHeader, useGo, Pages, localeList, changeLocale, Theme, MenuMode, MenuType, useThemeStore, ContentMode, useMultipleTab, copyText, MenuSplitTye, isUrl, openWindow, RouteReuseStore, menuList2Map, useApp } from "@dt-frames/core";
2
+ import { isString, isArray as isArray$1, isObject, isFunction, error, useTimeoutFn, useAttrs, useSlots, dispatchResize, BAR_MAP, off, renderThumbStyle, on, useAppStore, addResizeListener, removeResizeListener, windowResizeFn, isNumber, isBoolean, isNull, DtCache, CacheKey, deepMerge, http, getDynamicProps, getDictValueByCode, formatNumber, isVnode, getPopupContainer, isNullAndUnDef, useMessage, isEmpty, useTheme, useMenu, useHeader, useGo, Pages, localeList, changeLocale, Theme, MenuMode, MenuType, useThemeStore, ContentMode, useMultipleTab, copyText, MenuSplitTye, isUrl, openWindow, RouteReuseStore, menuList2Map, useApp } from "@dt-frames/core";
3
3
  import { InputSearch, Tooltip, Modal as Modal$1, RadioGroup, RadioButton, InputGroup, Input, Button, Select, TreeSelect, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, Slider, Rate, Divider, Col, Form, FormItem, Row, Popover, Spin, Dropdown, Menu, MenuItem, CheckboxGroup, Table, Upload, Image, MenuDivider, Tree, Empty, BackTop, Breadcrumb, Avatar, Drawer, SubMenu, LayoutHeader, LayoutSider, Tabs, TabPane, LayoutFooter, LayoutContent, ConfigProvider, Layout } from "ant-design-vue";
4
4
  import { isEqual, omit, cloneDeep, upperFirst, set, uniqBy, difference, get, trim } from "lodash-es";
5
5
  import { tryOnUnmounted, isFunction as isFunction$1, useFullscreen, useDebounceFn, useThrottleFn } from "@vueuse/core";
@@ -4518,7 +4518,7 @@ function useHeaderCode(code, templates = {}, changeColumns) {
4518
4518
  error(`\u672A\u627E\u5230structure: ${ctx} !`);
4519
4519
  return {};
4520
4520
  }
4521
- return { dict: appConf.structure[ctx] };
4521
+ return { dict: { ...appConf.structure[ctx], struCode: ctx } };
4522
4522
  case 10:
4523
4523
  return templates[ctx];
4524
4524
  case 11:
@@ -4615,6 +4615,12 @@ function useTable(tableProps) {
4615
4615
  },
4616
4616
  getSelectRows: () => {
4617
4617
  return getTableInstance2().getSelectRows();
4618
+ },
4619
+ updateTableDataRecord: (rowKey, record) => {
4620
+ return getTableInstance2().updateTableDataRecord(rowKey, record);
4621
+ },
4622
+ findTableDataRecord: (rowKey) => {
4623
+ return getTableInstance2().findTableDataRecord(rowKey);
4618
4624
  }
4619
4625
  };
4620
4626
  return [registerTable, methods];
@@ -4768,7 +4774,7 @@ function usePagination(props) {
4768
4774
  pageSize: defaultPageSize,
4769
4775
  size: size === "small" ? "small" : "default",
4770
4776
  defaultPageSize,
4771
- showTotal: (total, range) => `\u603B\u5171${total}\u9875`,
4777
+ showTotal: (total, range) => `\u603B\u5171${Math.ceil(total / unref(props).pagination.pageSize)}\u9875`,
4772
4778
  showSizeChanger: true,
4773
4779
  pageSizeOptions,
4774
4780
  showQuickJumper: true,
@@ -6102,27 +6108,44 @@ const _hoisted_2$f = /* @__PURE__ */ createTextVNode("\u5168\u9009");
6102
6108
  const _sfc_main$E = /* @__PURE__ */ defineComponent({
6103
6109
  __name: "DownloadCtrl",
6104
6110
  setup(__props) {
6111
+ const { message } = useMessage();
6105
6112
  const state = reactive({
6106
6113
  indeterminate: false,
6107
- checkAll: false,
6108
- checkedList: []
6114
+ checkAll: false
6109
6115
  });
6110
6116
  const outRow = ref();
6111
6117
  const onCheckAllChange = (e) => {
6112
6118
  var _a;
6113
- Object.assign(state, {
6114
- checkedList: e.target.checked ? (_a = outRow.value) == null ? void 0 : _a.columns.map((it, index) => `${index}`) : [],
6115
- indeterminate: false
6116
- });
6119
+ (_a = outRow.value) == null ? void 0 : _a.columns.map((it) => it.ifShow = e.target.checked);
6117
6120
  };
6118
6121
  const [registerDialog, { closeModal }] = useModal({
6119
6122
  width: "60%",
6120
6123
  title: "\u8BBE\u7F6E\u5BFC\u51FA\u5217"
6121
6124
  }, (data) => {
6122
6125
  outRow.value = data;
6123
- console.log(data);
6126
+ });
6127
+ watch(() => {
6128
+ var _a;
6129
+ return (_a = unref(outRow)) == null ? void 0 : _a.columns;
6130
+ }, (v) => {
6131
+ if (isArray$1(v)) {
6132
+ let showLens = v.filter((it) => it.ifShow).length;
6133
+ Object.assign(state, {
6134
+ checkAll: showLens === v.length,
6135
+ indeterminate: showLens !== v.length && showLens > 0
6136
+ });
6137
+ }
6138
+ }, {
6139
+ deep: true
6124
6140
  });
6125
6141
  function save() {
6142
+ var _a;
6143
+ let columns = (_a = unref(outRow)) == null ? void 0 : _a.columns.filter((it) => it.ifShow);
6144
+ if (!columns.length) {
6145
+ message.error("\u6682\u65E0\u53EF\u5BFC\u51FA\u7684\u5217\uFF01");
6146
+ return;
6147
+ }
6148
+ closeModal(columns);
6126
6149
  }
6127
6150
  return (_ctx, _cache) => {
6128
6151
  return openBlock(), createBlock(unref(_sfc_main$L), {
@@ -6143,35 +6166,30 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
6143
6166
  _: 1
6144
6167
  }, 8, ["checked", "indeterminate"]),
6145
6168
  createVNode(unref(Divider), { dashed: "" }),
6146
- createVNode(unref(CheckboxGroup), {
6147
- value: state.checkedList,
6148
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => state.checkedList = $event)
6149
- }, {
6150
- default: withCtx(() => [
6151
- createVNode(unref(Row), null, {
6152
- default: withCtx(() => {
6153
- var _a;
6154
- return [
6155
- (openBlock(true), createElementBlock(Fragment, null, renderList((_a = outRow.value) == null ? void 0 : _a.columns, (it, index) => {
6156
- return openBlock(), createBlock(unref(Col), { span: 8 }, {
6169
+ createVNode(unref(Row), null, {
6170
+ default: withCtx(() => {
6171
+ var _a;
6172
+ return [
6173
+ (openBlock(true), createElementBlock(Fragment, null, renderList((_a = outRow.value) == null ? void 0 : _a.columns, (it, index) => {
6174
+ return openBlock(), createBlock(unref(Col), { span: 8 }, {
6175
+ default: withCtx(() => [
6176
+ createVNode(unref(Checkbox), {
6177
+ checked: it.ifShow,
6178
+ "onUpdate:checked": ($event) => it.ifShow = $event
6179
+ }, {
6157
6180
  default: withCtx(() => [
6158
- createVNode(unref(Checkbox), { value: "index" }, {
6159
- default: withCtx(() => [
6160
- createTextVNode(toDisplayString(it.title), 1)
6161
- ]),
6162
- _: 2
6163
- }, 1024)
6181
+ createTextVNode(toDisplayString(it.title), 1)
6164
6182
  ]),
6165
6183
  _: 2
6166
- }, 1024);
6167
- }), 256))
6168
- ];
6169
- }),
6170
- _: 1
6171
- })
6172
- ]),
6184
+ }, 1032, ["checked", "onUpdate:checked"])
6185
+ ]),
6186
+ _: 2
6187
+ }, 1024);
6188
+ }), 256))
6189
+ ];
6190
+ }),
6173
6191
  _: 1
6174
- }, 8, ["value"])
6192
+ })
6175
6193
  ])
6176
6194
  ]),
6177
6195
  _: 1
@@ -6196,10 +6214,10 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
6196
6214
  data: {
6197
6215
  columns
6198
6216
  },
6199
- afterClose(columns2) {
6217
+ afterClose(selectColumns) {
6200
6218
  onDownload({
6201
6219
  type: key,
6202
- columns: columns2,
6220
+ columns: selectColumns,
6203
6221
  rows: key === "select" ? table.getSelectRows() : key === "current" ? dataSource : []
6204
6222
  });
6205
6223
  }
@@ -6727,7 +6745,7 @@ const _sfc_main$A = defineComponent({
6727
6745
  customRow
6728
6746
  };
6729
6747
  });
6730
- createTableInstance({ ...tableAction, tableElRef, getBind });
6748
+ createTableInstance({ ...tableAction, tableElRef, getBind, getProps });
6731
6749
  const handlers = {
6732
6750
  onColumnsChange: (data) => {
6733
6751
  var _a, _b;
@@ -6812,28 +6830,85 @@ function useFetch(api, baseUrl = "") {
6812
6830
  fetch
6813
6831
  };
6814
6832
  }
6815
- function handleDownloadPage({
6816
- columns = [],
6817
- rows = []
6818
- }, exportName = "") {
6819
- const titles = columns.map((it) => it.title);
6820
- const content = rows.reduce((total, it) => {
6821
- const rowData = columns.map((column) => it[column.dataIndex.toString()]);
6822
- total.push(rowData);
6823
- return total;
6824
- }, []);
6825
- export2Excel([titles].concat(content), exportName);
6826
- }
6827
- function export2Excel(data = [], exportName = "") {
6828
- const worksheet = xlsx.utils.aoa_to_sheet(data);
6829
- const fileName = exportName + "_" + dateFormat(new Date(), "yyyyMMdd") + ".xlsx";
6830
- const workbook = {
6831
- SheetNames: [fileName],
6832
- Sheets: {
6833
- [fileName]: worksheet
6833
+ function useDownload(exportUrl, exportName) {
6834
+ function download(excelData) {
6835
+ const { params: searchDTO, type, columns } = excelData;
6836
+ switch (type) {
6837
+ case "all":
6838
+ http.exportFile(exportUrl, {
6839
+ fields: setDownloadAllHeaders(columns),
6840
+ tableName: exportName,
6841
+ fileType: "xlsx",
6842
+ searchDTO
6843
+ }, `${exportName}.xlsx`);
6844
+ break;
6845
+ case "current":
6846
+ case "select":
6847
+ handleDownloadPage(excelData, exportName);
6848
+ break;
6834
6849
  }
6850
+ }
6851
+ function setDownloadAllHeaders(columns) {
6852
+ return columns.map((it) => {
6853
+ let column = {
6854
+ propertyName: it.dataIndex,
6855
+ head: it.title
6856
+ };
6857
+ if (it.render && isObject(it.render)) {
6858
+ const { dict, date, number } = it.render;
6859
+ if (isString(dict)) {
6860
+ column.dictCode = dict;
6861
+ } else if (isObject(dict)) {
6862
+ column.struCode = dict.struCode;
6863
+ column.struKey = dict.label;
6864
+ } else if (date) {
6865
+ column.format = date;
6866
+ } else if (number) {
6867
+ column.format = number;
6868
+ }
6869
+ }
6870
+ return column;
6871
+ });
6872
+ }
6873
+ function handleDownloadPage({ columns = [], rows = [] }, exportName2 = "") {
6874
+ const titles = columns.map((it) => it.title);
6875
+ const content = rows.reduce((total, it) => {
6876
+ const rowData = columns.map((column) => {
6877
+ let value = it[column.dataIndex.toString()];
6878
+ if (column.render && isObject(column.render) && value !== void 0) {
6879
+ const { dict, date, number, percent } = column.render;
6880
+ if (date) {
6881
+ return dayjs(value).format(date);
6882
+ } else if (dict) {
6883
+ console.log(getDictValueByCode(value, dict));
6884
+ return unref(getDictValueByCode(value, dict));
6885
+ } else if (percent) {
6886
+ return (value * 100).toFixed(2) + "%";
6887
+ } else if (number) {
6888
+ return (value * 100).toFixed(number || 2);
6889
+ }
6890
+ }
6891
+ return value;
6892
+ });
6893
+ total.push(rowData);
6894
+ return total;
6895
+ }, []);
6896
+ export2Excel([titles].concat(content), exportName2);
6897
+ }
6898
+ function export2Excel(data = [], exportName2 = "") {
6899
+ const worksheet = xlsx.utils.aoa_to_sheet(data);
6900
+ const fileName = exportName2 + "_" + dayjs(new Date()).format("YYYYMMDD") + ".xlsx";
6901
+ const workbook = {
6902
+ SheetNames: [fileName],
6903
+ Sheets: {
6904
+ [fileName]: worksheet
6905
+ }
6906
+ };
6907
+ xlsx.writeFile(workbook, fileName, { bookType: "xlsx" });
6908
+ }
6909
+ return {
6910
+ download
6835
6911
  };
6836
- xlsx.writeFile(workbook, fileName, { bookType: "xlsx" });
6837
6912
  }
6838
6913
  function useSource(opt) {
6839
6914
  var _a, _b, _c, _d;
@@ -6969,8 +7044,12 @@ function useSource(opt) {
6969
7044
  }
6970
7045
  });
6971
7046
  }
7047
+ const { download } = useDownload(apiFul.export, exportName);
6972
7048
  function onDownload(excelData) {
6973
- handleDownloadPage(excelData, exportName);
7049
+ download({
7050
+ ...excelData,
7051
+ params: baseData
7052
+ });
6974
7053
  }
6975
7054
  const form = {
6976
7055
  onSearch,
@@ -7102,7 +7181,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
7102
7181
  function useCurd(curdOpt) {
7103
7182
  const formsVal = ref();
7104
7183
  const [register, {
7105
- openModal
7184
+ openModal,
7185
+ closeModal
7106
7186
  }] = useModalOut();
7107
7187
  const {
7108
7188
  confirm
@@ -7182,6 +7262,8 @@ function useCurd(curdOpt) {
7182
7262
  del,
7183
7263
  dels,
7184
7264
  update,
7265
+ closeModal,
7266
+ openModal,
7185
7267
  setFormValues
7186
7268
  };
7187
7269
  }
@@ -7783,7 +7865,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
7783
7865
  historyFilesRef.value = props.defaultFiles.map((file, index) => {
7784
7866
  return {
7785
7867
  ...file,
7786
- fileId: file.id || index,
7868
+ fileId: file.fileId || index,
7787
7869
  fileName: file.fileName,
7788
7870
  status: 0,
7789
7871
  fileStatue: "\u5386\u53F2\u4E0A\u4F20"
@@ -8996,10 +9078,10 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
8996
9078
  setup(__props) {
8997
9079
  const props = __props;
8998
9080
  const visible = ref(false);
8999
- function toggleLang(lang) {
9081
+ async function toggleLang(lang) {
9000
9082
  visible.value = false;
9001
9083
  if (DtCache.getLocal(CacheKey.LOCALE) !== lang) {
9002
- changeLocale(lang);
9084
+ await changeLocale(lang);
9003
9085
  props.reload && location.reload();
9004
9086
  }
9005
9087
  }
@@ -10060,7 +10142,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
10060
10142
  unref(getShowFullScreen) ? (openBlock(), createBlock(unref(_sfc_main$o), { key: 2 })) : createCommentVNode("", true),
10061
10143
  unref(getShowLocale) ? (openBlock(), createBlock(unref(_sfc_main$m), {
10062
10144
  key: 3,
10063
- reload: false
10145
+ reload: true
10064
10146
  })) : createCommentVNode("", true),
10065
10147
  createVNode(unref(_sfc_main$n)),
10066
10148
  unref(getShowSettingTheme) ? (openBlock(), createBlock(unref(_sfc_main$h), { key: 4 })) : createCommentVNode("", true)
@@ -10844,4 +10926,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10844
10926
  };
10845
10927
  }
10846
10928
  });
10847
- export { DtBaseRouter, DtForm, DtIcon, _sfc_main$y as DtIframe, _sfc_main$L as DtModal, _sfc_main$X as DtPickIcon, DtTable, _sfc_main as DtTheme, _sfc_main$v as DtTree, _sfc_main$x as DtUpload, FormButtons, authMounted, export2Excel, iconMounted, initComponents, initDirectives, useCurd, useForm, useModal, useModalOut, useSource, useTable };
10929
+ export { DtBaseRouter, DtForm, DtIcon, _sfc_main$y as DtIframe, _sfc_main$L as DtModal, _sfc_main$X as DtPickIcon, DtTable, _sfc_main as DtTheme, _sfc_main$v as DtTree, _sfc_main$x as DtUpload, FormButtons, authMounted, iconMounted, initComponents, initDirectives, useCurd, useForm, useModal, useModalOut, useSource, useTable };
@@ -12,7 +12,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
12
12
  }>> & {
13
13
  [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any);
14
14
  }>>;
15
- toggleLang: (lang: Language) => void;
15
+ toggleLang: (lang: Language) => Promise<void>;
16
16
  Popover: {
17
17
  new (...args: any[]): {
18
18
  $: import("vue").ComponentInternalInstance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-frames/ui",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "keywords": [
5
5
  "ui",
6
6
  "dt-ui"
@@ -1,2 +0,0 @@
1
- import { handleDownloadPage, export2Excel } from './src/export2Excel';
2
- export { handleDownloadPage, export2Excel };
@@ -1,3 +0,0 @@
1
- import { DownloadType } from "../../table/src/types/tableHeader.type";
2
- export declare function handleDownloadPage({ columns, rows }: DownloadType, exportName?: string): void;
3
- export declare function export2Excel(data?: string[][], exportName?: string): void;