ele-admin-plus 1.1.9-beta.7 → 1.1.9-beta.9
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/es/ele-alert/index.js +2 -4
- package/es/ele-app/el.d.ts +6 -1
- package/es/ele-app/plus.d.ts +12 -0
- package/es/ele-avatar-group/index.d.ts +1 -1
- package/es/ele-avatar-group/index.js +1 -3
- package/es/ele-basic-select/index.d.ts +8 -8
- package/es/ele-basic-select/index.js +17 -13
- package/es/ele-check-card/index.d.ts +2 -2
- package/es/ele-check-card/index.js +0 -5
- package/es/ele-config-provider/components/receiver-view.d.ts +17 -0
- package/es/ele-config-provider/components/receiver-view.js +45 -0
- package/es/ele-config-provider/index.d.ts +2 -2
- package/es/ele-config-provider/props.d.ts +3 -3
- package/es/ele-config-provider/props.js +2 -2
- package/es/ele-config-provider/types.d.ts +2 -0
- package/es/ele-copyable/index.d.ts +4 -6
- package/es/ele-copyable/index.js +1 -5
- package/es/ele-cropper/index.d.ts +6 -6
- package/es/ele-cropper/index.js +1 -5
- package/es/ele-dashboard/index.d.ts +0 -1
- package/es/ele-dashboard/index.js +8 -17
- package/es/ele-data-table/index.d.ts +2 -2
- package/es/ele-data-table/index.js +8 -0
- package/es/ele-data-table/style/index.scss +4 -0
- package/es/ele-data-table/types.d.ts +10 -0
- package/es/ele-data-table/util.d.ts +5 -0
- package/es/ele-data-table/util.js +14 -0
- package/es/ele-dot/index.d.ts +2 -4
- package/es/ele-dot/index.js +4 -10
- package/es/ele-drawer/index.d.ts +6 -6
- package/es/ele-drawer/index.js +14 -11
- package/es/ele-dropdown/index.js +6 -10
- package/es/ele-dropdown/style/index.scss +2 -2
- package/es/ele-edit-tag/index.d.ts +6 -0
- package/es/ele-edit-tag/index.js +17 -15
- package/es/ele-edit-tag/props.d.ts +4 -0
- package/es/ele-edit-tag/props.js +5 -1
- package/es/ele-edit-tag/style/index.scss +13 -0
- package/es/ele-ellipsis/index.d.ts +3 -3
- package/es/ele-ellipsis/index.js +2 -4
- package/es/ele-file-list/components/file-grid-item.js +16 -9
- package/es/ele-file-list/components/file-grid.js +54 -50
- package/es/ele-file-list/components/file-table-item.js +20 -15
- package/es/ele-file-list/components/file-table.js +92 -86
- package/es/ele-file-list/index.d.ts +4 -4
- package/es/ele-file-list/index.js +1 -11
- package/es/ele-file-list-tool/index.d.ts +3 -3
- package/es/ele-file-list-tool/index.js +2 -2
- package/es/ele-icon-select/index.d.ts +22 -10
- package/es/ele-icon-select/index.js +33 -10
- package/es/ele-icon-select/props.d.ts +6 -1
- package/es/ele-icon-select/props.js +6 -1
- package/es/ele-icon-select/style/index.js +1 -0
- package/es/ele-icon-select/style/index.scss +16 -2
- package/es/ele-loading/index.d.ts +0 -2
- package/es/ele-loading/index.js +32 -30
- package/es/ele-map-picker/components/map-view.d.ts +2 -2
- package/es/ele-menus/index.d.ts +3 -3
- package/es/ele-menus/index.js +6 -7
- package/es/ele-menus/style/index.js +2 -0
- package/es/ele-menus/style/index.scss +2 -1
- package/es/ele-modal/index.d.ts +2 -2
- package/es/ele-modal/index.js +14 -8
- package/es/ele-modal/style/index.scss +18 -29
- package/es/ele-pagination/index.d.ts +10 -8
- package/es/ele-pagination/index.js +19 -13
- package/es/ele-pagination/props.d.ts +3 -2
- package/es/ele-pagination/props.js +2 -0
- package/es/ele-pagination/style/index.scss +9 -0
- package/es/ele-pagination/types.d.ts +6 -1
- package/es/ele-popconfirm/style/index.js +1 -1
- package/es/ele-popover/style/index.js +0 -1
- package/es/ele-printer/index.d.ts +6 -6
- package/es/ele-printer/index.js +11 -11
- package/es/ele-printer/util.js +1 -1
- package/es/ele-pro-layout/components/pro-sidebox.js +3 -1
- package/es/ele-pro-layout/index.d.ts +26 -26
- package/es/ele-pro-layout/index.js +7 -14
- package/es/ele-pro-table/components/table-tools.d.ts +99 -8
- package/es/ele-pro-table/components/table-tools.js +125 -8
- package/es/ele-pro-table/components/tool-column-list.js +1 -0
- package/es/ele-pro-table/components/tool-column.js +6 -2
- package/es/ele-pro-table/components/tool-export.d.ts +457 -0
- package/es/ele-pro-table/components/tool-export.js +451 -0
- package/es/ele-pro-table/components/tool-print-body-cell.d.ts +34 -0
- package/es/ele-pro-table/components/tool-print-body-cell.js +88 -0
- package/es/ele-pro-table/components/tool-print-header-cell.d.ts +34 -0
- package/es/ele-pro-table/components/tool-print-header-cell.js +88 -0
- package/es/ele-pro-table/components/tool-print.d.ts +899 -0
- package/es/ele-pro-table/components/tool-print.js +547 -0
- package/es/ele-pro-table/index.d.ts +31 -12
- package/es/ele-pro-table/index.js +57 -14
- package/es/ele-pro-table/props.d.ts +14 -8
- package/es/ele-pro-table/props.js +6 -2
- package/es/ele-pro-table/style/index.js +9 -0
- package/es/ele-pro-table/style/index.scss +33 -5
- package/es/ele-pro-table/types.d.ts +147 -5
- package/es/ele-pro-table/util.d.ts +47 -3
- package/es/ele-pro-table/util.js +119 -13
- package/es/ele-segmented/index.js +1 -3
- package/es/ele-split-panel/index.d.ts +9 -8
- package/es/ele-split-panel/index.js +63 -59
- package/es/ele-steps/index.d.ts +0 -1
- package/es/ele-steps/index.js +2 -4
- package/es/ele-table/index.d.ts +3 -0
- package/es/ele-table/index.js +2 -1
- package/es/ele-table/props.d.ts +2 -0
- package/es/ele-table/props.js +3 -1
- package/es/ele-table/style/index.scss +35 -0
- package/es/ele-table-select/index.d.ts +1 -1
- package/es/ele-tabs/index.d.ts +7 -5
- package/es/ele-tabs/index.js +1 -6
- package/es/ele-tabs/props.d.ts +1 -1
- package/es/ele-tool/index.d.ts +1 -1
- package/es/ele-tool/index.js +2 -4
- package/es/ele-tool/props.d.ts +7 -0
- package/es/ele-tool/props.js +5 -0
- package/es/ele-tooltip/index.js +9 -13
- package/es/ele-tooltip/style/css-var.scss +4 -0
- package/es/ele-tooltip/style/index.scss +23 -0
- package/es/ele-tour/index.js +80 -77
- package/es/ele-upload-list/components/list-item.d.ts +1 -1
- package/es/ele-upload-list/index.d.ts +6 -4
- package/es/ele-upload-list/index.js +2 -3
- package/es/ele-virtual-table/components/body-cell.d.ts +0 -1
- package/es/ele-virtual-table/components/body-cell.js +32 -47
- package/es/ele-virtual-table/components/footer-row.d.ts +2 -2
- package/es/ele-virtual-table/components/footer-row.js +15 -10
- package/es/ele-virtual-table/index.d.ts +1 -1
- package/es/ele-virtual-table/types.d.ts +15 -1
- package/es/ele-virtual-table/util.d.ts +26 -3
- package/es/ele-virtual-table/util.js +44 -0
- package/es/ele-watermark/index.d.ts +9 -0
- package/es/ele-watermark/index.js +1 -1
- package/es/ele-watermark/props.d.ts +5 -0
- package/es/ele-watermark/props.js +5 -0
- package/es/icons/PrinterOutlined.d.ts +2 -0
- package/es/icons/PrinterOutlined.js +29 -0
- package/es/icons/VerticalLeftOutlined.js +2 -2
- package/es/icons/VerticalRightOutlined.js +2 -2
- package/es/icons/index.d.ts +1 -0
- package/es/icons/index.js +58 -56
- package/es/lang/en_US.js +13 -2
- package/es/lang/zh_CN.js +13 -2
- package/es/lang/zh_TW.js +12 -1
- package/es/style/index.scss +1 -43
- package/es/style/plus.scss +43 -0
- package/es/style/themes/default.scss +5 -2
- package/es/style/themes/theme-util.scss +0 -2
- package/es/utils/resolvers.d.ts +2 -2
- package/es/utils/resolvers.js +33 -20
- package/lib/ele-alert/index.cjs +2 -4
- package/lib/ele-app/el.d.ts +6 -1
- package/lib/ele-app/plus.d.ts +12 -0
- package/lib/ele-avatar-group/index.cjs +1 -3
- package/lib/ele-avatar-group/index.d.ts +1 -1
- package/lib/ele-basic-select/index.cjs +16 -12
- package/lib/ele-basic-select/index.d.ts +8 -8
- package/lib/ele-check-card/index.cjs +0 -5
- package/lib/ele-check-card/index.d.ts +2 -2
- package/lib/ele-config-provider/components/receiver-view.cjs +44 -0
- package/lib/ele-config-provider/components/receiver-view.d.ts +17 -0
- package/lib/ele-config-provider/index.d.ts +2 -2
- package/lib/ele-config-provider/props.cjs +2 -2
- package/lib/ele-config-provider/props.d.ts +3 -3
- package/lib/ele-config-provider/types.d.ts +2 -0
- package/lib/ele-copyable/index.cjs +0 -4
- package/lib/ele-copyable/index.d.ts +4 -6
- package/lib/ele-cropper/index.cjs +0 -4
- package/lib/ele-cropper/index.d.ts +6 -6
- package/lib/ele-dashboard/index.cjs +7 -16
- package/lib/ele-dashboard/index.d.ts +0 -1
- package/lib/ele-data-table/index.cjs +8 -0
- package/lib/ele-data-table/index.d.ts +2 -2
- package/lib/ele-data-table/style/index.scss +4 -0
- package/lib/ele-data-table/types.d.ts +10 -0
- package/lib/ele-data-table/util.cjs +14 -0
- package/lib/ele-data-table/util.d.ts +5 -0
- package/lib/ele-dot/index.cjs +3 -9
- package/lib/ele-dot/index.d.ts +2 -4
- package/lib/ele-drawer/index.cjs +13 -10
- package/lib/ele-drawer/index.d.ts +6 -6
- package/lib/ele-dropdown/index.cjs +6 -10
- package/lib/ele-dropdown/style/index.scss +2 -2
- package/lib/ele-edit-tag/index.cjs +16 -14
- package/lib/ele-edit-tag/index.d.ts +6 -0
- package/lib/ele-edit-tag/props.cjs +5 -1
- package/lib/ele-edit-tag/props.d.ts +4 -0
- package/lib/ele-edit-tag/style/index.scss +13 -0
- package/lib/ele-ellipsis/index.cjs +2 -4
- package/lib/ele-ellipsis/index.d.ts +3 -3
- package/lib/ele-file-list/components/file-grid-item.cjs +15 -8
- package/lib/ele-file-list/components/file-grid.cjs +53 -49
- package/lib/ele-file-list/components/file-table-item.cjs +19 -14
- package/lib/ele-file-list/components/file-table.cjs +91 -85
- package/lib/ele-file-list/index.cjs +0 -10
- package/lib/ele-file-list/index.d.ts +4 -4
- package/lib/ele-file-list-tool/index.cjs +2 -2
- package/lib/ele-file-list-tool/index.d.ts +3 -3
- package/lib/ele-icon-select/index.cjs +39 -16
- package/lib/ele-icon-select/index.d.ts +22 -10
- package/lib/ele-icon-select/props.cjs +6 -1
- package/lib/ele-icon-select/props.d.ts +6 -1
- package/lib/ele-icon-select/style/index.cjs +1 -0
- package/lib/ele-icon-select/style/index.scss +16 -2
- package/lib/ele-loading/index.cjs +31 -29
- package/lib/ele-loading/index.d.ts +0 -2
- package/lib/ele-map-picker/components/map-view.d.ts +2 -2
- package/lib/ele-menus/index.cjs +6 -7
- package/lib/ele-menus/index.d.ts +3 -3
- package/lib/ele-menus/style/index.cjs +2 -0
- package/lib/ele-menus/style/index.scss +2 -1
- package/lib/ele-modal/index.cjs +13 -7
- package/lib/ele-modal/index.d.ts +2 -2
- package/lib/ele-modal/style/index.scss +18 -29
- package/lib/ele-pagination/index.cjs +18 -12
- package/lib/ele-pagination/index.d.ts +10 -8
- package/lib/ele-pagination/props.cjs +2 -0
- package/lib/ele-pagination/props.d.ts +3 -2
- package/lib/ele-pagination/style/index.scss +9 -0
- package/lib/ele-pagination/types.d.ts +6 -1
- package/lib/ele-popconfirm/style/index.cjs +1 -1
- package/lib/ele-popover/style/index.cjs +0 -1
- package/lib/ele-printer/index.cjs +10 -10
- package/lib/ele-printer/index.d.ts +6 -6
- package/lib/ele-printer/util.cjs +1 -1
- package/lib/ele-pro-layout/components/pro-sidebox.cjs +3 -1
- package/lib/ele-pro-layout/index.cjs +6 -13
- package/lib/ele-pro-layout/index.d.ts +26 -26
- package/lib/ele-pro-table/components/table-tools.cjs +124 -7
- package/lib/ele-pro-table/components/table-tools.d.ts +99 -8
- package/lib/ele-pro-table/components/tool-column-list.cjs +1 -0
- package/lib/ele-pro-table/components/tool-column.cjs +6 -2
- package/lib/ele-pro-table/components/tool-export.cjs +450 -0
- package/lib/ele-pro-table/components/tool-export.d.ts +457 -0
- package/lib/ele-pro-table/components/tool-print-body-cell.cjs +87 -0
- package/lib/ele-pro-table/components/tool-print-body-cell.d.ts +34 -0
- package/lib/ele-pro-table/components/tool-print-header-cell.cjs +87 -0
- package/lib/ele-pro-table/components/tool-print-header-cell.d.ts +34 -0
- package/lib/ele-pro-table/components/tool-print.cjs +546 -0
- package/lib/ele-pro-table/components/tool-print.d.ts +899 -0
- package/lib/ele-pro-table/index.cjs +56 -13
- package/lib/ele-pro-table/index.d.ts +31 -12
- package/lib/ele-pro-table/props.cjs +6 -2
- package/lib/ele-pro-table/props.d.ts +14 -8
- package/lib/ele-pro-table/style/index.cjs +9 -0
- package/lib/ele-pro-table/style/index.scss +33 -5
- package/lib/ele-pro-table/types.d.ts +147 -5
- package/lib/ele-pro-table/util.cjs +119 -13
- package/lib/ele-pro-table/util.d.ts +47 -3
- package/lib/ele-segmented/index.cjs +1 -3
- package/lib/ele-split-panel/index.cjs +62 -58
- package/lib/ele-split-panel/index.d.ts +9 -8
- package/lib/ele-steps/index.cjs +2 -4
- package/lib/ele-steps/index.d.ts +0 -1
- package/lib/ele-table/index.cjs +2 -1
- package/lib/ele-table/index.d.ts +3 -0
- package/lib/ele-table/props.cjs +3 -1
- package/lib/ele-table/props.d.ts +2 -0
- package/lib/ele-table/style/index.scss +35 -0
- package/lib/ele-table-select/index.d.ts +1 -1
- package/lib/ele-tabs/index.cjs +1 -6
- package/lib/ele-tabs/index.d.ts +7 -5
- package/lib/ele-tabs/props.d.ts +1 -1
- package/lib/ele-tool/index.cjs +1 -3
- package/lib/ele-tool/index.d.ts +1 -1
- package/lib/ele-tool/props.cjs +5 -0
- package/lib/ele-tool/props.d.ts +7 -0
- package/lib/ele-tooltip/index.cjs +9 -13
- package/lib/ele-tooltip/style/css-var.scss +4 -0
- package/lib/ele-tooltip/style/index.scss +23 -0
- package/lib/ele-tour/index.cjs +79 -76
- package/lib/ele-upload-list/components/list-item.d.ts +1 -1
- package/lib/ele-upload-list/index.cjs +1 -2
- package/lib/ele-upload-list/index.d.ts +6 -4
- package/lib/ele-virtual-table/components/body-cell.cjs +31 -46
- package/lib/ele-virtual-table/components/body-cell.d.ts +0 -1
- package/lib/ele-virtual-table/components/footer-row.cjs +13 -8
- package/lib/ele-virtual-table/components/footer-row.d.ts +2 -2
- package/lib/ele-virtual-table/index.d.ts +1 -1
- package/lib/ele-virtual-table/types.d.ts +15 -1
- package/lib/ele-virtual-table/util.cjs +44 -0
- package/lib/ele-virtual-table/util.d.ts +26 -3
- package/lib/ele-watermark/index.cjs +1 -1
- package/lib/ele-watermark/index.d.ts +9 -0
- package/lib/ele-watermark/props.cjs +5 -0
- package/lib/ele-watermark/props.d.ts +5 -0
- package/lib/icons/PrinterOutlined.cjs +28 -0
- package/lib/icons/PrinterOutlined.d.ts +2 -0
- package/lib/icons/VerticalLeftOutlined.cjs +2 -2
- package/lib/icons/VerticalRightOutlined.cjs +2 -2
- package/lib/icons/index.cjs +2 -0
- package/lib/icons/index.d.ts +1 -0
- package/lib/lang/en_US.cjs +13 -2
- package/lib/lang/zh_CN.cjs +13 -2
- package/lib/lang/zh_TW.cjs +12 -1
- package/lib/style/index.scss +1 -43
- package/lib/style/plus.scss +43 -0
- package/lib/style/themes/default.scss +5 -2
- package/lib/style/themes/theme-util.scss +0 -2
- package/lib/utils/resolvers.cjs +33 -20
- package/lib/utils/resolvers.d.ts +2 -2
- package/package.json +1 -1
- package/es/ele-popover/style/css-var.scss +0 -8
- package/es/ele-popover/style/index.scss +0 -27
- package/lib/ele-popover/style/css-var.scss +0 -8
- package/lib/ele-popover/style/index.scss +0 -27
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { defineComponent, ref, reactive, watch, resolveComponent, openBlock, createBlock, withCtx, createVNode, mergeProps, createTextVNode, toDisplayString, withModifiers, createCommentVNode, createElementVNode } from "vue";
|
|
2
|
+
import { ElForm, ElFormItem, ElInput, ElSelect, ElOption, ElCheckbox, ElButton, ElIcon } from "element-plus";
|
|
3
|
+
import { DownloadOutlined } from "../../icons";
|
|
4
|
+
import { eachTree } from "../../utils/core";
|
|
5
|
+
import EleTool from "../../ele-tool/index";
|
|
6
|
+
import EleModal from "../../ele-modal/index";
|
|
7
|
+
import { getColItems, exportColumnsfilter, getCheckedColumns, getExportData, exportCSV } from "../util";
|
|
8
|
+
import ToolColumnList from "./tool-column-list";
|
|
9
|
+
const _sfc_main = defineComponent({
|
|
10
|
+
name: "ToolExport",
|
|
11
|
+
components: {
|
|
12
|
+
ElForm,
|
|
13
|
+
ElFormItem,
|
|
14
|
+
ElInput,
|
|
15
|
+
ElSelect,
|
|
16
|
+
ElOption,
|
|
17
|
+
ElCheckbox,
|
|
18
|
+
ElButton,
|
|
19
|
+
ElIcon,
|
|
20
|
+
DownloadOutlined,
|
|
21
|
+
EleTool,
|
|
22
|
+
EleModal,
|
|
23
|
+
ToolColumnList
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
/** 提示文字 */
|
|
27
|
+
title: String,
|
|
28
|
+
/** 提示位置 */
|
|
29
|
+
placement: String,
|
|
30
|
+
/** 全选文字 */
|
|
31
|
+
checkAllText: String,
|
|
32
|
+
/** 重置文字 */
|
|
33
|
+
resetText: String,
|
|
34
|
+
/** 无标题列文字 */
|
|
35
|
+
untitledText: String,
|
|
36
|
+
/** 文件名文字 */
|
|
37
|
+
fileNameText: String,
|
|
38
|
+
/** 文件名提示文字 */
|
|
39
|
+
fileNamePlaceholderText: String,
|
|
40
|
+
/** 选择数据文字 */
|
|
41
|
+
selectDataText: String,
|
|
42
|
+
/** 选择字段文字 */
|
|
43
|
+
selectColumnText: String,
|
|
44
|
+
/** 当前页数据文字 */
|
|
45
|
+
dataTypePageText: String,
|
|
46
|
+
/** 选中数据文字 */
|
|
47
|
+
dataTypeSelectedText: String,
|
|
48
|
+
/** 全部数据文字 */
|
|
49
|
+
dataTypeAllText: String,
|
|
50
|
+
/** 取消文字 */
|
|
51
|
+
cancelText: String,
|
|
52
|
+
/** 确定文字 */
|
|
53
|
+
okText: String,
|
|
54
|
+
/** 弹窗参数 */
|
|
55
|
+
modalProps: Object,
|
|
56
|
+
/** 列数据 */
|
|
57
|
+
columns: Array,
|
|
58
|
+
/** 表格选中数据 */
|
|
59
|
+
selections: Array,
|
|
60
|
+
/** 表格当前页数据 */
|
|
61
|
+
pageData: Array,
|
|
62
|
+
/** 表格全部数据 */
|
|
63
|
+
datasource: Array,
|
|
64
|
+
/** 单元格合并行列方法 */
|
|
65
|
+
spanMethod: Function,
|
|
66
|
+
/** 是否显示合计行 */
|
|
67
|
+
showSummary: Boolean,
|
|
68
|
+
/** 合计行文本 */
|
|
69
|
+
sumText: String,
|
|
70
|
+
/** 合计行自定义方法 */
|
|
71
|
+
summaryMethod: Function,
|
|
72
|
+
/** 序号列起始索引 */
|
|
73
|
+
pageIndex: Number,
|
|
74
|
+
/** 表格请求数据方法 */
|
|
75
|
+
fetch: Function,
|
|
76
|
+
/** 默认文件名 */
|
|
77
|
+
defaultFileName: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "list"
|
|
80
|
+
},
|
|
81
|
+
/** 默认数据类型 */
|
|
82
|
+
defaultDataType: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: "pageData"
|
|
85
|
+
},
|
|
86
|
+
/** 导出前的钩子函数 */
|
|
87
|
+
beforeExport: Function
|
|
88
|
+
},
|
|
89
|
+
setup(props) {
|
|
90
|
+
const visible = ref(false);
|
|
91
|
+
const loading = ref(false);
|
|
92
|
+
const formRef = ref(null);
|
|
93
|
+
const form = reactive({
|
|
94
|
+
/** 文件名 */
|
|
95
|
+
fileName: props.defaultFileName
|
|
96
|
+
});
|
|
97
|
+
const fileNameRules = reactive({
|
|
98
|
+
required: true,
|
|
99
|
+
message: props.fileNamePlaceholderText,
|
|
100
|
+
type: "string",
|
|
101
|
+
trigger: "blur"
|
|
102
|
+
});
|
|
103
|
+
const dataType = ref(props.defaultDataType);
|
|
104
|
+
const colItems = ref([]);
|
|
105
|
+
const isCheckAll = ref(false);
|
|
106
|
+
const isIndeterminate = ref(false);
|
|
107
|
+
const openModal = () => {
|
|
108
|
+
visible.value = true;
|
|
109
|
+
};
|
|
110
|
+
const closeModal = () => {
|
|
111
|
+
visible.value = false;
|
|
112
|
+
};
|
|
113
|
+
const showLoading = () => {
|
|
114
|
+
loading.value = true;
|
|
115
|
+
};
|
|
116
|
+
const hideLoading = () => {
|
|
117
|
+
loading.value = false;
|
|
118
|
+
};
|
|
119
|
+
const exportData = (data) => {
|
|
120
|
+
showLoading();
|
|
121
|
+
const columns = getCheckedColumns(
|
|
122
|
+
props.columns,
|
|
123
|
+
colItems.value,
|
|
124
|
+
true,
|
|
125
|
+
exportColumnsfilter
|
|
126
|
+
);
|
|
127
|
+
const { headerData, bodyData, footerData, bodyCols } = getExportData(
|
|
128
|
+
data,
|
|
129
|
+
columns,
|
|
130
|
+
props.spanMethod,
|
|
131
|
+
props.pageIndex,
|
|
132
|
+
props.showSummary,
|
|
133
|
+
props.sumText,
|
|
134
|
+
props.summaryMethod
|
|
135
|
+
);
|
|
136
|
+
if (typeof props.beforeExport === "function") {
|
|
137
|
+
const flag = props.beforeExport({
|
|
138
|
+
data,
|
|
139
|
+
columns,
|
|
140
|
+
headerData,
|
|
141
|
+
bodyData,
|
|
142
|
+
footerData,
|
|
143
|
+
bodyCols,
|
|
144
|
+
fileName: form.fileName,
|
|
145
|
+
hideLoading,
|
|
146
|
+
closeModal
|
|
147
|
+
});
|
|
148
|
+
if (flag === false) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
exportCSV(form.fileName, headerData, bodyData, footerData);
|
|
153
|
+
hideLoading();
|
|
154
|
+
closeModal();
|
|
155
|
+
};
|
|
156
|
+
const handleExport = () => {
|
|
157
|
+
var _a, _b;
|
|
158
|
+
(_b = (_a = formRef.value) == null ? void 0 : _a.validate) == null ? void 0 : _b.call(_a, (valid) => {
|
|
159
|
+
if (!valid) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (dataType.value === "selections") {
|
|
163
|
+
exportData([...props.selections || []]);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (dataType.value !== "data") {
|
|
167
|
+
exportData([...props.pageData || []]);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (props.datasource == null || typeof props.datasource !== "function" || typeof props.fetch !== "function") {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
showLoading();
|
|
174
|
+
props.fetch((params) => {
|
|
175
|
+
props.datasource(params).then((result) => {
|
|
176
|
+
if (result == null) {
|
|
177
|
+
hideLoading();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
exportData(result);
|
|
181
|
+
}).catch(() => {
|
|
182
|
+
hideLoading();
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
const initColItems = () => {
|
|
188
|
+
colItems.value = getColItems(
|
|
189
|
+
props.columns,
|
|
190
|
+
props.untitledText,
|
|
191
|
+
exportColumnsfilter
|
|
192
|
+
);
|
|
193
|
+
let checkAll = true;
|
|
194
|
+
let indeterminate = false;
|
|
195
|
+
eachTree(colItems.value, (d) => {
|
|
196
|
+
if (!d.checked && checkAll) {
|
|
197
|
+
checkAll = false;
|
|
198
|
+
}
|
|
199
|
+
if (d.checked && !indeterminate) {
|
|
200
|
+
indeterminate = true;
|
|
201
|
+
}
|
|
202
|
+
if (!checkAll && indeterminate) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
isCheckAll.value = colItems.value.length > 0 && checkAll;
|
|
207
|
+
isIndeterminate.value = !checkAll && indeterminate;
|
|
208
|
+
};
|
|
209
|
+
const onCheckedChange = (item, checked) => {
|
|
210
|
+
let checkAll = true;
|
|
211
|
+
let indeterminate = false;
|
|
212
|
+
eachTree(colItems.value, (d) => {
|
|
213
|
+
if (d.uid === item.uid) {
|
|
214
|
+
d.checked = checked;
|
|
215
|
+
}
|
|
216
|
+
if (!d.checked && checkAll) {
|
|
217
|
+
checkAll = false;
|
|
218
|
+
}
|
|
219
|
+
if (d.checked && !indeterminate) {
|
|
220
|
+
indeterminate = true;
|
|
221
|
+
}
|
|
222
|
+
if (d.uid === item.uid && !checkAll && indeterminate) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
isCheckAll.value = colItems.value.length > 0 && checkAll;
|
|
227
|
+
isIndeterminate.value = !checkAll && indeterminate;
|
|
228
|
+
};
|
|
229
|
+
const onSortChange = (items, parent) => {
|
|
230
|
+
if (!parent) {
|
|
231
|
+
colItems.value = items;
|
|
232
|
+
} else {
|
|
233
|
+
eachTree(colItems.value, (d) => {
|
|
234
|
+
if (d.uid === parent.uid) {
|
|
235
|
+
d.children = items;
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const onCheckAllChange = (checked) => {
|
|
242
|
+
isCheckAll.value = checked;
|
|
243
|
+
isIndeterminate.value = false;
|
|
244
|
+
eachTree(colItems.value, (d) => {
|
|
245
|
+
if (d.checked !== checked) {
|
|
246
|
+
d.checked = checked;
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
const onReset = () => {
|
|
251
|
+
initColItems();
|
|
252
|
+
};
|
|
253
|
+
watch(visible, (visible2) => {
|
|
254
|
+
var _a, _b;
|
|
255
|
+
if (visible2) {
|
|
256
|
+
form.fileName = props.defaultFileName;
|
|
257
|
+
dataType.value = props.defaultDataType;
|
|
258
|
+
initColItems();
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
loading.value = false;
|
|
262
|
+
(_b = (_a = formRef.value) == null ? void 0 : _a.clearValidate) == null ? void 0 : _b.call(_a);
|
|
263
|
+
});
|
|
264
|
+
watch(
|
|
265
|
+
() => props.fileNamePlaceholderText,
|
|
266
|
+
(placeholder) => {
|
|
267
|
+
fileNameRules.message = placeholder;
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
return {
|
|
271
|
+
visible,
|
|
272
|
+
loading,
|
|
273
|
+
formRef,
|
|
274
|
+
form,
|
|
275
|
+
fileNameRules,
|
|
276
|
+
dataType,
|
|
277
|
+
colItems,
|
|
278
|
+
isCheckAll,
|
|
279
|
+
isIndeterminate,
|
|
280
|
+
openModal,
|
|
281
|
+
closeModal,
|
|
282
|
+
handleExport,
|
|
283
|
+
onCheckedChange,
|
|
284
|
+
onSortChange,
|
|
285
|
+
onCheckAllChange,
|
|
286
|
+
onReset
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
const _export_sfc = (sfc, props) => {
|
|
291
|
+
const target = sfc.__vccOpts || sfc;
|
|
292
|
+
for (const [key, val] of props) {
|
|
293
|
+
target[key] = val;
|
|
294
|
+
}
|
|
295
|
+
return target;
|
|
296
|
+
};
|
|
297
|
+
const _hoisted_1 = { class: "ele-tool-column is-sortable" };
|
|
298
|
+
const _hoisted_2 = { class: "ele-tool-column-header" };
|
|
299
|
+
const _hoisted_3 = { class: "ele-tool-column-label" };
|
|
300
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
301
|
+
const _component_DownloadOutlined = resolveComponent("DownloadOutlined");
|
|
302
|
+
const _component_ElIcon = resolveComponent("ElIcon");
|
|
303
|
+
const _component_ElInput = resolveComponent("ElInput");
|
|
304
|
+
const _component_ElFormItem = resolveComponent("ElFormItem");
|
|
305
|
+
const _component_ElOption = resolveComponent("ElOption");
|
|
306
|
+
const _component_ElSelect = resolveComponent("ElSelect");
|
|
307
|
+
const _component_ElCheckbox = resolveComponent("ElCheckbox");
|
|
308
|
+
const _component_ToolColumnList = resolveComponent("ToolColumnList");
|
|
309
|
+
const _component_ElForm = resolveComponent("ElForm");
|
|
310
|
+
const _component_ElButton = resolveComponent("ElButton");
|
|
311
|
+
const _component_EleModal = resolveComponent("EleModal");
|
|
312
|
+
const _component_EleTool = resolveComponent("EleTool");
|
|
313
|
+
return openBlock(), createBlock(_component_EleTool, {
|
|
314
|
+
title: _ctx.title,
|
|
315
|
+
placement: _ctx.placement,
|
|
316
|
+
onClick: _ctx.openModal
|
|
317
|
+
}, {
|
|
318
|
+
default: withCtx(() => [
|
|
319
|
+
createVNode(_component_ElIcon, { style: { "transform": "scale(1.12)", "transform-origin": "bottom" } }, {
|
|
320
|
+
default: withCtx(() => [
|
|
321
|
+
createVNode(_component_DownloadOutlined)
|
|
322
|
+
]),
|
|
323
|
+
_: 1
|
|
324
|
+
}),
|
|
325
|
+
createVNode(_component_EleModal, mergeProps({
|
|
326
|
+
form: true,
|
|
327
|
+
width: "460px",
|
|
328
|
+
title: _ctx.title,
|
|
329
|
+
position: "center"
|
|
330
|
+
}, _ctx.modalProps, {
|
|
331
|
+
modelValue: _ctx.visible,
|
|
332
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.visible = $event)
|
|
333
|
+
}), {
|
|
334
|
+
footer: withCtx(() => [
|
|
335
|
+
createVNode(_component_ElButton, { onClick: _ctx.closeModal }, {
|
|
336
|
+
default: withCtx(() => [
|
|
337
|
+
createTextVNode(toDisplayString(_ctx.cancelText), 1)
|
|
338
|
+
]),
|
|
339
|
+
_: 1
|
|
340
|
+
}, 8, ["onClick"]),
|
|
341
|
+
createVNode(_component_ElButton, {
|
|
342
|
+
loading: _ctx.loading,
|
|
343
|
+
type: "primary",
|
|
344
|
+
onClick: _ctx.handleExport
|
|
345
|
+
}, {
|
|
346
|
+
default: withCtx(() => [
|
|
347
|
+
createTextVNode(toDisplayString(_ctx.okText), 1)
|
|
348
|
+
]),
|
|
349
|
+
_: 1
|
|
350
|
+
}, 8, ["loading", "onClick"])
|
|
351
|
+
]),
|
|
352
|
+
default: withCtx(() => [
|
|
353
|
+
createVNode(_component_ElForm, {
|
|
354
|
+
ref: "formRef",
|
|
355
|
+
model: _ctx.form,
|
|
356
|
+
labelWidth: "80px",
|
|
357
|
+
onSubmit: _cache[3] || (_cache[3] = withModifiers(() => {
|
|
358
|
+
}, ["prevent"])),
|
|
359
|
+
class: "ele-tool-export-form"
|
|
360
|
+
}, {
|
|
361
|
+
default: withCtx(() => [
|
|
362
|
+
createVNode(_component_ElFormItem, {
|
|
363
|
+
label: _ctx.fileNameText,
|
|
364
|
+
prop: "fileName",
|
|
365
|
+
rules: _ctx.fileNameRules
|
|
366
|
+
}, {
|
|
367
|
+
default: withCtx(() => [
|
|
368
|
+
createVNode(_component_ElInput, {
|
|
369
|
+
maxlength: 20,
|
|
370
|
+
clearable: true,
|
|
371
|
+
modelValue: _ctx.form.fileName,
|
|
372
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.form.fileName = $event),
|
|
373
|
+
placeholder: _ctx.fileNamePlaceholderText
|
|
374
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
375
|
+
]),
|
|
376
|
+
_: 1
|
|
377
|
+
}, 8, ["label", "rules"]),
|
|
378
|
+
createVNode(_component_ElFormItem, { label: _ctx.selectDataText }, {
|
|
379
|
+
default: withCtx(() => [
|
|
380
|
+
createVNode(_component_ElSelect, {
|
|
381
|
+
modelValue: _ctx.dataType,
|
|
382
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.dataType = $event),
|
|
383
|
+
placeholder: _ctx.selectDataText
|
|
384
|
+
}, {
|
|
385
|
+
default: withCtx(() => [
|
|
386
|
+
_ctx.pageData != null ? (openBlock(), createBlock(_component_ElOption, {
|
|
387
|
+
key: 0,
|
|
388
|
+
value: "pageData",
|
|
389
|
+
label: _ctx.dataTypePageText
|
|
390
|
+
}, null, 8, ["label"])) : createCommentVNode("", true),
|
|
391
|
+
_ctx.selections != null ? (openBlock(), createBlock(_component_ElOption, {
|
|
392
|
+
key: 1,
|
|
393
|
+
value: "selections",
|
|
394
|
+
label: _ctx.dataTypeSelectedText
|
|
395
|
+
}, null, 8, ["label"])) : createCommentVNode("", true),
|
|
396
|
+
_ctx.datasource != null ? (openBlock(), createBlock(_component_ElOption, {
|
|
397
|
+
key: 2,
|
|
398
|
+
value: "data",
|
|
399
|
+
label: _ctx.dataTypeAllText
|
|
400
|
+
}, null, 8, ["label"])) : createCommentVNode("", true)
|
|
401
|
+
]),
|
|
402
|
+
_: 1
|
|
403
|
+
}, 8, ["modelValue", "placeholder"])
|
|
404
|
+
]),
|
|
405
|
+
_: 1
|
|
406
|
+
}, 8, ["label"]),
|
|
407
|
+
createVNode(_component_ElFormItem, { label: _ctx.selectColumnText }, {
|
|
408
|
+
default: withCtx(() => [
|
|
409
|
+
createElementVNode("div", _hoisted_1, [
|
|
410
|
+
createElementVNode("div", _hoisted_2, [
|
|
411
|
+
createElementVNode("div", _hoisted_3, [
|
|
412
|
+
createVNode(_component_ElCheckbox, {
|
|
413
|
+
modelValue: _ctx.isCheckAll,
|
|
414
|
+
indeterminate: _ctx.isIndeterminate,
|
|
415
|
+
"onUpdate:modelValue": _ctx.onCheckAllChange
|
|
416
|
+
}, {
|
|
417
|
+
default: withCtx(() => [
|
|
418
|
+
createTextVNode(toDisplayString(_ctx.checkAllText), 1)
|
|
419
|
+
]),
|
|
420
|
+
_: 1
|
|
421
|
+
}, 8, ["modelValue", "indeterminate", "onUpdate:modelValue"])
|
|
422
|
+
]),
|
|
423
|
+
createElementVNode("div", {
|
|
424
|
+
class: "ele-tool-column-link",
|
|
425
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onReset && _ctx.onReset(...args))
|
|
426
|
+
}, toDisplayString(_ctx.resetText), 1)
|
|
427
|
+
]),
|
|
428
|
+
createVNode(_component_ToolColumnList, {
|
|
429
|
+
data: _ctx.colItems,
|
|
430
|
+
sortable: true,
|
|
431
|
+
onSortChange: _ctx.onSortChange,
|
|
432
|
+
onCheckedChange: _ctx.onCheckedChange
|
|
433
|
+
}, null, 8, ["data", "onSortChange", "onCheckedChange"])
|
|
434
|
+
])
|
|
435
|
+
]),
|
|
436
|
+
_: 1
|
|
437
|
+
}, 8, ["label"])
|
|
438
|
+
]),
|
|
439
|
+
_: 1
|
|
440
|
+
}, 8, ["model"])
|
|
441
|
+
]),
|
|
442
|
+
_: 1
|
|
443
|
+
}, 16, ["title", "modelValue"])
|
|
444
|
+
]),
|
|
445
|
+
_: 1
|
|
446
|
+
}, 8, ["title", "placement", "onClick"]);
|
|
447
|
+
}
|
|
448
|
+
const toolExport = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
449
|
+
export {
|
|
450
|
+
toolExport as default
|
|
451
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import { StyleValues } from '../../ele-app/types';
|
|
3
|
+
import type { CustomRenderProps } from '../../ele-virtual-table/types';
|
|
4
|
+
import type { ExportDataItem } from '../types';
|
|
5
|
+
declare const _default: import("vue").DefineComponent<{
|
|
6
|
+
/** 列数据 */
|
|
7
|
+
col: {
|
|
8
|
+
type: PropType<ExportDataItem>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
/** 列索引 */
|
|
12
|
+
columnIndex: NumberConstructor;
|
|
13
|
+
/** 单元格样式 */
|
|
14
|
+
bodyCellStyle: PropType<import("element-plus/es/components/table/src/table/defaults").CellStyle<import("../types").DataItem> | undefined>;
|
|
15
|
+
/** 单元格类名自定义 */
|
|
16
|
+
bodyCellClass: PropType<import("element-plus/es/components/table/src/table/defaults").CellCls<import("../types").DataItem> | undefined>;
|
|
17
|
+
}, {
|
|
18
|
+
renderOpt: import("vue").ComputedRef<CustomRenderProps>;
|
|
19
|
+
cellStyle: import("vue").ComputedRef<StyleValues | undefined>;
|
|
20
|
+
cellClass: import("vue").ComputedRef<string>;
|
|
21
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
/** 列数据 */
|
|
23
|
+
col: {
|
|
24
|
+
type: PropType<ExportDataItem>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
/** 列索引 */
|
|
28
|
+
columnIndex: NumberConstructor;
|
|
29
|
+
/** 单元格样式 */
|
|
30
|
+
bodyCellStyle: PropType<import("element-plus/es/components/table/src/table/defaults").CellStyle<import("../types").DataItem> | undefined>;
|
|
31
|
+
/** 单元格类名自定义 */
|
|
32
|
+
bodyCellClass: PropType<import("element-plus/es/components/table/src/table/defaults").CellCls<import("../types").DataItem> | undefined>;
|
|
33
|
+
}>>, {}, {}>;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, normalizeClass, createVNode, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { CellRender } from "../../ele-virtual-table/util";
|
|
3
|
+
const _sfc_main = defineComponent({
|
|
4
|
+
name: "ToolPrintBodyCell",
|
|
5
|
+
components: { CellRender },
|
|
6
|
+
props: {
|
|
7
|
+
/** 列数据 */
|
|
8
|
+
col: {
|
|
9
|
+
type: Object,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
/** 列索引 */
|
|
13
|
+
columnIndex: Number,
|
|
14
|
+
/** 单元格样式 */
|
|
15
|
+
bodyCellStyle: [Object, Function],
|
|
16
|
+
/** 单元格类名自定义 */
|
|
17
|
+
bodyCellClass: [String, Function]
|
|
18
|
+
},
|
|
19
|
+
setup(props, { slots }) {
|
|
20
|
+
const renderOpt = computed(() => {
|
|
21
|
+
const { text, row, column, index: $index } = props.col;
|
|
22
|
+
const params = [{ row, column, $index }];
|
|
23
|
+
if (column && !["expand", "selection", "index"].includes(column.type || "") && column.slot && typeof slots[column.slot] === "function") {
|
|
24
|
+
return { render: slots[column.slot], params };
|
|
25
|
+
}
|
|
26
|
+
return { render: () => text, params };
|
|
27
|
+
});
|
|
28
|
+
const cellParam = computed(() => {
|
|
29
|
+
return {
|
|
30
|
+
column: props.col.column,
|
|
31
|
+
columnIndex: props.columnIndex,
|
|
32
|
+
rowIndex: props.col.index,
|
|
33
|
+
row: props.col.row
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
const cellStyle = computed(() => {
|
|
37
|
+
if (typeof props.bodyCellStyle === "function") {
|
|
38
|
+
return props.bodyCellStyle(cellParam.value);
|
|
39
|
+
}
|
|
40
|
+
return props.bodyCellStyle;
|
|
41
|
+
});
|
|
42
|
+
const cellClass = computed(() => {
|
|
43
|
+
const classes = [];
|
|
44
|
+
const column = props.col.column;
|
|
45
|
+
if (column) {
|
|
46
|
+
if (column.align) {
|
|
47
|
+
classes.push("is-align-" + column.align);
|
|
48
|
+
}
|
|
49
|
+
if (typeof props.bodyCellClass === "function") {
|
|
50
|
+
const temp = props.bodyCellClass(cellParam.value);
|
|
51
|
+
if (temp) {
|
|
52
|
+
classes.push(temp);
|
|
53
|
+
}
|
|
54
|
+
} else if (props.bodyCellClass) {
|
|
55
|
+
classes.push(props.bodyCellClass);
|
|
56
|
+
}
|
|
57
|
+
if (column.className) {
|
|
58
|
+
classes.push(column.className);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return classes.join(" ");
|
|
62
|
+
});
|
|
63
|
+
return { renderOpt, cellStyle, cellClass };
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const _export_sfc = (sfc, props) => {
|
|
67
|
+
const target = sfc.__vccOpts || sfc;
|
|
68
|
+
for (const [key, val] of props) {
|
|
69
|
+
target[key] = val;
|
|
70
|
+
}
|
|
71
|
+
return target;
|
|
72
|
+
};
|
|
73
|
+
const _hoisted_1 = ["colspan", "rowspan"];
|
|
74
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
75
|
+
const _component_CellRender = resolveComponent("CellRender");
|
|
76
|
+
return openBlock(), createElementBlock("td", {
|
|
77
|
+
colspan: _ctx.col.colspan,
|
|
78
|
+
rowspan: _ctx.col.rowspan,
|
|
79
|
+
style: normalizeStyle(_ctx.cellStyle),
|
|
80
|
+
class: normalizeClass(_ctx.cellClass)
|
|
81
|
+
}, [
|
|
82
|
+
createVNode(_component_CellRender, normalizeProps(guardReactiveProps(_ctx.renderOpt)), null, 16)
|
|
83
|
+
], 14, _hoisted_1);
|
|
84
|
+
}
|
|
85
|
+
const toolPrintBodyCell = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
86
|
+
export {
|
|
87
|
+
toolPrintBodyCell as default
|
|
88
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import { StyleValues } from '../../ele-app/types';
|
|
3
|
+
import type { CustomRenderProps } from '../../ele-virtual-table/types';
|
|
4
|
+
import type { ExportDataItem } from '../types';
|
|
5
|
+
declare const _default: import("vue").DefineComponent<{
|
|
6
|
+
/** 列数据 */
|
|
7
|
+
col: {
|
|
8
|
+
type: PropType<ExportDataItem>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
/** 列索引 */
|
|
12
|
+
columnIndex: NumberConstructor;
|
|
13
|
+
/** 单元格样式 */
|
|
14
|
+
headerCellStyle: PropType<import("element-plus/es/components/table/src/table/defaults").CellStyle<import("../types").DataItem> | undefined>;
|
|
15
|
+
/** 单元格类名自定义 */
|
|
16
|
+
headerCellClass: PropType<import("element-plus/es/components/table/src/table/defaults").CellCls<import("../types").DataItem> | undefined>;
|
|
17
|
+
}, {
|
|
18
|
+
renderOpt: import("vue").ComputedRef<CustomRenderProps>;
|
|
19
|
+
cellStyle: import("vue").ComputedRef<StyleValues | undefined>;
|
|
20
|
+
cellClass: import("vue").ComputedRef<string>;
|
|
21
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
/** 列数据 */
|
|
23
|
+
col: {
|
|
24
|
+
type: PropType<ExportDataItem>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
/** 列索引 */
|
|
28
|
+
columnIndex: NumberConstructor;
|
|
29
|
+
/** 单元格样式 */
|
|
30
|
+
headerCellStyle: PropType<import("element-plus/es/components/table/src/table/defaults").CellStyle<import("../types").DataItem> | undefined>;
|
|
31
|
+
/** 单元格类名自定义 */
|
|
32
|
+
headerCellClass: PropType<import("element-plus/es/components/table/src/table/defaults").CellCls<import("../types").DataItem> | undefined>;
|
|
33
|
+
}>>, {}, {}>;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, normalizeClass, createVNode, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { CellRender } from "../../ele-virtual-table/util";
|
|
3
|
+
const _sfc_main = defineComponent({
|
|
4
|
+
name: "ToolPrintHeaderCell",
|
|
5
|
+
components: { CellRender },
|
|
6
|
+
props: {
|
|
7
|
+
/** 列数据 */
|
|
8
|
+
col: {
|
|
9
|
+
type: Object,
|
|
10
|
+
required: true
|
|
11
|
+
},
|
|
12
|
+
/** 列索引 */
|
|
13
|
+
columnIndex: Number,
|
|
14
|
+
/** 单元格样式 */
|
|
15
|
+
headerCellStyle: [Object, Function],
|
|
16
|
+
/** 单元格类名自定义 */
|
|
17
|
+
headerCellClass: [String, Function]
|
|
18
|
+
},
|
|
19
|
+
setup(props, { slots }) {
|
|
20
|
+
const renderOpt = computed(() => {
|
|
21
|
+
const { text, column } = props.col;
|
|
22
|
+
const params = [{ column, $index: props.columnIndex }];
|
|
23
|
+
if (column && "index" !== column.type && column.headerSlot && typeof slots[column.headerSlot] === "function") {
|
|
24
|
+
return { render: slots[column.headerSlot], params };
|
|
25
|
+
}
|
|
26
|
+
return { render: () => text, params };
|
|
27
|
+
});
|
|
28
|
+
const cellParam = computed(() => {
|
|
29
|
+
return {
|
|
30
|
+
column: props.col.column,
|
|
31
|
+
columnIndex: props.columnIndex,
|
|
32
|
+
rowIndex: props.col.index
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const cellStyle = computed(() => {
|
|
36
|
+
if (typeof props.headerCellStyle === "function") {
|
|
37
|
+
return props.headerCellStyle(cellParam.value);
|
|
38
|
+
}
|
|
39
|
+
return props.headerCellStyle;
|
|
40
|
+
});
|
|
41
|
+
const cellClass = computed(() => {
|
|
42
|
+
const classes = [];
|
|
43
|
+
const column = props.col.column;
|
|
44
|
+
if (column) {
|
|
45
|
+
const align = column.headerAlign || column.align;
|
|
46
|
+
if (align) {
|
|
47
|
+
classes.push("is-align-" + align);
|
|
48
|
+
}
|
|
49
|
+
if (typeof props.headerCellClass === "function") {
|
|
50
|
+
const temp = props.headerCellClass(cellParam.value);
|
|
51
|
+
if (temp) {
|
|
52
|
+
classes.push(temp);
|
|
53
|
+
}
|
|
54
|
+
} else if (props.headerCellClass) {
|
|
55
|
+
classes.push(props.headerCellClass);
|
|
56
|
+
}
|
|
57
|
+
if (column.labelClassName) {
|
|
58
|
+
classes.push(column.labelClassName);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return classes.join(" ");
|
|
62
|
+
});
|
|
63
|
+
return { renderOpt, cellStyle, cellClass };
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const _export_sfc = (sfc, props) => {
|
|
67
|
+
const target = sfc.__vccOpts || sfc;
|
|
68
|
+
for (const [key, val] of props) {
|
|
69
|
+
target[key] = val;
|
|
70
|
+
}
|
|
71
|
+
return target;
|
|
72
|
+
};
|
|
73
|
+
const _hoisted_1 = ["colspan", "rowspan"];
|
|
74
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
75
|
+
const _component_CellRender = resolveComponent("CellRender");
|
|
76
|
+
return openBlock(), createElementBlock("th", {
|
|
77
|
+
colspan: _ctx.col.colspan,
|
|
78
|
+
rowspan: _ctx.col.rowspan,
|
|
79
|
+
style: normalizeStyle(_ctx.cellStyle),
|
|
80
|
+
class: normalizeClass(_ctx.cellClass)
|
|
81
|
+
}, [
|
|
82
|
+
createVNode(_component_CellRender, normalizeProps(guardReactiveProps(_ctx.renderOpt)), null, 16)
|
|
83
|
+
], 14, _hoisted_1);
|
|
84
|
+
}
|
|
85
|
+
const toolPrintHeaderCell = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
86
|
+
export {
|
|
87
|
+
toolPrintHeaderCell as default
|
|
88
|
+
};
|