sh-view 2.7.8 → 2.7.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/other.js +8 -0
- package/package.json +3 -2
- package/packages/components/index.js +35 -35
- package/packages/components/{global-components/sh-alert → sh-alert}/index.vue +8 -15
- package/packages/components/{global-components/sh-badge → sh-badge}/index.vue +6 -5
- package/packages/components/{global-components/sh-drawer → sh-drawer}/index.vue +49 -27
- package/packages/components/{global-components/sh-form → sh-form}/js/useForm.js +2 -2
- package/packages/components/sh-header/index.vue +260 -0
- package/packages/components/{global-components/sh-poptip → sh-poptip}/index.vue +1 -1
- package/packages/components/{global-components/sh-progress → sh-progress}/index.vue +2 -18
- package/packages/components/{global-components/sh-table → sh-table}/css/index.scss +18 -0
- package/packages/components/{global-components/sh-table → sh-table}/js/useTable.js +4 -6
- package/packages/components/{global-components/sh-table → sh-table}/table.vue +217 -218
- package/packages/components/{global-components/sh-tabs → sh-tabs}/index.vue +97 -34
- package/packages/components/{global-components/sh-tree → sh-tree}/components/table-tree.vue +1 -1
- package/packages/components/{global-components/sh-tree → sh-tree}/css/index.scss +1 -0
- package/packages/components/{global-components/sh-tree → sh-tree}/index.vue +16 -5
- package/packages/components/{global-components/sh-tree → sh-tree}/mixin/treeProps.js +1 -1
- package/packages/index.js +39 -39
- package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-week-box.vue +126 -126
- package/packages/{components/other-components → other}/sh-menu/index.vue +3 -0
- package/packages/{components/other-components → other}/sh-menu/menu-item-content.vue +3 -3
- package/packages/other/sh-preview/components/sh-excel.vue +163 -0
- package/packages/{components/other-components → other}/sh-preview/index.vue +92 -89
- package/packages/vxeTable/css/index.scss +1 -2
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +70 -63
- package/packages/components/global-components/sh-header/index.vue +0 -278
- package/packages/components/other-components/sh-preview/components/sh-excel.vue +0 -929
- /package/packages/components/{global-components/sh-calendar → sh-calendar}/index.vue +0 -0
- /package/packages/components/{global-components/sh-card → sh-card}/index.vue +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/index.vue +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/themes/dark.js +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/themes/dracula.js +0 -0
- /package/packages/components/{global-components/sh-code-editor → sh-code-editor}/themes/index.js +0 -0
- /package/packages/components/{global-components/sh-col → sh-col}/css/index.scss +0 -0
- /package/packages/components/{global-components/sh-col → sh-col}/index.vue +0 -0
- /package/packages/components/{global-components/sh-corner → sh-corner}/index.vue +0 -0
- /package/packages/components/{global-components/sh-count-to → sh-count-to}/index.vue +0 -0
- /package/packages/components/{global-components/sh-date → sh-date}/index.vue +0 -0
- /package/packages/components/{global-components/sh-drawer → sh-drawer}/scrollbar.js +0 -0
- /package/packages/components/{global-components/sh-empty → sh-empty}/index.vue +0 -0
- /package/packages/components/{global-components/sh-form → sh-form}/form.vue +0 -0
- /package/packages/components/{global-components/sh-form → sh-form}/js/props.js +0 -0
- /package/packages/components/{global-components/sh-form → sh-form}/query.vue +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/icons.scss +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.svg +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.ttf +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.woff +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/default/ionicons.woff2 +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.js +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.json +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.ttf +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.woff +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/iconfont.woff2 +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/font/icons.scss +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/css/index.scss +0 -0
- /package/packages/components/{global-components/sh-icon → sh-icon}/index.vue +0 -0
- /package/packages/components/{global-components/sh-image → sh-image}/index.vue +0 -0
- /package/packages/components/{global-components/sh-list → sh-list}/index.vue +0 -0
- /package/packages/components/{global-components/sh-loading → sh-loading}/index.vue +0 -0
- /package/packages/components/{global-components/sh-modal → sh-modal}/index.vue +0 -0
- /package/packages/components/{global-components/sh-noticebar → sh-noticebar}/index.vue +0 -0
- /package/packages/components/{global-components/sh-pull-refresh → sh-pull-refresh}/index.vue +0 -0
- /package/packages/components/{global-components/sh-result → sh-result}/index.vue +0 -0
- /package/packages/components/{global-components/sh-row → sh-row}/css/index.scss +0 -0
- /package/packages/components/{global-components/sh-row → sh-row}/index.vue +0 -0
- /package/packages/components/{global-components/sh-split → sh-split}/components/trigger.vue +0 -0
- /package/packages/components/{global-components/sh-split → sh-split}/index.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/components/importModal.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/components/sh-column.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/grid.vue +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/js/excel_to_json.js +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/js/props.js +0 -0
- /package/packages/components/{global-components/sh-table → sh-table}/js/tableMethods.js +0 -0
- /package/packages/components/{global-components/sh-tag → sh-tag}/index.vue +0 -0
- /package/packages/components/{global-components/sh-toolbar → sh-toolbar}/index.vue +0 -0
- /package/packages/components/{global-components/sh-upload → sh-upload}/index.vue +0 -0
- /package/packages/components/{global-components/sh-upload → sh-upload}/js/ajax.js +0 -0
- /package/packages/components/{global-components/sh-water-fall → sh-water-fall}/index.vue +0 -0
- /package/packages/components/{global-components/sh-water-mark → sh-water-mark}/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/components/cron-content.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/css/index.scss +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/mixin/cron-emits.js +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/mixin/cron-hooks.js +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/mixin/cron-props.js +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-day-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-hour-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-minute-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-month-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-second-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/tabs/cron-year-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-cron-modal/utils/index.js +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/langs/zh-Hans.js +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/content/default/content.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.inline.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.inline.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.mobile.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/content.mobile.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.mobile.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.mobile.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.shadowdom.css +0 -0
- /package/packages/{components/other-components → other}/sh-markdown/tinymce/skins/ui/oxide/skin.shadowdom.min.css +0 -0
- /package/packages/{components/other-components → other}/sh-menu/menu-group-content.vue +0 -0
- /package/packages/{components/other-components → other}/sh-menu-card/index.vue +0 -0
- /package/packages/{components/other-components → other}/sh-menu-card/menu-box.vue +0 -0
- /package/packages/{components/other-components → other}/sh-preview/components/sh-word.vue +0 -0
- /package/packages/{components/other-components → other}/sh-preview/js/data-hook.js +0 -0
- /package/packages/{components/other-components → other}/sh-preview/js/data-props.js +0 -0
- /package/packages/{components/other-components → other}/sh-system-tip/index.vue +0 -0
|
@@ -1,218 +1,217 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="tableWrapRef" class="sh-vxe-table" :class="{ 'sh-table-ghost': tableGlobalConfig.ghost }" :style="{ height: wrapHeight }">
|
|
3
|
-
<div v-if="isTopSlot" ref="topSlotRef" v-resize="handleResize" class="sh-table-top"><slot name="top"></slot></div>
|
|
4
|
-
<div v-if="isFormSlot" ref="formSlotRef" v-resize="handleResize" class="sh-table-form">
|
|
5
|
-
<slot name="form">
|
|
6
|
-
<sh-query v-bind="tableQueryConfig" @submit="onFormSubmit" @reset="onFormReset" @collapsed="onFormCollapsed" @edit-closed="onFormEditClosed">
|
|
7
|
-
<template #footLeft><slot name="formLeft"></slot></template>
|
|
8
|
-
<template #footRight><slot name="formRight"></slot></template>
|
|
9
|
-
</sh-query>
|
|
10
|
-
</slot>
|
|
11
|
-
</div>
|
|
12
|
-
<div v-if="isToolbarSlot" ref="toolbarSlotRef" v-resize="handleResize" class="sh-table-toolbar">
|
|
13
|
-
<slot name="toolbar">
|
|
14
|
-
<div class="sh-table-toolbar-wrap">
|
|
15
|
-
<div class="sh-table-toolbar-left">
|
|
16
|
-
<div v-if="tableGlobalConfig.title" class="sh-table-toolbar-item">
|
|
17
|
-
<h3 class="tableName">{{ tableGlobalConfig.tableName }}</h3>
|
|
18
|
-
</div>
|
|
19
|
-
<!--ps:全表搜索不支持反转-->
|
|
20
|
-
<div v-if="tableGlobalConfig.globalFilter" class="sh-table-toolbar-item">
|
|
21
|
-
<vxe-input v-model="tableFilterText" v-bind="tableFilterConfig" @blur="handleTableFilter" @clear="handleTableFilter" @search-click="handleTableFilter" />
|
|
22
|
-
<span v-if="tableFilterData">
|
|
23
|
-
共搜索到 <strong>{{ tableFilterData.length }}</strong> 条数据
|
|
24
|
-
</span>
|
|
25
|
-
</div>
|
|
26
|
-
<div v-if="slots.toolbarLeft" class="sh-table-toolbar-item">
|
|
27
|
-
<slot name="toolbarLeft"></slot>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="sh-table-toolbar-right">
|
|
31
|
-
<div v-if="slots.toolbarRight" class="sh-table-toolbar-item">
|
|
32
|
-
<slot name="toolbarRight"></slot>
|
|
33
|
-
</div>
|
|
34
|
-
<template v-for="(tool, toolIndex) in tableTools" :key="toolIndex">
|
|
35
|
-
<div class="sh-table-toolbar-item">
|
|
36
|
-
<vxe-button v-ripple :size="size" v-bind="tool" @click="handleTableTool(tool)"></vxe-button>
|
|
37
|
-
</div>
|
|
38
|
-
</template>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
</slot>
|
|
42
|
-
</div>
|
|
43
|
-
<div v-if="isHeadSlot" ref="headSlotRef" v-resize="handleResize" class="sh-table-head"><slot name="head"></slot></div>
|
|
44
|
-
<vxe-table
|
|
45
|
-
:id="id"
|
|
46
|
-
ref="tableRef"
|
|
47
|
-
:key="renderKey"
|
|
48
|
-
:class="{ 'is--hasfooter': showFooter }"
|
|
49
|
-
v-bind="tableBindConfig"
|
|
50
|
-
:height="tableHeight"
|
|
51
|
-
@current-change="onCurrentChange"
|
|
52
|
-
@radio-change="onRadioChange"
|
|
53
|
-
@checkbox-change="onSelectionChange"
|
|
54
|
-
@checkbox-all="onSelectionChange"
|
|
55
|
-
@checkbox-range-end="onSelectionChange"
|
|
56
|
-
@cell-click="onCellClick"
|
|
57
|
-
@cell-dblclick="onCellDblClick"
|
|
58
|
-
@header-cell-click="onHeaderCellClick"
|
|
59
|
-
@sort-change="onSortChange"
|
|
60
|
-
@filter-change="onFilterChange"
|
|
61
|
-
@toggle-row-expand="onToggleRowExpand"
|
|
62
|
-
@toggle-tree-expand="onToggleTreeExpand"
|
|
63
|
-
@edit-closed="onEditClosed"
|
|
64
|
-
@edit-actived="onEditActived"
|
|
65
|
-
@scroll="onScroll"
|
|
66
|
-
@custom="onCustom"
|
|
67
|
-
@toolbar-button-click="onToolbarButtonClick"
|
|
68
|
-
@toolbar-tool-click="onToolbarToolClick"
|
|
69
|
-
@option-click="handleGoptionClick">
|
|
70
|
-
<template v-if="customLayout">
|
|
71
|
-
<slot></slot>
|
|
72
|
-
</template>
|
|
73
|
-
<template v-else>
|
|
74
|
-
<template v-for="(column, columnIndex) in tablePrevColumns" :key="columnIndex">
|
|
75
|
-
<vxe-column v-bind="column"></vxe-column>
|
|
76
|
-
</template>
|
|
77
|
-
<template v-for="(column, columnIndex) in columns" :key="columnIndex">
|
|
78
|
-
<sh-column :column="column"></sh-column>
|
|
79
|
-
</template>
|
|
80
|
-
</template>
|
|
81
|
-
<template #empty>
|
|
82
|
-
<sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
|
|
83
|
-
</template>
|
|
84
|
-
</vxe-table>
|
|
85
|
-
<div v-if="isFootSlot" ref="footSlotRef" v-resize="handleResize" class="sh-table-foot"><slot name="foot"></slot></div>
|
|
86
|
-
<div v-if="isPagerSlot" ref="pagerSlotRef" v-resize="handleResize" class="sh-table-pager">
|
|
87
|
-
<vxe-pager ref="pagerSlotRef" v-bind="tablePagerConfig" @page-change="onPageChange">
|
|
88
|
-
<template #pagerLeft>
|
|
89
|
-
<div v-if="selectionRows.length" class="sh-table-footer-info">
|
|
90
|
-
已选择 <strong>{{ selectionRows.length }}</strong> 项
|
|
91
|
-
</div>
|
|
92
|
-
<slot name="pagerLeft"></slot>
|
|
93
|
-
</template>
|
|
94
|
-
<template #pagerRight>
|
|
95
|
-
<slot name="pagerRight"></slot>
|
|
96
|
-
</template>
|
|
97
|
-
</vxe-pager>
|
|
98
|
-
</div>
|
|
99
|
-
<div v-if="isBottomSlot" ref="bottomSlotRef" v-resize="handleResize" class="sh-table-bottom"><slot name="bottom"></slot></div>
|
|
100
|
-
<!--导入弹窗-->
|
|
101
|
-
<importModal v-if="importBindConfig.modalConfig.modelValue" v-bind="importBindConfig" @confirm="setImportData"></importModal>
|
|
102
|
-
</div>
|
|
103
|
-
</template>
|
|
104
|
-
|
|
105
|
-
<script>
|
|
106
|
-
import { computed, defineComponent, getCurrentInstance, provide, ref, reactive } from 'vue'
|
|
107
|
-
import './css/index.scss'
|
|
108
|
-
|
|
109
|
-
import props from './js/props'
|
|
110
|
-
import shColumn from './components/sh-column.vue'
|
|
111
|
-
import importModal from './components/importModal.vue'
|
|
112
|
-
import useTable from './js/useTable'
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
'
|
|
125
|
-
'
|
|
126
|
-
'
|
|
127
|
-
'cell-
|
|
128
|
-
'cell-
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
'
|
|
132
|
-
'toggle-
|
|
133
|
-
'
|
|
134
|
-
'edit-
|
|
135
|
-
'
|
|
136
|
-
'
|
|
137
|
-
'
|
|
138
|
-
'
|
|
139
|
-
'toolbar-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
'form-
|
|
143
|
-
'form-
|
|
144
|
-
'form-
|
|
145
|
-
'
|
|
146
|
-
'
|
|
147
|
-
'
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const {
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
const
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
let
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="tableWrapRef" class="sh-vxe-table" :class="{ 'sh-table-ghost': tableGlobalConfig.ghost, 'is--loading': tableBindConfig.loading }" :style="{ height: wrapHeight }">
|
|
3
|
+
<div v-if="isTopSlot" ref="topSlotRef" v-resize="handleResize" class="sh-table-top"><slot name="top"></slot></div>
|
|
4
|
+
<div v-if="isFormSlot" ref="formSlotRef" v-resize="handleResize" class="sh-table-form">
|
|
5
|
+
<slot name="form">
|
|
6
|
+
<sh-query v-bind="tableQueryConfig" @submit="onFormSubmit" @reset="onFormReset" @collapsed="onFormCollapsed" @edit-closed="onFormEditClosed">
|
|
7
|
+
<template #footLeft><slot name="formLeft"></slot></template>
|
|
8
|
+
<template #footRight><slot name="formRight"></slot></template>
|
|
9
|
+
</sh-query>
|
|
10
|
+
</slot>
|
|
11
|
+
</div>
|
|
12
|
+
<div v-if="isToolbarSlot" ref="toolbarSlotRef" v-resize="handleResize" class="sh-table-toolbar">
|
|
13
|
+
<slot name="toolbar">
|
|
14
|
+
<div class="sh-table-toolbar-wrap">
|
|
15
|
+
<div class="sh-table-toolbar-left">
|
|
16
|
+
<div v-if="tableGlobalConfig.title" class="sh-table-toolbar-item">
|
|
17
|
+
<h3 class="tableName">{{ tableGlobalConfig.tableName }}</h3>
|
|
18
|
+
</div>
|
|
19
|
+
<!--ps:全表搜索不支持反转-->
|
|
20
|
+
<div v-if="tableGlobalConfig.globalFilter" class="sh-table-toolbar-item">
|
|
21
|
+
<vxe-input v-model="tableFilterText" v-bind="tableFilterConfig" @blur="handleTableFilter" @clear="handleTableFilter" @search-click="handleTableFilter" />
|
|
22
|
+
<span v-if="tableFilterData">
|
|
23
|
+
共搜索到 <strong>{{ tableFilterData.length }}</strong> 条数据
|
|
24
|
+
</span>
|
|
25
|
+
</div>
|
|
26
|
+
<div v-if="slots.toolbarLeft" class="sh-table-toolbar-item">
|
|
27
|
+
<slot name="toolbarLeft"></slot>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="sh-table-toolbar-right">
|
|
31
|
+
<div v-if="slots.toolbarRight" class="sh-table-toolbar-item">
|
|
32
|
+
<slot name="toolbarRight"></slot>
|
|
33
|
+
</div>
|
|
34
|
+
<template v-for="(tool, toolIndex) in tableTools" :key="toolIndex">
|
|
35
|
+
<div class="sh-table-toolbar-item">
|
|
36
|
+
<vxe-button v-ripple :size="size" v-bind="tool" @click="handleTableTool(tool)"></vxe-button>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</slot>
|
|
42
|
+
</div>
|
|
43
|
+
<div v-if="isHeadSlot" ref="headSlotRef" v-resize="handleResize" class="sh-table-head"><slot name="head"></slot></div>
|
|
44
|
+
<vxe-table
|
|
45
|
+
:id="id"
|
|
46
|
+
ref="tableRef"
|
|
47
|
+
:key="renderKey"
|
|
48
|
+
:class="{ 'is--hasfooter': showFooter }"
|
|
49
|
+
v-bind="tableBindConfig"
|
|
50
|
+
:height="tableHeight"
|
|
51
|
+
@current-change="onCurrentChange"
|
|
52
|
+
@radio-change="onRadioChange"
|
|
53
|
+
@checkbox-change="onSelectionChange"
|
|
54
|
+
@checkbox-all="onSelectionChange"
|
|
55
|
+
@checkbox-range-end="onSelectionChange"
|
|
56
|
+
@cell-click="onCellClick"
|
|
57
|
+
@cell-dblclick="onCellDblClick"
|
|
58
|
+
@header-cell-click="onHeaderCellClick"
|
|
59
|
+
@sort-change="onSortChange"
|
|
60
|
+
@filter-change="onFilterChange"
|
|
61
|
+
@toggle-row-expand="onToggleRowExpand"
|
|
62
|
+
@toggle-tree-expand="onToggleTreeExpand"
|
|
63
|
+
@edit-closed="onEditClosed"
|
|
64
|
+
@edit-actived="onEditActived"
|
|
65
|
+
@scroll="onScroll"
|
|
66
|
+
@custom="onCustom"
|
|
67
|
+
@toolbar-button-click="onToolbarButtonClick"
|
|
68
|
+
@toolbar-tool-click="onToolbarToolClick"
|
|
69
|
+
@option-click="handleGoptionClick">
|
|
70
|
+
<template v-if="customLayout">
|
|
71
|
+
<slot></slot>
|
|
72
|
+
</template>
|
|
73
|
+
<template v-else>
|
|
74
|
+
<template v-for="(column, columnIndex) in tablePrevColumns" :key="columnIndex">
|
|
75
|
+
<vxe-column v-bind="column"></vxe-column>
|
|
76
|
+
</template>
|
|
77
|
+
<template v-for="(column, columnIndex) in columns" :key="columnIndex">
|
|
78
|
+
<sh-column :column="column"></sh-column>
|
|
79
|
+
</template>
|
|
80
|
+
</template>
|
|
81
|
+
<template #empty>
|
|
82
|
+
<sh-empty :icon="emptyIcon" :content="emptyText"></sh-empty>
|
|
83
|
+
</template>
|
|
84
|
+
</vxe-table>
|
|
85
|
+
<div v-if="isFootSlot" ref="footSlotRef" v-resize="handleResize" class="sh-table-foot"><slot name="foot"></slot></div>
|
|
86
|
+
<div v-if="isPagerSlot" ref="pagerSlotRef" v-resize="handleResize" class="sh-table-pager">
|
|
87
|
+
<vxe-pager ref="pagerSlotRef" v-bind="tablePagerConfig" @page-change="onPageChange">
|
|
88
|
+
<template #pagerLeft>
|
|
89
|
+
<div v-if="selectionRows.length" class="sh-table-footer-info">
|
|
90
|
+
已选择 <strong>{{ selectionRows.length }}</strong> 项
|
|
91
|
+
</div>
|
|
92
|
+
<slot name="pagerLeft"></slot>
|
|
93
|
+
</template>
|
|
94
|
+
<template #pagerRight>
|
|
95
|
+
<slot name="pagerRight"></slot>
|
|
96
|
+
</template>
|
|
97
|
+
</vxe-pager>
|
|
98
|
+
</div>
|
|
99
|
+
<div v-if="isBottomSlot" ref="bottomSlotRef" v-resize="handleResize" class="sh-table-bottom"><slot name="bottom"></slot></div>
|
|
100
|
+
<!--导入弹窗-->
|
|
101
|
+
<importModal v-if="importBindConfig.modalConfig.modelValue" v-bind="importBindConfig" @confirm="setImportData"></importModal>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<script>
|
|
106
|
+
import { computed, defineComponent, getCurrentInstance, provide, ref, reactive } from 'vue'
|
|
107
|
+
import './css/index.scss'
|
|
108
|
+
|
|
109
|
+
import props from './js/props'
|
|
110
|
+
import shColumn from './components/sh-column.vue'
|
|
111
|
+
import importModal from './components/importModal.vue'
|
|
112
|
+
import useTable from './js/useTable'
|
|
113
|
+
export default defineComponent({
|
|
114
|
+
name: 'ShTable',
|
|
115
|
+
components: {
|
|
116
|
+
shColumn,
|
|
117
|
+
importModal
|
|
118
|
+
},
|
|
119
|
+
props: {
|
|
120
|
+
...props
|
|
121
|
+
},
|
|
122
|
+
emits: [
|
|
123
|
+
'current-change',
|
|
124
|
+
'radio-change',
|
|
125
|
+
'selection-change',
|
|
126
|
+
'cell-click',
|
|
127
|
+
'cell-dblclick',
|
|
128
|
+
'header-cell-click',
|
|
129
|
+
'sort-change',
|
|
130
|
+
'filter-change',
|
|
131
|
+
'toggle-row-expand',
|
|
132
|
+
'toggle-tree-expand',
|
|
133
|
+
'edit-closed',
|
|
134
|
+
'edit-actived',
|
|
135
|
+
'scroll',
|
|
136
|
+
'custom',
|
|
137
|
+
'page-change',
|
|
138
|
+
'toolbar-button-click',
|
|
139
|
+
'toolbar-tool-click',
|
|
140
|
+
|
|
141
|
+
'form-submit',
|
|
142
|
+
'form-reset',
|
|
143
|
+
'form-edit-closed',
|
|
144
|
+
'form-submit-invalid',
|
|
145
|
+
'import-confirm',
|
|
146
|
+
'globaloption',
|
|
147
|
+
'toolbaroption'
|
|
148
|
+
],
|
|
149
|
+
setup(props, context) {
|
|
150
|
+
const { proxy } = getCurrentInstance()
|
|
151
|
+
const { emit, slots } = context
|
|
152
|
+
const tableWrapRef = ref()
|
|
153
|
+
const topSlotRef = ref()
|
|
154
|
+
const formSlotRef = ref()
|
|
155
|
+
const toolbarSlotRef = ref()
|
|
156
|
+
const headSlotRef = ref()
|
|
157
|
+
const footSlotRef = ref()
|
|
158
|
+
const pagerSlotRef = ref()
|
|
159
|
+
const bottomSlotRef = ref()
|
|
160
|
+
const tableHeight = ref(props.height)
|
|
161
|
+
|
|
162
|
+
const useTableHooks = useTable(props, context, proxy)
|
|
163
|
+
|
|
164
|
+
const isTopSlot = computed(() => Boolean(slots.top))
|
|
165
|
+
const isFormSlot = computed(() => useTableHooks.tableGlobalConfig.value.search || Boolean(slots.form))
|
|
166
|
+
const isToolbarSlot = computed(() => {
|
|
167
|
+
const { title, globalFilter } = useTableHooks.tableGlobalConfig.value
|
|
168
|
+
return title || globalFilter || slots.toolbar || slots.toolbarLeft || slots.toolbarRight || useTableHooks.tableTools.value.length
|
|
169
|
+
})
|
|
170
|
+
const isHeadSlot = computed(() => Boolean(slots.head))
|
|
171
|
+
const isFootSlot = computed(() => Boolean(slots.foot))
|
|
172
|
+
const isPagerSlot = computed(() => useTableHooks.tablePagerConfig.value.enabled)
|
|
173
|
+
const isBottomSlot = computed(() => Boolean(slots.bottom))
|
|
174
|
+
|
|
175
|
+
provide(
|
|
176
|
+
'ShTableInstance',
|
|
177
|
+
reactive({
|
|
178
|
+
columnObjConfig: useTableHooks.tableColumnObjConfig,
|
|
179
|
+
turnColumnItemFilters: useTableHooks.turnColumnItemFilters,
|
|
180
|
+
slots: useTableHooks.slots
|
|
181
|
+
})
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
const handleResize = e => {
|
|
185
|
+
if (useTableHooks.wrapHeight.value === 'auto') return
|
|
186
|
+
let slotRefs = [topSlotRef, formSlotRef, toolbarSlotRef, headSlotRef, footSlotRef, pagerSlotRef, bottomSlotRef]
|
|
187
|
+
let otherHeight = 0
|
|
188
|
+
let parentHeight = tableWrapRef.value?.offsetHeight
|
|
189
|
+
slotRefs.forEach(slotRef => {
|
|
190
|
+
otherHeight += slotRef.value?.offsetHeight || 0
|
|
191
|
+
})
|
|
192
|
+
tableHeight.value = parentHeight - otherHeight
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
...useTableHooks,
|
|
197
|
+
tableWrapRef,
|
|
198
|
+
topSlotRef,
|
|
199
|
+
formSlotRef,
|
|
200
|
+
toolbarSlotRef,
|
|
201
|
+
headSlotRef,
|
|
202
|
+
footSlotRef,
|
|
203
|
+
pagerSlotRef,
|
|
204
|
+
bottomSlotRef,
|
|
205
|
+
tableHeight,
|
|
206
|
+
isTopSlot,
|
|
207
|
+
isFormSlot,
|
|
208
|
+
isToolbarSlot,
|
|
209
|
+
isHeadSlot,
|
|
210
|
+
isFootSlot,
|
|
211
|
+
isPagerSlot,
|
|
212
|
+
isBottomSlot,
|
|
213
|
+
handleResize
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
</script>
|