bri-components 1.0.0
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/README.md +30 -0
- package/lib/.DS_Store +0 -0
- package/lib/0.bri-components.min.js +2 -0
- package/lib/0.bri-components.min.js.map +1 -0
- package/lib/1.bri-components.min.js +2 -0
- package/lib/1.bri-components.min.js.map +1 -0
- package/lib/2.bri-components.min.js +2 -0
- package/lib/2.bri-components.min.js.map +1 -0
- package/lib/3.bri-components.min.js +2 -0
- package/lib/3.bri-components.min.js.gz +0 -0
- package/lib/3.bri-components.min.js.map +1 -0
- package/lib/4.bri-components.min.js +2 -0
- package/lib/4.bri-components.min.js.gz +0 -0
- package/lib/4.bri-components.min.js.map +1 -0
- package/lib/5.bri-components.min.js +2 -0
- package/lib/5.bri-components.min.js.map +1 -0
- package/lib/6.bri-components.min.js +2 -0
- package/lib/6.bri-components.min.js.map +1 -0
- package/lib/bri-components.min.js +21 -0
- package/lib/bri-components.min.js.gz +0 -0
- package/lib/bri-components.min.js.map +1 -0
- package/lib/styles/bri-components.css +1 -0
- package/lib/styles/bundle.css +14 -0
- package/lib/styles/font/fontello.eot +0 -0
- package/lib/styles/font/fontello.svg +32 -0
- package/lib/styles/font/fontello.ttf +0 -0
- package/lib/styles/font/fontello.woff +0 -0
- package/lib/styles/font/fontello.woff2 +0 -0
- package/package.json +121 -0
- package/src/.DS_Store +0 -0
- package/src/components/controls/base/DshBack.vue +36 -0
- package/src/components/controls/base/DshCascader.vue +366 -0
- package/src/components/controls/base/DshCascaderMultiple.vue +158 -0
- package/src/components/controls/base/DshCheckbox.vue +199 -0
- package/src/components/controls/base/DshCoordinates.vue +497 -0
- package/src/components/controls/base/DshDate.vue +148 -0
- package/src/components/controls/base/DshDaterange.vue +335 -0
- package/src/components/controls/base/DshDivider.vue +59 -0
- package/src/components/controls/base/DshEditor.vue +166 -0
- package/src/components/controls/base/DshInput.vue +139 -0
- package/src/components/controls/base/DshLabels.vue +302 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +425 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -0
- package/src/components/controls/base/DshNumber/DshNumber.vue +148 -0
- package/src/components/controls/base/DshNumberange.vue +137 -0
- package/src/components/controls/base/DshPackage.vue +72 -0
- package/src/components/controls/base/DshSelect.vue +231 -0
- package/src/components/controls/base/DshSwitch.vue +112 -0
- package/src/components/controls/base/DshUndeveloped.vue +39 -0
- package/src/components/controls/base/YSerialNumber.vue +37 -0
- package/src/components/controls/base/ZUpload/YUploadImage.vue +228 -0
- package/src/components/controls/base/ZUpload/index.vue +356 -0
- package/src/components/controls/base/ZUpload/upload-list.vue +277 -0
- package/src/components/controls/base/ZUpload/upload-listItem.vue +0 -0
- package/src/components/controls/base/ZUpload/uploadMixin.js +397 -0
- package/src/components/controls/base/selectMixin.js +110 -0
- package/src/components/controls/base/textMultiple/DshTextMultiple.vue +94 -0
- package/src/components/controls/base/textMultiple/MultipleInput.vue +106 -0
- package/src/components/controls/controlMap.js +94 -0
- package/src/components/controls/controlMixin.js +84 -0
- package/src/components/form/DshAdvSearchForm.vue +341 -0
- package/src/components/form/DshDefaultSearch.vue +203 -0
- package/src/components/form/DshForm.vue +364 -0
- package/src/components/form/searchMixin.js +205 -0
- package/src/components/list/DshBox/DshBox.vue +168 -0
- package/src/components/list/DshBox/DshCard.vue +219 -0
- package/src/components/list/DshBox/DshCrossTable.vue +624 -0
- package/src/components/list/DshBox/DshList.vue +442 -0
- package/src/components/list/DshBox/DshPanel.vue +407 -0
- package/src/components/list/DshBox/DshSingleData.vue +82 -0
- package/src/components/list/DshBox/DshTable.vue +273 -0
- package/src/components/list/DshCascaderTable.vue +817 -0
- package/src/components/list/DshFlatTable.vue +622 -0
- package/src/components/list/ZTree.vue +527 -0
- package/src/components/list/easyTable/index.js +23 -0
- package/src/components/list/easyTable/src/directives/clickoutside.js +32 -0
- package/src/components/list/easyTable/src/mixins/layerAdjustment.js +62 -0
- package/src/components/list/easyTable/src/settings/settings.js +11 -0
- package/src/components/list/easyTable/src/utils/deepClone.js +256 -0
- package/src/components/list/easyTable/src/utils/dom.js +41 -0
- package/src/components/list/easyTable/src/utils/utils.js +190 -0
- package/src/components/list/easyTable/v-checkbox/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox/src/checkbox.vue +127 -0
- package/src/components/list/easyTable/v-checkbox-group/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox-group/src/checkbox-group.vue +68 -0
- package/src/components/list/easyTable/v-dropdown/index.js +7 -0
- package/src/components/list/easyTable/v-dropdown/src/dropdown.vue +337 -0
- package/src/components/list/easyTable/v-table/index.js +7 -0
- package/src/components/list/easyTable/v-table/src/body-cell-merge-mixin.js +141 -0
- package/src/components/list/easyTable/v-table/src/cell-edit-mixin.js +102 -0
- package/src/components/list/easyTable/v-table/src/checkbox-selection-mixin.js +189 -0
- package/src/components/list/easyTable/v-table/src/classes-mixin.js +56 -0
- package/src/components/list/easyTable/v-table/src/drag-width-mixin.js +202 -0
- package/src/components/list/easyTable/v-table/src/export-csv.js +74 -0
- package/src/components/list/easyTable/v-table/src/frozen-columns-mixin.js +134 -0
- package/src/components/list/easyTable/v-table/src/loading.vue +49 -0
- package/src/components/list/easyTable/v-table/src/scroll-bar-control-mixin.js +21 -0
- package/src/components/list/easyTable/v-table/src/scroll-control-mixin.js +92 -0
- package/src/components/list/easyTable/v-table/src/sort-control-mixin.js +108 -0
- package/src/components/list/easyTable/v-table/src/table-empty-mixin.js +73 -0
- package/src/components/list/easyTable/v-table/src/table-empty.vue +66 -0
- package/src/components/list/easyTable/v-table/src/table-filters-mixin.js +126 -0
- package/src/components/list/easyTable/v-table/src/table-footer-mixin.js +122 -0
- package/src/components/list/easyTable/v-table/src/table-resize-mixin.js +279 -0
- package/src/components/list/easyTable/v-table/src/table-row-mouse-events-mixin.js +123 -0
- package/src/components/list/easyTable/v-table/src/table.vue +1565 -0
- package/src/components/list/easyTable/v-table/src/title-cell-merge-mixin.js +115 -0
- package/src/components/list/evTable/EvTable.vue +323 -0
- package/src/components/list/evTable/EvTableMixin.js +26 -0
- package/src/components/other/DshAvatar.vue +149 -0
- package/src/components/other/DshBtnModal.vue +64 -0
- package/src/components/other/DshColorPanel.vue +128 -0
- package/src/components/other/DshEditPanel.vue +130 -0
- package/src/components/other/InfoCascader.vue +258 -0
- package/src/components/other/YNoPermission.vue +45 -0
- package/src/components/other/ZCode.vue +125 -0
- package/src/components/other/ZCollapseTree.vue +84 -0
- package/src/components/other/ZGantt.vue +669 -0
- package/src/components/other/ZIframe.vue +105 -0
- package/src/components/other/ZLoading.vue +59 -0
- package/src/components/other/menu/DshMenu.vue +133 -0
- package/src/components/other/menu/DshMenuNav.vue +104 -0
- package/src/components/pages/Error/Error403.vue +34 -0
- package/src/components/pages/Error/Error404.vue +34 -0
- package/src/components/pages/Error/Error500.vue +34 -0
- package/src/components/pages/Error/error.less +163 -0
- package/src/components/pages/Error/errorBack.vue +38 -0
- package/src/components/small/Ctooltip.vue +90 -0
- package/src/components/small/DshButtons.vue +195 -0
- package/src/components/small/DshControlDefine.vue +110 -0
- package/src/components/small/DshCrumbs.vue +61 -0
- package/src/components/small/DshCrumbsItem.vue +107 -0
- package/src/components/small/DshDropdown.vue +159 -0
- package/src/components/small/DshFileShow.vue +212 -0
- package/src/components/small/DshIcons.vue +63 -0
- package/src/components/small/DshModal.vue +255 -0
- package/src/components/small/DshPage.vue +98 -0
- package/src/components/small/DshSteps.vue +68 -0
- package/src/components/small/DshTabs.vue +227 -0
- package/src/components/small/DshTags.vue +58 -0
- package/src/components/small/DshTdRender.js +21 -0
- package/src/components/small/DshTitle.vue +36 -0
- package/src/components/small/render.js +20 -0
- package/src/components/unit/DshFormItem.vue +157 -0
- package/src/components/unit/DshUnit.vue +72 -0
- package/src/components/unit/unitMixin.js +43 -0
- package/src/datas/.DS_Store +0 -0
- package/src/datas/common/region.json +1 -0
- package/src/datas/common/resourceData.json +20 -0
- package/src/datas/index.js +11 -0
- package/src/index.js +243 -0
- package/src/styles/animate.less +16 -0
- package/src/styles/bundle.css +14 -0
- package/src/styles/common/box.less +157 -0
- package/src/styles/common/common.less +31 -0
- package/src/styles/common/flex.less +282 -0
- package/src/styles/common/index.less +4 -0
- package/src/styles/common/text.less +43 -0
- package/src/styles/components/controls/DshCascader.less +75 -0
- package/src/styles/components/controls/DshCheckbox.less +156 -0
- package/src/styles/components/controls/DshCoordinates.less +72 -0
- package/src/styles/components/controls/DshDaterange.less +49 -0
- package/src/styles/components/controls/DshDivider.less +115 -0
- package/src/styles/components/controls/DshEditor.less +52 -0
- package/src/styles/components/controls/DshInput.less +40 -0
- package/src/styles/components/controls/DshLabels.less +187 -0
- package/src/styles/components/controls/DshNumberange.less +24 -0
- package/src/styles/components/controls/DshPackage.less +25 -0
- package/src/styles/components/controls/DshSelect.less +172 -0
- package/src/styles/components/controls/MultipleInput.less +55 -0
- package/src/styles/components/controls/ZUpload.less +446 -0
- package/src/styles/components/form/DshAdvSearchForm.less +159 -0
- package/src/styles/components/form/DshDefaultSearch.less +71 -0
- package/src/styles/components/index.less +49 -0
- package/src/styles/components/list/DshCascaderTable.less +113 -0
- package/src/styles/components/list/DshCrossTable.less +175 -0
- package/src/styles/components/list/DshFlatTable.less +98 -0
- package/src/styles/components/list/DshSingleData.less +30 -0
- package/src/styles/components/list/evTable.less +79 -0
- package/src/styles/components/list/evtable/animation.less +141 -0
- package/src/styles/components/list/evtable/font/fontello.eot +0 -0
- package/src/styles/components/list/evtable/font/fontello.svg +32 -0
- package/src/styles/components/list/evtable/font/fontello.ttf +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff2 +0 -0
- package/src/styles/components/list/evtable/fontello.less +68 -0
- package/src/styles/components/list/evtable/index.less +5 -0
- package/src/styles/components/list/evtable/v-checkbox.less +167 -0
- package/src/styles/components/list/evtable/v-dropdown.less +235 -0
- package/src/styles/components/list/evtable/v-table.less +334 -0
- package/src/styles/components/list/ivu_reset.less +49 -0
- package/src/styles/components/other/DshEditPanel.less +70 -0
- package/src/styles/components/other/DshMenu.less +37 -0
- package/src/styles/components/other/DshMenuNav.less +82 -0
- package/src/styles/components/other/InfoCascader.less +55 -0
- package/src/styles/components/other/ZCode.less +1 -0
- package/src/styles/components/other/ZCollapseTree.less +62 -0
- package/src/styles/components/other/ZGantt.less +278 -0
- package/src/styles/components/other/ZLoading.less +36 -0
- package/src/styles/components/small/Ctooltip.less +5 -0
- package/src/styles/components/small/DshButtons.less +40 -0
- package/src/styles/components/small/DshControlDefine.less +64 -0
- package/src/styles/components/small/DshDropdown.less +61 -0
- package/src/styles/components/small/DshPage.less +94 -0
- package/src/styles/components/small/DshSteps.less +58 -0
- package/src/styles/components/small/DshTabs.less +82 -0
- package/src/styles/components/small/DshTitle.less +18 -0
- package/src/styles/components/unit/DshFormItem.less +124 -0
- package/src/styles/define.less +374 -0
- package/src/styles/index.less +10 -0
- package/src/styles/reset.less +83 -0
- package/src/styles/variables.less +98 -0
- package/src/styles/view_reset.less +446 -0
|
@@ -0,0 +1,1565 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="['v-table-views', 'v-table-class',`${className}`]"
|
|
4
|
+
ref="table"
|
|
5
|
+
:style="{
|
|
6
|
+
'width': internalWidth + 'px',
|
|
7
|
+
'height': getTableHeight,
|
|
8
|
+
'background-color': tableBgColor
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<!-- 左列 -->
|
|
12
|
+
<template v-if="frozenCols.length > 0">
|
|
13
|
+
<div
|
|
14
|
+
class="v-table-leftview"
|
|
15
|
+
:style="{'width':leftViewWidth+'px'}"
|
|
16
|
+
>
|
|
17
|
+
<!-- 左列-头 -->
|
|
18
|
+
<div
|
|
19
|
+
:class="{
|
|
20
|
+
'v-table-header':true,
|
|
21
|
+
'v-table-title-class':true,
|
|
22
|
+
'v-table-header-notFixed':!fixTitle
|
|
23
|
+
}"
|
|
24
|
+
:style="{'width': leftViewWidth+'px','background-color':titleBgColor,'color':titleFontColor}"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="v-table-header-inner"
|
|
28
|
+
style="display: block;"
|
|
29
|
+
>
|
|
30
|
+
<table
|
|
31
|
+
class="v-table-htable"
|
|
32
|
+
border="1"
|
|
33
|
+
cellspacing="0"
|
|
34
|
+
cellpadding="0"
|
|
35
|
+
bordercolor="#E5E5E5"
|
|
36
|
+
>
|
|
37
|
+
<tbody>
|
|
38
|
+
<template v-if="frozenTitleCols.length > 0">
|
|
39
|
+
<tr
|
|
40
|
+
v-for="(row, ridx) in frozenTitleCols"
|
|
41
|
+
:key="ridx"
|
|
42
|
+
>
|
|
43
|
+
<td
|
|
44
|
+
v-for="(col, cidx) in row"
|
|
45
|
+
:key="cidx"
|
|
46
|
+
:class="[col.titleCellClassName]"
|
|
47
|
+
:colspan="col.colspan"
|
|
48
|
+
:rowspan="col.rowspan"
|
|
49
|
+
@mousemove.stop="handleTitleMouseMove($event,col.fields)"
|
|
50
|
+
@mousedown.stop="handleTitleMouseDown($event)"
|
|
51
|
+
@mouseout.stop="handleTitleMouseOut()"
|
|
52
|
+
@click="titleCellClick(col.fields,col.title);"
|
|
53
|
+
@dblclick="titleCellDblClick(col.fields,col.title)"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
:class="['v-table-title-cell',showVerticalBorder?'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
57
|
+
:style="{'width':titleColumnWidth(col.fields)+'px','height':titleColumnHeight(col.rowspan)+'px','text-align':col.titleAlign}"
|
|
58
|
+
>
|
|
59
|
+
<span class="table-title">
|
|
60
|
+
<span v-if="isSelectionCol(col.fields)">
|
|
61
|
+
<v-checkbox
|
|
62
|
+
@change="handleCheckAll"
|
|
63
|
+
:indeterminate="indeterminate"
|
|
64
|
+
v-model="isAllChecked"
|
|
65
|
+
:show-slot="false"
|
|
66
|
+
label="check-all"
|
|
67
|
+
></v-checkbox>
|
|
68
|
+
</span>
|
|
69
|
+
<span
|
|
70
|
+
v-else
|
|
71
|
+
v-html="col.title"
|
|
72
|
+
></span>
|
|
73
|
+
<span
|
|
74
|
+
@click="sortControl(col.fields[0])"
|
|
75
|
+
class="v-table-sort-icon"
|
|
76
|
+
v-if="enableSort(col.orderBy)"
|
|
77
|
+
>
|
|
78
|
+
<slot name="sort">
|
|
79
|
+
<i :class='["v-icon-up-dir",getCurrentSort(col.fields[0]) ==="asc" ? "checked":""]'></i>
|
|
80
|
+
<i :class='["v-icon-down-dir",getCurrentSort(col.fields[0]) ==="desc" ? "checked":""]'></i>
|
|
81
|
+
</slot>
|
|
82
|
+
</span>
|
|
83
|
+
</span>
|
|
84
|
+
<!--filters-->
|
|
85
|
+
<v-dropdown
|
|
86
|
+
class="v-table-dropdown"
|
|
87
|
+
v-if="enableFilters(col.filters,col.fields)"
|
|
88
|
+
v-model="col.filters"
|
|
89
|
+
:show-operation="col.filterMultiple"
|
|
90
|
+
:is-multiple="col.filterMultiple"
|
|
91
|
+
@on-filter-method="filterEvent"
|
|
92
|
+
@change="filterConditionChange(col.filterMultiple)"
|
|
93
|
+
>
|
|
94
|
+
<i :class="['v-table-filter-icon',vTableFiltersIcon(col.filters)]"></i>
|
|
95
|
+
</v-dropdown>
|
|
96
|
+
</div>
|
|
97
|
+
</td>
|
|
98
|
+
</tr>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<template v-else>
|
|
102
|
+
<tr class="v-table-header-row">
|
|
103
|
+
<td
|
|
104
|
+
v-for="(col, fcidx) in frozenCols"
|
|
105
|
+
:key="fcidx"
|
|
106
|
+
:class="[col.titleCellClassName]"
|
|
107
|
+
@mousemove.stop="handleTitleMouseMove($event,col.field)"
|
|
108
|
+
@mousedown.stop="handleTitleMouseDown($event)"
|
|
109
|
+
@mouseout.stop="handleTitleMouseOut()"
|
|
110
|
+
@click="titleCellClick(col.field,col.title);"
|
|
111
|
+
@dblclick="titleCellDblClick(col.field,col.title)"
|
|
112
|
+
>
|
|
113
|
+
<div
|
|
114
|
+
:class="['v-table-title-cell',showVerticalBorder?'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
115
|
+
:style="{'width':col.width+'px','height':titleRowHeight+'px','text-align':col.titleAlign}"
|
|
116
|
+
>
|
|
117
|
+
<span class="table-title">
|
|
118
|
+
<span v-if="col.type === 'selection'">
|
|
119
|
+
<v-checkbox
|
|
120
|
+
@change="handleCheckAll"
|
|
121
|
+
:indeterminate="indeterminate"
|
|
122
|
+
v-model="isAllChecked"
|
|
123
|
+
:show-slot="false"
|
|
124
|
+
label="check-all"
|
|
125
|
+
></v-checkbox>
|
|
126
|
+
</span>
|
|
127
|
+
<span
|
|
128
|
+
v-else
|
|
129
|
+
v-html="col.title"
|
|
130
|
+
></span>
|
|
131
|
+
<span
|
|
132
|
+
@click="sortControl(col.field)"
|
|
133
|
+
class="v-table-sort-icon"
|
|
134
|
+
v-if="enableSort(col.orderBy)"
|
|
135
|
+
>
|
|
136
|
+
<slot name="sort">
|
|
137
|
+
<i :class='["v-icon-up-dir",getCurrentSort(col.field) ==="asc" ? "checked":""]'></i>
|
|
138
|
+
<i :class='["v-icon-down-dir",getCurrentSort(col.field) ==="desc" ? "checked":""]'></i>
|
|
139
|
+
</slot>
|
|
140
|
+
</span>
|
|
141
|
+
</span>
|
|
142
|
+
<!--filters-->
|
|
143
|
+
<v-dropdown
|
|
144
|
+
class="v-table-dropdown"
|
|
145
|
+
v-if="enableFilters(col.filters)"
|
|
146
|
+
v-model="col.filters"
|
|
147
|
+
:show-operation="col.filterMultiple"
|
|
148
|
+
:is-multiple="col.filterMultiple"
|
|
149
|
+
@on-filter-method="filterEvent"
|
|
150
|
+
@change="filterConditionChange(col.filterMultiple)"
|
|
151
|
+
>
|
|
152
|
+
<i :class="['v-table-filter-icon',vTableFiltersIcon(col.filters)]"></i>
|
|
153
|
+
</v-dropdown>
|
|
154
|
+
</div>
|
|
155
|
+
</td>
|
|
156
|
+
</tr>
|
|
157
|
+
</template>
|
|
158
|
+
</tbody>
|
|
159
|
+
</table>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<!-- 左列-内容 -->
|
|
164
|
+
<div
|
|
165
|
+
class="v-table-body v-table-body-class"
|
|
166
|
+
:style="{'width': leftViewWidth+'px', 'height': bodyViewHeight+'px', 'margin-top': titleRowHeight+'px'}"
|
|
167
|
+
>
|
|
168
|
+
<div :class="['v-table-body-inner',vTableBodyInner]">
|
|
169
|
+
<v-checkbox-group
|
|
170
|
+
v-model="checkboxGroupModel"
|
|
171
|
+
@change="handleCheckGroupChange"
|
|
172
|
+
>
|
|
173
|
+
<table
|
|
174
|
+
class="v-table-btable"
|
|
175
|
+
border="1"
|
|
176
|
+
cellspacing="0"
|
|
177
|
+
cellpadding="0"
|
|
178
|
+
bordercolor="#E5E5E5"
|
|
179
|
+
>
|
|
180
|
+
<tbody>
|
|
181
|
+
<tr
|
|
182
|
+
v-for="(item,rowIndex) in internalTableData"
|
|
183
|
+
class="v-table-row"
|
|
184
|
+
:key="rowIndex"
|
|
185
|
+
:style="[trBgColor(rowIndex+1)]"
|
|
186
|
+
@mouseenter.stop="handleMouseEnter(rowIndex)"
|
|
187
|
+
@mouseleave.stop="handleMouseOut(rowIndex)"
|
|
188
|
+
>
|
|
189
|
+
<td
|
|
190
|
+
v-if="cellMergeInit(rowIndex,col.field,item,true)"
|
|
191
|
+
v-for="(col,colIndex) in frozenCols"
|
|
192
|
+
:key="colIndex"
|
|
193
|
+
:colSpan="setColRowSpan(rowIndex,col.field,item).colSpan"
|
|
194
|
+
:rowSpan="setColRowSpan(rowIndex,col.field,item).rowSpan"
|
|
195
|
+
:class="[setColumnCellClassName(rowIndex,col.field,item)]"
|
|
196
|
+
>
|
|
197
|
+
<!--存在列合并-->
|
|
198
|
+
<div
|
|
199
|
+
v-if="isCellMergeRender(rowIndex,col.field,item)"
|
|
200
|
+
:class="['v-table-body-cell',showVerticalBorder ? 'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
201
|
+
:style="{'width':getRowWidthByColSpan(rowIndex,col.field,item)+'px','height': getRowHeightByRowSpan(rowIndex,col.field,item)+'px','line-height':getRowHeightByRowSpan(rowIndex,col.field,item)+'px','text-align':col.columnAlign}"
|
|
202
|
+
:title="col.overflowTitle ? overflowTitle(item,rowIndex,col) :''"
|
|
203
|
+
@click="rowCellClick(rowIndex,item,col);cellEditClick($event,col.isEdit,item,col.field,rowIndex)"
|
|
204
|
+
@dblclick="rowCellDbClick(rowIndex,item,col)"
|
|
205
|
+
>
|
|
206
|
+
<span v-if="cellMergeContentType(rowIndex,col.field,item).isComponent">
|
|
207
|
+
<component
|
|
208
|
+
:render="col.render"
|
|
209
|
+
:row="item"
|
|
210
|
+
:rowData="item"
|
|
211
|
+
:column="col"
|
|
212
|
+
:field="col.field ? col.field : ''"
|
|
213
|
+
:index="rowIndex"
|
|
214
|
+
:is="cellMerge(rowIndex,item,col.field).componentName"
|
|
215
|
+
@on-custom-comp="customCompFunc"
|
|
216
|
+
></component>
|
|
217
|
+
</span>
|
|
218
|
+
<span
|
|
219
|
+
v-else
|
|
220
|
+
v-html="cellMerge(rowIndex,item,col.field).content"
|
|
221
|
+
></span>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<!--不存在列合并-->
|
|
225
|
+
<div
|
|
226
|
+
v-else
|
|
227
|
+
:class="['v-table-body-cell',showVerticalBorder ? 'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
228
|
+
:style="getCellStyle(col, item)"
|
|
229
|
+
:title="col.overflowTitle ? overflowTitle(item,rowIndex,col) : ''"
|
|
230
|
+
@click="rowCellClick(rowIndex, item, col); cellEditClick($event, col.isEdit, item,col.field, rowIndex)"
|
|
231
|
+
@dblclick="rowCellDbClick(rowIndex, item, col)"
|
|
232
|
+
>
|
|
233
|
+
<span v-if="typeof col.componentName ==='string' && col.componentName.length > 0">
|
|
234
|
+
<component
|
|
235
|
+
:render="col.render"
|
|
236
|
+
:row="item"
|
|
237
|
+
:rowData="item"
|
|
238
|
+
:column="col"
|
|
239
|
+
:field="col.field ? col.field : ''"
|
|
240
|
+
:index="rowIndex"
|
|
241
|
+
:is="col.componentName"
|
|
242
|
+
@on-custom-comp="customCompFunc"
|
|
243
|
+
></component>
|
|
244
|
+
</span>
|
|
245
|
+
|
|
246
|
+
<span
|
|
247
|
+
v-else-if="typeof col.formatter==='function'"
|
|
248
|
+
v-html="col.formatter(item,rowIndex,pagingIndex,col.field)"
|
|
249
|
+
></span>
|
|
250
|
+
|
|
251
|
+
<span v-else-if="col.type === 'selection'">
|
|
252
|
+
<v-checkbox
|
|
253
|
+
@change="handleCheckChange(item)"
|
|
254
|
+
:show-slot="false"
|
|
255
|
+
:disabled="item._disabled"
|
|
256
|
+
:label="rowIndex"
|
|
257
|
+
></v-checkbox>
|
|
258
|
+
</span>
|
|
259
|
+
|
|
260
|
+
<span v-else>
|
|
261
|
+
{{item[col.field]}}
|
|
262
|
+
</span>
|
|
263
|
+
</div>
|
|
264
|
+
</td>
|
|
265
|
+
</tr>
|
|
266
|
+
</tbody>
|
|
267
|
+
</table>
|
|
268
|
+
</v-checkbox-group>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
<!-- 左列-底 -->
|
|
273
|
+
<div
|
|
274
|
+
v-if="frozenFooterCols.length > 0"
|
|
275
|
+
:class="['v-table-footer','v-table-footer-class']"
|
|
276
|
+
:style="{'width': leftViewWidth+'px','height':footerTotalHeight}"
|
|
277
|
+
>
|
|
278
|
+
<table
|
|
279
|
+
class="v-table-ftable"
|
|
280
|
+
border="1"
|
|
281
|
+
cellspacing="0"
|
|
282
|
+
cellpadding="0"
|
|
283
|
+
bordercolor="#E5E5E5"
|
|
284
|
+
>
|
|
285
|
+
<tr
|
|
286
|
+
class="v-table-row"
|
|
287
|
+
v-for="(item,rowIndex) in frozenFooterCols"
|
|
288
|
+
:key="rowIndex"
|
|
289
|
+
>
|
|
290
|
+
<td
|
|
291
|
+
v-for="(col,colIndex) in item"
|
|
292
|
+
:key="colIndex"
|
|
293
|
+
:class="setFooterCellClassName(true,rowIndex,colIndex,col.content)"
|
|
294
|
+
>
|
|
295
|
+
<div
|
|
296
|
+
:style="{'height':footerRowHeight+'px','line-height':footerRowHeight+'px','width':col.width+'px','text-align':col.align}"
|
|
297
|
+
:class="['v-table-body-cell',vTableBodyCell]"
|
|
298
|
+
v-html="col.content"
|
|
299
|
+
></div>
|
|
300
|
+
</td>
|
|
301
|
+
</tr>
|
|
302
|
+
</table>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
</template>
|
|
306
|
+
|
|
307
|
+
<!-- 中列-->
|
|
308
|
+
<div
|
|
309
|
+
class="v-table-centerview"
|
|
310
|
+
:style="{
|
|
311
|
+
'width': centerViewWidth + 'px',
|
|
312
|
+
'height': getTableCenterViewHeight,
|
|
313
|
+
'margin-left': leftViewWidth + 'px',
|
|
314
|
+
'margin-right': rightViewWidth + 'px'
|
|
315
|
+
}"
|
|
316
|
+
>
|
|
317
|
+
<!-- 中列 头-->
|
|
318
|
+
<div
|
|
319
|
+
:class="{
|
|
320
|
+
'v-table-header':true,
|
|
321
|
+
'v-table-title-class':true,
|
|
322
|
+
'v-table-header-notFixed':!fixTitle
|
|
323
|
+
}"
|
|
324
|
+
:style="{'width': centerViewWidth+'px', 'color':titleFontColor}"
|
|
325
|
+
>
|
|
326
|
+
<div
|
|
327
|
+
class="v-table-header-inner"
|
|
328
|
+
style="display: block;"
|
|
329
|
+
>
|
|
330
|
+
<table
|
|
331
|
+
class="v-table-htable"
|
|
332
|
+
:style="{ 'background-color':titleBgColor }"
|
|
333
|
+
border="1"
|
|
334
|
+
cellspacing="0"
|
|
335
|
+
cellpadding="0"
|
|
336
|
+
bordercolor="#E5E5E5"
|
|
337
|
+
>
|
|
338
|
+
<tbody>
|
|
339
|
+
<template v-if="noFrozenTitleCols.length > 0">
|
|
340
|
+
<tr
|
|
341
|
+
v-for="(row, nfridx) in noFrozenTitleCols"
|
|
342
|
+
:key="nfridx"
|
|
343
|
+
>
|
|
344
|
+
<td
|
|
345
|
+
v-for="(col, cidx) in row"
|
|
346
|
+
:key="cidx"
|
|
347
|
+
:class="[col.titleCellClassName]"
|
|
348
|
+
:colspan="col.colspan"
|
|
349
|
+
:rowspan="col.rowspan"
|
|
350
|
+
@mousemove.stop="handleTitleMouseMove($event,col.fields)"
|
|
351
|
+
@mousedown.stop="handleTitleMouseDown($event)"
|
|
352
|
+
@mouseout.stop="handleTitleMouseOut()"
|
|
353
|
+
@click="titleCellClick(col.fields,col.title);"
|
|
354
|
+
@dblclick="titleCellDblClick(col.fields,col.title)"
|
|
355
|
+
>
|
|
356
|
+
<div
|
|
357
|
+
:class="['v-table-title-cell',showVerticalBorder?'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
358
|
+
:style="{'width':titleColumnWidth(col.fields)+'px','height':titleColumnHeight(col.rowspan)+'px','text-align':col.titleAlign}"
|
|
359
|
+
>
|
|
360
|
+
<span class="table-title dsh-ellipsis">
|
|
361
|
+
<span v-if="isSelectionCol(col.fields)">
|
|
362
|
+
<v-checkbox
|
|
363
|
+
@change="handleCheckAll"
|
|
364
|
+
:indeterminate="indeterminate"
|
|
365
|
+
v-model="isAllChecked"
|
|
366
|
+
:show-slot="false"
|
|
367
|
+
label="check-all"
|
|
368
|
+
></v-checkbox>
|
|
369
|
+
</span>
|
|
370
|
+
<span
|
|
371
|
+
v-else
|
|
372
|
+
v-html="col.title"
|
|
373
|
+
></span>
|
|
374
|
+
</span>
|
|
375
|
+
|
|
376
|
+
<span
|
|
377
|
+
v-if="enableSort(col.orderBy)"
|
|
378
|
+
@click="sortControl(col.fields[0])"
|
|
379
|
+
class="v-table-sort-icon"
|
|
380
|
+
>
|
|
381
|
+
<slot name="sort">
|
|
382
|
+
<i :class='["v-icon-up-dir",getCurrentSort(col.fields[0]) ==="asc" ? "checked":""]'></i>
|
|
383
|
+
<i :class='["v-icon-down-dir",getCurrentSort(col.fields[0]) ==="desc" ? "checked":""]'></i>
|
|
384
|
+
</slot>
|
|
385
|
+
</span>
|
|
386
|
+
<!--filters-->
|
|
387
|
+
<v-dropdown
|
|
388
|
+
class="v-table-dropdown"
|
|
389
|
+
v-if="enableFilters(col.filters,col.fields)"
|
|
390
|
+
v-model="col.filters"
|
|
391
|
+
:show-operation="col.filterMultiple"
|
|
392
|
+
:is-multiple="col.filterMultiple"
|
|
393
|
+
@on-filter-method="filterEvent"
|
|
394
|
+
@change="filterConditionChange(col.filterMultiple)"
|
|
395
|
+
>
|
|
396
|
+
<i :class="['v-table-filter-icon',vTableFiltersIcon(col.filters)]"></i>
|
|
397
|
+
</v-dropdown>
|
|
398
|
+
</div>
|
|
399
|
+
</td>
|
|
400
|
+
</tr>
|
|
401
|
+
</template>
|
|
402
|
+
|
|
403
|
+
<template v-else>
|
|
404
|
+
<tr class="v-table-header-row">
|
|
405
|
+
<td
|
|
406
|
+
v-for="(col,colIndex) in noFrozenCols"
|
|
407
|
+
:key="colIndex"
|
|
408
|
+
:class="[col.titleCellClassName]"
|
|
409
|
+
@mousemove.stop="handleTitleMouseMove($event,col.field)"
|
|
410
|
+
@mousedown.stop="handleTitleMouseDown($event)"
|
|
411
|
+
@mouseout.stop="handleTitleMouseOut()"
|
|
412
|
+
@click="titleCellClick(col.field,col.title);"
|
|
413
|
+
@dblclick="titleCellDblClick(col.field,col.title)"
|
|
414
|
+
>
|
|
415
|
+
<div
|
|
416
|
+
:class="['v-table-title-cell',showVerticalBorder?'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
417
|
+
:style="{'width':col.width+'px','height':titleRowHeight+'px','text-align':col.titleAlign}"
|
|
418
|
+
>
|
|
419
|
+
<Ctooltip
|
|
420
|
+
transfer
|
|
421
|
+
:content="col.title"
|
|
422
|
+
style="display:inline-block;width:100%;"
|
|
423
|
+
>
|
|
424
|
+
<span
|
|
425
|
+
class="table-title dsh-ellipsis"
|
|
426
|
+
style="width:100%"
|
|
427
|
+
>
|
|
428
|
+
<span v-if="col.type === 'selection'">
|
|
429
|
+
<v-checkbox
|
|
430
|
+
@change="handleCheckAll"
|
|
431
|
+
:indeterminate="indeterminate"
|
|
432
|
+
v-model="isAllChecked"
|
|
433
|
+
:show-slot="false"
|
|
434
|
+
label="check-all"
|
|
435
|
+
></v-checkbox>
|
|
436
|
+
</span>
|
|
437
|
+
<span
|
|
438
|
+
v-else
|
|
439
|
+
v-html="col.title"
|
|
440
|
+
></span>
|
|
441
|
+
<!--filters-->
|
|
442
|
+
<v-dropdown
|
|
443
|
+
class="v-table-dropdown"
|
|
444
|
+
v-if="enableFilters(col.filters)"
|
|
445
|
+
v-model="col.filters"
|
|
446
|
+
:show-operation="col.filterMultiple"
|
|
447
|
+
:is-multiple="col.filterMultiple"
|
|
448
|
+
@on-filter-method="filterEvent"
|
|
449
|
+
@change="filterConditionChange(col.filterMultiple)"
|
|
450
|
+
>
|
|
451
|
+
<i :class="['v-table-filter-icon',vTableFiltersIcon(col.filters)]"></i>
|
|
452
|
+
</v-dropdown>
|
|
453
|
+
</span>
|
|
454
|
+
<span
|
|
455
|
+
@click="sortControl(col.field)"
|
|
456
|
+
class="v-table-sort-icon"
|
|
457
|
+
v-if="enableSort(col.orderBy)"
|
|
458
|
+
>
|
|
459
|
+
<slot name="sort">
|
|
460
|
+
<i :class='["v-icon-up-dir",getCurrentSort(col.field) ==="asc" ? "checked":""]'></i>
|
|
461
|
+
<i :class='["v-icon-down-dir",getCurrentSort(col.field) ==="desc" ? "checked":""]'></i>
|
|
462
|
+
</slot>
|
|
463
|
+
</span>
|
|
464
|
+
</Ctooltip>
|
|
465
|
+
</div>
|
|
466
|
+
</td>
|
|
467
|
+
</tr>
|
|
468
|
+
</template>
|
|
469
|
+
</tbody>
|
|
470
|
+
</table>
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
|
|
474
|
+
<!-- 中列 内容-->
|
|
475
|
+
<div
|
|
476
|
+
:class="['v-table-body v-table-body-class',vTableRightBody]"
|
|
477
|
+
:style="{
|
|
478
|
+
'width': centerViewWidth + 'px',
|
|
479
|
+
'max-height': getTableCenterViewBodyHeight,
|
|
480
|
+
'margin-top': titleRowHeight + 'px'
|
|
481
|
+
}"
|
|
482
|
+
>
|
|
483
|
+
<v-checkbox-group
|
|
484
|
+
v-model="checkboxGroupModel"
|
|
485
|
+
@change="handleCheckGroupChange"
|
|
486
|
+
>
|
|
487
|
+
<table
|
|
488
|
+
class="v-table-btable"
|
|
489
|
+
border="1"
|
|
490
|
+
cellspacing="0"
|
|
491
|
+
cellpadding="0"
|
|
492
|
+
bordercolor="#E5E5E5"
|
|
493
|
+
>
|
|
494
|
+
<tbody>
|
|
495
|
+
<tr
|
|
496
|
+
:key="rowIndex"
|
|
497
|
+
v-for="(item,rowIndex) in internalTableData"
|
|
498
|
+
class="v-table-row"
|
|
499
|
+
:style="[trBgColor(rowIndex+1)]"
|
|
500
|
+
@mouseenter.stop="handleMouseEnter(rowIndex)"
|
|
501
|
+
@mouseleave.stop="handleMouseOut(rowIndex)"
|
|
502
|
+
@click="$emit('click-row', item, rowIndex)"
|
|
503
|
+
>
|
|
504
|
+
<td
|
|
505
|
+
v-if="cellMergeInit(rowIndex,col.field,item,false)"
|
|
506
|
+
v-for="(col,colIndex) in noFrozenCols"
|
|
507
|
+
:key="colIndex"
|
|
508
|
+
:colSpan="setColRowSpan(rowIndex,col.field,item).colSpan"
|
|
509
|
+
:rowSpan="setColRowSpan(rowIndex,col.field,item).rowSpan"
|
|
510
|
+
:class="[setColumnCellClassName(rowIndex,col.field,item)]"
|
|
511
|
+
@click="clickTd($event, col)"
|
|
512
|
+
>
|
|
513
|
+
<!--存在列合并-->
|
|
514
|
+
<div
|
|
515
|
+
v-if="isCellMergeRender(rowIndex,col.field,item)"
|
|
516
|
+
:class="['v-table-body-cell',showVerticalBorder ? 'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
517
|
+
:style="{
|
|
518
|
+
'width': getRowWidthByColSpan(rowIndex, col.field, item)+'px',
|
|
519
|
+
'height': getRowHeightByRowSpan(rowIndex, col.field, item)+'px',
|
|
520
|
+
'line-height': getRowHeightByRowSpan(rowIndex, col.field, item)+'px',
|
|
521
|
+
'text-align': col.columnAlign
|
|
522
|
+
}"
|
|
523
|
+
:title="col.overflowTitle ? overflowTitle(item,rowIndex,col) :''"
|
|
524
|
+
@click="rowCellClick(rowIndex,item,col);cellEditClick($event,col.isEdit,item,col.field,rowIndex)"
|
|
525
|
+
@dblclick="rowCellDbClick(rowIndex,item,col)"
|
|
526
|
+
>
|
|
527
|
+
<span v-if="cellMergeContentType(rowIndex,col.field,item).isComponent">
|
|
528
|
+
<component
|
|
529
|
+
:render="col.render"
|
|
530
|
+
:row="item"
|
|
531
|
+
:rowData="item"
|
|
532
|
+
:column="col"
|
|
533
|
+
:field="col.field ? col.field : ''"
|
|
534
|
+
:index="rowIndex"
|
|
535
|
+
:is="cellMerge(rowIndex,item,col.field).componentName"
|
|
536
|
+
@on-custom-comp="customCompFunc"
|
|
537
|
+
></component>
|
|
538
|
+
</span>
|
|
539
|
+
<span
|
|
540
|
+
v-else
|
|
541
|
+
v-html="cellMerge(rowIndex,item,col.field).content"
|
|
542
|
+
>
|
|
543
|
+
</span>
|
|
544
|
+
</div>
|
|
545
|
+
|
|
546
|
+
<!--不存在列合并-->
|
|
547
|
+
<div
|
|
548
|
+
v-else
|
|
549
|
+
:class="['v-table-body-cell',showVerticalBorder ? 'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
550
|
+
:style="getCellStyle(col, item)"
|
|
551
|
+
:title="col.overflowTitle ? overflowTitle(item,rowIndex,col) :''"
|
|
552
|
+
@click="rowCellClick(rowIndex,item,col);cellEditClick($event,col.isEdit,item,col.field,rowIndex)"
|
|
553
|
+
@dblclick="rowCellDbClick(rowIndex,item,col)"
|
|
554
|
+
>
|
|
555
|
+
<span v-if="typeof col.componentName ==='string' && col.componentName.length > 0">
|
|
556
|
+
<component
|
|
557
|
+
:render="col.render"
|
|
558
|
+
:row="item"
|
|
559
|
+
:rowData="item"
|
|
560
|
+
:column="col"
|
|
561
|
+
:field="col.field ? col.field : ''"
|
|
562
|
+
:index="rowIndex"
|
|
563
|
+
:is="col.componentName"
|
|
564
|
+
@on-custom-comp="customCompFunc"
|
|
565
|
+
></component>
|
|
566
|
+
</span>
|
|
567
|
+
<span
|
|
568
|
+
v-else-if="typeof col.formatter==='function'"
|
|
569
|
+
v-html="col.formatter(item,rowIndex,pagingIndex,col.field)"
|
|
570
|
+
>
|
|
571
|
+
</span>
|
|
572
|
+
<span v-else-if="col.type === 'selection'">
|
|
573
|
+
<v-checkbox
|
|
574
|
+
:show-slot="false"
|
|
575
|
+
:disabled="item._disabled"
|
|
576
|
+
:label="rowIndex"
|
|
577
|
+
@change="handleCheckChange(item)"
|
|
578
|
+
></v-checkbox>
|
|
579
|
+
</span>
|
|
580
|
+
<span v-else>
|
|
581
|
+
{{item[col.field]}}
|
|
582
|
+
</span>
|
|
583
|
+
</div>
|
|
584
|
+
</td>
|
|
585
|
+
</tr>
|
|
586
|
+
</tbody>
|
|
587
|
+
</table>
|
|
588
|
+
</v-checkbox-group>
|
|
589
|
+
</div>
|
|
590
|
+
|
|
591
|
+
<!-- 中列 footer-->
|
|
592
|
+
<div
|
|
593
|
+
v-if="noFrozenFooterCols.length > 0"
|
|
594
|
+
:class="['v-table-footer','v-table-footer-class',vTableFooter]"
|
|
595
|
+
:style="{'width': centerViewWidth+'px','height':footerTotalHeight}"
|
|
596
|
+
>
|
|
597
|
+
<table
|
|
598
|
+
class="v-table-ftable"
|
|
599
|
+
border="1"
|
|
600
|
+
cellspacing="0"
|
|
601
|
+
cellpadding="0"
|
|
602
|
+
bordercolor="#E5E5E5"
|
|
603
|
+
>
|
|
604
|
+
<tr
|
|
605
|
+
class="v-table-row"
|
|
606
|
+
v-for="(item,rowIndex) in noFrozenFooterCols"
|
|
607
|
+
:key="rowIndex"
|
|
608
|
+
>
|
|
609
|
+
<td
|
|
610
|
+
v-for="(col,colIndex) in item"
|
|
611
|
+
:key="colIndex"
|
|
612
|
+
:class="setFooterCellClassName(false,rowIndex,colIndex,col.content)"
|
|
613
|
+
>
|
|
614
|
+
<div
|
|
615
|
+
:style="{'height':footerRowHeight+'px','line-height':footerRowHeight+'px','width':col.width+'px','text-align':col.align}"
|
|
616
|
+
:class="['v-table-body-cell',vTableBodyCell]"
|
|
617
|
+
v-html="col.content"
|
|
618
|
+
></div>
|
|
619
|
+
</td>
|
|
620
|
+
</tr>
|
|
621
|
+
</table>
|
|
622
|
+
</div>
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
<!--右列-->
|
|
626
|
+
<template v-if="frozenRightCols.length > 0">
|
|
627
|
+
<div
|
|
628
|
+
class="v-table-rightview"
|
|
629
|
+
:style="{'width':rightViewWidth+'px'}"
|
|
630
|
+
>
|
|
631
|
+
<!-- 右列-头 -->
|
|
632
|
+
<div
|
|
633
|
+
:class="{
|
|
634
|
+
'v-table-header':true,
|
|
635
|
+
'v-table-title-class':true,
|
|
636
|
+
'v-table-header-notFixed':!fixTitle
|
|
637
|
+
}"
|
|
638
|
+
:style="{'width': rightViewWidth+'px','background-color':titleBgColor,'color':titleFontColor}"
|
|
639
|
+
>
|
|
640
|
+
<div
|
|
641
|
+
class="v-table-header-inner"
|
|
642
|
+
style="display: block;"
|
|
643
|
+
>
|
|
644
|
+
<table
|
|
645
|
+
class="v-table-htable"
|
|
646
|
+
border="1"
|
|
647
|
+
cellspacing="0"
|
|
648
|
+
cellpadding="0"
|
|
649
|
+
bordercolor="#E5E5E5"
|
|
650
|
+
>
|
|
651
|
+
<tbody>
|
|
652
|
+
|
|
653
|
+
<template v-if="frozenRightTitleCols.length > 0">
|
|
654
|
+
<tr
|
|
655
|
+
v-for="(row, ridx) in frozenRightTitleCols"
|
|
656
|
+
:key="ridx"
|
|
657
|
+
>
|
|
658
|
+
<td
|
|
659
|
+
v-for="(col, cidx) in row"
|
|
660
|
+
:key="cidx"
|
|
661
|
+
:class="[col.titleCellClassName]"
|
|
662
|
+
:colspan="col.colspan"
|
|
663
|
+
:rowspan="col.rowspan"
|
|
664
|
+
@mousemove.stop="handleTitleMouseMove($event,col.fields)"
|
|
665
|
+
@mousedown.stop="handleTitleMouseDown($event)"
|
|
666
|
+
@mouseout.stop="handleTitleMouseOut()"
|
|
667
|
+
@click="titleCellClick(col.fields,col.title);"
|
|
668
|
+
@dblclick="titleCellDblClick(col.fields,col.title)"
|
|
669
|
+
>
|
|
670
|
+
<div
|
|
671
|
+
:class="['v-table-title-cell',showVerticalBorder?'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
672
|
+
:style="{'width':titleColumnWidth(col.fields)+'px','height':titleColumnHeight(col.rowspan)+'px','text-align':col.titleAlign}"
|
|
673
|
+
>
|
|
674
|
+
<span class="table-title">
|
|
675
|
+
<span v-if="isSelectionCol(col.fields)">
|
|
676
|
+
<v-checkbox
|
|
677
|
+
@change="handleCheckAll"
|
|
678
|
+
:indeterminate="indeterminate"
|
|
679
|
+
v-model="isAllChecked"
|
|
680
|
+
:show-slot="false"
|
|
681
|
+
label="check-all"
|
|
682
|
+
></v-checkbox>
|
|
683
|
+
</span>
|
|
684
|
+
<span
|
|
685
|
+
v-else
|
|
686
|
+
v-html="col.title"
|
|
687
|
+
></span>
|
|
688
|
+
<span
|
|
689
|
+
@click="sortControl(col.fields[0])"
|
|
690
|
+
class="v-table-sort-icon"
|
|
691
|
+
v-if="enableSort(col.orderBy)"
|
|
692
|
+
>
|
|
693
|
+
<slot name="sort">
|
|
694
|
+
<i :class='["v-icon-up-dir",getCurrentSort(col.fields[0]) ==="asc" ? "checked":""]'></i>
|
|
695
|
+
<i :class='["v-icon-down-dir",getCurrentSort(col.fields[0]) ==="desc" ? "checked":""]'></i>
|
|
696
|
+
</slot>
|
|
697
|
+
</span>
|
|
698
|
+
</span>
|
|
699
|
+
<!--filters-->
|
|
700
|
+
<v-dropdown
|
|
701
|
+
class="v-table-dropdown"
|
|
702
|
+
v-if="enableFilters(col.filters,col.fields)"
|
|
703
|
+
v-model="col.filters"
|
|
704
|
+
:show-operation="col.filterMultiple"
|
|
705
|
+
:is-multiple="col.filterMultiple"
|
|
706
|
+
@on-filter-method="filterEvent"
|
|
707
|
+
@change="filterConditionChange(col.filterMultiple)"
|
|
708
|
+
>
|
|
709
|
+
<i :class="['v-table-filter-icon',vTableFiltersIcon(col.filters)]"></i>
|
|
710
|
+
</v-dropdown>
|
|
711
|
+
</div>
|
|
712
|
+
</td>
|
|
713
|
+
</tr>
|
|
714
|
+
</template>
|
|
715
|
+
|
|
716
|
+
<template v-else>
|
|
717
|
+
<tr class="v-table-header-row">
|
|
718
|
+
<td
|
|
719
|
+
v-for="(col, fcidx) in frozenRightCols"
|
|
720
|
+
:key="fcidx"
|
|
721
|
+
:class="[col.titleCellClassName]"
|
|
722
|
+
@mousemove.stop="handleTitleMouseMove($event,col.field)"
|
|
723
|
+
@mousedown.stop="handleTitleMouseDown($event)"
|
|
724
|
+
@mouseout.stop="handleTitleMouseOut()"
|
|
725
|
+
@click="titleCellClick(col.field,col.title);"
|
|
726
|
+
@dblclick="titleCellDblClick(col.field,col.title)"
|
|
727
|
+
>
|
|
728
|
+
<div
|
|
729
|
+
:class="['v-table-title-cell',showVerticalBorder?'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
730
|
+
:style="{'width':col.width+'px','height':titleRowHeight+'px','text-align':col.titleAlign}"
|
|
731
|
+
>
|
|
732
|
+
<span class="table-title">
|
|
733
|
+
<span v-if="col.type === 'selection'">
|
|
734
|
+
<v-checkbox
|
|
735
|
+
@change="handleCheckAll"
|
|
736
|
+
:indeterminate="indeterminate"
|
|
737
|
+
v-model="isAllChecked"
|
|
738
|
+
:show-slot="false"
|
|
739
|
+
label="check-all"
|
|
740
|
+
></v-checkbox>
|
|
741
|
+
</span>
|
|
742
|
+
<span
|
|
743
|
+
v-else
|
|
744
|
+
v-html="col.title"
|
|
745
|
+
></span>
|
|
746
|
+
<span
|
|
747
|
+
@click="sortControl(col.field)"
|
|
748
|
+
class="v-table-sort-icon"
|
|
749
|
+
v-if="enableSort(col.orderBy)"
|
|
750
|
+
>
|
|
751
|
+
<slot name="sort">
|
|
752
|
+
<i :class='["v-icon-up-dir",getCurrentSort(col.field) ==="asc" ? "checked":""]'></i>
|
|
753
|
+
<i :class='["v-icon-down-dir",getCurrentSort(col.field) ==="desc" ? "checked":""]'></i>
|
|
754
|
+
</slot>
|
|
755
|
+
</span>
|
|
756
|
+
</span>
|
|
757
|
+
<!--filters-->
|
|
758
|
+
<v-dropdown
|
|
759
|
+
class="v-table-dropdown"
|
|
760
|
+
v-if="enableFilters(col.filters)"
|
|
761
|
+
v-model="col.filters"
|
|
762
|
+
:show-operation="col.filterMultiple"
|
|
763
|
+
:is-multiple="col.filterMultiple"
|
|
764
|
+
@on-filter-method="filterEvent"
|
|
765
|
+
@change="filterConditionChange(col.filterMultiple)"
|
|
766
|
+
>
|
|
767
|
+
<i :class="['v-table-filter-icon',vTableFiltersIcon(col.filters)]"></i>
|
|
768
|
+
</v-dropdown>
|
|
769
|
+
</div>
|
|
770
|
+
</td>
|
|
771
|
+
</tr>
|
|
772
|
+
</template>
|
|
773
|
+
</tbody>
|
|
774
|
+
</table>
|
|
775
|
+
</div>
|
|
776
|
+
</div>
|
|
777
|
+
|
|
778
|
+
<!-- 右列-内容 -->
|
|
779
|
+
<div
|
|
780
|
+
class="v-table-body v-table-body-class"
|
|
781
|
+
:style="{'width': rightViewWidth+'px', 'height': bodyViewHeight+'px', 'margin-top': titleRowHeight+'px'}"
|
|
782
|
+
>
|
|
783
|
+
<div :class="['v-table-body-inner',vTableBodyInner]">
|
|
784
|
+
<v-checkbox-group
|
|
785
|
+
v-model="checkboxGroupModel"
|
|
786
|
+
@change="handleCheckGroupChange"
|
|
787
|
+
>
|
|
788
|
+
<table
|
|
789
|
+
class="v-table-btable"
|
|
790
|
+
border="1"
|
|
791
|
+
cellspacing="0"
|
|
792
|
+
cellpadding="0"
|
|
793
|
+
bordercolor="#E5E5E5"
|
|
794
|
+
>
|
|
795
|
+
<tbody>
|
|
796
|
+
<tr
|
|
797
|
+
v-for="(item,rowIndex) in internalTableData"
|
|
798
|
+
class="v-table-row"
|
|
799
|
+
:key="rowIndex"
|
|
800
|
+
:style="[trBgColor(rowIndex+1)]"
|
|
801
|
+
@mouseenter.stop="handleMouseEnter(rowIndex)"
|
|
802
|
+
@mouseleave.stop="handleMouseOut(rowIndex)"
|
|
803
|
+
>
|
|
804
|
+
<td
|
|
805
|
+
v-if="cellMergeInit(rowIndex,col.field,item,true)"
|
|
806
|
+
v-for="(col,colIndex) in frozenRightCols"
|
|
807
|
+
:key="colIndex"
|
|
808
|
+
:colSpan="setColRowSpan(rowIndex,col.field,item).colSpan"
|
|
809
|
+
:rowSpan="setColRowSpan(rowIndex,col.field,item).rowSpan"
|
|
810
|
+
:class="[setColumnCellClassName(rowIndex,col.field,item)]"
|
|
811
|
+
>
|
|
812
|
+
<!--存在列合并-->
|
|
813
|
+
<div
|
|
814
|
+
v-if="isCellMergeRender(rowIndex,col.field,item)"
|
|
815
|
+
:class="['v-table-body-cell',showVerticalBorder ? 'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
816
|
+
:style="{'width':getRowWidthByColSpan(rowIndex,col.field,item)+'px','height': getRowHeightByRowSpan(rowIndex,col.field,item)+'px','line-height':getRowHeightByRowSpan(rowIndex,col.field,item)+'px','text-align':col.columnAlign}"
|
|
817
|
+
:title="col.overflowTitle ? overflowTitle(item,rowIndex,col) :''"
|
|
818
|
+
@click="rowCellClick(rowIndex,item,col);cellEditClick($event,col.isEdit,item,col.field,rowIndex)"
|
|
819
|
+
@dblclick="rowCellDbClick(rowIndex,item,col)"
|
|
820
|
+
>
|
|
821
|
+
<span v-if="cellMergeContentType(rowIndex,col.field,item).isComponent">
|
|
822
|
+
<component
|
|
823
|
+
:render="col.render"
|
|
824
|
+
:row="item"
|
|
825
|
+
:rowData="item"
|
|
826
|
+
:column="col"
|
|
827
|
+
:field="col.field ? col.field : ''"
|
|
828
|
+
:index="rowIndex"
|
|
829
|
+
:is="cellMerge(rowIndex,item,col.field).componentName"
|
|
830
|
+
@on-custom-comp="customCompFunc"
|
|
831
|
+
></component>
|
|
832
|
+
</span>
|
|
833
|
+
<span
|
|
834
|
+
v-else
|
|
835
|
+
v-html="cellMerge(rowIndex,item,col.field).content"
|
|
836
|
+
></span>
|
|
837
|
+
</div>
|
|
838
|
+
|
|
839
|
+
<!--不存在列合并-->
|
|
840
|
+
<div
|
|
841
|
+
v-else
|
|
842
|
+
:class="['v-table-body-cell',showVerticalBorder ? 'vertical-border':'',showHorizontalBorder?'horizontal-border':'']"
|
|
843
|
+
:style="getCellStyle(col, item)"
|
|
844
|
+
:title="col.overflowTitle ? overflowTitle(item,rowIndex,col) :''"
|
|
845
|
+
@click="rowCellClick(rowIndex,item,col);cellEditClick($event,col.isEdit,item,col.field,rowIndex)"
|
|
846
|
+
@dblclick="rowCellDbClick(rowIndex,item,col)"
|
|
847
|
+
>
|
|
848
|
+
<span v-if="typeof col.componentName ==='string' && col.componentName.length > 0">
|
|
849
|
+
<component
|
|
850
|
+
:render="col.render"
|
|
851
|
+
:row="item"
|
|
852
|
+
:rowData="item"
|
|
853
|
+
:column="col"
|
|
854
|
+
:field="col.field ? col.field : ''"
|
|
855
|
+
:index="rowIndex"
|
|
856
|
+
:is="col.componentName"
|
|
857
|
+
@on-custom-comp="customCompFunc"
|
|
858
|
+
></component>
|
|
859
|
+
</span>
|
|
860
|
+
<span
|
|
861
|
+
v-else-if="typeof col.formatter==='function'"
|
|
862
|
+
v-html="col.formatter(item,rowIndex,pagingIndex,col.field)"
|
|
863
|
+
></span>
|
|
864
|
+
<span v-else-if="col.type === 'selection'">
|
|
865
|
+
<v-checkbox
|
|
866
|
+
@change="handleCheckChange(item)"
|
|
867
|
+
:show-slot="false"
|
|
868
|
+
:disabled="item._disabled"
|
|
869
|
+
:label="rowIndex"
|
|
870
|
+
></v-checkbox>
|
|
871
|
+
</span>
|
|
872
|
+
<span v-else>
|
|
873
|
+
{{item[col.field]}}
|
|
874
|
+
</span>
|
|
875
|
+
</div>
|
|
876
|
+
</td>
|
|
877
|
+
</tr>
|
|
878
|
+
</tbody>
|
|
879
|
+
</table>
|
|
880
|
+
</v-checkbox-group>
|
|
881
|
+
</div>
|
|
882
|
+
</div>
|
|
883
|
+
|
|
884
|
+
<!-- 右列-底 -->
|
|
885
|
+
<div
|
|
886
|
+
v-if="frozenRightFooterCols.length > 0"
|
|
887
|
+
:class="['v-table-footer','v-table-footer-class']"
|
|
888
|
+
:style="{'width': leftViewWidth+'px','height':footerTotalHeight}"
|
|
889
|
+
>
|
|
890
|
+
<table
|
|
891
|
+
class="v-table-ftable"
|
|
892
|
+
border="1"
|
|
893
|
+
cellspacing="0"
|
|
894
|
+
cellpadding="0"
|
|
895
|
+
bordercolor="#E5E5E5"
|
|
896
|
+
>
|
|
897
|
+
<tr
|
|
898
|
+
class="v-table-row"
|
|
899
|
+
v-for="(item,rowIndex) in frozenFooterCols"
|
|
900
|
+
:key="rowIndex"
|
|
901
|
+
>
|
|
902
|
+
<td
|
|
903
|
+
v-for="(col,colIndex) in item"
|
|
904
|
+
:key="colIndex"
|
|
905
|
+
:class="setFooterCellClassName(true,rowIndex,colIndex,col.content)"
|
|
906
|
+
>
|
|
907
|
+
<div
|
|
908
|
+
v-html="col.content"
|
|
909
|
+
:class="['v-table-body-cell',vTableBodyCell]"
|
|
910
|
+
:style="{'height':footerRowHeight+'px','line-height':footerRowHeight+'px','width':col.width+'px','text-align':col.align}"
|
|
911
|
+
></div>
|
|
912
|
+
</td>
|
|
913
|
+
</tr>
|
|
914
|
+
</table>
|
|
915
|
+
</div>
|
|
916
|
+
</div>
|
|
917
|
+
</template>
|
|
918
|
+
|
|
919
|
+
<table-empty
|
|
920
|
+
v-if="!isLoading && isTableEmpty"
|
|
921
|
+
:width="internalWidth"
|
|
922
|
+
:total-columns-width="totalColumnsWidth"
|
|
923
|
+
:content-height="errorContentHeight"
|
|
924
|
+
:title-height="getTotalColumnsHeight()"
|
|
925
|
+
:error-content="tipContent"
|
|
926
|
+
:is-loading="isLoading"
|
|
927
|
+
></table-empty>
|
|
928
|
+
|
|
929
|
+
<loading
|
|
930
|
+
v-if="isLoading"
|
|
931
|
+
:loading-content="loadingContent"
|
|
932
|
+
:title-rows="internalTitleRows"
|
|
933
|
+
:title-row-height="titleRowHeight"
|
|
934
|
+
:columns="internalColumns"
|
|
935
|
+
:loading-opacity="loadingOpacity"
|
|
936
|
+
></loading>
|
|
937
|
+
|
|
938
|
+
<!--列拖动时的线条-->
|
|
939
|
+
<div
|
|
940
|
+
v-show="isDragging"
|
|
941
|
+
class="v-table-drag-line"
|
|
942
|
+
></div>
|
|
943
|
+
</div>
|
|
944
|
+
</template>
|
|
945
|
+
|
|
946
|
+
<script>
|
|
947
|
+
|
|
948
|
+
import classesMixin from "./classes-mixin.js";
|
|
949
|
+
import scrollControlMixin from "./scroll-control-mixin.js";
|
|
950
|
+
import frozenColumnsMixin from "./frozen-columns-mixin.js";
|
|
951
|
+
import tableResizeMixin from "./table-resize-mixin.js";
|
|
952
|
+
import sortControlMixin from "./sort-control-mixin.js";
|
|
953
|
+
import tableEmptyMixin from "./table-empty-mixin.js";
|
|
954
|
+
import dragWidthMixin from "./drag-width-mixin.js";
|
|
955
|
+
import cellEditMixin from "./cell-edit-mixin.js";
|
|
956
|
+
import bodyCellMergeMixin from "./body-cell-merge-mixin.js";
|
|
957
|
+
import titleCellMergeMixin from "./title-cell-merge-mixin.js";
|
|
958
|
+
import checkboxSelectionMixin from "./checkbox-selection-mixin.js";
|
|
959
|
+
import tableFooterMixin from "./table-footer-mixin.js";
|
|
960
|
+
import scrollBarControlMixin from "./scroll-bar-control-mixin.js";
|
|
961
|
+
import tableRowMouseEventsMixin from "./table-row-mouse-events-mixin";
|
|
962
|
+
import tableFiltersMixin from "./table-filters-mixin";
|
|
963
|
+
|
|
964
|
+
import utils from "../../src/utils/utils.js";
|
|
965
|
+
import deepClone from "../../src/utils/deepClone.js";
|
|
966
|
+
|
|
967
|
+
import tableEmpty from "./table-empty.vue";
|
|
968
|
+
import loading from "./loading.vue";
|
|
969
|
+
import VCheckboxGroup from "../../v-checkbox-group/index.js";
|
|
970
|
+
import VCheckbox from "../../v-checkbox/index.js";
|
|
971
|
+
import VDropdown from "../../v-dropdown/index.js";
|
|
972
|
+
|
|
973
|
+
export default {
|
|
974
|
+
name: "v-table",
|
|
975
|
+
mixins: [classesMixin, tableResizeMixin, frozenColumnsMixin, scrollControlMixin, sortControlMixin, tableEmptyMixin, dragWidthMixin, cellEditMixin, bodyCellMergeMixin, titleCellMergeMixin, checkboxSelectionMixin, tableFooterMixin, scrollBarControlMixin, tableRowMouseEventsMixin, tableFiltersMixin],
|
|
976
|
+
components: {tableEmpty, loading, VCheckboxGroup, VCheckbox, VDropdown},
|
|
977
|
+
data () {
|
|
978
|
+
return {
|
|
979
|
+
// 本地列表数据
|
|
980
|
+
internalTableData: [],
|
|
981
|
+
// 本地宽度
|
|
982
|
+
internalWidth: 0,
|
|
983
|
+
// 本地高度
|
|
984
|
+
internalHeight: 0,
|
|
985
|
+
// 本地列数据
|
|
986
|
+
internalColumns: [],
|
|
987
|
+
// 本地复杂表头数据
|
|
988
|
+
internalTitleRows: [],
|
|
989
|
+
errorMsg: " V-Table error: ",
|
|
990
|
+
// 最大宽度(当width:'max'时)
|
|
991
|
+
maxWidth: 5000,
|
|
992
|
+
hasFrozenColumn: false, // 是否拥有固定列(false时最后一列的右边border无边框)
|
|
993
|
+
hasFrozenRightColumn: false,
|
|
994
|
+
resizeTimer: null,
|
|
995
|
+
firstLoad: true, // 表格首次初始化加载,用于区分显示”数据加载中“还是”暂无数据“
|
|
996
|
+
tipContent: ""
|
|
997
|
+
};
|
|
998
|
+
},
|
|
999
|
+
props: {
|
|
1000
|
+
// 表格自定义class
|
|
1001
|
+
className: {
|
|
1002
|
+
type: String,
|
|
1003
|
+
default: ""
|
|
1004
|
+
},
|
|
1005
|
+
|
|
1006
|
+
width: [Number, String],
|
|
1007
|
+
minWidth: {
|
|
1008
|
+
type: Number,
|
|
1009
|
+
default: 50
|
|
1010
|
+
},
|
|
1011
|
+
height: {
|
|
1012
|
+
type: Number,
|
|
1013
|
+
require: false
|
|
1014
|
+
},
|
|
1015
|
+
minHeight: {
|
|
1016
|
+
type: Number,
|
|
1017
|
+
default: 50
|
|
1018
|
+
},
|
|
1019
|
+
titleRowHeight: {
|
|
1020
|
+
type: Number,
|
|
1021
|
+
default: 38
|
|
1022
|
+
},
|
|
1023
|
+
// 随着浏览器窗口改变,横向自适应
|
|
1024
|
+
isHorizontalResize: {
|
|
1025
|
+
type: Boolean,
|
|
1026
|
+
default: false
|
|
1027
|
+
},
|
|
1028
|
+
// 随着浏览器窗口改变,垂直自适应
|
|
1029
|
+
isVerticalResize: {
|
|
1030
|
+
type: Boolean,
|
|
1031
|
+
default: false
|
|
1032
|
+
},
|
|
1033
|
+
|
|
1034
|
+
// 垂直自适应偏移量
|
|
1035
|
+
verticalResizeOffset: {
|
|
1036
|
+
type: Number,
|
|
1037
|
+
default: 0
|
|
1038
|
+
},
|
|
1039
|
+
|
|
1040
|
+
tableBgColor: {
|
|
1041
|
+
type: String,
|
|
1042
|
+
default: "#fff"
|
|
1043
|
+
},
|
|
1044
|
+
|
|
1045
|
+
// 表头背景颜色
|
|
1046
|
+
titleBgColor: {
|
|
1047
|
+
type: String,
|
|
1048
|
+
default: "#F0F0F0"
|
|
1049
|
+
},
|
|
1050
|
+
|
|
1051
|
+
// 表头字体颜色
|
|
1052
|
+
titleFontColor: {
|
|
1053
|
+
type: String,
|
|
1054
|
+
default: "#5d5d5d"
|
|
1055
|
+
},
|
|
1056
|
+
|
|
1057
|
+
// 奇数行颜色
|
|
1058
|
+
oddBgColor: {
|
|
1059
|
+
type: String,
|
|
1060
|
+
default: ""
|
|
1061
|
+
},
|
|
1062
|
+
// 偶数行颜色
|
|
1063
|
+
evenBgColor: {
|
|
1064
|
+
type: String,
|
|
1065
|
+
default: ""
|
|
1066
|
+
},
|
|
1067
|
+
// 内容行高
|
|
1068
|
+
rowHeight: {
|
|
1069
|
+
type: Number,
|
|
1070
|
+
default: 40
|
|
1071
|
+
},
|
|
1072
|
+
// 多列排序
|
|
1073
|
+
multipleSort: {
|
|
1074
|
+
type: Boolean,
|
|
1075
|
+
default: true
|
|
1076
|
+
},
|
|
1077
|
+
// 是否展示排序
|
|
1078
|
+
showSort: {
|
|
1079
|
+
type: Boolean,
|
|
1080
|
+
default: false
|
|
1081
|
+
},
|
|
1082
|
+
// 只在 升序和倒序切换
|
|
1083
|
+
sortAlways: {
|
|
1084
|
+
type: Boolean,
|
|
1085
|
+
default: false
|
|
1086
|
+
},
|
|
1087
|
+
columns: {
|
|
1088
|
+
type: Array,
|
|
1089
|
+
require: true
|
|
1090
|
+
},
|
|
1091
|
+
fixTitle: {
|
|
1092
|
+
type: Boolean,
|
|
1093
|
+
default: true
|
|
1094
|
+
},
|
|
1095
|
+
|
|
1096
|
+
// 特殊表头
|
|
1097
|
+
titleRows: {
|
|
1098
|
+
type: Array,
|
|
1099
|
+
require: true,
|
|
1100
|
+
default: function () {
|
|
1101
|
+
return [];
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
tableData: {
|
|
1105
|
+
type: Array,
|
|
1106
|
+
require: true,
|
|
1107
|
+
default: function () {
|
|
1108
|
+
return [];
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
// 分页序号
|
|
1112
|
+
pagingIndex: Number,
|
|
1113
|
+
// 没数据时的html
|
|
1114
|
+
errorContent: {
|
|
1115
|
+
type: String,
|
|
1116
|
+
default: "暂无数据..."
|
|
1117
|
+
},
|
|
1118
|
+
// 没数据时内容区域高度
|
|
1119
|
+
errorContentHeight: {
|
|
1120
|
+
type: Number,
|
|
1121
|
+
default: 50
|
|
1122
|
+
},
|
|
1123
|
+
// 是否正在加载,为false 则会显示错误信息(如果加载时间较长,最好设置为true,数据返回后设置为false)
|
|
1124
|
+
isLoading: {
|
|
1125
|
+
type: Boolean,
|
|
1126
|
+
default: false
|
|
1127
|
+
},
|
|
1128
|
+
loadingContent: {
|
|
1129
|
+
type: String,
|
|
1130
|
+
default: '<span><i class="v-icon-spin5 animate-loading-23" style="font-size: 28px;opacity:0.6;"></i></span>'
|
|
1131
|
+
},
|
|
1132
|
+
// 不设置则没有hover效果
|
|
1133
|
+
rowHoverColor: {
|
|
1134
|
+
type: String
|
|
1135
|
+
},
|
|
1136
|
+
rowClickColor: {
|
|
1137
|
+
type: String
|
|
1138
|
+
},
|
|
1139
|
+
showVerticalBorder: {
|
|
1140
|
+
type: Boolean,
|
|
1141
|
+
default: true
|
|
1142
|
+
},
|
|
1143
|
+
showHorizontalBorder: {
|
|
1144
|
+
type: Boolean,
|
|
1145
|
+
default: true
|
|
1146
|
+
},
|
|
1147
|
+
footer: {
|
|
1148
|
+
type: Array,
|
|
1149
|
+
default: function () {
|
|
1150
|
+
return [
|
|
1151
|
+
// ["本页总计", "--", "--", 1000, 2000, "--"],
|
|
1152
|
+
// ["总计", "--", "--", 434784953450, 8858459488458, "--"]
|
|
1153
|
+
];
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
footerRowHeight: {
|
|
1157
|
+
type: Number,
|
|
1158
|
+
default: 40
|
|
1159
|
+
},
|
|
1160
|
+
columnWidthDrag: {
|
|
1161
|
+
type: Boolean,
|
|
1162
|
+
default: false
|
|
1163
|
+
},
|
|
1164
|
+
loadingOpacity: {
|
|
1165
|
+
type: Number,
|
|
1166
|
+
default: 0.6
|
|
1167
|
+
},
|
|
1168
|
+
// 表体单元格样式回调
|
|
1169
|
+
columnCellClassName: Function,
|
|
1170
|
+
// footer单元格样式回调
|
|
1171
|
+
footerCellClassName: Function,
|
|
1172
|
+
// 行单击回调
|
|
1173
|
+
rowClick: Function,
|
|
1174
|
+
// 行双击回调
|
|
1175
|
+
rowDblclick: Function,
|
|
1176
|
+
// 表头单元格单击回调
|
|
1177
|
+
titleClick: Function,
|
|
1178
|
+
// 表头单元格双击回调
|
|
1179
|
+
titleDblclick: Function,
|
|
1180
|
+
// 鼠标进入行的回调
|
|
1181
|
+
rowMouseEnter: Function,
|
|
1182
|
+
// 鼠标离开行的回调
|
|
1183
|
+
rowMouseLeave: Function,
|
|
1184
|
+
// 单元格编辑完成回调
|
|
1185
|
+
cellEditDone: Function,
|
|
1186
|
+
// 单元格合并
|
|
1187
|
+
cellMerge: Function,
|
|
1188
|
+
// select all
|
|
1189
|
+
selectAll: Function,
|
|
1190
|
+
// 单个checkbox change event
|
|
1191
|
+
selectChange: Function,
|
|
1192
|
+
// checkbox-group change event
|
|
1193
|
+
selectGroupChange: Function,
|
|
1194
|
+
// filter event
|
|
1195
|
+
filterMethod: Function,
|
|
1196
|
+
//
|
|
1197
|
+
columnWidthDragResize: Function
|
|
1198
|
+
},
|
|
1199
|
+
computed: {
|
|
1200
|
+
// 是否是复杂表头
|
|
1201
|
+
isComplexTitle () {
|
|
1202
|
+
return (Array.isArray(this.internalTitleRows) && this.internalTitleRows.length > 0);
|
|
1203
|
+
},
|
|
1204
|
+
// 获取表格高度
|
|
1205
|
+
getTableHeight () {
|
|
1206
|
+
// return `${this.isTableEmpty ? this.tableEmptyHeight : this.internalHeight}px`;
|
|
1207
|
+
return "100%";
|
|
1208
|
+
},
|
|
1209
|
+
getTableCenterViewHeight () {
|
|
1210
|
+
// return undefined;
|
|
1211
|
+
return "100%";
|
|
1212
|
+
},
|
|
1213
|
+
getTableCenterViewBodyHeight () {
|
|
1214
|
+
// return `${this.bodyViewHeight}px`;
|
|
1215
|
+
return "calc(100% - 52px)";
|
|
1216
|
+
},
|
|
1217
|
+
|
|
1218
|
+
// 左侧区域宽度
|
|
1219
|
+
leftViewWidth () {
|
|
1220
|
+
let result = 0;
|
|
1221
|
+
if (this.hasFrozenColumn) {
|
|
1222
|
+
result = this.frozenCols.reduce((total, curr) => total + curr.width, 0);
|
|
1223
|
+
}
|
|
1224
|
+
return result;
|
|
1225
|
+
},
|
|
1226
|
+
// 左侧区域宽度
|
|
1227
|
+
rightViewWidth () {
|
|
1228
|
+
let result = 0;
|
|
1229
|
+
if (this.hasFrozenRightColumn) {
|
|
1230
|
+
result = this.frozenRightCols.reduce((total, curr) => total + curr.width, 0);
|
|
1231
|
+
}
|
|
1232
|
+
return result;
|
|
1233
|
+
},
|
|
1234
|
+
// 中侧区域宽度
|
|
1235
|
+
centerViewWidth () {
|
|
1236
|
+
// let width = 5000;
|
|
1237
|
+
// if (this.$refs.table) {
|
|
1238
|
+
// width = this.$refs.table.clientWidth;
|
|
1239
|
+
// }
|
|
1240
|
+
// let result = width - this.leftViewWidth - this.rightViewWidth;
|
|
1241
|
+
let result = this.internalWidth - this.leftViewWidth - this.rightViewWidth;
|
|
1242
|
+
return this.hasFrozenColumn ? result : result;
|
|
1243
|
+
},
|
|
1244
|
+
|
|
1245
|
+
// 左侧、右侧区域高度
|
|
1246
|
+
bodyViewHeight () {
|
|
1247
|
+
let result;
|
|
1248
|
+
if (this.internalTitleRows.length > 0) {
|
|
1249
|
+
result = this.internalHeight - this.titleRowHeight * (this.internalTitleRows.length + this.getTitleRowspanTotalCount);
|
|
1250
|
+
} else {
|
|
1251
|
+
result = this.internalHeight - this.titleRowHeight;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// 1px: 当有滚动条时,使滚动条显示全
|
|
1255
|
+
result -= (this.footerTotalHeight + 1);
|
|
1256
|
+
|
|
1257
|
+
return result;
|
|
1258
|
+
},
|
|
1259
|
+
|
|
1260
|
+
// 所有列的总宽度
|
|
1261
|
+
totalColumnsWidth () {
|
|
1262
|
+
return this.internalColumns.reduce(function (total, curr) {
|
|
1263
|
+
return curr.width ? (total + curr.width + 1) : total;
|
|
1264
|
+
}, 7); // 7代表1px边线+6px滚动条
|
|
1265
|
+
},
|
|
1266
|
+
|
|
1267
|
+
// 获取未固定列的总宽度
|
|
1268
|
+
totalNoFrozenColumnsWidth () {
|
|
1269
|
+
|
|
1270
|
+
return this.noFrozenCols.reduce(function (total, curr) {
|
|
1271
|
+
return curr.width ? (total + curr.width) : total;
|
|
1272
|
+
}, 0);
|
|
1273
|
+
},
|
|
1274
|
+
|
|
1275
|
+
// 获取所有的字段
|
|
1276
|
+
getColumnsFields () {
|
|
1277
|
+
return this.internalColumns.map((item) => {
|
|
1278
|
+
return item.field;
|
|
1279
|
+
});
|
|
1280
|
+
},
|
|
1281
|
+
|
|
1282
|
+
// 获取非固定列的字段集合
|
|
1283
|
+
getNoFrozenColumnsFields () {
|
|
1284
|
+
return this.internalColumns.filter(x => !x.isFrozen && !x.isFrozenRight).map((item) => {
|
|
1285
|
+
return item.field;
|
|
1286
|
+
});
|
|
1287
|
+
},
|
|
1288
|
+
|
|
1289
|
+
// 获取固定左列的字段集合
|
|
1290
|
+
getFrozenColumnsFields () {
|
|
1291
|
+
return this.internalColumns.filter(x => x.isFrozen).map((item) => {
|
|
1292
|
+
return item.field;
|
|
1293
|
+
});
|
|
1294
|
+
},
|
|
1295
|
+
// 获取固定右列的字段集合
|
|
1296
|
+
getFrozenRightColumnsFields () {
|
|
1297
|
+
return this.internalColumns.filter(x => x.isFrozenRight).map((item) => {
|
|
1298
|
+
return item.field;
|
|
1299
|
+
});
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1302
|
+
created () {
|
|
1303
|
+
this.internalTableData = this.initInternalTableData(this.tableData);
|
|
1304
|
+
this.tipContent = this.errorContent;
|
|
1305
|
+
|
|
1306
|
+
if (Array.isArray(this.columns) && this.columns.length > 0) {
|
|
1307
|
+
this.initColumns();
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
this.updateCheckboxGroupModel();
|
|
1311
|
+
this.initView();
|
|
1312
|
+
},
|
|
1313
|
+
mounted () {
|
|
1314
|
+
this.setScrollbarWidth();
|
|
1315
|
+
this.tableEmpty();
|
|
1316
|
+
this.tableResize();
|
|
1317
|
+
|
|
1318
|
+
if (Array.isArray(this.tableData) && this.tableData.length > 0) {
|
|
1319
|
+
|
|
1320
|
+
this.scrollControl();
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
this.controlScrollBar();
|
|
1324
|
+
},
|
|
1325
|
+
methods: {
|
|
1326
|
+
// 当宽度设置 && 非固定列未设置宽度时(列自适应)初始化列集合
|
|
1327
|
+
initColumns () {
|
|
1328
|
+
this.internalHeight = this.height;
|
|
1329
|
+
|
|
1330
|
+
this.footerTotalHeight = this.getFooterTotalRowHeight;
|
|
1331
|
+
|
|
1332
|
+
this.internalColumns = Array.isArray(this.columns) ? deepClone(this.columns) : [];
|
|
1333
|
+
|
|
1334
|
+
this.internalTitleRows = Array.isArray(this.titleRows) ? deepClone(this.titleRows) : [];
|
|
1335
|
+
|
|
1336
|
+
this.initColumnsFilters();
|
|
1337
|
+
|
|
1338
|
+
this.initResizeColumns();
|
|
1339
|
+
|
|
1340
|
+
this.hasFrozenColumn = this.internalColumns.some(x => x.isFrozen);
|
|
1341
|
+
this.hasFrozenRightColumn = this.internalColumns.some(x => x.isFrozenRight);
|
|
1342
|
+
|
|
1343
|
+
this.initTableWidth();
|
|
1344
|
+
this.setSortColumns();
|
|
1345
|
+
|
|
1346
|
+
let self = this;
|
|
1347
|
+
let widthCountCheck = 0;
|
|
1348
|
+
|
|
1349
|
+
if (self.internalWidth && self.internalWidth > 0) {
|
|
1350
|
+
self.internalColumns.map(function (item) {
|
|
1351
|
+
if (!(item.width && item.width > 0)) {
|
|
1352
|
+
|
|
1353
|
+
widthCountCheck++;
|
|
1354
|
+
if (self.isHorizontalResize) {
|
|
1355
|
+
console.error(self.errorMsg + "If you are using the isHorizontalResize property,Please set the value for each column's width");
|
|
1356
|
+
} else {
|
|
1357
|
+
item.width = self.internalWidth - self.totalColumnsWidth;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
if (widthCountCheck > 1) {
|
|
1365
|
+
console.error(this.errorMsg + "Only allow one column is not set width");
|
|
1366
|
+
}
|
|
1367
|
+
},
|
|
1368
|
+
|
|
1369
|
+
// 初始化width
|
|
1370
|
+
initTableWidth () {
|
|
1371
|
+
this.internalWidth = this.isHorizontalResize ? this.maxWidth : this.width;
|
|
1372
|
+
},
|
|
1373
|
+
getCellStyle (col, item) {
|
|
1374
|
+
return {
|
|
1375
|
+
"width": col.width + "px",
|
|
1376
|
+
// "height": `${this.rowHeight}px`,
|
|
1377
|
+
// "line-height": `${this.rowHeight}px`,
|
|
1378
|
+
"height": undefined,
|
|
1379
|
+
"padding": "10px 15px",
|
|
1380
|
+
"line-height": undefined,
|
|
1381
|
+
"text-align": col.columnAlign
|
|
1382
|
+
};
|
|
1383
|
+
},
|
|
1384
|
+
// // 获取所有列的总高度
|
|
1385
|
+
// getTotalColumnsHeight () {
|
|
1386
|
+
// return this.titleRowHeight * (this.internalTitleRows ? this.internalTitleRows.length : 1) +
|
|
1387
|
+
// this.internalTableData.length * (this.rowHeight + 1) +
|
|
1388
|
+
// this.footerTotalHeight + 1;
|
|
1389
|
+
// },
|
|
1390
|
+
// 获取所有列的总高度
|
|
1391
|
+
getTotalColumnsHeight () {
|
|
1392
|
+
let titleTotalHeight = (this.internalTitleRows && this.internalTitleRows.length > 0) ? this.titleRowHeight * this.internalTitleRows.length : this.titleRowHeight;
|
|
1393
|
+
|
|
1394
|
+
titleTotalHeight += this.footerTotalHeight;
|
|
1395
|
+
|
|
1396
|
+
return titleTotalHeight + this.internalTableData.length * this.rowHeight + 1;
|
|
1397
|
+
},
|
|
1398
|
+
clickTd (e, col) {
|
|
1399
|
+
if (["selection", "expane", "expend"].includes(col.type) || ["操作"].includes(col._name) || ["操作"].includes(col.title)) {
|
|
1400
|
+
e.stopPropagation();
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
|
|
1404
|
+
// custom columns component event
|
|
1405
|
+
customCompFunc (params) {
|
|
1406
|
+
this.$emit("on-custom-comp", params);
|
|
1407
|
+
},
|
|
1408
|
+
// 行颜色
|
|
1409
|
+
trBgColor (num) {
|
|
1410
|
+
return {
|
|
1411
|
+
"background-color": num % 2 === 0 ? this.oddBgColor : this.evenBgColor
|
|
1412
|
+
};
|
|
1413
|
+
},
|
|
1414
|
+
// 设置 column 列的样式
|
|
1415
|
+
setColumnCellClassName (rowIndex, field, rowData) {
|
|
1416
|
+
return this.columnCellClassName && this.columnCellClassName(rowIndex, field, rowData);
|
|
1417
|
+
},
|
|
1418
|
+
|
|
1419
|
+
// 获取每个表头列的宽度
|
|
1420
|
+
titleColumnWidth (fields) {
|
|
1421
|
+
let result = 0;
|
|
1422
|
+
if (Array.isArray(fields)) {
|
|
1423
|
+
let matchItems = this.internalColumns.filter((item, index) => {
|
|
1424
|
+
return fields.some(x => x === item.field);
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
result = matchItems.reduce((total, curr) => total + curr.width, 0);
|
|
1428
|
+
} else {
|
|
1429
|
+
console.error(this.errorMsg + "the fields attribute must be a array in titleRows");
|
|
1430
|
+
}
|
|
1431
|
+
return result;
|
|
1432
|
+
},
|
|
1433
|
+
// 获取每个表头列的高度
|
|
1434
|
+
titleColumnHeight (rowspan) {
|
|
1435
|
+
if (rowspan && rowspan > 0) {
|
|
1436
|
+
return this.titleRowHeight * rowspan;
|
|
1437
|
+
} else {
|
|
1438
|
+
return this.titleRowHeight;
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
// 超出的title提示
|
|
1442
|
+
overflowTitle (row, rowIndex, col) {
|
|
1443
|
+
let result = "";
|
|
1444
|
+
if (typeof col.formatter === "function") {
|
|
1445
|
+
let val = col.formatter(row, rowIndex, this.pagingIndex, col.field);
|
|
1446
|
+
// 如果是html 不处理
|
|
1447
|
+
if (utils.isHtml(val)) {
|
|
1448
|
+
result = "";
|
|
1449
|
+
} else {
|
|
1450
|
+
result = val;
|
|
1451
|
+
}
|
|
1452
|
+
} else {
|
|
1453
|
+
result = row[col.field];
|
|
1454
|
+
}
|
|
1455
|
+
return result;
|
|
1456
|
+
},
|
|
1457
|
+
|
|
1458
|
+
// 当没设置宽度和高度时动态计算
|
|
1459
|
+
initView () {
|
|
1460
|
+
// 当没有设置宽度计算总宽度
|
|
1461
|
+
if (!(this.internalWidth && this.internalWidth > 0)) {
|
|
1462
|
+
|
|
1463
|
+
if (this.columns && this.columns.length > 0) {
|
|
1464
|
+
this.internalWidth = this.columns.reduce((total, curr) => total + curr.width, 0);
|
|
1465
|
+
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
let totalColumnsHeight = this.getTotalColumnsHeight();
|
|
1470
|
+
|
|
1471
|
+
// 当没有设置高度时计算总高度 || 设置的高度大于所有列高度之和时
|
|
1472
|
+
if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {
|
|
1473
|
+
|
|
1474
|
+
if (!this.isVerticalResize) {
|
|
1475
|
+
|
|
1476
|
+
this.internalHeight = totalColumnsHeight;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
} else if (this.height <= totalColumnsHeight) {
|
|
1480
|
+
|
|
1481
|
+
this.internalHeight = this.height;
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
|
|
1485
|
+
initInternalTableData () {
|
|
1486
|
+
return Array.isArray(this.tableData) ? deepClone(this.tableData) : [];
|
|
1487
|
+
},
|
|
1488
|
+
updateErrorContent () {
|
|
1489
|
+
if (!this.firstLoad) {
|
|
1490
|
+
if (!(this.internalTableData && this.internalTableData.length)) {
|
|
1491
|
+
this.tipContent = "暂无数据";
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
this.firstLoad = false;
|
|
1495
|
+
},
|
|
1496
|
+
// 对外暴露(隐藏显示切换时)
|
|
1497
|
+
resize () {
|
|
1498
|
+
// fixed bug in IE9 #17
|
|
1499
|
+
this.resizeTimer = setTimeout(x => {
|
|
1500
|
+
|
|
1501
|
+
this.tableResize();
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
watch: {
|
|
1506
|
+
|
|
1507
|
+
// 重新跟新列信息
|
|
1508
|
+
"columns": {
|
|
1509
|
+
handler: function (newVal) {
|
|
1510
|
+
|
|
1511
|
+
this.initColumns();
|
|
1512
|
+
// fix issue #261
|
|
1513
|
+
this.tableResize();
|
|
1514
|
+
},
|
|
1515
|
+
deep: true
|
|
1516
|
+
},
|
|
1517
|
+
// 重新覆盖复杂表头信息
|
|
1518
|
+
"titleRows": {
|
|
1519
|
+
handler: function (newVal) {
|
|
1520
|
+
|
|
1521
|
+
this.initColumns();
|
|
1522
|
+
},
|
|
1523
|
+
deep: true
|
|
1524
|
+
},
|
|
1525
|
+
|
|
1526
|
+
// deep watch
|
|
1527
|
+
"tableData": {
|
|
1528
|
+
|
|
1529
|
+
handler: function (newVal) {
|
|
1530
|
+
|
|
1531
|
+
this.skipRenderCells = [];
|
|
1532
|
+
|
|
1533
|
+
this.internalTableData = this.initInternalTableData(newVal);
|
|
1534
|
+
|
|
1535
|
+
this.updateCheckboxGroupModel();
|
|
1536
|
+
|
|
1537
|
+
this.tableEmpty();
|
|
1538
|
+
|
|
1539
|
+
if (Array.isArray(newVal) && newVal.length > 0) {
|
|
1540
|
+
|
|
1541
|
+
this.initView();
|
|
1542
|
+
|
|
1543
|
+
this.scrollControl();
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
this.resize();
|
|
1547
|
+
},
|
|
1548
|
+
deep: true
|
|
1549
|
+
},
|
|
1550
|
+
"pagingIndex": {
|
|
1551
|
+
|
|
1552
|
+
handler: function () {
|
|
1553
|
+
|
|
1554
|
+
this.clearCurrentRow();
|
|
1555
|
+
|
|
1556
|
+
this.bodyScrollTop();
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
},
|
|
1560
|
+
beforeDestroy () {
|
|
1561
|
+
|
|
1562
|
+
clearTimeout(this.resizeTimer);
|
|
1563
|
+
}
|
|
1564
|
+
};
|
|
1565
|
+
</script>
|