@aochuang/common 1.0.0 → 1.0.1
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/common/loading/index.js +7 -0
- package/common/loading/loading.vue +71 -0
- package/common/tips/index.js +7 -0
- package/common/tips/tips.vue +82 -0
- package/common/tooltip/index.js +7 -0
- package/common/tooltip/popper.js +18 -0
- package/common/tooltip/tooltip.vue +55 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-boolean.vue +33 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date-range.vue +30 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime-range.vue +34 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number-range.vue +67 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number.vue +35 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-string.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-value.vue +73 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item.vue +226 -0
- package/components/advanced-filter/advanced-filter-condition-toggle.vue +112 -0
- package/components/advanced-filter/advanced-filter-condition.vue +352 -0
- package/components/advanced-filter/advanced-filter-permanent-item.vue +10 -0
- package/components/advanced-filter/advanced-filter-permanent.vue +10 -0
- package/components/advanced-filter/advanced-filter-scene-form.vue +95 -0
- package/components/advanced-filter/advanced-filter-scene-item.vue +64 -0
- package/components/advanced-filter/advanced-filter-scene-manage.vue +264 -0
- package/components/advanced-filter/advanced-filter-scene-transfer.vue +283 -0
- package/components/advanced-filter/advanced-filter-scene.vue +199 -0
- package/components/advanced-filter/advanced-filter.vue +114 -0
- package/components/advanced-filter/index.js +36 -0
- package/components/advanced-filter/utils.js +132 -0
- package/components/autocomplete/autocomplete.vue +121 -0
- package/components/autocomplete/index.js +7 -0
- package/components/avatar/avatar.png +0 -0
- package/components/avatar/avatar.vue +212 -0
- package/components/avatar/index.js +7 -0
- package/components/brick-wall/brick-wall-skeleton.vue +125 -0
- package/components/brick-wall/brick-wall.vue +293 -0
- package/components/brick-wall/index.js +7 -0
- package/components/button/button.vue +537 -0
- package/components/button/index.js +7 -0
- package/components/button/utils.js +20 -0
- package/components/cascader/cascader.vue +184 -0
- package/components/cascader/index.js +7 -0
- package/components/cascader/util.js +50 -0
- package/components/checkbox/checkbox.vue +114 -0
- package/components/checkbox/index.js +7 -0
- package/components/checkbox-button/index.js +8 -0
- package/components/checkbox-group/checkbox-group.vue +11 -0
- package/components/checkbox-group/index.js +7 -0
- package/components/date-picker/date-picker.vue +300 -0
- package/components/date-picker/index.js +7 -0
- package/components/dialog/dialog.vue +182 -0
- package/components/dialog/index.js +14 -0
- package/components/dialog/utils.js +20 -0
- package/components/drawer/drawer.vue +186 -0
- package/components/drawer/index.js +14 -0
- package/components/drawer/utils.js +36 -0
- package/components/dropdown/dropdown-item.vue +63 -0
- package/components/dropdown/dropdown.vue +286 -0
- package/components/dropdown/index.js +16 -0
- package/components/empty/empty.vue +62 -0
- package/components/empty/index.js +7 -0
- package/components/filter/filter-group.vue +44 -0
- package/components/filter/filter-item.vue +122 -0
- package/components/filter/filter-more.vue +114 -0
- package/components/filter/filter.vue +407 -0
- package/components/filter/index.js +20 -0
- package/components/filter/refresh-line.svg +1 -0
- package/components/filter/util.js +5 -0
- package/components/form/form-cell.vue +231 -0
- package/components/form/form-group.vue +147 -0
- package/components/form/form-row.vue +51 -0
- package/components/form/form.vue +256 -0
- package/components/form/index.js +13 -0
- package/components/grid/grid-card-view/grid-card-view.vue +157 -0
- package/components/grid/grid-column.vue +136 -0
- package/components/grid/grid-filter/grid-filter-group.vue +41 -0
- package/components/grid/grid-filter/grid-filter-item.vue +68 -0
- package/components/grid/grid-filter/grid-filter.vue +115 -0
- package/components/grid/grid-filter/util.js +7 -0
- package/components/grid/grid-filter-operate/grid-filter-operate-item.vue +55 -0
- package/components/grid/grid-filter-operate/grid-filter-operate.vue +46 -0
- package/components/grid/grid-sort/grid-sort-proxy.js +27 -0
- package/components/grid/grid-sort/grid-sort.vue +205 -0
- package/components/grid/grid-sort/icons/asc.png +0 -0
- package/components/grid/grid-sort/icons/desc.png +0 -0
- package/components/grid/grid-sort/index.js +7 -0
- package/components/grid/grid-table-view/grid-table-view.vue +178 -0
- package/components/grid/grid-table.vue +547 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar.vue +129 -0
- package/components/grid/grid-toolbar/grid-global-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-global-toolbar.vue +37 -0
- package/components/grid/grid-toolbar/grid-more-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-more-toolbar.vue +138 -0
- package/components/grid/grid-toolbar/grid-row-toolbar.vue +279 -0
- package/components/grid/grid-view-select.vue +78 -0
- package/components/grid/grid.vue +1102 -0
- package/components/grid/icons/more-line.svg +1 -0
- package/components/grid/icons/refresh.svg +14 -0
- package/components/grid/index.js +61 -0
- package/components/grid/util.js +31 -0
- package/components/icon/demo.css +539 -0
- package/components/icon/demo_index.html +7433 -0
- package/components/icon/icon.vue +96 -0
- package/components/icon/iconfont.css +1275 -0
- package/components/icon/iconfont.eot +0 -0
- package/components/icon/iconfont.js +1 -0
- package/components/icon/iconfont.json +2214 -0
- package/components/icon/iconfont.svg +455 -0
- package/components/icon/iconfont.ttf +0 -0
- package/components/icon/iconfont.woff +0 -0
- package/components/icon/iconfont.woff2 +0 -0
- package/components/icon/index.js +7 -0
- package/components/image/image.vue +299 -0
- package/components/image/index.js +12 -0
- package/components/image/util.js +26 -0
- package/components/index.js +153 -0
- package/components/loading/index.js +7 -0
- package/components/loading/loading.vue +130 -0
- package/components/menu/index.js +14 -0
- package/components/menu/menu-group.vue +240 -0
- package/components/menu/menu-item.vue +215 -0
- package/components/menu/menu.vue +64 -0
- package/components/message/index.js +19 -0
- package/components/message/message.js +28 -0
- package/components/message/message.less +6 -0
- package/components/message-box/index.js +10 -0
- package/components/message-box/message-box.js +140 -0
- package/components/message-box/message-box.less +5 -0
- package/components/pagination/index.js +7 -0
- package/components/pagination/pagination.vue +193 -0
- package/components/panel/index.js +7 -0
- package/components/panel/panel.vue +44 -0
- package/components/popover/index.js +7 -0
- package/components/popover/popover.vue +140 -0
- package/components/popup-select/index.js +7 -0
- package/components/popup-select/popup-select.vue +114 -0
- package/components/radio/index.js +7 -0
- package/components/radio/radio.vue +92 -0
- package/components/radio-button/index.js +7 -0
- package/components/radio-button/radio-button.vue +20 -0
- package/components/radio-group/index.js +7 -0
- package/components/radio-group/radio-group.vue +22 -0
- package/components/searchbox/index.js +7 -0
- package/components/searchbox/searchbox.vue +260 -0
- package/components/select/index.js +9 -0
- package/components/select/select-load-more.vue +53 -0
- package/components/select/select.vue +572 -0
- package/components/skeleton/index.js +14 -0
- package/components/skeleton/skeleton-rows.vue +52 -0
- package/components/skeleton/skeleton.vue +72 -0
- package/components/sortable/index.js +9 -0
- package/components/sortable/sortable-item.vue +77 -0
- package/components/sortable/sortable.vue +62 -0
- package/components/spinner/index.js +7 -0
- package/components/spinner/spinner.vue +121 -0
- package/components/spinner-range/index.js +7 -0
- package/components/spinner-range/spinner-range.vue +97 -0
- package/components/spinner-textarea/index.js +7 -0
- package/components/spinner-textarea/spinner-textarea.vue +65 -0
- package/components/switch/index.js +7 -0
- package/components/switch/switch.vue +105 -0
- package/components/tabs/index.js +10 -0
- package/components/tabs/tabs.vue +115 -0
- package/components/tag/index.js +9 -0
- package/components/tag/tag.less +30 -0
- package/components/text/index.js +7 -0
- package/components/text/text.vue +69 -0
- package/components/textarea/index.js +7 -0
- package/components/textarea/textarea.vue +229 -0
- package/components/textbox/index.js +7 -0
- package/components/textbox/textbox.vue +275 -0
- package/components/time-picker/index.js +7 -0
- package/components/time-picker/time-picker.vue +77 -0
- package/components/toolbar/index.js +14 -0
- package/components/toolbar/toolbar-item.vue +43 -0
- package/components/toolbar/toolbar.vue +81 -0
- package/components/tooltip/index.js +9 -0
- package/components/tooltip/tooltip.vue +86 -0
- package/components/transfer/index.js +7 -0
- package/components/transfer/transfer-load-more.vue +53 -0
- package/components/transfer/transfer.vue +245 -0
- package/components/tree/index.js +7 -0
- package/components/tree/tree.vue +326 -0
- package/components/tree/utils.js +122 -0
- package/components/video/index.js +7 -0
- package/components/video/video.vue +53 -0
- package/package.json +4 -1
- package/utils/date.js +55 -0
- package/utils/emitter.js +3 -0
- package/utils/json.js +19 -0
- package/utils/resize-event.js +35 -0
- package/utils/util.js +12 -0
- package/utils/utils.js +0 -0
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="ui-grid"
|
|
4
|
+
:class="[currentViewName ? ('ui-grid-view--' + currentViewName) : '']"
|
|
5
|
+
:style="gridStyle"
|
|
6
|
+
>
|
|
7
|
+
<div v-if="ready && showWrap" ref="wrap" class="ui-grid__wrap">
|
|
8
|
+
<div ref="header" class="ui-grid__header">
|
|
9
|
+
<div class="ui-grid__filter">
|
|
10
|
+
<ui-filter ref="filter" v-model="filterPropsValue" :ready="filterReady" :imediate="imediate" :tableLoading="tableLoading" @change="handleFilterChange">
|
|
11
|
+
<template v-if="simpleFilterGroups && simpleFilterGroups.length">
|
|
12
|
+
<ui-filter-group
|
|
13
|
+
v-for="group in simpleFilterGroups"
|
|
14
|
+
:key="group.id"
|
|
15
|
+
v-bind="group.props"
|
|
16
|
+
>
|
|
17
|
+
<template v-if="group.children && group.children.length">
|
|
18
|
+
<ui-filter-item
|
|
19
|
+
v-for="item in group.children"
|
|
20
|
+
:key="item.id"
|
|
21
|
+
class="ui-grid__filter-item"
|
|
22
|
+
v-bind="item.props"
|
|
23
|
+
>
|
|
24
|
+
<component :is="handleRenderFilterItem(item)" :data-key="item.data && item.data.key"></component>
|
|
25
|
+
</ui-filter-item>
|
|
26
|
+
</template>
|
|
27
|
+
</ui-filter-group>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-if="simpleFilterNotGroupItems && simpleFilterNotGroupItems.length">
|
|
30
|
+
<ui-filter-item
|
|
31
|
+
v-for="item in simpleFilterNotGroupItems"
|
|
32
|
+
:key="item.id"
|
|
33
|
+
class="ui-grid__filter-item"
|
|
34
|
+
v-bind="item.props"
|
|
35
|
+
>
|
|
36
|
+
<component :is="handleRenderFilterItem(item)" :data-key="item.data && item.data.key"></component>
|
|
37
|
+
</ui-filter-item>
|
|
38
|
+
</template>
|
|
39
|
+
<ui-filter-item v-if="filterOperateProps && filterOperateProps.items && filterOperateProps.items.length">
|
|
40
|
+
<ui-dropdown
|
|
41
|
+
label="按搜索条件"
|
|
42
|
+
:loading="tableLoading"
|
|
43
|
+
>
|
|
44
|
+
<ui-dropdown-item
|
|
45
|
+
v-for="item in filterOperateProps.items"
|
|
46
|
+
:key="item.id"
|
|
47
|
+
:label="item.props.label"
|
|
48
|
+
:value="item.props.value"
|
|
49
|
+
:divided="item.props.divided"
|
|
50
|
+
:icon="item.props.icon"
|
|
51
|
+
:type="item.props.type"
|
|
52
|
+
@click="handleFilterOperateItemClick(item)"
|
|
53
|
+
></ui-dropdown-item>
|
|
54
|
+
</ui-dropdown>
|
|
55
|
+
</ui-filter-item>
|
|
56
|
+
</ui-filter>
|
|
57
|
+
</div>
|
|
58
|
+
<div class="ui-grid__global">
|
|
59
|
+
<div v-if="globalToolbarProps && globalToolbarProps.items && globalToolbarProps.items.length" class="ui-grid__global-toolbar">
|
|
60
|
+
<grid-global-toolbar
|
|
61
|
+
v-bind="globalToolbarProps"
|
|
62
|
+
></grid-global-toolbar>
|
|
63
|
+
</div>
|
|
64
|
+
<div v-if="viewPanelData && viewPanelData.length" class="ui-grid__views">
|
|
65
|
+
<grid-view-select
|
|
66
|
+
:current="currentViewName"
|
|
67
|
+
:items="viewPanelData"
|
|
68
|
+
@change="handleViewPanelChange"
|
|
69
|
+
></grid-view-select>
|
|
70
|
+
</div>
|
|
71
|
+
<div v-if="sortProps && sortProps.items && sortProps.items.length" class="ui-grid__sort">
|
|
72
|
+
<grid-sort
|
|
73
|
+
v-bind="sortProps"
|
|
74
|
+
@change="handleBealoneSortChange"
|
|
75
|
+
></grid-sort>
|
|
76
|
+
</div>
|
|
77
|
+
<div v-if="moreToolbarProps && moreToolbarProps.items && moreToolbarProps.items.length" class="ui-grid__more-toolbar">
|
|
78
|
+
<grid-more-toolbar
|
|
79
|
+
v-bind="moreToolbarProps"
|
|
80
|
+
></grid-more-toolbar>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div v-if="showBatchToolbar" ref="batch" class="ui-grid__batch">
|
|
86
|
+
<div class="ui-grid__batch-inner">
|
|
87
|
+
<grid-batch-toolbar
|
|
88
|
+
:data="tableData"
|
|
89
|
+
:selecteds="selecteds"
|
|
90
|
+
v-bind="batchToolbarProps"
|
|
91
|
+
@clear-selection="handleClearSelection"
|
|
92
|
+
@batch-success="handleBatchSuccess"
|
|
93
|
+
></grid-batch-toolbar>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<template v-if="!enableMultipleView">
|
|
97
|
+
<div class="ui-grid__table" :style="tableStyle">
|
|
98
|
+
<grid-table
|
|
99
|
+
ref="table"
|
|
100
|
+
:row-height="rowHeight"
|
|
101
|
+
:key="tableKey"
|
|
102
|
+
:default-sort="defaultSort"
|
|
103
|
+
:show-index="showIndex"
|
|
104
|
+
:border="border"
|
|
105
|
+
:id-field="innerIdField"
|
|
106
|
+
:parent-field="parentField"
|
|
107
|
+
:multiple="innerMultiple"
|
|
108
|
+
:selectable="innerSelectable"
|
|
109
|
+
:data="tableData"
|
|
110
|
+
:height="tableHeight"
|
|
111
|
+
:row-class-name="rowClassName"
|
|
112
|
+
:max-height="tableMaxHeight"
|
|
113
|
+
:empty-text="emptyText"
|
|
114
|
+
:show-summary="showSummary"
|
|
115
|
+
:show-pagination="showPagination"
|
|
116
|
+
:page-index="tablePageIndex"
|
|
117
|
+
:page-size="tablePageSize"
|
|
118
|
+
:remote-sort="remoteSort"
|
|
119
|
+
:show-header="showHeader"
|
|
120
|
+
:row-check-method="rowCheckMethod"
|
|
121
|
+
:row-visible-method="rowVisibleMethod"
|
|
122
|
+
:check-strictly="checkStrictly"
|
|
123
|
+
:selectable-all="selectableAll"
|
|
124
|
+
@loaded="handleDataLoaded"
|
|
125
|
+
@selection-change="handleSelectionChange"
|
|
126
|
+
@select-change="handleSelectChange"
|
|
127
|
+
@sort-change="handleTableSortChange"
|
|
128
|
+
@column-resize-change="handleColumnResizeChange"
|
|
129
|
+
@hover-row-change="handleHoverRowChange"
|
|
130
|
+
@hook:mounted="handleTableMounted"
|
|
131
|
+
>
|
|
132
|
+
<slot></slot>
|
|
133
|
+
<vxe-column
|
|
134
|
+
v-if="rowToolbar && rowToolbar.length"
|
|
135
|
+
title="操作"
|
|
136
|
+
fixed="right"
|
|
137
|
+
field="__rowToolbar"
|
|
138
|
+
:width="rowToolbarWidth"
|
|
139
|
+
>
|
|
140
|
+
<template slot-scope="{ row, $rowIndex }">
|
|
141
|
+
<grid-row-toolbar :row="row" :row-index="$rowIndex" :items="rowToolbar"></grid-row-toolbar>
|
|
142
|
+
</template>
|
|
143
|
+
</vxe-column>
|
|
144
|
+
<slot name="append"></slot>
|
|
145
|
+
</grid-table>
|
|
146
|
+
<transition>
|
|
147
|
+
<div
|
|
148
|
+
v-if="tableLoading"
|
|
149
|
+
class="ui-grid__loading"
|
|
150
|
+
>
|
|
151
|
+
<ui-loading type="primary" size="medium"></ui-loading>
|
|
152
|
+
</div>
|
|
153
|
+
</transition>
|
|
154
|
+
<slot name="outer"></slot>
|
|
155
|
+
</div>
|
|
156
|
+
</template>
|
|
157
|
+
<template v-else>
|
|
158
|
+
<div class="ui-grid__content">
|
|
159
|
+
<slot></slot>
|
|
160
|
+
<transition>
|
|
161
|
+
<div
|
|
162
|
+
v-if="tableLoading"
|
|
163
|
+
class="ui-grid__loading"
|
|
164
|
+
>
|
|
165
|
+
<ui-loading type="primary" size="medium"></ui-loading>
|
|
166
|
+
</div>
|
|
167
|
+
</transition>
|
|
168
|
+
</div>
|
|
169
|
+
</template>
|
|
170
|
+
<div v-if="showPagination" ref="pagination" class="ui-grid__pagination">
|
|
171
|
+
<div class="ui-grid__pagination-inner">
|
|
172
|
+
<div class="ui-grid__pagination-check" v-if="!selectable && innerMultiple">
|
|
173
|
+
<span
|
|
174
|
+
class="ui-grid__pagination-check-input"
|
|
175
|
+
@click.stop
|
|
176
|
+
>
|
|
177
|
+
<vex-checkbox
|
|
178
|
+
:value="innerCheckAll"
|
|
179
|
+
:indeterminate="innerIndeterminate"
|
|
180
|
+
@input="handleCheckAllChange"
|
|
181
|
+
>全选 / 已选中{{ selecteds.length }}项</vex-checkbox>
|
|
182
|
+
</span>
|
|
183
|
+
</div>
|
|
184
|
+
<div class="ui-grid__pagination-control">
|
|
185
|
+
<ui-pagination
|
|
186
|
+
:page-index="tablePageIndex"
|
|
187
|
+
:page-size="tablePageSize"
|
|
188
|
+
:total="tableTotal"
|
|
189
|
+
:title="title"
|
|
190
|
+
:allow-select-page-size="allowSelectPageSize"
|
|
191
|
+
:showPrevOrNext="showPrevOrNext"
|
|
192
|
+
@page-change="handlePageChange"
|
|
193
|
+
>
|
|
194
|
+
</ui-pagination>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</template>
|
|
200
|
+
<script>
|
|
201
|
+
import { Filter, FilterGroup, FilterItem } from '../filter'
|
|
202
|
+
import GridTable from './grid-table'
|
|
203
|
+
import GridColumn from './grid-column.vue'
|
|
204
|
+
import GridRowToolbar from './grid-toolbar/grid-row-toolbar'
|
|
205
|
+
import GridGlobalToolbar from './grid-toolbar/grid-global-toolbar'
|
|
206
|
+
import GridBatchToolbar from './grid-toolbar/grid-batch-toolbar'
|
|
207
|
+
import GridMoreToolbar from './grid-toolbar/grid-more-toolbar'
|
|
208
|
+
import GridViewSelect from './grid-view-select'
|
|
209
|
+
import GridTableView from './grid-table-view/grid-table-view'
|
|
210
|
+
import GridCardView from './grid-card-view/grid-card-view'
|
|
211
|
+
import { Dropdown, DropdownItem } from '../dropdown'
|
|
212
|
+
import { GridSort } from './grid-sort'
|
|
213
|
+
import Pagination from '../pagination'
|
|
214
|
+
import Loading from '../loading'
|
|
215
|
+
import { Checkbox as VexCheckbox, Column } from 'vxe-table'
|
|
216
|
+
import { dispatch, getStorage, setStorage } from './util'
|
|
217
|
+
import { addResizeListener, removeResizeListener } from '../../utils/resize-event'
|
|
218
|
+
|
|
219
|
+
export default {
|
|
220
|
+
name: 'UiGrid',
|
|
221
|
+
components: {
|
|
222
|
+
VexCheckbox,
|
|
223
|
+
UiDropdown: Dropdown,
|
|
224
|
+
UiDropdownItem: DropdownItem,
|
|
225
|
+
UiLoading: Loading,
|
|
226
|
+
UiFilter: Filter,
|
|
227
|
+
UiFilterItem: FilterItem,
|
|
228
|
+
UiFilterGroup: FilterGroup,
|
|
229
|
+
UiPagination: Pagination,
|
|
230
|
+
VxeColumn: Column,
|
|
231
|
+
GridSort,
|
|
232
|
+
GridColumn,
|
|
233
|
+
GridViewSelect,
|
|
234
|
+
GridTableView,
|
|
235
|
+
GridCardView,
|
|
236
|
+
GridRowToolbar,
|
|
237
|
+
GridGlobalToolbar,
|
|
238
|
+
GridBatchToolbar,
|
|
239
|
+
GridMoreToolbar,
|
|
240
|
+
GridTable
|
|
241
|
+
},
|
|
242
|
+
inject: {
|
|
243
|
+
UiPage: {
|
|
244
|
+
default: null
|
|
245
|
+
},
|
|
246
|
+
UiDialog: {
|
|
247
|
+
default: null
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
provide() {
|
|
251
|
+
return {
|
|
252
|
+
UiGrid: this
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
props: {
|
|
256
|
+
id: {
|
|
257
|
+
type: String
|
|
258
|
+
},
|
|
259
|
+
height: {
|
|
260
|
+
type: String,
|
|
261
|
+
default: '100%'
|
|
262
|
+
},
|
|
263
|
+
tableKey: {
|
|
264
|
+
type: String
|
|
265
|
+
},
|
|
266
|
+
maxHeight: {
|
|
267
|
+
type: String
|
|
268
|
+
},
|
|
269
|
+
selectable: {
|
|
270
|
+
type: Boolean,
|
|
271
|
+
default: false
|
|
272
|
+
},
|
|
273
|
+
multiple: {
|
|
274
|
+
type: Boolean,
|
|
275
|
+
default: false
|
|
276
|
+
},
|
|
277
|
+
emptyText: {
|
|
278
|
+
type: String
|
|
279
|
+
},
|
|
280
|
+
data: {
|
|
281
|
+
type: Array
|
|
282
|
+
},
|
|
283
|
+
rowToolbar: {
|
|
284
|
+
type: Array
|
|
285
|
+
},
|
|
286
|
+
showHeader: {
|
|
287
|
+
type: Boolean,
|
|
288
|
+
default: true
|
|
289
|
+
},
|
|
290
|
+
idField: {
|
|
291
|
+
type: String
|
|
292
|
+
},
|
|
293
|
+
parentField: {
|
|
294
|
+
type: String
|
|
295
|
+
},
|
|
296
|
+
rowToolbarWidth: {
|
|
297
|
+
type: [String, Number],
|
|
298
|
+
default: '120px'
|
|
299
|
+
},
|
|
300
|
+
loading: {
|
|
301
|
+
type: Boolean,
|
|
302
|
+
default: false
|
|
303
|
+
},
|
|
304
|
+
queryMethod: {
|
|
305
|
+
type: Function
|
|
306
|
+
},
|
|
307
|
+
showPagination: {
|
|
308
|
+
type: Boolean,
|
|
309
|
+
default: true
|
|
310
|
+
},
|
|
311
|
+
showIndex: {
|
|
312
|
+
type: Boolean
|
|
313
|
+
},
|
|
314
|
+
title: {
|
|
315
|
+
type: String
|
|
316
|
+
},
|
|
317
|
+
total: {
|
|
318
|
+
type: Number
|
|
319
|
+
},
|
|
320
|
+
border: {
|
|
321
|
+
type: Boolean,
|
|
322
|
+
default: false
|
|
323
|
+
},
|
|
324
|
+
showSummary: {
|
|
325
|
+
type: Boolean,
|
|
326
|
+
default: false
|
|
327
|
+
},
|
|
328
|
+
autoLoad: {
|
|
329
|
+
type: Boolean,
|
|
330
|
+
default: true
|
|
331
|
+
},
|
|
332
|
+
rowHeight: {
|
|
333
|
+
type: String
|
|
334
|
+
},
|
|
335
|
+
rowClassName: {
|
|
336
|
+
type: [String, Function]
|
|
337
|
+
},
|
|
338
|
+
remoteSort: {
|
|
339
|
+
type: Boolean,
|
|
340
|
+
default: true
|
|
341
|
+
},
|
|
342
|
+
/**
|
|
343
|
+
* {
|
|
344
|
+
* field: null,
|
|
345
|
+
* order: null
|
|
346
|
+
* }
|
|
347
|
+
*/
|
|
348
|
+
defaultSort: {
|
|
349
|
+
type: [Object, Array]
|
|
350
|
+
},
|
|
351
|
+
checkStrictly: {
|
|
352
|
+
type: Boolean,
|
|
353
|
+
default: false
|
|
354
|
+
},
|
|
355
|
+
selectableAll: {
|
|
356
|
+
type: Boolean,
|
|
357
|
+
default: true
|
|
358
|
+
},
|
|
359
|
+
rowCheckMethod: {
|
|
360
|
+
type: Function
|
|
361
|
+
},
|
|
362
|
+
rowVisibleMethod: {
|
|
363
|
+
type: Function
|
|
364
|
+
},
|
|
365
|
+
imediate: {
|
|
366
|
+
type: Boolean,
|
|
367
|
+
default: true
|
|
368
|
+
},
|
|
369
|
+
enableMultipleView: {
|
|
370
|
+
type: Boolean,
|
|
371
|
+
default: false
|
|
372
|
+
},
|
|
373
|
+
allowSelectPageSize: {
|
|
374
|
+
type: Boolean,
|
|
375
|
+
default: true
|
|
376
|
+
},
|
|
377
|
+
// 显示 上一页 下一页
|
|
378
|
+
showPrevOrNext: {
|
|
379
|
+
type: Boolean,
|
|
380
|
+
default: false
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
data() {
|
|
384
|
+
return {
|
|
385
|
+
ready: false,
|
|
386
|
+
filterReady: false,
|
|
387
|
+
selecteds: [],
|
|
388
|
+
globalToolbarProps: {},
|
|
389
|
+
batchToolbarProps: {},
|
|
390
|
+
moreToolbarProps: {},
|
|
391
|
+
filterOperateProps: {
|
|
392
|
+
items: []
|
|
393
|
+
},
|
|
394
|
+
sortProps: {
|
|
395
|
+
items: [],
|
|
396
|
+
value: null
|
|
397
|
+
},
|
|
398
|
+
filterProps: {
|
|
399
|
+
items: [],
|
|
400
|
+
groups: [],
|
|
401
|
+
value: null
|
|
402
|
+
},
|
|
403
|
+
showColumnSetting: false,
|
|
404
|
+
tableColumns: [],
|
|
405
|
+
tablePageIndex: 1,
|
|
406
|
+
tablePageSize: 20,
|
|
407
|
+
tableLoading: this.loading,
|
|
408
|
+
tableTotal: 0,
|
|
409
|
+
tableData: [],
|
|
410
|
+
tableStyle: null,
|
|
411
|
+
tableMaxHeight: null,
|
|
412
|
+
innerIdField: this.idField,
|
|
413
|
+
innerMultiple: this.multiple,
|
|
414
|
+
hoverRow: null,
|
|
415
|
+
viewPanelData: [],
|
|
416
|
+
currentViewName: 'table',
|
|
417
|
+
$control: null
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
computed: {
|
|
421
|
+
showWrap() {
|
|
422
|
+
if (this.globalToolbarProps && this.globalToolbarProps.items && this.globalToolbarProps.items.length) {
|
|
423
|
+
return true
|
|
424
|
+
}
|
|
425
|
+
if (this.moreToolbarProps && this.moreToolbarProps.items && this.moreToolbarProps.items.length) {
|
|
426
|
+
return true
|
|
427
|
+
}
|
|
428
|
+
if (this.simpleFilterItems && this.simpleFilterItems.length) {
|
|
429
|
+
return true
|
|
430
|
+
}
|
|
431
|
+
return false
|
|
432
|
+
},
|
|
433
|
+
gridStyle() {
|
|
434
|
+
const style = {}
|
|
435
|
+
if (this.height && this.height !== 'auto') {
|
|
436
|
+
style.height = this.height
|
|
437
|
+
}
|
|
438
|
+
if (this.height && this.maxHeight) {
|
|
439
|
+
style['max-height'] = this.maxHeight
|
|
440
|
+
}
|
|
441
|
+
return style
|
|
442
|
+
},
|
|
443
|
+
simpleFilterGroups() {
|
|
444
|
+
if (!this.filterProps || !this.filterProps.groups) {
|
|
445
|
+
return
|
|
446
|
+
}
|
|
447
|
+
return this.filterProps.groups.map(v => {
|
|
448
|
+
const vv = Object.assign({}, v)
|
|
449
|
+
vv.children = this.simpleFilterItems.filter(item => item.groupId === v.id)
|
|
450
|
+
return vv
|
|
451
|
+
})
|
|
452
|
+
},
|
|
453
|
+
simpleFilterItems() {
|
|
454
|
+
if (!this.filterProps || !this.filterProps.items) {
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
return (this.filterProps.items || []).filter(v => v.type !== 'advance')
|
|
458
|
+
},
|
|
459
|
+
simpleFilterNotGroupItems() {
|
|
460
|
+
if (!this.filterProps || !this.filterProps.items) {
|
|
461
|
+
return
|
|
462
|
+
}
|
|
463
|
+
return (this.filterProps.items || []).filter(v => !v.groupId)
|
|
464
|
+
},
|
|
465
|
+
innerShowSort() {
|
|
466
|
+
return !!(this.sortProps && this.sortProps.items && this.sortProps.items.length)
|
|
467
|
+
},
|
|
468
|
+
exportColumns() {
|
|
469
|
+
return this.tableColumns.filter(v => v.props.exportable)
|
|
470
|
+
},
|
|
471
|
+
tableHeight () {
|
|
472
|
+
if (this.maxHeight) {
|
|
473
|
+
return ''
|
|
474
|
+
}
|
|
475
|
+
if (!this.height || this.height === 'auto') {
|
|
476
|
+
return 'auto'
|
|
477
|
+
}
|
|
478
|
+
return '100%'
|
|
479
|
+
},
|
|
480
|
+
innerSelectable () {
|
|
481
|
+
if (this.multiple === true) {
|
|
482
|
+
return true
|
|
483
|
+
}
|
|
484
|
+
return !!this.selectable
|
|
485
|
+
},
|
|
486
|
+
innerIndeterminate() {
|
|
487
|
+
return !!(this.selecteds.length && this.selecteds.length < this.tableData.length)
|
|
488
|
+
},
|
|
489
|
+
innerCheckAll () {
|
|
490
|
+
return this.selecteds.length && this.selecteds.length >= this.tableData.length
|
|
491
|
+
},
|
|
492
|
+
tableViewContent () {
|
|
493
|
+
const tableView = this.viewPanelData.find(v => v.name === 'table')
|
|
494
|
+
if (!tableView) {
|
|
495
|
+
return
|
|
496
|
+
}
|
|
497
|
+
const rs = tableView.render()
|
|
498
|
+
console.log(rs)
|
|
499
|
+
return {
|
|
500
|
+
functional: true,
|
|
501
|
+
render (h) {
|
|
502
|
+
return h('div', rs)
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
showBatchToolbar () {
|
|
507
|
+
return this.batchToolbarProps.items && this.batchToolbarProps.items.length && !!this.selecteds.length
|
|
508
|
+
},
|
|
509
|
+
cacheCurrentViewNameKey () {
|
|
510
|
+
if (!this.id) {
|
|
511
|
+
return
|
|
512
|
+
}
|
|
513
|
+
return 'bi-grid-current-view-name-' + this.id
|
|
514
|
+
},
|
|
515
|
+
filterPropsValue: {
|
|
516
|
+
get () {
|
|
517
|
+
return this.filterProps.value
|
|
518
|
+
},
|
|
519
|
+
set (val) {
|
|
520
|
+
this.filterProps.value = val
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
watch: {
|
|
525
|
+
data(data) {
|
|
526
|
+
// this.tableData = data
|
|
527
|
+
if (this.showPagination) {
|
|
528
|
+
this._setData({
|
|
529
|
+
total: data.length,
|
|
530
|
+
results: data
|
|
531
|
+
})
|
|
532
|
+
} else {
|
|
533
|
+
this._setData(data)
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
loading(val) {
|
|
537
|
+
this.tableLoading = val
|
|
538
|
+
},
|
|
539
|
+
idField (val) {
|
|
540
|
+
this.innerIdField = val
|
|
541
|
+
},
|
|
542
|
+
multiple (val) {
|
|
543
|
+
this.setMultiple(val)
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
created() {
|
|
547
|
+
this.cacheColumns = []
|
|
548
|
+
if (this.$route.query && this.$route.query.pageindex) {
|
|
549
|
+
this.tablePageIndex = Number(this.$route.query.pageindex)
|
|
550
|
+
}
|
|
551
|
+
if (this.data && this.data.length) {
|
|
552
|
+
this._setData(this.data)
|
|
553
|
+
}
|
|
554
|
+
if (this.cacheCurrentViewNameKey) {
|
|
555
|
+
const currentViewName = getStorage(this.cacheCurrentViewNameKey)
|
|
556
|
+
if (currentViewName) {
|
|
557
|
+
this.currentViewName = currentViewName
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
dispatch(this, 'UiGridCreated', {
|
|
561
|
+
setIdField: (idField) => {
|
|
562
|
+
this.setIdField(idField)
|
|
563
|
+
},
|
|
564
|
+
setMultiple: (multiple) => {
|
|
565
|
+
this.setMultiple(multiple)
|
|
566
|
+
}
|
|
567
|
+
})
|
|
568
|
+
},
|
|
569
|
+
mounted() {
|
|
570
|
+
if (this.$refs.table) {
|
|
571
|
+
this.$control = this.$refs.table
|
|
572
|
+
}
|
|
573
|
+
this.ready = true
|
|
574
|
+
this.doLayout()
|
|
575
|
+
// 稍微晚一点执行,页面可能还需要加载一些数据
|
|
576
|
+
this.loadTimer = setTimeout(() => {
|
|
577
|
+
if (this.autoLoad) {
|
|
578
|
+
this.loadData()
|
|
579
|
+
}
|
|
580
|
+
this.filterReady = true
|
|
581
|
+
})
|
|
582
|
+
addResizeListener(this.$el.parentNode, () => {
|
|
583
|
+
this.doLayout()
|
|
584
|
+
})
|
|
585
|
+
},
|
|
586
|
+
beforeDestroy() {
|
|
587
|
+
clearTimeout(this.timer)
|
|
588
|
+
clearTimeout(this.loadTimer)
|
|
589
|
+
clearTimeout(this._timer)
|
|
590
|
+
removeResizeListener(this.$el.parentNode)
|
|
591
|
+
},
|
|
592
|
+
methods: {
|
|
593
|
+
handleViewPanelChange ({ item }) {
|
|
594
|
+
this.currentViewName = item.name
|
|
595
|
+
if (this.selecteds.length) {
|
|
596
|
+
this.selecteds = []
|
|
597
|
+
this.$emit('selection-change', {
|
|
598
|
+
selection: this.selecteds,
|
|
599
|
+
data: this.tableData
|
|
600
|
+
})
|
|
601
|
+
}
|
|
602
|
+
if (this.cacheCurrentViewNameKey) {
|
|
603
|
+
setStorage(this.cacheCurrentViewNameKey, item.name)
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
handleCheckAllChange(value) {
|
|
607
|
+
if (value) {
|
|
608
|
+
this.selecteds = this.tableData
|
|
609
|
+
this.setSelectionRows(this.tableData, true)
|
|
610
|
+
} else {
|
|
611
|
+
this.selecteds = []
|
|
612
|
+
this.setSelectionRows(this.tableData, false)
|
|
613
|
+
}
|
|
614
|
+
this.$emit('selection-change', {
|
|
615
|
+
selection: this.selecteds,
|
|
616
|
+
data: this.tableData
|
|
617
|
+
})
|
|
618
|
+
},
|
|
619
|
+
setIdField (idField) {
|
|
620
|
+
this.innerIdField = idField
|
|
621
|
+
},
|
|
622
|
+
setMultiple (multiple) {
|
|
623
|
+
this.innerMultiple = multiple
|
|
624
|
+
},
|
|
625
|
+
handleFilterOperateItemClick (item) {
|
|
626
|
+
item && item.click && item.click({
|
|
627
|
+
data: this.tableData,
|
|
628
|
+
total: this.showPagination ? this.tableTotal : this.tableData.length
|
|
629
|
+
})
|
|
630
|
+
},
|
|
631
|
+
handleHoverRowChange (evt) {
|
|
632
|
+
this.hoverRow = evt.row
|
|
633
|
+
},
|
|
634
|
+
handleColumnResizeChange (evt) {
|
|
635
|
+
this.$emit('column-resize-change', evt)
|
|
636
|
+
},
|
|
637
|
+
handleDataLoaded () {
|
|
638
|
+
this.$emit('loaded', {
|
|
639
|
+
data: this.tableData
|
|
640
|
+
})
|
|
641
|
+
},
|
|
642
|
+
handleBealoneSortChange (evt) {
|
|
643
|
+
this.$set(this.sortProps, 'value', evt.value)
|
|
644
|
+
if (!this.remoteSort) {
|
|
645
|
+
return
|
|
646
|
+
}
|
|
647
|
+
this.loadData()
|
|
648
|
+
},
|
|
649
|
+
handleTableSortChange() {
|
|
650
|
+
this.isChangeSort = true
|
|
651
|
+
if (!this.remoteSort) {
|
|
652
|
+
return
|
|
653
|
+
}
|
|
654
|
+
this.loadData()
|
|
655
|
+
},
|
|
656
|
+
handleRenderFilterItem(item) {
|
|
657
|
+
return {
|
|
658
|
+
functional: true,
|
|
659
|
+
render: (h, c) => {
|
|
660
|
+
return item.render(h, c)
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
handleClearSelection() {
|
|
665
|
+
this.selecteds = []
|
|
666
|
+
this.$control && this.$control.clearSelection()
|
|
667
|
+
},
|
|
668
|
+
handleBatchSuccess() {
|
|
669
|
+
this.loadData()
|
|
670
|
+
},
|
|
671
|
+
handleSelectionChange({ selection }) {
|
|
672
|
+
this.selecteds = selection || []
|
|
673
|
+
this.$emit('selection-change', {
|
|
674
|
+
selection,
|
|
675
|
+
data: this.tableData
|
|
676
|
+
})
|
|
677
|
+
},
|
|
678
|
+
handleSelectChange ({ row }) {
|
|
679
|
+
this.$emit('current-change', {
|
|
680
|
+
row,
|
|
681
|
+
data: this.tableData
|
|
682
|
+
})
|
|
683
|
+
},
|
|
684
|
+
handlePageChange(e) {
|
|
685
|
+
this.tablePageSize = e.pageSize
|
|
686
|
+
this.tablePageIndex = e.pageIndex
|
|
687
|
+
this.loadData()
|
|
688
|
+
},
|
|
689
|
+
handleFilterChange() {
|
|
690
|
+
if (!this.autoLoad) {
|
|
691
|
+
return
|
|
692
|
+
}
|
|
693
|
+
this.reload()
|
|
694
|
+
},
|
|
695
|
+
handleRefreshClick() {
|
|
696
|
+
if (this.tableLoading) {
|
|
697
|
+
return
|
|
698
|
+
}
|
|
699
|
+
this.loadData()
|
|
700
|
+
},
|
|
701
|
+
getFilters() {
|
|
702
|
+
if (this.$refs.filter) {
|
|
703
|
+
return this.$refs.filter.getFilters()
|
|
704
|
+
}
|
|
705
|
+
return {}
|
|
706
|
+
},
|
|
707
|
+
getSort() {
|
|
708
|
+
let sort = null
|
|
709
|
+
if (this.$control) {
|
|
710
|
+
sort = this.$control.getSortColumns().reduce((rs, v) => {
|
|
711
|
+
rs[v.field] = v.order
|
|
712
|
+
return rs
|
|
713
|
+
}, {})
|
|
714
|
+
}
|
|
715
|
+
if (this.sortProps && this.sortProps.value) {
|
|
716
|
+
if (!sort) {
|
|
717
|
+
sort = {}
|
|
718
|
+
}
|
|
719
|
+
sort[this.sortProps.value.prop] = this.sortProps.value.order
|
|
720
|
+
}
|
|
721
|
+
// 排序改变过的,就不用默认的了
|
|
722
|
+
if (!this.isChangeSort) {
|
|
723
|
+
if ((!sort || !Object.keys(sort).length) && this.defaultSort) {
|
|
724
|
+
let defaultSort = this.defaultSort
|
|
725
|
+
if (defaultSort && !Array.isArray(defaultSort)) {
|
|
726
|
+
defaultSort = [defaultSort]
|
|
727
|
+
}
|
|
728
|
+
sort = defaultSort.reduce((rs, v) => {
|
|
729
|
+
rs[v.field] = v.order
|
|
730
|
+
return rs
|
|
731
|
+
}, {})
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return sort
|
|
735
|
+
},
|
|
736
|
+
reload() {
|
|
737
|
+
this.tablePageIndex = 1
|
|
738
|
+
return this.loadData()
|
|
739
|
+
},
|
|
740
|
+
loadData() {
|
|
741
|
+
return new Promise((resolve, reject) => {
|
|
742
|
+
if (typeof this.queryMethod === 'function') {
|
|
743
|
+
let ps = {}
|
|
744
|
+
const fs = this.getFilters()
|
|
745
|
+
if (this.showPagination) {
|
|
746
|
+
ps = {
|
|
747
|
+
pageIndex: this.tablePageIndex - 1,
|
|
748
|
+
pageSize: this.tablePageSize
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
const options = {
|
|
752
|
+
filter: fs,
|
|
753
|
+
page: ps
|
|
754
|
+
}
|
|
755
|
+
const sort = this.getSort()
|
|
756
|
+
if (sort) {
|
|
757
|
+
const sortKey = Object.keys(sort)[0]
|
|
758
|
+
const orderMap = {
|
|
759
|
+
'asc': 2,
|
|
760
|
+
'desc': 1
|
|
761
|
+
}
|
|
762
|
+
options.order = {
|
|
763
|
+
sortField: sortKey,
|
|
764
|
+
order: orderMap[sort[sortKey]]
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
const rs = this.queryMethod(options)
|
|
768
|
+
if (rs && rs.then) {
|
|
769
|
+
this.tableLoading = true
|
|
770
|
+
rs.then((data) => {
|
|
771
|
+
this.tableLoading = false
|
|
772
|
+
this._setData(data)
|
|
773
|
+
resolve(data)
|
|
774
|
+
}, (err) => {
|
|
775
|
+
this.tableLoading = false
|
|
776
|
+
reject(err)
|
|
777
|
+
})
|
|
778
|
+
} else {
|
|
779
|
+
this._setData(rs)
|
|
780
|
+
}
|
|
781
|
+
} else {
|
|
782
|
+
resolve()
|
|
783
|
+
}
|
|
784
|
+
})
|
|
785
|
+
},
|
|
786
|
+
_setData(result) {
|
|
787
|
+
if (this.showPagination) {
|
|
788
|
+
let total = 0
|
|
789
|
+
let data = []
|
|
790
|
+
if (result) {
|
|
791
|
+
total = parseInt(result.total) || 0
|
|
792
|
+
data = result.results || []
|
|
793
|
+
}
|
|
794
|
+
this.tableData = data
|
|
795
|
+
this.tableTotal = total
|
|
796
|
+
} else {
|
|
797
|
+
this.tableData = result || []
|
|
798
|
+
}
|
|
799
|
+
this.selecteds = []
|
|
800
|
+
this.$control && this.$control.clearSelection()
|
|
801
|
+
if (this.multiple) {
|
|
802
|
+
this.$emit('selection-change', {
|
|
803
|
+
selection: [],
|
|
804
|
+
data: this.tableData
|
|
805
|
+
})
|
|
806
|
+
}
|
|
807
|
+
this.$emit('filled', {
|
|
808
|
+
data: this.tableData
|
|
809
|
+
})
|
|
810
|
+
},
|
|
811
|
+
toggleRowSelection(row, isSelected) {
|
|
812
|
+
this.$control && this.$control.toggleRowSelection(row, isSelected)
|
|
813
|
+
},
|
|
814
|
+
setCurrentRow(row) {
|
|
815
|
+
this.$control && this.$control.setCurrentRow(row)
|
|
816
|
+
},
|
|
817
|
+
setSelectionRows (rows, isSelected = true) {
|
|
818
|
+
this.$control && this.$control.setCheckboxRow(rows, isSelected)
|
|
819
|
+
},
|
|
820
|
+
setSelectRow (row) {
|
|
821
|
+
this.$control && this.$control.setRadioRow(row)
|
|
822
|
+
},
|
|
823
|
+
doLayout () {
|
|
824
|
+
let tableMaxHeight = null
|
|
825
|
+
if (this.maxHeight) {
|
|
826
|
+
const parentHeight = this.$el.parentNode.clientHeight || 0
|
|
827
|
+
const wrapHeight = this.$refs.wrap ? this.$refs.wrap.offsetHeight : 0
|
|
828
|
+
const paginationHeight = this.$refs.pagination ? this.$refs.pagination.offsetHeight : 0
|
|
829
|
+
if (this.maxHeight.indexOf('%')) {
|
|
830
|
+
tableMaxHeight = parentHeight - wrapHeight - paginationHeight * (parseInt(this.maxHeight) / 100) + ''
|
|
831
|
+
} else {
|
|
832
|
+
tableMaxHeight = this.maxHeight - wrapHeight - paginationHeight + ''
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
this.tableMaxHeight = tableMaxHeight
|
|
836
|
+
},
|
|
837
|
+
addViewPanel (data) {
|
|
838
|
+
if (!data || !data.name) {
|
|
839
|
+
throw new Error('缺少必须参数')
|
|
840
|
+
}
|
|
841
|
+
if (this.viewPanelData.some(v => v.name === data.name)) {
|
|
842
|
+
return
|
|
843
|
+
}
|
|
844
|
+
this.viewPanelData.push(data)
|
|
845
|
+
},
|
|
846
|
+
removeViewPanel (name) {
|
|
847
|
+
let index = -1
|
|
848
|
+
this.viewPanelData.some((v, i) => {
|
|
849
|
+
if (v.name === name) {
|
|
850
|
+
index = i
|
|
851
|
+
return true
|
|
852
|
+
}
|
|
853
|
+
})
|
|
854
|
+
if (index < 0) {
|
|
855
|
+
return
|
|
856
|
+
}
|
|
857
|
+
this.viewPanelData.splice(index, 1)
|
|
858
|
+
},
|
|
859
|
+
handleGridViewSelectionChange (evt) {
|
|
860
|
+
this.selecteds = evt.selection || []
|
|
861
|
+
this.$emit('selection-change', {
|
|
862
|
+
selection: evt.selection,
|
|
863
|
+
data: this.tableData
|
|
864
|
+
})
|
|
865
|
+
},
|
|
866
|
+
handleCardViewSelectionChange (evt) {
|
|
867
|
+
this.selecteds = evt.selection || []
|
|
868
|
+
this.$emit('selection-change', {
|
|
869
|
+
selection: evt.selection,
|
|
870
|
+
data: this.tableData
|
|
871
|
+
})
|
|
872
|
+
},
|
|
873
|
+
handleTableMounted () {
|
|
874
|
+
this.$control = this.$refs.table
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
</script>
|
|
879
|
+
<style lang="less">
|
|
880
|
+
body {
|
|
881
|
+
.is--checked.vxe-checkbox,
|
|
882
|
+
.is--checked.vxe-checkbox .vxe-checkbox--icon,
|
|
883
|
+
.is--checked.vxe-custom--checkbox-option,
|
|
884
|
+
.is--checked.vxe-custom--checkbox-option .vxe-checkbox--icon,
|
|
885
|
+
.is--checked.vxe-export--panel-column-option,
|
|
886
|
+
.is--checked.vxe-export--panel-column-option .vxe-checkbox--icon,
|
|
887
|
+
.is--checked.vxe-table--filter-option,
|
|
888
|
+
.is--checked.vxe-table--filter-option .vxe-checkbox--icon,
|
|
889
|
+
.is--indeterminate.vxe-checkbox,
|
|
890
|
+
.is--indeterminate.vxe-checkbox .vxe-checkbox--icon,
|
|
891
|
+
.is--indeterminate.vxe-custom--checkbox-option,
|
|
892
|
+
.is--indeterminate.vxe-custom--checkbox-option .vxe-checkbox--icon,
|
|
893
|
+
.is--indeterminate.vxe-export--panel-column-option,
|
|
894
|
+
.is--indeterminate.vxe-export--panel-column-option .vxe-checkbox--icon,
|
|
895
|
+
.is--indeterminate.vxe-table--filter-option,
|
|
896
|
+
.is--indeterminate.vxe-table--filter-option .vxe-checkbox--icon,
|
|
897
|
+
.vxe-table--render-default .is--checked.vxe-cell--checkbox,
|
|
898
|
+
.vxe-table--render-default .is--checked.vxe-cell--checkbox .vxe-checkbox--icon,
|
|
899
|
+
.vxe-table--render-default .is--indeterminate.vxe-cell--checkbox,
|
|
900
|
+
.vxe-table--render-default .is--indeterminate.vxe-cell--checkbox .vxe-checkbox--icon {
|
|
901
|
+
color: #0052cc;
|
|
902
|
+
}
|
|
903
|
+
.vxe-table--render-default .vxe-cell--checkbox.is--disabled .vxe-checkbox--icon{
|
|
904
|
+
color: #dcdfe6;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
.ui-grid{
|
|
908
|
+
position: relative;
|
|
909
|
+
display: flex;
|
|
910
|
+
flex-direction: column;
|
|
911
|
+
[class*=vxe-], [class*=vxe-] :after, [class*=vxe-] :before, [class*=vxe-]:after, [class*=vxe-]:before{
|
|
912
|
+
box-sizing: border-box;
|
|
913
|
+
}
|
|
914
|
+
.ui-grid-pagination{
|
|
915
|
+
padding-top: 0;
|
|
916
|
+
padding-bottom: 0;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
.ui-grid__wrap {
|
|
920
|
+
padding-bottom: 12px;
|
|
921
|
+
position: relative;
|
|
922
|
+
}
|
|
923
|
+
.ui-grid__header{
|
|
924
|
+
display: flex;
|
|
925
|
+
flex-direction: row;
|
|
926
|
+
align-items: center;
|
|
927
|
+
justify-content: space-between;
|
|
928
|
+
min-height: 28px;
|
|
929
|
+
position: relative;
|
|
930
|
+
z-index: 3;
|
|
931
|
+
}
|
|
932
|
+
.ui-grid__sort{
|
|
933
|
+
padding-top: 4px;
|
|
934
|
+
padding-bottom: 4px;
|
|
935
|
+
}
|
|
936
|
+
.ui-grid__filter{
|
|
937
|
+
// display: flex;
|
|
938
|
+
// flex-direction: row;
|
|
939
|
+
// align-items: center;
|
|
940
|
+
flex: 1;
|
|
941
|
+
}
|
|
942
|
+
.ui-grid__filter-item{
|
|
943
|
+
vertical-align: top;
|
|
944
|
+
margin-right: 12px;
|
|
945
|
+
}
|
|
946
|
+
.ui-grid__pagination-inner{
|
|
947
|
+
padding: 9px 0 0;
|
|
948
|
+
background-color: #fff;
|
|
949
|
+
position: relative;
|
|
950
|
+
z-index: 3;
|
|
951
|
+
display: flex;
|
|
952
|
+
flex-direction: row;
|
|
953
|
+
align-items: center;
|
|
954
|
+
}
|
|
955
|
+
.ui-grid__pagination-control{
|
|
956
|
+
flex: 1;
|
|
957
|
+
min-width: 0;
|
|
958
|
+
}
|
|
959
|
+
.ui-grid__global{
|
|
960
|
+
display: flex;
|
|
961
|
+
flex-direction: row;
|
|
962
|
+
justify-content: flex-end;
|
|
963
|
+
align-items: center;
|
|
964
|
+
}
|
|
965
|
+
.ui-grid-global-toolbar{
|
|
966
|
+
.ui-toolbar-item{
|
|
967
|
+
line-height: 1;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
.ui-grid__more-toolbar,
|
|
971
|
+
.ui-grid__global-toolbar{
|
|
972
|
+
display: inline-block;
|
|
973
|
+
margin-left: 12px;
|
|
974
|
+
}
|
|
975
|
+
.ui-grid__batch{
|
|
976
|
+
margin-bottom: 12px;
|
|
977
|
+
}
|
|
978
|
+
.ui-grid__loading{
|
|
979
|
+
position: absolute;
|
|
980
|
+
top: 0;
|
|
981
|
+
right: 0;
|
|
982
|
+
bottom: 0;
|
|
983
|
+
left: 0;
|
|
984
|
+
z-index: 100;
|
|
985
|
+
background-color: #fff;
|
|
986
|
+
display: flex;
|
|
987
|
+
flex-direction: column;
|
|
988
|
+
justify-content: center;
|
|
989
|
+
align-items: center;
|
|
990
|
+
opacity: .8;
|
|
991
|
+
line-height: 1em;
|
|
992
|
+
&.v-enter{
|
|
993
|
+
opacity: 0;
|
|
994
|
+
}
|
|
995
|
+
&.v-enter-active{
|
|
996
|
+
transition: all .3s;
|
|
997
|
+
}
|
|
998
|
+
&.v-enter-active{
|
|
999
|
+
opacity: 0.8;
|
|
1000
|
+
}
|
|
1001
|
+
&.v-leave{
|
|
1002
|
+
opacity: 0.8;
|
|
1003
|
+
}
|
|
1004
|
+
&.v-leave-active{
|
|
1005
|
+
transition: all .3s;
|
|
1006
|
+
}
|
|
1007
|
+
&.v-leave-active{
|
|
1008
|
+
opacity: 0;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
@keyframes grid-refreshing{
|
|
1012
|
+
0% {
|
|
1013
|
+
transform: rotate(0);
|
|
1014
|
+
}
|
|
1015
|
+
100% {
|
|
1016
|
+
transform: rotate(1turn);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
.ui-grid__refresh{
|
|
1020
|
+
margin-left: 12px;
|
|
1021
|
+
width: 28px;
|
|
1022
|
+
height: 28px;
|
|
1023
|
+
line-height: 28px;
|
|
1024
|
+
cursor: pointer;
|
|
1025
|
+
border-radius: 4px;
|
|
1026
|
+
transition: all .25s;
|
|
1027
|
+
text-align: center;
|
|
1028
|
+
&:hover {
|
|
1029
|
+
background-color: #f8f8f9;
|
|
1030
|
+
}
|
|
1031
|
+
&:after {
|
|
1032
|
+
content: '';
|
|
1033
|
+
width: 18px;
|
|
1034
|
+
height: 18px;
|
|
1035
|
+
display: inline-block;
|
|
1036
|
+
vertical-align: top;
|
|
1037
|
+
margin-top: 5px;
|
|
1038
|
+
background: url('./icons/refresh.svg') no-repeat 50% 50%;
|
|
1039
|
+
background-size: 16px;
|
|
1040
|
+
}
|
|
1041
|
+
&.is-loading {
|
|
1042
|
+
&:after {
|
|
1043
|
+
animation: grid-refreshing 1s linear infinite;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
.ui-grid__table{
|
|
1048
|
+
position: relative;
|
|
1049
|
+
flex: 1;
|
|
1050
|
+
min-height: 0;
|
|
1051
|
+
}
|
|
1052
|
+
.ui-grid__content{
|
|
1053
|
+
position: relative;
|
|
1054
|
+
flex: 1;
|
|
1055
|
+
min-height: 0;
|
|
1056
|
+
display: flex;
|
|
1057
|
+
flex-direction: column;
|
|
1058
|
+
}
|
|
1059
|
+
.ui-grid__pagination-check{
|
|
1060
|
+
display: flex;
|
|
1061
|
+
flex-direction: row;
|
|
1062
|
+
align-items: center;
|
|
1063
|
+
padding: 0 20px;
|
|
1064
|
+
position: relative;
|
|
1065
|
+
margin-right: 2px;
|
|
1066
|
+
height: 18px;
|
|
1067
|
+
line-height: 18px;
|
|
1068
|
+
&:after {
|
|
1069
|
+
content: '';
|
|
1070
|
+
position: absolute;
|
|
1071
|
+
width: 1px;
|
|
1072
|
+
height: 18px;
|
|
1073
|
+
background-color: #eee;
|
|
1074
|
+
top: 50%;
|
|
1075
|
+
margin-top: -9px;
|
|
1076
|
+
right: 0;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
.ui-grid__pagination-check-input{
|
|
1080
|
+
height: 18px;
|
|
1081
|
+
line-height: 18px;
|
|
1082
|
+
display: inline-block;
|
|
1083
|
+
.vxe-checkbox{
|
|
1084
|
+
vertical-align: top;
|
|
1085
|
+
}
|
|
1086
|
+
.vxe-checkbox:not(.is--disabled)>input:focus+.vxe-checkbox--icon{
|
|
1087
|
+
box-shadow: none;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
.ui-grid__sort{
|
|
1091
|
+
margin-left: 12px;
|
|
1092
|
+
}
|
|
1093
|
+
.ui-grid-view--card {
|
|
1094
|
+
.ui-grid__pagination{
|
|
1095
|
+
border-top: 1px solid #eee;
|
|
1096
|
+
margin-top: 12px;
|
|
1097
|
+
.ui-grid__pagination-check{
|
|
1098
|
+
padding-left: 0;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
</style>
|