@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,178 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-grid-table-view" v-if="currentViewName === 'table'">
|
|
3
|
+
<grid-table
|
|
4
|
+
ref="table"
|
|
5
|
+
:row-height="rowHeight"
|
|
6
|
+
:show-index="showIndex"
|
|
7
|
+
:border="border"
|
|
8
|
+
:id-field="idField"
|
|
9
|
+
:parent-field="parentField"
|
|
10
|
+
:multiple="multiple"
|
|
11
|
+
:selectable="selectable"
|
|
12
|
+
:data="data"
|
|
13
|
+
:height="height"
|
|
14
|
+
:row-class-name="rowClassName"
|
|
15
|
+
:max-height="maxHeight"
|
|
16
|
+
:empty-text="emptyText"
|
|
17
|
+
:show-summary="showSummary"
|
|
18
|
+
:show-pagination="showPagination"
|
|
19
|
+
:page-index="pageIndex"
|
|
20
|
+
:page-size="pageSize"
|
|
21
|
+
:remote-sort="remoteSort"
|
|
22
|
+
:show-header="showHeader"
|
|
23
|
+
@selection-change="handleSelectionChange"
|
|
24
|
+
@select-change="handleSelectChange"
|
|
25
|
+
>
|
|
26
|
+
<slot></slot>
|
|
27
|
+
<vxe-column
|
|
28
|
+
v-if="rowToolbar && rowToolbar.length"
|
|
29
|
+
title="操作"
|
|
30
|
+
fixed="right"
|
|
31
|
+
field="__rowToolbar"
|
|
32
|
+
:width="rowToolbarWidth"
|
|
33
|
+
>
|
|
34
|
+
<template slot-scope="{ row, $rowIndex }">
|
|
35
|
+
<grid-row-toolbar :row="row" :row-index="$rowIndex" :items="rowToolbar"></grid-row-toolbar>
|
|
36
|
+
</template>
|
|
37
|
+
</vxe-column>
|
|
38
|
+
</grid-table>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
<script>
|
|
42
|
+
import GridRowToolbar from '../grid-toolbar/grid-row-toolbar'
|
|
43
|
+
import GridTable from '../grid-table'
|
|
44
|
+
import { Column } from 'vxe-table'
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
name: 'UiGridTableView',
|
|
48
|
+
inject: ['UiGrid'],
|
|
49
|
+
components: {
|
|
50
|
+
GridTable,
|
|
51
|
+
VxeColumn: Column,
|
|
52
|
+
GridRowToolbar
|
|
53
|
+
},
|
|
54
|
+
computed: {
|
|
55
|
+
currentViewName () {
|
|
56
|
+
return this.UiGrid.currentViewName
|
|
57
|
+
},
|
|
58
|
+
rowHeight () {
|
|
59
|
+
return this.UiGrid.rowHeight
|
|
60
|
+
},
|
|
61
|
+
showIndex () {
|
|
62
|
+
return this.UiGrid.showIndex
|
|
63
|
+
},
|
|
64
|
+
border () {
|
|
65
|
+
return this.UiGrid.border
|
|
66
|
+
},
|
|
67
|
+
idField () {
|
|
68
|
+
return this.UiGrid.innerIdField
|
|
69
|
+
},
|
|
70
|
+
parentField () {
|
|
71
|
+
return this.UiGrid.parentField
|
|
72
|
+
},
|
|
73
|
+
multiple () {
|
|
74
|
+
return this.UiGrid.innerMultiple
|
|
75
|
+
},
|
|
76
|
+
selectable () {
|
|
77
|
+
return this.UiGrid.innerSelectable
|
|
78
|
+
},
|
|
79
|
+
data () {
|
|
80
|
+
return this.UiGrid.tableData
|
|
81
|
+
},
|
|
82
|
+
height () {
|
|
83
|
+
return this.UiGrid.tableHeight
|
|
84
|
+
},
|
|
85
|
+
rowClassName () {
|
|
86
|
+
return this.UiGrid.rowClassName
|
|
87
|
+
},
|
|
88
|
+
maxHeight () {
|
|
89
|
+
return this.UiGrid.tableMaxHeight
|
|
90
|
+
},
|
|
91
|
+
emptyText () {
|
|
92
|
+
return this.UiGrid.emptyText
|
|
93
|
+
},
|
|
94
|
+
showSummary () {
|
|
95
|
+
return this.UiGrid.showSummary
|
|
96
|
+
},
|
|
97
|
+
showPagination () {
|
|
98
|
+
return this.UiGrid.showPagination
|
|
99
|
+
},
|
|
100
|
+
pageIndex () {
|
|
101
|
+
return this.UiGrid.tablePageIndex
|
|
102
|
+
},
|
|
103
|
+
pageSize () {
|
|
104
|
+
return this.UiGrid.tablePageSize
|
|
105
|
+
},
|
|
106
|
+
remoteSort () {
|
|
107
|
+
return this.UiGrid.remoteSort
|
|
108
|
+
},
|
|
109
|
+
showHeader () {
|
|
110
|
+
return this.UiGrid.showHeader
|
|
111
|
+
},
|
|
112
|
+
rowToolbar () {
|
|
113
|
+
return this.UiGrid.rowToolbar
|
|
114
|
+
},
|
|
115
|
+
rowToolbarWidth () {
|
|
116
|
+
return this.UiGrid.rowToolbarWidth
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
created () {
|
|
120
|
+
this.UiGrid.addViewPanel({
|
|
121
|
+
label: '表格',
|
|
122
|
+
name: 'table',
|
|
123
|
+
icon: `
|
|
124
|
+
<svg t="1717655840748" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="25904" width="200" height="200">
|
|
125
|
+
<path d="M272 704v144H128v-144h144z m592 30v80H384v-80h480zM272 444v144H128v-144h144z m592 30v80H384v-80h480zM272 176v144H128V176h144z m592 34v80H384v-80h480z" fill="currentColor"></path>
|
|
126
|
+
</svg>
|
|
127
|
+
`
|
|
128
|
+
})
|
|
129
|
+
},
|
|
130
|
+
watch: {
|
|
131
|
+
currentViewName () {
|
|
132
|
+
if (this.UiGrid.currentViewName === 'table') {
|
|
133
|
+
this.UiGrid.$control = this
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
mounted () {
|
|
138
|
+
if (this.UiGrid.currentViewName === 'table') {
|
|
139
|
+
this.UiGrid.$control = this
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
methods: {
|
|
143
|
+
getSortColumns () {
|
|
144
|
+
return this.$refs.table.getSortColumns()
|
|
145
|
+
},
|
|
146
|
+
clearSelection () {
|
|
147
|
+
this.$refs.table && this.$refs.table.clearSelection()
|
|
148
|
+
},
|
|
149
|
+
toggleRowSelection(row, isSelected) {
|
|
150
|
+
this.$refs.table && this.$refs.table.toggleRowSelection(row, isSelected)
|
|
151
|
+
},
|
|
152
|
+
setCurrentRow(row) {
|
|
153
|
+
this.$refs.table && this.$refs.table.setCurrentRow(row)
|
|
154
|
+
},
|
|
155
|
+
setCheckboxRow (rows, isSelected = true) {
|
|
156
|
+
this.$refs.table && this.$refs.table.setCheckboxRow(rows, isSelected)
|
|
157
|
+
},
|
|
158
|
+
setRadioRow (row) {
|
|
159
|
+
this.$refs.table && this.$refs.table.setRadioRow(row)
|
|
160
|
+
},
|
|
161
|
+
handleSelectionChange (evt) {
|
|
162
|
+
this.UiGrid.handleGridViewSelectionChange(evt)
|
|
163
|
+
},
|
|
164
|
+
handleSelectChange (evt) {
|
|
165
|
+
this.UiGrid.handleSelectChange(evt)
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
beforeDestroy () {
|
|
169
|
+
this.UiGrid.removeViewPanel('table')
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
</script>
|
|
173
|
+
<style lang="less">
|
|
174
|
+
.ui-grid-table-view{
|
|
175
|
+
flex: 1;
|
|
176
|
+
min-height: 0;
|
|
177
|
+
}
|
|
178
|
+
</style>
|
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<vxe-table
|
|
3
|
+
ref="table"
|
|
4
|
+
class="ui-grid-table"
|
|
5
|
+
:class="{ 'is-border': border, 'is-fixed-row-height': isFixedRowHeight }"
|
|
6
|
+
round
|
|
7
|
+
show-header-overflow="tooltip"
|
|
8
|
+
min-height="24px"
|
|
9
|
+
:show-overflow="showOverflow"
|
|
10
|
+
:row-id="rowId"
|
|
11
|
+
:height="tableHeight"
|
|
12
|
+
:max-height="maxHeight"
|
|
13
|
+
:row-config="rowConfig"
|
|
14
|
+
:row-class-name="rowClassName"
|
|
15
|
+
:tree-config="treeConfig"
|
|
16
|
+
:column-config="columnConfig"
|
|
17
|
+
:radio-config="radioConfig"
|
|
18
|
+
:checkbox-config="checkboxConfig"
|
|
19
|
+
:sort-config="sortConfig"
|
|
20
|
+
:seq-config="seqConfig"
|
|
21
|
+
:show-header="showHeader"
|
|
22
|
+
:data="data"
|
|
23
|
+
:border="border ? 'full' : 'inner'"
|
|
24
|
+
:scroll-y="scrollYConfig"
|
|
25
|
+
:scroll-x="scrollXConfig"
|
|
26
|
+
:show-footer="showSummary"
|
|
27
|
+
:footer-method="handleFooterMethod"
|
|
28
|
+
:footer-row-class-name="footerRowClassName"
|
|
29
|
+
@checkbox-change="handleSelectionChange"
|
|
30
|
+
@checkbox-all="handleSelectionAllChange"
|
|
31
|
+
@radio-change="handleRadioChange"
|
|
32
|
+
@cell-mouseenter="handleCellMouseEnter"
|
|
33
|
+
@cell-mouseleave="handleCellMouseLeave"
|
|
34
|
+
@sort-change="handleSortChange"
|
|
35
|
+
@resizable-change="handleColumnResizeableChange"
|
|
36
|
+
>
|
|
37
|
+
<template v-if="selectable && showIndex">
|
|
38
|
+
<vxe-column
|
|
39
|
+
v-if="multiple"
|
|
40
|
+
type="checkbox"
|
|
41
|
+
width="60px"
|
|
42
|
+
fixed="left"
|
|
43
|
+
align="center"
|
|
44
|
+
>
|
|
45
|
+
<template #header="{ checked, indeterminate }">
|
|
46
|
+
<template v-if="selectableAll">
|
|
47
|
+
<ui-tooltip content="选中当前页">
|
|
48
|
+
<vex-checkbox
|
|
49
|
+
:value="checked"
|
|
50
|
+
:indeterminate="indeterminate"
|
|
51
|
+
:style="{ width: '18px', 'margin-right': '3px' }"
|
|
52
|
+
@input="handleCheckAllChange"
|
|
53
|
+
@click.native.stop
|
|
54
|
+
>
|
|
55
|
+
</vex-checkbox>
|
|
56
|
+
</ui-tooltip>
|
|
57
|
+
</template>
|
|
58
|
+
</template>
|
|
59
|
+
</vxe-column>
|
|
60
|
+
<vxe-column v-else type="radio" width="54px" fixed="left" align="center">
|
|
61
|
+
<template slot="radio" slot-scope="scope">
|
|
62
|
+
<vex-radio
|
|
63
|
+
v-if="
|
|
64
|
+
hoverRowId === scope.rowid ||
|
|
65
|
+
handleRowRadioValue(scope.row, scope.column)
|
|
66
|
+
"
|
|
67
|
+
:value="handleRowRadioValue(scope.row, scope.column)"
|
|
68
|
+
:label="true"
|
|
69
|
+
:style="{ width: '18px' }"
|
|
70
|
+
@input="handleRowRadioInput(scope.row, scope.column)"
|
|
71
|
+
>
|
|
72
|
+
</vex-radio>
|
|
73
|
+
<span v-else :style="{'display': 'inline-block'}">
|
|
74
|
+
{{
|
|
75
|
+
showPagination
|
|
76
|
+
? (pageIndex - 1) * pageSize + scope.$rowIndex + 1
|
|
77
|
+
: scope.$rowIndex + 1
|
|
78
|
+
}}
|
|
79
|
+
</span>
|
|
80
|
+
</template>
|
|
81
|
+
</vxe-column>
|
|
82
|
+
</template>
|
|
83
|
+
<template v-else>
|
|
84
|
+
<template v-if="selectable">
|
|
85
|
+
<vxe-column
|
|
86
|
+
v-if="multiple"
|
|
87
|
+
type="checkbox"
|
|
88
|
+
width="60px"
|
|
89
|
+
fixed="left"
|
|
90
|
+
align="center"
|
|
91
|
+
>
|
|
92
|
+
</vxe-column>
|
|
93
|
+
<vxe-column
|
|
94
|
+
v-else
|
|
95
|
+
type="radio"
|
|
96
|
+
width="60px"
|
|
97
|
+
fixed="left"
|
|
98
|
+
align="center"
|
|
99
|
+
></vxe-column>
|
|
100
|
+
</template>
|
|
101
|
+
<vxe-column
|
|
102
|
+
v-if="showIndex"
|
|
103
|
+
type="seq"
|
|
104
|
+
width="60px"
|
|
105
|
+
fixed="left"
|
|
106
|
+
align="center"
|
|
107
|
+
>
|
|
108
|
+
</vxe-column>
|
|
109
|
+
</template>
|
|
110
|
+
<slot></slot>
|
|
111
|
+
</vxe-table>
|
|
112
|
+
</template>
|
|
113
|
+
<script>
|
|
114
|
+
import { Table, Column, Checkbox, Radio } from 'vxe-table'
|
|
115
|
+
import 'vxe-table/lib/style.css'
|
|
116
|
+
|
|
117
|
+
export default {
|
|
118
|
+
name: 'UiGridTable',
|
|
119
|
+
components: {
|
|
120
|
+
VxeTable: Table,
|
|
121
|
+
VxeColumn: Column,
|
|
122
|
+
VexCheckbox: Checkbox,
|
|
123
|
+
VexRadio: Radio
|
|
124
|
+
},
|
|
125
|
+
inject: ['UiGrid'],
|
|
126
|
+
props: {
|
|
127
|
+
data: {
|
|
128
|
+
type: Array
|
|
129
|
+
},
|
|
130
|
+
idField: {
|
|
131
|
+
type: String
|
|
132
|
+
},
|
|
133
|
+
parentField: {
|
|
134
|
+
type: String
|
|
135
|
+
},
|
|
136
|
+
border: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: false
|
|
139
|
+
},
|
|
140
|
+
selectable: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false
|
|
143
|
+
},
|
|
144
|
+
checkStrictly: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
default: false
|
|
147
|
+
},
|
|
148
|
+
selectableAll: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: true
|
|
151
|
+
},
|
|
152
|
+
multiple: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: false
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* 行是否允许选择方法
|
|
158
|
+
*/
|
|
159
|
+
rowCheckMethod: {
|
|
160
|
+
type: Function
|
|
161
|
+
},
|
|
162
|
+
rowVisibleMethod: {
|
|
163
|
+
type: Function
|
|
164
|
+
},
|
|
165
|
+
showIndex: {
|
|
166
|
+
type: Boolean,
|
|
167
|
+
default: false
|
|
168
|
+
},
|
|
169
|
+
showPagination: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: false
|
|
172
|
+
},
|
|
173
|
+
showHeader: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
default: true
|
|
176
|
+
},
|
|
177
|
+
pageIndex: {
|
|
178
|
+
type: Number,
|
|
179
|
+
default: 1
|
|
180
|
+
},
|
|
181
|
+
pageSize: {
|
|
182
|
+
type: Number,
|
|
183
|
+
default: 20
|
|
184
|
+
},
|
|
185
|
+
height: {
|
|
186
|
+
type: String
|
|
187
|
+
},
|
|
188
|
+
maxHeight: {
|
|
189
|
+
type: String
|
|
190
|
+
},
|
|
191
|
+
rowClassName: {
|
|
192
|
+
type: [String, Function]
|
|
193
|
+
},
|
|
194
|
+
rowHeight: {
|
|
195
|
+
type: String
|
|
196
|
+
},
|
|
197
|
+
defaultSort: {
|
|
198
|
+
type: [Object, Array]
|
|
199
|
+
},
|
|
200
|
+
remoteSort: {
|
|
201
|
+
type: Boolean,
|
|
202
|
+
default: true
|
|
203
|
+
},
|
|
204
|
+
showSummary: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: false
|
|
207
|
+
},
|
|
208
|
+
rowId: {
|
|
209
|
+
type: String,
|
|
210
|
+
default: 'id'
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
data() {
|
|
214
|
+
return {
|
|
215
|
+
hoverRowId: null
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
computed: {
|
|
219
|
+
isFixedRowHeight () {
|
|
220
|
+
return !!this.rowHeight && this.rowHeight !== 'auto'
|
|
221
|
+
},
|
|
222
|
+
tableHeight() {
|
|
223
|
+
let height
|
|
224
|
+
if (this.maxHeight) {
|
|
225
|
+
height = ''
|
|
226
|
+
} else {
|
|
227
|
+
if (this.height && this.height !== 'auto') {
|
|
228
|
+
height = '100%' // vxetable如果设置auto表示自动根据父级元素高度计算
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return height
|
|
232
|
+
},
|
|
233
|
+
sortConfig() {
|
|
234
|
+
return {
|
|
235
|
+
trigger: 'cell',
|
|
236
|
+
defaultSort: this.defaultSort,
|
|
237
|
+
remote: this.remoteSort
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
seqConfig() {
|
|
241
|
+
return {
|
|
242
|
+
seqMethod: ({ seq }) => {
|
|
243
|
+
return this.showPagination
|
|
244
|
+
? (this.pageIndex - 1) * this.pageSize + seq
|
|
245
|
+
: seq
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
scrollYConfig() {
|
|
250
|
+
if (this.rowHeight && this.rowHeight !== 'auto') {
|
|
251
|
+
return {
|
|
252
|
+
gt: 50,
|
|
253
|
+
enabled: true
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
return {
|
|
257
|
+
// gt: 20
|
|
258
|
+
enabled: false
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
scrollXConfig() {
|
|
263
|
+
return {
|
|
264
|
+
// gt: 10
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
rowConfig() {
|
|
268
|
+
return {
|
|
269
|
+
keyField: this.idField,
|
|
270
|
+
isHover: true,
|
|
271
|
+
height: this.rowHeight && this.rowHeight !== 'auto' ? this.rowHeight : null,
|
|
272
|
+
isCurrent: this.selectable && this.multiple === false
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
columnConfig() {
|
|
276
|
+
return {
|
|
277
|
+
resizable: true
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
treeConfig () {
|
|
281
|
+
if (!this.parentField) {
|
|
282
|
+
return
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
expandAll: true,
|
|
286
|
+
transform: false,
|
|
287
|
+
rowField: this.idField,
|
|
288
|
+
parentField: this.parentField
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
radioConfig() {
|
|
292
|
+
return {
|
|
293
|
+
trigger: 'row',
|
|
294
|
+
visibleMethod: this.rowVisibleMethod,
|
|
295
|
+
checkMethod: this.rowCheckMethod
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
showOverflow () {
|
|
299
|
+
if (!this.rowHeight || this.rowHeight === 'auto') {
|
|
300
|
+
return
|
|
301
|
+
}
|
|
302
|
+
return 'ellipsis'
|
|
303
|
+
},
|
|
304
|
+
checkboxConfig() {
|
|
305
|
+
return {
|
|
306
|
+
// trigger: 'row',
|
|
307
|
+
checkStrictly: this.checkStrictly, // 暂时这么写,后面再看
|
|
308
|
+
visibleMethod: this.rowVisibleMethod,
|
|
309
|
+
checkMethod: this.rowCheckMethod
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
mounted() {
|
|
314
|
+
const me = this
|
|
315
|
+
const loadTableData = this.$refs.table.loadTableData
|
|
316
|
+
this.$refs.table.loadTableData = function (...args) {
|
|
317
|
+
return loadTableData.apply(this, args).then(() => {
|
|
318
|
+
me.$emit('loaded')
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
beforeDestroy() {
|
|
323
|
+
clearTimeout(this._mouseLeaveTimer)
|
|
324
|
+
},
|
|
325
|
+
methods: {
|
|
326
|
+
footerRowClassName({ $rowIndex }) {
|
|
327
|
+
if ($rowIndex === 0) {
|
|
328
|
+
return 'vxe-table__footer-row'
|
|
329
|
+
}
|
|
330
|
+
return ''
|
|
331
|
+
},
|
|
332
|
+
handleCheckAllChange(value) {
|
|
333
|
+
const event = new window.CustomEvent('input', {
|
|
334
|
+
detail: '模拟触发一下,因为vxTable组件的handleCheckAllEvent需要'
|
|
335
|
+
})
|
|
336
|
+
this.$refs.table.handleCheckAllEvent(event, value)
|
|
337
|
+
},
|
|
338
|
+
handleRowCheckboxValue(row, column) {
|
|
339
|
+
if (!this.$refs.table) {
|
|
340
|
+
return false
|
|
341
|
+
}
|
|
342
|
+
return this.$refs.table.isCheckedByCheckboxRow(row)
|
|
343
|
+
},
|
|
344
|
+
handleRowRadioValue(row, column) {
|
|
345
|
+
if (!this.$refs.table) {
|
|
346
|
+
return false
|
|
347
|
+
}
|
|
348
|
+
return this.$refs.table.isCheckedByRadioRow(row)
|
|
349
|
+
},
|
|
350
|
+
handleRowRadioInput(row) {
|
|
351
|
+
if (!this.$refs.table) {
|
|
352
|
+
return
|
|
353
|
+
}
|
|
354
|
+
this.$refs.table.setRadioRow(row)
|
|
355
|
+
},
|
|
356
|
+
handleCellMouseEnter(evt) {
|
|
357
|
+
this.hoverRowId = evt.rowid
|
|
358
|
+
clearTimeout(this._mouseLeaveTimer)
|
|
359
|
+
this.$emit('hover-row-change', {
|
|
360
|
+
row: evt.row
|
|
361
|
+
})
|
|
362
|
+
},
|
|
363
|
+
handleSortChange (evt) {
|
|
364
|
+
this.$emit('sort-change', evt)
|
|
365
|
+
},
|
|
366
|
+
handleCellMouseLeave() {
|
|
367
|
+
clearTimeout(this._mouseLeaveTimer)
|
|
368
|
+
this._mouseLeaveTimer = setTimeout(() => {
|
|
369
|
+
if (!this.$refs.table.hoverRow) {
|
|
370
|
+
this.hoverRowId = null
|
|
371
|
+
this.$emit('hover-row-change', {
|
|
372
|
+
row: null
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
},
|
|
377
|
+
handleSelectionChange(evt) {
|
|
378
|
+
if (!this.selectable) {
|
|
379
|
+
return
|
|
380
|
+
}
|
|
381
|
+
if (!this.multiple) {
|
|
382
|
+
return
|
|
383
|
+
}
|
|
384
|
+
this.$emit('selection-change', {
|
|
385
|
+
selection: evt.records
|
|
386
|
+
})
|
|
387
|
+
},
|
|
388
|
+
handleSelectionAllChange(evt) {
|
|
389
|
+
this.$emit('selection-change', {
|
|
390
|
+
selection: evt.records
|
|
391
|
+
})
|
|
392
|
+
},
|
|
393
|
+
handleRadioChange(evt) {
|
|
394
|
+
if (!this.selectable) {
|
|
395
|
+
return
|
|
396
|
+
}
|
|
397
|
+
if (this.multiple) {
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
this.$emit('select-change', {
|
|
401
|
+
row: evt.row
|
|
402
|
+
})
|
|
403
|
+
},
|
|
404
|
+
handleColumnResizeableChange (evt) {
|
|
405
|
+
this.$emit('column-resize-change', evt)
|
|
406
|
+
},
|
|
407
|
+
handleFooterMethod ({ columns, data }) {
|
|
408
|
+
return [
|
|
409
|
+
columns.map((column, columnIndex) => {
|
|
410
|
+
if (columnIndex === 0) {
|
|
411
|
+
return '合计'
|
|
412
|
+
}
|
|
413
|
+
if (column.footerClassName && column.footerClassName.indexOf('is-show-summary') >= 0) {
|
|
414
|
+
return this.sumColumnValue(data, column)
|
|
415
|
+
}
|
|
416
|
+
return null
|
|
417
|
+
})
|
|
418
|
+
]
|
|
419
|
+
},
|
|
420
|
+
sumColumnValue (list, column) {
|
|
421
|
+
let count = 0
|
|
422
|
+
list.forEach(item => {
|
|
423
|
+
if (item[column.field]) {
|
|
424
|
+
count += Number(item[column.field])
|
|
425
|
+
} else {
|
|
426
|
+
count += 0
|
|
427
|
+
}
|
|
428
|
+
})
|
|
429
|
+
const cacheColumn = this.UiGrid.cacheColumns.find(v => v.prop === column.field)
|
|
430
|
+
if (cacheColumn && cacheColumn.formatSummary) {
|
|
431
|
+
count = cacheColumn.formatSummary({
|
|
432
|
+
value: count
|
|
433
|
+
})
|
|
434
|
+
}
|
|
435
|
+
return count
|
|
436
|
+
},
|
|
437
|
+
clearSelection() {
|
|
438
|
+
this.$refs.table && this.$refs.table.clearCheckboxRow()
|
|
439
|
+
},
|
|
440
|
+
setCheckboxRow(rows, isSelected = true) {
|
|
441
|
+
this.$refs.table && this.$refs.table.setCheckboxRow(rows, isSelected)
|
|
442
|
+
},
|
|
443
|
+
setRadioRow(row) {
|
|
444
|
+
if (row) {
|
|
445
|
+
this.$refs.table && this.$refs.table.setRadioRow(row)
|
|
446
|
+
} else {
|
|
447
|
+
this.$refs.table && this.$refs.table.clearRadioRow()
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
getSortColumns () {
|
|
451
|
+
return this.$refs.table.getSortColumns()
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
</script>
|
|
456
|
+
<style lang="less">
|
|
457
|
+
.ui-grid-table {
|
|
458
|
+
[class*="vxe-"] {
|
|
459
|
+
font-feature-settings: normal;
|
|
460
|
+
font-variant: normal;
|
|
461
|
+
}
|
|
462
|
+
&:not(.is-border) {
|
|
463
|
+
.vxe-resizable {
|
|
464
|
+
&:after {
|
|
465
|
+
content: "";
|
|
466
|
+
position: absolute;
|
|
467
|
+
left: 50%;
|
|
468
|
+
top: 50%;
|
|
469
|
+
margin-left: -1px;
|
|
470
|
+
margin-top: -9px;
|
|
471
|
+
width: 1px;
|
|
472
|
+
height: 18px;
|
|
473
|
+
background-color: rgba(0, 0, 0, 0.08);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.vxe-header--column.col--last {
|
|
478
|
+
.vxe-resizable {
|
|
479
|
+
&:after {
|
|
480
|
+
opacity: 0;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.vxe-table--header {
|
|
487
|
+
.vxe-cell {
|
|
488
|
+
display: flex;
|
|
489
|
+
flex-direction: row;
|
|
490
|
+
align-items: center;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.vxe-cell--title {
|
|
494
|
+
flex: 1;
|
|
495
|
+
min-width: 0;
|
|
496
|
+
white-space: nowrap;
|
|
497
|
+
overflow: hidden;
|
|
498
|
+
text-overflow: ellipsis;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.vxe-cell--sort {
|
|
503
|
+
transform: scale(0.8);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
&.vxe-table .vxe-sort--asc-btn {
|
|
507
|
+
top: -1px;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
&.vxe-table .vxe-sort--desc-btn {
|
|
511
|
+
bottom: -2px;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.vxe-table--render-default .vxe-table--empty-content {
|
|
515
|
+
pointer-events: none;
|
|
516
|
+
}
|
|
517
|
+
&.vxe-table--render-default .vxe-body--column:not(.col--ellipsis),
|
|
518
|
+
&.vxe-table--render-default .vxe-footer--column:not(.col--ellipsis),
|
|
519
|
+
&.vxe-table--render-default .vxe-header--column:not(.col--ellipsis){
|
|
520
|
+
padding-top: 10px;
|
|
521
|
+
padding-bottom: 10px;
|
|
522
|
+
}
|
|
523
|
+
&.vxe-table--render-default .vxe-body--column.col--ellipsis,
|
|
524
|
+
&.vxe-table--render-default .vxe-footer--column.col--ellipsis,
|
|
525
|
+
&.vxe-table--render-default .vxe-header--column.col--ellipsis,
|
|
526
|
+
&.vxe-table--render-default.vxe-editable .vxe-body--column{
|
|
527
|
+
height: 42px;
|
|
528
|
+
}
|
|
529
|
+
&.is-fixed-row-height {
|
|
530
|
+
&.vxe-table--render-default .vxe-body--column:not(.col--ellipsis),
|
|
531
|
+
&.vxe-table--render-default .vxe-footer--column:not(.col--ellipsis),
|
|
532
|
+
&.vxe-table--render-default .vxe-header--column:not(.col--ellipsis){
|
|
533
|
+
padding-top: 5px;
|
|
534
|
+
padding-bottom: 5px;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
.vxe-table__footer-row {
|
|
538
|
+
background-color: #f0f9eb !important;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
body {
|
|
543
|
+
.vxe-table--render-default {
|
|
544
|
+
color: #172b4d;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
</style>
|