bri-components 1.5.13 → 1.5.15
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 +83 -83
- package/lib/0.bri-components.min.js +1 -1
- package/lib/1.bri-components.min.js +1 -1
- package/lib/10.bri-components.min.js +1 -1
- package/lib/2.bri-components.min.js +1 -1
- package/lib/3.bri-components.min.js +1 -1
- package/lib/4.bri-components.min.js +1 -1
- package/lib/5.bri-components.min.js +1 -1
- package/lib/6.bri-components.min.js +1 -1
- package/lib/7.bri-components.min.js +1 -1
- package/lib/8.bri-components.min.js +1 -1
- package/lib/9.bri-components.min.js +1 -1
- package/lib/bri-components.min.js +4 -4
- package/lib/styles/bundle.css +12 -12
- package/lib/styles/font/fontello.svg +31 -31
- package/package.json +125 -125
- package/src/components/Error/Error403.vue +42 -42
- package/src/components/Error/Error404.vue +40 -40
- package/src/components/Error/Error500.vue +51 -51
- package/src/components/Error/error.less +162 -162
- package/src/components/Error/errorBack.vue +40 -40
- package/src/components/controls/DshControlInput.vue +195 -195
- package/src/components/controls/base/BriUpload/BriUpload.vue +434 -434
- package/src/components/controls/base/BriUpload/BriUploadImage.vue +377 -377
- package/src/components/controls/base/BriUpload/uploadList.vue +727 -731
- package/src/components/controls/base/BriUpload/uploadMixin.js +446 -446
- package/src/components/controls/base/DshCascader/DshCascader.vue +215 -215
- package/src/components/controls/base/DshCascader/components/cascaderModal.vue +366 -366
- package/src/components/controls/base/DshCascader/components/cascaderPicker.vue +416 -416
- package/src/components/controls/base/DshCascader/components/cascaderSimple.vue +141 -141
- package/src/components/controls/base/DshCascader/components/cascaderTree.vue +151 -151
- package/src/components/controls/base/DshCoordinates.vue +577 -577
- package/src/components/controls/base/DshDate/DshDate.vue +191 -191
- package/src/components/controls/base/DshDate/DshDaterange.vue +186 -186
- package/src/components/controls/base/DshDivider.vue +201 -201
- package/src/components/controls/base/DshEditor.vue +274 -274
- package/src/components/controls/base/DshInput/BriInputs.vue +166 -166
- package/src/components/controls/base/DshInput/DshInput.vue +260 -260
- package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +435 -435
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -34
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -14
- package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -322
- package/src/components/controls/base/DshNumber/DshNumber.vue +143 -143
- package/src/components/controls/base/DshNumber/DshNumberange.vue +109 -109
- package/src/components/controls/base/DshSelect/DshCheckbox.vue +168 -168
- package/src/components/controls/base/DshSelect/DshSelect.vue +180 -180
- package/src/components/controls/base/DshSwitch/DshSwitch.vue +115 -115
- package/src/components/controls/control.less +324 -324
- package/src/components/controls/controlMap.js +114 -114
- package/src/components/controls/extra/DshColor.vue +81 -81
- package/src/components/controls/extra/DshThemeColor.vue +100 -100
- package/src/components/controls/extra/DshThemeIcon.vue +122 -122
- package/src/components/controls/mixins/cascaderMixin.js +325 -327
- package/src/components/controls/mixins/cascaderPickerMixin.js +227 -227
- package/src/components/controls/mixins/cascaderTableMixin.js +130 -130
- package/src/components/controls/mixins/controlMixin.js +393 -393
- package/src/components/controls/mixins/dateMixin.js +149 -149
- package/src/components/controls/mixins/flatTableMixin.js +111 -111
- package/src/components/controls/mixins/numberMixin.js +112 -112
- package/src/components/controls/mixins/selectMixin.js +233 -233
- package/src/components/controls/mixins/switchMixin.js +87 -87
- package/src/components/controls/mixins/userAndDepartMixin.js +260 -260
- package/src/components/controls/senior/DshLabels.vue +333 -333
- package/src/components/controls/senior/DshPackage.vue +57 -57
- package/src/components/controls/senior/cascaderTable.vue +213 -213
- package/src/components/controls/senior/flatTable.vue +138 -138
- package/src/components/controls/senior/selectDepartments.vue +399 -399
- package/src/components/controls/senior/selectUsers/departMenu.vue +293 -293
- package/src/components/controls/senior/selectUsers/selectUsers.vue +712 -712
- package/src/components/controls/special/DshBack.vue +42 -42
- package/src/components/controls/special/DshUndeveloped.vue +41 -41
- package/src/components/form/DshAdvSearch.vue +510 -510
- package/src/components/form/DshDefaultSearch.vue +260 -260
- package/src/components/form/DshForm.vue +494 -494
- package/src/components/form/searchMixin.js +376 -376
- package/src/components/list/BriCard.vue +95 -95
- package/src/components/list/BriTable.vue +205 -205
- package/src/components/list/BriTree.vue +529 -529
- package/src/components/list/BriTreeItem.vue +163 -163
- package/src/components/list/DshBox/DshBox.vue +219 -219
- package/src/components/list/DshBox/DshCard.vue +446 -446
- package/src/components/list/DshBox/DshCrossTable.vue +827 -827
- package/src/components/list/DshBox/DshList.vue +404 -404
- package/src/components/list/DshBox/DshPanel.vue +669 -669
- package/src/components/list/DshBox/DshSingleData.vue +119 -119
- package/src/components/list/DshBox/DshTable.vue +239 -239
- package/src/components/list/DshCascaderTable.vue +115 -115
- package/src/components/list/DshFlatTable.vue +337 -337
- package/src/components/list/DshPage.vue +194 -194
- package/src/components/list/DshTreeTable.vue +113 -113
- package/src/components/list/common/importModal.vue +243 -243
- package/src/components/list/common/quoteListModal.vue +206 -206
- package/src/components/list/mixins/DshCascaderTableMixin.js +278 -278
- package/src/components/list/mixins/DshFlatTableMixin.js +509 -509
- package/src/components/list/mixins/DshTreeTableMixin.js +286 -286
- package/src/components/list/mixins/tableBaseMixin.js +1653 -1653
- package/src/components/list/mixins/treeTableBaseMixin.js +145 -145
- package/src/components/other/BriAvatar.vue +166 -166
- package/src/components/other/BriCode.vue +125 -125
- package/src/components/other/BriCollapseTree.vue +207 -207
- package/src/components/other/BriGantt.vue +1087 -1087
- package/src/components/other/BriIframe.vue +116 -116
- package/src/components/other/BriLoading.vue +171 -171
- package/src/components/other/BriSvg.vue +27 -27
- package/src/components/other/DshColorPanel.vue +128 -128
- package/src/components/other/DshMenuNav.vue +188 -188
- package/src/components/small/BriButton.vue +71 -71
- package/src/components/small/BriDrawer.vue +169 -169
- package/src/components/small/BriTooltip.vue +87 -87
- package/src/components/small/DshBtnModal.vue +68 -68
- package/src/components/small/DshButtons.vue +324 -324
- package/src/components/small/DshDropdown.vue +225 -225
- package/src/components/small/DshIcons.vue +59 -59
- package/src/components/small/DshListRender.js +21 -21
- package/src/components/small/DshModal.vue +160 -160
- package/src/components/small/DshSteps.vue +141 -141
- package/src/components/small/DshTabs.vue +598 -598
- package/src/components/small/DshTabsSet.vue +309 -309
- package/src/components/small/DshTags.vue +251 -251
- package/src/components/small/DshTitle.vue +50 -50
- package/src/components/small/render.js +20 -20
- package/src/components/unit/DshFormUnit.vue +398 -398
- package/src/components/unit/DshListUnit.vue +115 -115
- package/src/components/unit/unitMixin.js +86 -86
- package/src/data/index.js +4 -9
- package/src/index.js +282 -282
- package/src/styles/bundle.css +12 -12
- package/src/styles/components/BriButton.less +307 -307
- package/src/styles/components/BriTable.less +344 -344
- package/src/styles/components/DshModal.less +257 -257
- package/src/styles/components/index.less +3 -3
- package/src/styles/global/animate.less +11 -11
- package/src/styles/global/base.less +45 -45
- package/src/styles/global/box.less +186 -186
- package/src/styles/global/control.less +122 -122
- package/src/styles/global/flex.less +282 -282
- package/src/styles/global/global.less +8 -8
- package/src/styles/global/text.less +59 -59
- package/src/styles/global/variables.less +85 -85
- package/src/styles/iconfont/iconfont.css +254 -254
- package/src/styles/iconfont/iconfont.json +422 -422
- package/src/styles/iconfont/iconfont.svg +137 -137
- package/src/styles/index.less +26 -26
- package/src/styles/reset-easytable.less +21 -21
- package/src/styles/reset-iview-controls.less +145 -145
- package/src/styles/reset-iview-other.less +49 -49
- package/src/styles/reset-iview-variables.less +43 -43
- package/src/styles/reset.less +45 -45
- package/src/utils/index.js +5 -5
- package/src/utils/table.js +175 -175
- package/lib/11.bri-components.min.js +0 -1
|
@@ -1,827 +1,827 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="DshCrossTable">
|
|
3
|
-
<!-- 左 表头列 -->
|
|
4
|
-
<div
|
|
5
|
-
class="DshCrossTable-left"
|
|
6
|
-
:style="renderTableBoxStyle + `;width: ${propsObj.titleWidth ? propsObj.titleWidth : 160}px`"
|
|
7
|
-
>
|
|
8
|
-
<!-- 多选框 和 序号 -->
|
|
9
|
-
<div
|
|
10
|
-
v-if="selfPropsObj.showCheck && selfPropsObj.showIndex"
|
|
11
|
-
class="DshCrossTable-left-header"
|
|
12
|
-
>
|
|
13
|
-
<table
|
|
14
|
-
cellspacing="0"
|
|
15
|
-
cellpadding="0"
|
|
16
|
-
>
|
|
17
|
-
<!-- 多选框 -->
|
|
18
|
-
<tr
|
|
19
|
-
v-if="selfPropsObj.showCheck"
|
|
20
|
-
class="DshCrossTable-row"
|
|
21
|
-
>
|
|
22
|
-
<td
|
|
23
|
-
class="DshCrossTable-col DshCrossTable-col-checkbox"
|
|
24
|
-
:style="{
|
|
25
|
-
background: '#f4f4f4',
|
|
26
|
-
}"
|
|
27
|
-
>
|
|
28
|
-
<Checkbox
|
|
29
|
-
v-model="isSelectAll"
|
|
30
|
-
@on-change="selectAll"
|
|
31
|
-
></Checkbox>
|
|
32
|
-
</td>
|
|
33
|
-
</tr>
|
|
34
|
-
|
|
35
|
-
<!-- 序号 -->
|
|
36
|
-
<tr
|
|
37
|
-
v-if="selfPropsObj.showIndex"
|
|
38
|
-
class="DshCrossTable-row"
|
|
39
|
-
>
|
|
40
|
-
<td
|
|
41
|
-
class="DshCrossTable-col DshCrossTable-col-index"
|
|
42
|
-
:style="{
|
|
43
|
-
background: '#f4f4f4',
|
|
44
|
-
}"
|
|
45
|
-
>
|
|
46
|
-
<div class="td-content">序号</div>
|
|
47
|
-
</td>
|
|
48
|
-
</tr>
|
|
49
|
-
</table>
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
<!-- 表头s -->
|
|
53
|
-
<div class="DshCrossTable-left-body">
|
|
54
|
-
<div :style="{
|
|
55
|
-
height: '10000px'
|
|
56
|
-
}">
|
|
57
|
-
<table
|
|
58
|
-
cellspacing="0"
|
|
59
|
-
cellpadding="0"
|
|
60
|
-
>
|
|
61
|
-
<!-- 头部 -->
|
|
62
|
-
<tr
|
|
63
|
-
v-for="colItem in columnList.filter(colItem => colItem.isHead === true)"
|
|
64
|
-
:key="colItem._key"
|
|
65
|
-
>
|
|
66
|
-
<td
|
|
67
|
-
class="DshCrossTable-col DshCrossTable-col-content"
|
|
68
|
-
:style="{
|
|
69
|
-
background: '#f4f4f4',
|
|
70
|
-
textAlign: 'center',
|
|
71
|
-
fontWeight: 500
|
|
72
|
-
}"
|
|
73
|
-
>
|
|
74
|
-
<bri-tooltip
|
|
75
|
-
transfer
|
|
76
|
-
:content="colItem.title"
|
|
77
|
-
>
|
|
78
|
-
<div class="td-content dsh-ellipsis">
|
|
79
|
-
{{ colItem.title }}
|
|
80
|
-
</div>
|
|
81
|
-
</bri-tooltip>
|
|
82
|
-
</td>
|
|
83
|
-
</tr>
|
|
84
|
-
|
|
85
|
-
<!-- 字段项 -->
|
|
86
|
-
<tr
|
|
87
|
-
v-for="colItem in columnList.filter(colItem => !colItem.isHead)"
|
|
88
|
-
:key="colItem._key"
|
|
89
|
-
>
|
|
90
|
-
<td
|
|
91
|
-
class="DshCrossTable-col DshCrossTable-col-content"
|
|
92
|
-
:style="{
|
|
93
|
-
background: '#F7F9FD',
|
|
94
|
-
display: 'flex',
|
|
95
|
-
width: (propsObj.titleWidth ? propsObj.titleWidth : 160)+ 'px'
|
|
96
|
-
}"
|
|
97
|
-
>
|
|
98
|
-
<bri-tooltip
|
|
99
|
-
style="width: calc(100% - 16px)"
|
|
100
|
-
:content="colItem.title"
|
|
101
|
-
transfer
|
|
102
|
-
>
|
|
103
|
-
<div class="td-content dsh-ellipsis">
|
|
104
|
-
<slot
|
|
105
|
-
name="col"
|
|
106
|
-
:col="colItem"
|
|
107
|
-
>
|
|
108
|
-
<div
|
|
109
|
-
v-if="changedFields.includes(colItem._key)"
|
|
110
|
-
class="crossTable-col"
|
|
111
|
-
>
|
|
112
|
-
<span class="crossTable-col-title">{{ colItem.title }}</span>
|
|
113
|
-
<span class="crossTable-col-sign">变更</span>
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<template v-else>
|
|
117
|
-
{{ colItem.title }}
|
|
118
|
-
</template>
|
|
119
|
-
</slot>
|
|
120
|
-
</div>
|
|
121
|
-
</bri-tooltip>
|
|
122
|
-
|
|
123
|
-
<Tooltip
|
|
124
|
-
v-if="colItem._description"
|
|
125
|
-
style="width:16px"
|
|
126
|
-
:content="colItem._description"
|
|
127
|
-
placement="top-start"
|
|
128
|
-
max-width="200"
|
|
129
|
-
:transfer="true"
|
|
130
|
-
>
|
|
131
|
-
<Icon
|
|
132
|
-
type="ios-help-circle-outline"
|
|
133
|
-
size="16"
|
|
134
|
-
/>
|
|
135
|
-
</Tooltip>
|
|
136
|
-
</td>
|
|
137
|
-
</tr>
|
|
138
|
-
</table>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
|
|
142
|
-
<!-- 操作 -->
|
|
143
|
-
<div
|
|
144
|
-
v-if="operationColumn && selfPropsObj.showAction"
|
|
145
|
-
class="DshCrossTable-left-footer"
|
|
146
|
-
>
|
|
147
|
-
<table
|
|
148
|
-
cellspacing="0"
|
|
149
|
-
cellpadding="0"
|
|
150
|
-
>
|
|
151
|
-
<tr class="DshCrossTable-row">
|
|
152
|
-
<td
|
|
153
|
-
class="DshCrossTable-col DshCrossTable-col-operation"
|
|
154
|
-
:style="{
|
|
155
|
-
background: '#f4f4f4'
|
|
156
|
-
}"
|
|
157
|
-
>
|
|
158
|
-
<div class="td-content">{{ operationColumn.title }}</div>
|
|
159
|
-
</td>
|
|
160
|
-
</tr>
|
|
161
|
-
</table>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<!-- 右 -数据 -->
|
|
166
|
-
<div
|
|
167
|
-
ref="DshCrossTable-right"
|
|
168
|
-
id="DshCrossTable-right"
|
|
169
|
-
:style="renderTableBoxStyle"
|
|
170
|
-
class="DshCrossTable-right"
|
|
171
|
-
>
|
|
172
|
-
<!-- 多选框 和 序号 -->
|
|
173
|
-
<div
|
|
174
|
-
v-if="selfPropsObj.showCheck && selfPropsObj.showIndex"
|
|
175
|
-
class="DshCrossTable-right-header"
|
|
176
|
-
>
|
|
177
|
-
<table
|
|
178
|
-
cellspacing="0"
|
|
179
|
-
cellpadding="0"
|
|
180
|
-
:style="{
|
|
181
|
-
width: rowWidth + 10 + 'px',
|
|
182
|
-
}"
|
|
183
|
-
>
|
|
184
|
-
<!-- 多选框 -->
|
|
185
|
-
<tr
|
|
186
|
-
v-if="selfPropsObj.showCheck"
|
|
187
|
-
class="DshCrossTable-row"
|
|
188
|
-
>
|
|
189
|
-
<CheckboxGroup
|
|
190
|
-
v-model="selectIds"
|
|
191
|
-
@on-change="select"
|
|
192
|
-
style="height:40px"
|
|
193
|
-
>
|
|
194
|
-
<td
|
|
195
|
-
v-for="(dataItem, dataIndex) in data"
|
|
196
|
-
:key="dataItem._id"
|
|
197
|
-
class="DshCrossTable-td-checkbox"
|
|
198
|
-
:style="{
|
|
199
|
-
width: colWidth ? colWidth + 'px' : '200px',
|
|
200
|
-
background: '#f4f4f4',
|
|
201
|
-
textAlign: 'center'
|
|
202
|
-
}"
|
|
203
|
-
>
|
|
204
|
-
<Checkbox
|
|
205
|
-
class="td-content"
|
|
206
|
-
style="display: inline-block; width: 100%;"
|
|
207
|
-
:label="dataItem._id"
|
|
208
|
-
@click.native="clickRowCheckbox(dataItem, dataIndex)"
|
|
209
|
-
>{{ "" }}</Checkbox>
|
|
210
|
-
</td>
|
|
211
|
-
</CheckboxGroup>
|
|
212
|
-
</tr>
|
|
213
|
-
|
|
214
|
-
<!-- 序号 -->
|
|
215
|
-
<tr v-if="selfPropsObj.showIndex">
|
|
216
|
-
<td
|
|
217
|
-
v-for="(dataItem, dataIndex) in data"
|
|
218
|
-
:key="dataItem._id"
|
|
219
|
-
class="DshCrossTable-td-index"
|
|
220
|
-
:style="{
|
|
221
|
-
width: colWidth ? colWidth + 'px' : '200px',
|
|
222
|
-
background: '#f4f4f4',
|
|
223
|
-
textAlign: 'center'
|
|
224
|
-
}"
|
|
225
|
-
@click="clickRow(dataItem, dataIndex)"
|
|
226
|
-
>
|
|
227
|
-
<div class="td-content">{{ dataIndex + 1 }}</div>
|
|
228
|
-
</td>
|
|
229
|
-
</tr>
|
|
230
|
-
</table>
|
|
231
|
-
</div>
|
|
232
|
-
|
|
233
|
-
<!-- 内容 -->
|
|
234
|
-
<div
|
|
235
|
-
v-if="showTable"
|
|
236
|
-
class="DshCrossTable-right-body"
|
|
237
|
-
:style="showScrollX === false ? {
|
|
238
|
-
overflowX: 'hidden'
|
|
239
|
-
} : {}"
|
|
240
|
-
@scroll="tableScroll($event)"
|
|
241
|
-
>
|
|
242
|
-
<!-- 无数据 -->
|
|
243
|
-
<div
|
|
244
|
-
v-if="!data.length"
|
|
245
|
-
class="dsh-subtip"
|
|
246
|
-
>{{ noDataText }}</div>
|
|
247
|
-
|
|
248
|
-
<!-- 存在数据 -->
|
|
249
|
-
<table
|
|
250
|
-
v-else
|
|
251
|
-
cellspacing="0"
|
|
252
|
-
cellpadding="0"
|
|
253
|
-
:style="{
|
|
254
|
-
width: rowWidth + 'px'
|
|
255
|
-
}"
|
|
256
|
-
>
|
|
257
|
-
<!-- 头部 -->
|
|
258
|
-
<tr
|
|
259
|
-
v-for="colItem in columnList.filter(colItem => colItem.isHead === true)"
|
|
260
|
-
:key="colItem._key"
|
|
261
|
-
>
|
|
262
|
-
<td
|
|
263
|
-
v-for="dataItem in data"
|
|
264
|
-
:key="dataItem._id"
|
|
265
|
-
class="DshCrossTable-td-content"
|
|
266
|
-
:style="{
|
|
267
|
-
width: colWidth ? colWidth + 'px' : '200px',
|
|
268
|
-
background: '#f4f4f4',
|
|
269
|
-
textAlign: 'center',
|
|
270
|
-
fontWeight: 500
|
|
271
|
-
}"
|
|
272
|
-
>
|
|
273
|
-
<div class="td-content">
|
|
274
|
-
{{ dataItem[colItem._key] }}
|
|
275
|
-
</div>
|
|
276
|
-
</td>
|
|
277
|
-
</tr>
|
|
278
|
-
|
|
279
|
-
<!-- 字段项 -->
|
|
280
|
-
<tr
|
|
281
|
-
v-for="(colItem, colIndex) in columnList.filter(colItem => !colItem.isHead)"
|
|
282
|
-
:key="colItem._key"
|
|
283
|
-
>
|
|
284
|
-
<td
|
|
285
|
-
v-for="(dataItem, dataIndex) in data"
|
|
286
|
-
:key="dataItem._id"
|
|
287
|
-
class="DshCrossTable-td-content"
|
|
288
|
-
:style="{
|
|
289
|
-
width: colWidth ? colWidth + 'px' : '200px',
|
|
290
|
-
background: changedFields.includes(colItem._key) && data.length === 2 && dataIndex === 1
|
|
291
|
-
? '#FFECED'
|
|
292
|
-
: dataIndex % 2 === 0 ? '' : '#F7F9FD',
|
|
293
|
-
color: changedFields.includes(colItem._key) && data.length === 2 && dataIndex === 1 ? 'red' : undefined
|
|
294
|
-
}"
|
|
295
|
-
@click="clickRow(dataItem, dataIndex)"
|
|
296
|
-
>
|
|
297
|
-
<div
|
|
298
|
-
v-if="colItem.renderBodyCell"
|
|
299
|
-
class="td-content"
|
|
300
|
-
>
|
|
301
|
-
<dsh-list-render
|
|
302
|
-
:row="dataItem"
|
|
303
|
-
:index="dataIndex"
|
|
304
|
-
:render="colItem.renderBodyCell"
|
|
305
|
-
></dsh-list-render>
|
|
306
|
-
</div>
|
|
307
|
-
|
|
308
|
-
<div
|
|
309
|
-
v-else-if="colItem.formatter"
|
|
310
|
-
class="td-content"
|
|
311
|
-
v-html="colItem.formatter(dataItem, colIndex, 0, colItem._key)"
|
|
312
|
-
></div>
|
|
313
|
-
|
|
314
|
-
<div
|
|
315
|
-
v-else
|
|
316
|
-
class="td-content"
|
|
317
|
-
>{{ dataItem[colItem._key] }}</div>
|
|
318
|
-
</td>
|
|
319
|
-
</tr>
|
|
320
|
-
</table>
|
|
321
|
-
</div>
|
|
322
|
-
|
|
323
|
-
<!-- 操作 -->
|
|
324
|
-
<div
|
|
325
|
-
v-if="operationColumn && selfPropsObj.showAction"
|
|
326
|
-
class="DshCrossTable-right-footer"
|
|
327
|
-
>
|
|
328
|
-
<table
|
|
329
|
-
cellspacing="0"
|
|
330
|
-
cellpadding="0"
|
|
331
|
-
:style="{
|
|
332
|
-
width: rowWidth + 10 + 'px'
|
|
333
|
-
}"
|
|
334
|
-
>
|
|
335
|
-
<tr class="DshCrossTable-row">
|
|
336
|
-
<td
|
|
337
|
-
v-for="(dataItem, dataIndex) in data"
|
|
338
|
-
:key="dataItem._id"
|
|
339
|
-
class="DshCrossTable-td-operation"
|
|
340
|
-
:style="{
|
|
341
|
-
width: colWidth ? colWidth + 'px' : '200px',
|
|
342
|
-
background: '#f4f4f4',
|
|
343
|
-
}"
|
|
344
|
-
>
|
|
345
|
-
<div class="td-content">
|
|
346
|
-
<dsh-list-render
|
|
347
|
-
:row="dataItem"
|
|
348
|
-
:index="dataIndex"
|
|
349
|
-
:render="operationColumn.renderBodyCell"
|
|
350
|
-
></dsh-list-render>
|
|
351
|
-
</div>
|
|
352
|
-
</td>
|
|
353
|
-
</tr>
|
|
354
|
-
</table>
|
|
355
|
-
</div>
|
|
356
|
-
</div>
|
|
357
|
-
</div>
|
|
358
|
-
</template>
|
|
359
|
-
|
|
360
|
-
<script>
|
|
361
|
-
import elementResizeDetectorMaker from "element-resize-detector";
|
|
362
|
-
|
|
363
|
-
export default {
|
|
364
|
-
name: "DshCrossTable",
|
|
365
|
-
props: {
|
|
366
|
-
data: {
|
|
367
|
-
type: Array,
|
|
368
|
-
default () {
|
|
369
|
-
return [];
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
columns: {
|
|
373
|
-
type: Array,
|
|
374
|
-
default () {
|
|
375
|
-
return [];
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
propsObj: {
|
|
379
|
-
type: Object,
|
|
380
|
-
default () {
|
|
381
|
-
return {};
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
operationList: {
|
|
385
|
-
type: Array,
|
|
386
|
-
default () {
|
|
387
|
-
return [];
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
|
|
391
|
-
noDataText: {
|
|
392
|
-
type: String,
|
|
393
|
-
default: "暂无数据…"
|
|
394
|
-
},
|
|
395
|
-
changedFields: {
|
|
396
|
-
type: Array,
|
|
397
|
-
default () {
|
|
398
|
-
return [];
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
data () {
|
|
403
|
-
return {
|
|
404
|
-
selections: [],
|
|
405
|
-
// curRow: null // 可以不声明
|
|
406
|
-
|
|
407
|
-
allChecked: false,
|
|
408
|
-
selectionList: [],
|
|
409
|
-
rowWidth: 0,
|
|
410
|
-
colWidth: 0,
|
|
411
|
-
titleWidth: 200,
|
|
412
|
-
showScrollX: false,
|
|
413
|
-
showTable: false,
|
|
414
|
-
currentPage: 1,
|
|
415
|
-
pagesize: 10,
|
|
416
|
-
pagesizeOpts: [50, 30, 20, 15, 10], // pagesize选择下拉
|
|
417
|
-
showTotal: true,
|
|
418
|
-
total: 0,
|
|
419
|
-
pageHeightScreen: [5, 10, 15] // 根据大中小屏,设置内部height,pagesize最多出现几个然后滚动
|
|
420
|
-
};
|
|
421
|
-
},
|
|
422
|
-
computed: {
|
|
423
|
-
selfPropsObj () {
|
|
424
|
-
return {
|
|
425
|
-
showCheck: true,
|
|
426
|
-
showIndex: true,
|
|
427
|
-
showAction: true,
|
|
428
|
-
...this.propsObj
|
|
429
|
-
};
|
|
430
|
-
},
|
|
431
|
-
columnList () {
|
|
432
|
-
return this.columns;
|
|
433
|
-
},
|
|
434
|
-
operationColumn () {
|
|
435
|
-
return {
|
|
436
|
-
title: "操作",
|
|
437
|
-
_key: "__operation__",
|
|
438
|
-
key: "__operation__",
|
|
439
|
-
field: "__operation__",
|
|
440
|
-
width: 150,
|
|
441
|
-
renderBodyCell: (params, h) => {
|
|
442
|
-
return this.operationList.length < 3
|
|
443
|
-
? h("dsh-buttons", {
|
|
444
|
-
props: {
|
|
445
|
-
list: this.operationList
|
|
446
|
-
},
|
|
447
|
-
on: {
|
|
448
|
-
click: (operationItem) => {
|
|
449
|
-
this.$dshEmit(operationItem, params.row, params.row);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
})
|
|
453
|
-
: h("div", {
|
|
454
|
-
style: {
|
|
455
|
-
display: "flex",
|
|
456
|
-
justifyContent: "center"
|
|
457
|
-
}
|
|
458
|
-
}, [
|
|
459
|
-
h("dsh-buttons", {
|
|
460
|
-
style: {
|
|
461
|
-
display: "inline-block"
|
|
462
|
-
},
|
|
463
|
-
props: {
|
|
464
|
-
list: this.operationList.slice(0, 2)
|
|
465
|
-
},
|
|
466
|
-
on: {
|
|
467
|
-
click: (operationItem) => {
|
|
468
|
-
this.$dshEmit(operationItem, params.row, params.row);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}),
|
|
472
|
-
h("dsh-dropdown", {
|
|
473
|
-
props: {
|
|
474
|
-
dropdownObj: {
|
|
475
|
-
icon: "ios-more",
|
|
476
|
-
size: 22,
|
|
477
|
-
color: "#E9ECF4",
|
|
478
|
-
showDropdownItemIcon: false
|
|
479
|
-
},
|
|
480
|
-
list: this.operationList.slice(2)
|
|
481
|
-
},
|
|
482
|
-
on: {
|
|
483
|
-
click: (operationItem) => {
|
|
484
|
-
this.$dshEmit(operationItem, params.row, params.row);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}, [
|
|
488
|
-
h("dsh-buttons", {
|
|
489
|
-
props: {
|
|
490
|
-
list: [
|
|
491
|
-
{
|
|
492
|
-
name: "更多>>",
|
|
493
|
-
type: "more",
|
|
494
|
-
btnType: "text",
|
|
495
|
-
size: "small"
|
|
496
|
-
}
|
|
497
|
-
]
|
|
498
|
-
}
|
|
499
|
-
})
|
|
500
|
-
])
|
|
501
|
-
]);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
},
|
|
505
|
-
renderTableBoxStyle () {
|
|
506
|
-
let styleStr = "";
|
|
507
|
-
if (this.tableExpend) {
|
|
508
|
-
styleStr += "padding-bottom:38px;";
|
|
509
|
-
} else {
|
|
510
|
-
styleStr += "padding-bottom:0px;";
|
|
511
|
-
}
|
|
512
|
-
if (this.tableSelection && this.tableIndex) {
|
|
513
|
-
styleStr += "padding-top:77px";
|
|
514
|
-
} else if (this.tableSelection || this.tableIndex) {
|
|
515
|
-
styleStr += "padding-top:39px";
|
|
516
|
-
} else {
|
|
517
|
-
styleStr += "padding-top:0px";
|
|
518
|
-
}
|
|
519
|
-
return styleStr;
|
|
520
|
-
},
|
|
521
|
-
selectIds: {
|
|
522
|
-
get () {
|
|
523
|
-
return this.selections.map(item => item._id);
|
|
524
|
-
},
|
|
525
|
-
set (val) {
|
|
526
|
-
this.selections = this.data.filter(item => val.includes(item._id));
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
isSelectAll: {
|
|
530
|
-
get () {
|
|
531
|
-
return this.data.length > 0 && this.selectIds.length === this.data.length;
|
|
532
|
-
},
|
|
533
|
-
set (bool) {
|
|
534
|
-
this.selections = bool ? this.data : [];
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
},
|
|
539
|
-
created () {},
|
|
540
|
-
mounted () {
|
|
541
|
-
this.init();
|
|
542
|
-
},
|
|
543
|
-
methods: {
|
|
544
|
-
// 初始化
|
|
545
|
-
init () {
|
|
546
|
-
this.initTableData();
|
|
547
|
-
},
|
|
548
|
-
initTableData () {
|
|
549
|
-
// dom加载完成之后设置主要内容区域的宽,并且绑定监测滚动事件
|
|
550
|
-
this.$nextTick(() => {
|
|
551
|
-
this.initTableWidth();
|
|
552
|
-
});
|
|
553
|
-
},
|
|
554
|
-
initTableWidth () {
|
|
555
|
-
// 创建实例,无参数
|
|
556
|
-
let erd = elementResizeDetectorMaker();
|
|
557
|
-
// 创建实例带参数
|
|
558
|
-
/* let erdUltraFast = elementResizeDetectorMaker({
|
|
559
|
-
strategy: "scroll",
|
|
560
|
-
callOnAdd: true,
|
|
561
|
-
debug: true
|
|
562
|
-
}); */
|
|
563
|
-
// 监听id为CrossTable-right的元素 大小变化
|
|
564
|
-
let that = this;
|
|
565
|
-
erd.listenTo(document.getElementById("DshCrossTable-right"), function (element) {
|
|
566
|
-
// 计算宽度
|
|
567
|
-
let tableWidth = that.$refs["DshCrossTable-right"].clientWidth - 10;
|
|
568
|
-
let nums = tableWidth / 200;
|
|
569
|
-
let dataTotal = that.data.length;
|
|
570
|
-
if (nums >= dataTotal) {
|
|
571
|
-
that.rowWidth = tableWidth;
|
|
572
|
-
that.colWidth = tableWidth / dataTotal;
|
|
573
|
-
that.showScrollX = false;
|
|
574
|
-
} else {
|
|
575
|
-
that.rowWidth = dataTotal * 200;
|
|
576
|
-
that.showScrollX = true;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
// that.rowWidth = 200 * that.data.length;
|
|
580
|
-
/* if (that.selfPropsObj.colWidth === "half") { //
|
|
581
|
-
that.colWidth = (tableWidth - 10) / dataTotal;
|
|
582
|
-
} */
|
|
583
|
-
|
|
584
|
-
that.showTable = true;
|
|
585
|
-
});
|
|
586
|
-
},
|
|
587
|
-
// 竖向滚动监测,赋值给左侧表头滚动,保持同步
|
|
588
|
-
tableScroll (event) {
|
|
589
|
-
const leftEle = document.getElementsByClassName("DshCrossTable-left")[0]; // 左侧内容表头
|
|
590
|
-
const leftBodyEle = document.getElementsByClassName("DshCrossTable-left-body")[0]; // 左侧
|
|
591
|
-
const rightHeaderEle = document.getElementsByClassName("DshCrossTable-right-header")[0] || {}; // 右头
|
|
592
|
-
const rightFooterEle = document.getElementsByClassName("DshCrossTable-right-footer")[0] || {}; // 右低
|
|
593
|
-
|
|
594
|
-
// 上下滚动
|
|
595
|
-
leftBodyEle.scrollTop = event.srcElement.scrollTop;
|
|
596
|
-
if (this.selfPropsObj.showCheck && this.selfPropsObj.showIndex) {
|
|
597
|
-
if (event.srcElement.scrollTop !== 0) {
|
|
598
|
-
rightHeaderEle.style.boxShadow = "0px 0px 5px 0px #dddddd";
|
|
599
|
-
rightFooterEle.style.boxShadow = "0px 0px 5px 0px #dddddd";
|
|
600
|
-
} else {
|
|
601
|
-
rightHeaderEle.style.boxShadow = rightFooterEle.style.boxShadow = "none";
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// 左右滚动
|
|
606
|
-
rightHeaderEle.scrollLeft = rightFooterEle.scrollLeft = event.srcElement.scrollLeft;
|
|
607
|
-
if (event.srcElement.scrollLeft !== 0) {
|
|
608
|
-
leftEle.style.boxShadow = "0px 0px 3px 0px #dddddd";
|
|
609
|
-
} else {
|
|
610
|
-
leftEle.style.boxShadow = "none";
|
|
611
|
-
}
|
|
612
|
-
},
|
|
613
|
-
|
|
614
|
-
// 点击某行
|
|
615
|
-
clickRow (row) {
|
|
616
|
-
this.$emit("clickRow", row);
|
|
617
|
-
},
|
|
618
|
-
// 点击某行的选择框
|
|
619
|
-
clickRowCheckbox (row) {
|
|
620
|
-
this.curRow = row;
|
|
621
|
-
this.curRow.bool = !this.selectIds.includes(row._id);
|
|
622
|
-
},
|
|
623
|
-
// 切换全选
|
|
624
|
-
selectAll (bool) {
|
|
625
|
-
this.$emit("selectAll", this.selectIds, this.selections, bool);
|
|
626
|
-
this.changeSelect();
|
|
627
|
-
},
|
|
628
|
-
// 切换选择
|
|
629
|
-
select (selectIds) {
|
|
630
|
-
this.$emit("select", this.selectIds, this.selections, this.curRow, this.curRow.bool);
|
|
631
|
-
this.changeSelect();
|
|
632
|
-
},
|
|
633
|
-
// 改变选择项
|
|
634
|
-
changeSelect () {
|
|
635
|
-
this.$emit("changeSelect", this.selectIds, this.selections);
|
|
636
|
-
}
|
|
637
|
-
},
|
|
638
|
-
watch: {
|
|
639
|
-
data (newVal, oldVal) {
|
|
640
|
-
this.init();
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
</script>
|
|
645
|
-
|
|
646
|
-
<style lang="less">
|
|
647
|
-
.DshCrossTable {
|
|
648
|
-
width: 100%;
|
|
649
|
-
height: 100%;
|
|
650
|
-
display: flex;
|
|
651
|
-
flex-direction: row;
|
|
652
|
-
|
|
653
|
-
&-left,
|
|
654
|
-
&-right {
|
|
655
|
-
border-top: 1px solid #eeeeee;
|
|
656
|
-
border-bottom: 1px solid #eeeeee;
|
|
657
|
-
overflow: hidden;
|
|
658
|
-
display: flex;
|
|
659
|
-
flex-direction: column;
|
|
660
|
-
|
|
661
|
-
&-header {
|
|
662
|
-
width: 100%;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
&-body {
|
|
666
|
-
width: 100%;
|
|
667
|
-
flex: 1;
|
|
668
|
-
min-height: 0px;
|
|
669
|
-
overflow: scroll;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
&-footer {
|
|
673
|
-
width: 100%;
|
|
674
|
-
height: 38px;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
&-left {
|
|
679
|
-
width: 160px;
|
|
680
|
-
height: 100%;
|
|
681
|
-
border-left: 1px solid #eeeeee;
|
|
682
|
-
border-right: 1px solid #eeeeee;
|
|
683
|
-
// background: #F7F9FD;
|
|
684
|
-
z-index: 2;
|
|
685
|
-
|
|
686
|
-
&-header {
|
|
687
|
-
overflow: hidden;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
&-body {
|
|
691
|
-
overflow: hidden;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
&-footer {
|
|
695
|
-
overflow: hidden;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
&-right {
|
|
700
|
-
flex: 1;
|
|
701
|
-
min-width: 0px;
|
|
702
|
-
height: 100%;
|
|
703
|
-
border-right: 1px solid #eeeeee;
|
|
704
|
-
|
|
705
|
-
&-header {
|
|
706
|
-
overflow: hidden;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
&-body {
|
|
710
|
-
overflow: scroll;
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
&-footer {
|
|
714
|
-
overflow: hidden;
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
&-row {
|
|
719
|
-
// height: 40px;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
&-col {
|
|
723
|
-
font-weight: bold;
|
|
724
|
-
color: #5D5D5D;
|
|
725
|
-
|
|
726
|
-
&-checkbox,
|
|
727
|
-
&-index,
|
|
728
|
-
&-operation {}
|
|
729
|
-
|
|
730
|
-
&-Checkbox {}
|
|
731
|
-
|
|
732
|
-
&-index {}
|
|
733
|
-
|
|
734
|
-
&-content {
|
|
735
|
-
.crossTable-col {
|
|
736
|
-
width: 100%;
|
|
737
|
-
.dsh-flex-row-center-center();
|
|
738
|
-
|
|
739
|
-
&-title {
|
|
740
|
-
flex: 1;
|
|
741
|
-
min-width: 0px;
|
|
742
|
-
height: 100%;
|
|
743
|
-
.dsh-ellipsis();
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
&-sign {
|
|
747
|
-
#dsh-sign-change();
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
&-operation {}
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
&-td {
|
|
756
|
-
|
|
757
|
-
&-checkbox,
|
|
758
|
-
&-index,
|
|
759
|
-
&-operation {}
|
|
760
|
-
|
|
761
|
-
&-Checkbox {}
|
|
762
|
-
|
|
763
|
-
&-index {}
|
|
764
|
-
|
|
765
|
-
&-content {}
|
|
766
|
-
|
|
767
|
-
&-operation {}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
table {
|
|
771
|
-
width: 100%;
|
|
772
|
-
|
|
773
|
-
tr {
|
|
774
|
-
height: 39px;
|
|
775
|
-
font-size: 12px;
|
|
776
|
-
overflow: hidden;
|
|
777
|
-
|
|
778
|
-
td {
|
|
779
|
-
display: inline-block;
|
|
780
|
-
width: 200px;
|
|
781
|
-
height: 40px;
|
|
782
|
-
line-height: 40px;
|
|
783
|
-
padding: 0 10px;
|
|
784
|
-
border-right: 1px solid #EDEDED;
|
|
785
|
-
border-bottom: 1px solid #EDEDED;
|
|
786
|
-
cursor: pointer;
|
|
787
|
-
overflow: hidden;
|
|
788
|
-
|
|
789
|
-
.td-content {
|
|
790
|
-
width: 100%;
|
|
791
|
-
height: 100%;
|
|
792
|
-
padding: 8px 0px;
|
|
793
|
-
line-height: 22px;
|
|
794
|
-
vertical-align: middle;
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
.cross-table-box {
|
|
801
|
-
height: 38px;
|
|
802
|
-
padding: 7px 0;
|
|
803
|
-
|
|
804
|
-
&-content {
|
|
805
|
-
width: auto;
|
|
806
|
-
border-radius: 2px;
|
|
807
|
-
border: 1px solid #6daef2;
|
|
808
|
-
font-size: 12px !important;
|
|
809
|
-
color: #6DAEF2;
|
|
810
|
-
cursor: pointer;
|
|
811
|
-
height: 24px;
|
|
812
|
-
display: inline-block;
|
|
813
|
-
line-height: 24px;
|
|
814
|
-
padding: 0 5px;
|
|
815
|
-
overflow: hidden;
|
|
816
|
-
word-break: keep-all;
|
|
817
|
-
white-space: nowrap;
|
|
818
|
-
text-overflow: ellipsis;
|
|
819
|
-
|
|
820
|
-
i {
|
|
821
|
-
margin-right: 5px;
|
|
822
|
-
font-size: 12px !important;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="DshCrossTable">
|
|
3
|
+
<!-- 左 表头列 -->
|
|
4
|
+
<div
|
|
5
|
+
class="DshCrossTable-left"
|
|
6
|
+
:style="renderTableBoxStyle + `;width: ${propsObj.titleWidth ? propsObj.titleWidth : 160}px`"
|
|
7
|
+
>
|
|
8
|
+
<!-- 多选框 和 序号 -->
|
|
9
|
+
<div
|
|
10
|
+
v-if="selfPropsObj.showCheck && selfPropsObj.showIndex"
|
|
11
|
+
class="DshCrossTable-left-header"
|
|
12
|
+
>
|
|
13
|
+
<table
|
|
14
|
+
cellspacing="0"
|
|
15
|
+
cellpadding="0"
|
|
16
|
+
>
|
|
17
|
+
<!-- 多选框 -->
|
|
18
|
+
<tr
|
|
19
|
+
v-if="selfPropsObj.showCheck"
|
|
20
|
+
class="DshCrossTable-row"
|
|
21
|
+
>
|
|
22
|
+
<td
|
|
23
|
+
class="DshCrossTable-col DshCrossTable-col-checkbox"
|
|
24
|
+
:style="{
|
|
25
|
+
background: '#f4f4f4',
|
|
26
|
+
}"
|
|
27
|
+
>
|
|
28
|
+
<Checkbox
|
|
29
|
+
v-model="isSelectAll"
|
|
30
|
+
@on-change="selectAll"
|
|
31
|
+
></Checkbox>
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
|
|
35
|
+
<!-- 序号 -->
|
|
36
|
+
<tr
|
|
37
|
+
v-if="selfPropsObj.showIndex"
|
|
38
|
+
class="DshCrossTable-row"
|
|
39
|
+
>
|
|
40
|
+
<td
|
|
41
|
+
class="DshCrossTable-col DshCrossTable-col-index"
|
|
42
|
+
:style="{
|
|
43
|
+
background: '#f4f4f4',
|
|
44
|
+
}"
|
|
45
|
+
>
|
|
46
|
+
<div class="td-content">序号</div>
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
</table>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- 表头s -->
|
|
53
|
+
<div class="DshCrossTable-left-body">
|
|
54
|
+
<div :style="{
|
|
55
|
+
height: '10000px'
|
|
56
|
+
}">
|
|
57
|
+
<table
|
|
58
|
+
cellspacing="0"
|
|
59
|
+
cellpadding="0"
|
|
60
|
+
>
|
|
61
|
+
<!-- 头部 -->
|
|
62
|
+
<tr
|
|
63
|
+
v-for="colItem in columnList.filter(colItem => colItem.isHead === true)"
|
|
64
|
+
:key="colItem._key"
|
|
65
|
+
>
|
|
66
|
+
<td
|
|
67
|
+
class="DshCrossTable-col DshCrossTable-col-content"
|
|
68
|
+
:style="{
|
|
69
|
+
background: '#f4f4f4',
|
|
70
|
+
textAlign: 'center',
|
|
71
|
+
fontWeight: 500
|
|
72
|
+
}"
|
|
73
|
+
>
|
|
74
|
+
<bri-tooltip
|
|
75
|
+
transfer
|
|
76
|
+
:content="colItem.title"
|
|
77
|
+
>
|
|
78
|
+
<div class="td-content dsh-ellipsis">
|
|
79
|
+
{{ colItem.title }}
|
|
80
|
+
</div>
|
|
81
|
+
</bri-tooltip>
|
|
82
|
+
</td>
|
|
83
|
+
</tr>
|
|
84
|
+
|
|
85
|
+
<!-- 字段项 -->
|
|
86
|
+
<tr
|
|
87
|
+
v-for="colItem in columnList.filter(colItem => !colItem.isHead)"
|
|
88
|
+
:key="colItem._key"
|
|
89
|
+
>
|
|
90
|
+
<td
|
|
91
|
+
class="DshCrossTable-col DshCrossTable-col-content"
|
|
92
|
+
:style="{
|
|
93
|
+
background: '#F7F9FD',
|
|
94
|
+
display: 'flex',
|
|
95
|
+
width: (propsObj.titleWidth ? propsObj.titleWidth : 160)+ 'px'
|
|
96
|
+
}"
|
|
97
|
+
>
|
|
98
|
+
<bri-tooltip
|
|
99
|
+
style="width: calc(100% - 16px)"
|
|
100
|
+
:content="colItem.title"
|
|
101
|
+
transfer
|
|
102
|
+
>
|
|
103
|
+
<div class="td-content dsh-ellipsis">
|
|
104
|
+
<slot
|
|
105
|
+
name="col"
|
|
106
|
+
:col="colItem"
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
v-if="changedFields.includes(colItem._key)"
|
|
110
|
+
class="crossTable-col"
|
|
111
|
+
>
|
|
112
|
+
<span class="crossTable-col-title">{{ colItem.title }}</span>
|
|
113
|
+
<span class="crossTable-col-sign">变更</span>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<template v-else>
|
|
117
|
+
{{ colItem.title }}
|
|
118
|
+
</template>
|
|
119
|
+
</slot>
|
|
120
|
+
</div>
|
|
121
|
+
</bri-tooltip>
|
|
122
|
+
|
|
123
|
+
<Tooltip
|
|
124
|
+
v-if="colItem._description"
|
|
125
|
+
style="width:16px"
|
|
126
|
+
:content="colItem._description"
|
|
127
|
+
placement="top-start"
|
|
128
|
+
max-width="200"
|
|
129
|
+
:transfer="true"
|
|
130
|
+
>
|
|
131
|
+
<Icon
|
|
132
|
+
type="ios-help-circle-outline"
|
|
133
|
+
size="16"
|
|
134
|
+
/>
|
|
135
|
+
</Tooltip>
|
|
136
|
+
</td>
|
|
137
|
+
</tr>
|
|
138
|
+
</table>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<!-- 操作 -->
|
|
143
|
+
<div
|
|
144
|
+
v-if="operationColumn && selfPropsObj.showAction"
|
|
145
|
+
class="DshCrossTable-left-footer"
|
|
146
|
+
>
|
|
147
|
+
<table
|
|
148
|
+
cellspacing="0"
|
|
149
|
+
cellpadding="0"
|
|
150
|
+
>
|
|
151
|
+
<tr class="DshCrossTable-row">
|
|
152
|
+
<td
|
|
153
|
+
class="DshCrossTable-col DshCrossTable-col-operation"
|
|
154
|
+
:style="{
|
|
155
|
+
background: '#f4f4f4'
|
|
156
|
+
}"
|
|
157
|
+
>
|
|
158
|
+
<div class="td-content">{{ operationColumn.title }}</div>
|
|
159
|
+
</td>
|
|
160
|
+
</tr>
|
|
161
|
+
</table>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<!-- 右 -数据 -->
|
|
166
|
+
<div
|
|
167
|
+
ref="DshCrossTable-right"
|
|
168
|
+
id="DshCrossTable-right"
|
|
169
|
+
:style="renderTableBoxStyle"
|
|
170
|
+
class="DshCrossTable-right"
|
|
171
|
+
>
|
|
172
|
+
<!-- 多选框 和 序号 -->
|
|
173
|
+
<div
|
|
174
|
+
v-if="selfPropsObj.showCheck && selfPropsObj.showIndex"
|
|
175
|
+
class="DshCrossTable-right-header"
|
|
176
|
+
>
|
|
177
|
+
<table
|
|
178
|
+
cellspacing="0"
|
|
179
|
+
cellpadding="0"
|
|
180
|
+
:style="{
|
|
181
|
+
width: rowWidth + 10 + 'px',
|
|
182
|
+
}"
|
|
183
|
+
>
|
|
184
|
+
<!-- 多选框 -->
|
|
185
|
+
<tr
|
|
186
|
+
v-if="selfPropsObj.showCheck"
|
|
187
|
+
class="DshCrossTable-row"
|
|
188
|
+
>
|
|
189
|
+
<CheckboxGroup
|
|
190
|
+
v-model="selectIds"
|
|
191
|
+
@on-change="select"
|
|
192
|
+
style="height:40px"
|
|
193
|
+
>
|
|
194
|
+
<td
|
|
195
|
+
v-for="(dataItem, dataIndex) in data"
|
|
196
|
+
:key="dataItem._id"
|
|
197
|
+
class="DshCrossTable-td-checkbox"
|
|
198
|
+
:style="{
|
|
199
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
200
|
+
background: '#f4f4f4',
|
|
201
|
+
textAlign: 'center'
|
|
202
|
+
}"
|
|
203
|
+
>
|
|
204
|
+
<Checkbox
|
|
205
|
+
class="td-content"
|
|
206
|
+
style="display: inline-block; width: 100%;"
|
|
207
|
+
:label="dataItem._id"
|
|
208
|
+
@click.native="clickRowCheckbox(dataItem, dataIndex)"
|
|
209
|
+
>{{ "" }}</Checkbox>
|
|
210
|
+
</td>
|
|
211
|
+
</CheckboxGroup>
|
|
212
|
+
</tr>
|
|
213
|
+
|
|
214
|
+
<!-- 序号 -->
|
|
215
|
+
<tr v-if="selfPropsObj.showIndex">
|
|
216
|
+
<td
|
|
217
|
+
v-for="(dataItem, dataIndex) in data"
|
|
218
|
+
:key="dataItem._id"
|
|
219
|
+
class="DshCrossTable-td-index"
|
|
220
|
+
:style="{
|
|
221
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
222
|
+
background: '#f4f4f4',
|
|
223
|
+
textAlign: 'center'
|
|
224
|
+
}"
|
|
225
|
+
@click="clickRow(dataItem, dataIndex)"
|
|
226
|
+
>
|
|
227
|
+
<div class="td-content">{{ dataIndex + 1 }}</div>
|
|
228
|
+
</td>
|
|
229
|
+
</tr>
|
|
230
|
+
</table>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<!-- 内容 -->
|
|
234
|
+
<div
|
|
235
|
+
v-if="showTable"
|
|
236
|
+
class="DshCrossTable-right-body"
|
|
237
|
+
:style="showScrollX === false ? {
|
|
238
|
+
overflowX: 'hidden'
|
|
239
|
+
} : {}"
|
|
240
|
+
@scroll="tableScroll($event)"
|
|
241
|
+
>
|
|
242
|
+
<!-- 无数据 -->
|
|
243
|
+
<div
|
|
244
|
+
v-if="!data.length"
|
|
245
|
+
class="dsh-subtip"
|
|
246
|
+
>{{ noDataText }}</div>
|
|
247
|
+
|
|
248
|
+
<!-- 存在数据 -->
|
|
249
|
+
<table
|
|
250
|
+
v-else
|
|
251
|
+
cellspacing="0"
|
|
252
|
+
cellpadding="0"
|
|
253
|
+
:style="{
|
|
254
|
+
width: rowWidth + 'px'
|
|
255
|
+
}"
|
|
256
|
+
>
|
|
257
|
+
<!-- 头部 -->
|
|
258
|
+
<tr
|
|
259
|
+
v-for="colItem in columnList.filter(colItem => colItem.isHead === true)"
|
|
260
|
+
:key="colItem._key"
|
|
261
|
+
>
|
|
262
|
+
<td
|
|
263
|
+
v-for="dataItem in data"
|
|
264
|
+
:key="dataItem._id"
|
|
265
|
+
class="DshCrossTable-td-content"
|
|
266
|
+
:style="{
|
|
267
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
268
|
+
background: '#f4f4f4',
|
|
269
|
+
textAlign: 'center',
|
|
270
|
+
fontWeight: 500
|
|
271
|
+
}"
|
|
272
|
+
>
|
|
273
|
+
<div class="td-content">
|
|
274
|
+
{{ dataItem[colItem._key] }}
|
|
275
|
+
</div>
|
|
276
|
+
</td>
|
|
277
|
+
</tr>
|
|
278
|
+
|
|
279
|
+
<!-- 字段项 -->
|
|
280
|
+
<tr
|
|
281
|
+
v-for="(colItem, colIndex) in columnList.filter(colItem => !colItem.isHead)"
|
|
282
|
+
:key="colItem._key"
|
|
283
|
+
>
|
|
284
|
+
<td
|
|
285
|
+
v-for="(dataItem, dataIndex) in data"
|
|
286
|
+
:key="dataItem._id"
|
|
287
|
+
class="DshCrossTable-td-content"
|
|
288
|
+
:style="{
|
|
289
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
290
|
+
background: changedFields.includes(colItem._key) && data.length === 2 && dataIndex === 1
|
|
291
|
+
? '#FFECED'
|
|
292
|
+
: dataIndex % 2 === 0 ? '' : '#F7F9FD',
|
|
293
|
+
color: changedFields.includes(colItem._key) && data.length === 2 && dataIndex === 1 ? 'red' : undefined
|
|
294
|
+
}"
|
|
295
|
+
@click="clickRow(dataItem, dataIndex)"
|
|
296
|
+
>
|
|
297
|
+
<div
|
|
298
|
+
v-if="colItem.renderBodyCell"
|
|
299
|
+
class="td-content"
|
|
300
|
+
>
|
|
301
|
+
<dsh-list-render
|
|
302
|
+
:row="dataItem"
|
|
303
|
+
:index="dataIndex"
|
|
304
|
+
:render="colItem.renderBodyCell"
|
|
305
|
+
></dsh-list-render>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<div
|
|
309
|
+
v-else-if="colItem.formatter"
|
|
310
|
+
class="td-content"
|
|
311
|
+
v-html="colItem.formatter(dataItem, colIndex, 0, colItem._key)"
|
|
312
|
+
></div>
|
|
313
|
+
|
|
314
|
+
<div
|
|
315
|
+
v-else
|
|
316
|
+
class="td-content"
|
|
317
|
+
>{{ dataItem[colItem._key] }}</div>
|
|
318
|
+
</td>
|
|
319
|
+
</tr>
|
|
320
|
+
</table>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<!-- 操作 -->
|
|
324
|
+
<div
|
|
325
|
+
v-if="operationColumn && selfPropsObj.showAction"
|
|
326
|
+
class="DshCrossTable-right-footer"
|
|
327
|
+
>
|
|
328
|
+
<table
|
|
329
|
+
cellspacing="0"
|
|
330
|
+
cellpadding="0"
|
|
331
|
+
:style="{
|
|
332
|
+
width: rowWidth + 10 + 'px'
|
|
333
|
+
}"
|
|
334
|
+
>
|
|
335
|
+
<tr class="DshCrossTable-row">
|
|
336
|
+
<td
|
|
337
|
+
v-for="(dataItem, dataIndex) in data"
|
|
338
|
+
:key="dataItem._id"
|
|
339
|
+
class="DshCrossTable-td-operation"
|
|
340
|
+
:style="{
|
|
341
|
+
width: colWidth ? colWidth + 'px' : '200px',
|
|
342
|
+
background: '#f4f4f4',
|
|
343
|
+
}"
|
|
344
|
+
>
|
|
345
|
+
<div class="td-content">
|
|
346
|
+
<dsh-list-render
|
|
347
|
+
:row="dataItem"
|
|
348
|
+
:index="dataIndex"
|
|
349
|
+
:render="operationColumn.renderBodyCell"
|
|
350
|
+
></dsh-list-render>
|
|
351
|
+
</div>
|
|
352
|
+
</td>
|
|
353
|
+
</tr>
|
|
354
|
+
</table>
|
|
355
|
+
</div>
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
</template>
|
|
359
|
+
|
|
360
|
+
<script>
|
|
361
|
+
import elementResizeDetectorMaker from "element-resize-detector";
|
|
362
|
+
|
|
363
|
+
export default {
|
|
364
|
+
name: "DshCrossTable",
|
|
365
|
+
props: {
|
|
366
|
+
data: {
|
|
367
|
+
type: Array,
|
|
368
|
+
default () {
|
|
369
|
+
return [];
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
columns: {
|
|
373
|
+
type: Array,
|
|
374
|
+
default () {
|
|
375
|
+
return [];
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
propsObj: {
|
|
379
|
+
type: Object,
|
|
380
|
+
default () {
|
|
381
|
+
return {};
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
operationList: {
|
|
385
|
+
type: Array,
|
|
386
|
+
default () {
|
|
387
|
+
return [];
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
noDataText: {
|
|
392
|
+
type: String,
|
|
393
|
+
default: "暂无数据…"
|
|
394
|
+
},
|
|
395
|
+
changedFields: {
|
|
396
|
+
type: Array,
|
|
397
|
+
default () {
|
|
398
|
+
return [];
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
data () {
|
|
403
|
+
return {
|
|
404
|
+
selections: [],
|
|
405
|
+
// curRow: null // 可以不声明
|
|
406
|
+
|
|
407
|
+
allChecked: false,
|
|
408
|
+
selectionList: [],
|
|
409
|
+
rowWidth: 0,
|
|
410
|
+
colWidth: 0,
|
|
411
|
+
titleWidth: 200,
|
|
412
|
+
showScrollX: false,
|
|
413
|
+
showTable: false,
|
|
414
|
+
currentPage: 1,
|
|
415
|
+
pagesize: 10,
|
|
416
|
+
pagesizeOpts: [50, 30, 20, 15, 10], // pagesize选择下拉
|
|
417
|
+
showTotal: true,
|
|
418
|
+
total: 0,
|
|
419
|
+
pageHeightScreen: [5, 10, 15] // 根据大中小屏,设置内部height,pagesize最多出现几个然后滚动
|
|
420
|
+
};
|
|
421
|
+
},
|
|
422
|
+
computed: {
|
|
423
|
+
selfPropsObj () {
|
|
424
|
+
return {
|
|
425
|
+
showCheck: true,
|
|
426
|
+
showIndex: true,
|
|
427
|
+
showAction: true,
|
|
428
|
+
...this.propsObj
|
|
429
|
+
};
|
|
430
|
+
},
|
|
431
|
+
columnList () {
|
|
432
|
+
return this.columns;
|
|
433
|
+
},
|
|
434
|
+
operationColumn () {
|
|
435
|
+
return {
|
|
436
|
+
title: "操作",
|
|
437
|
+
_key: "__operation__",
|
|
438
|
+
key: "__operation__",
|
|
439
|
+
field: "__operation__",
|
|
440
|
+
width: 150,
|
|
441
|
+
renderBodyCell: (params, h) => {
|
|
442
|
+
return this.operationList.length < 3
|
|
443
|
+
? h("dsh-buttons", {
|
|
444
|
+
props: {
|
|
445
|
+
list: this.operationList
|
|
446
|
+
},
|
|
447
|
+
on: {
|
|
448
|
+
click: (operationItem) => {
|
|
449
|
+
this.$dshEmit(operationItem, params.row, params.row);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
})
|
|
453
|
+
: h("div", {
|
|
454
|
+
style: {
|
|
455
|
+
display: "flex",
|
|
456
|
+
justifyContent: "center"
|
|
457
|
+
}
|
|
458
|
+
}, [
|
|
459
|
+
h("dsh-buttons", {
|
|
460
|
+
style: {
|
|
461
|
+
display: "inline-block"
|
|
462
|
+
},
|
|
463
|
+
props: {
|
|
464
|
+
list: this.operationList.slice(0, 2)
|
|
465
|
+
},
|
|
466
|
+
on: {
|
|
467
|
+
click: (operationItem) => {
|
|
468
|
+
this.$dshEmit(operationItem, params.row, params.row);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}),
|
|
472
|
+
h("dsh-dropdown", {
|
|
473
|
+
props: {
|
|
474
|
+
dropdownObj: {
|
|
475
|
+
icon: "ios-more",
|
|
476
|
+
size: 22,
|
|
477
|
+
color: "#E9ECF4",
|
|
478
|
+
showDropdownItemIcon: false
|
|
479
|
+
},
|
|
480
|
+
list: this.operationList.slice(2)
|
|
481
|
+
},
|
|
482
|
+
on: {
|
|
483
|
+
click: (operationItem) => {
|
|
484
|
+
this.$dshEmit(operationItem, params.row, params.row);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}, [
|
|
488
|
+
h("dsh-buttons", {
|
|
489
|
+
props: {
|
|
490
|
+
list: [
|
|
491
|
+
{
|
|
492
|
+
name: "更多>>",
|
|
493
|
+
type: "more",
|
|
494
|
+
btnType: "text",
|
|
495
|
+
size: "small"
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
}
|
|
499
|
+
})
|
|
500
|
+
])
|
|
501
|
+
]);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
},
|
|
505
|
+
renderTableBoxStyle () {
|
|
506
|
+
let styleStr = "";
|
|
507
|
+
if (this.tableExpend) {
|
|
508
|
+
styleStr += "padding-bottom:38px;";
|
|
509
|
+
} else {
|
|
510
|
+
styleStr += "padding-bottom:0px;";
|
|
511
|
+
}
|
|
512
|
+
if (this.tableSelection && this.tableIndex) {
|
|
513
|
+
styleStr += "padding-top:77px";
|
|
514
|
+
} else if (this.tableSelection || this.tableIndex) {
|
|
515
|
+
styleStr += "padding-top:39px";
|
|
516
|
+
} else {
|
|
517
|
+
styleStr += "padding-top:0px";
|
|
518
|
+
}
|
|
519
|
+
return styleStr;
|
|
520
|
+
},
|
|
521
|
+
selectIds: {
|
|
522
|
+
get () {
|
|
523
|
+
return this.selections.map(item => item._id);
|
|
524
|
+
},
|
|
525
|
+
set (val) {
|
|
526
|
+
this.selections = this.data.filter(item => val.includes(item._id));
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
isSelectAll: {
|
|
530
|
+
get () {
|
|
531
|
+
return this.data.length > 0 && this.selectIds.length === this.data.length;
|
|
532
|
+
},
|
|
533
|
+
set (bool) {
|
|
534
|
+
this.selections = bool ? this.data : [];
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
},
|
|
539
|
+
created () {},
|
|
540
|
+
mounted () {
|
|
541
|
+
this.init();
|
|
542
|
+
},
|
|
543
|
+
methods: {
|
|
544
|
+
// 初始化
|
|
545
|
+
init () {
|
|
546
|
+
this.initTableData();
|
|
547
|
+
},
|
|
548
|
+
initTableData () {
|
|
549
|
+
// dom加载完成之后设置主要内容区域的宽,并且绑定监测滚动事件
|
|
550
|
+
this.$nextTick(() => {
|
|
551
|
+
this.initTableWidth();
|
|
552
|
+
});
|
|
553
|
+
},
|
|
554
|
+
initTableWidth () {
|
|
555
|
+
// 创建实例,无参数
|
|
556
|
+
let erd = elementResizeDetectorMaker();
|
|
557
|
+
// 创建实例带参数
|
|
558
|
+
/* let erdUltraFast = elementResizeDetectorMaker({
|
|
559
|
+
strategy: "scroll",
|
|
560
|
+
callOnAdd: true,
|
|
561
|
+
debug: true
|
|
562
|
+
}); */
|
|
563
|
+
// 监听id为CrossTable-right的元素 大小变化
|
|
564
|
+
let that = this;
|
|
565
|
+
erd.listenTo(document.getElementById("DshCrossTable-right"), function (element) {
|
|
566
|
+
// 计算宽度
|
|
567
|
+
let tableWidth = that.$refs["DshCrossTable-right"].clientWidth - 10;
|
|
568
|
+
let nums = tableWidth / 200;
|
|
569
|
+
let dataTotal = that.data.length;
|
|
570
|
+
if (nums >= dataTotal) {
|
|
571
|
+
that.rowWidth = tableWidth;
|
|
572
|
+
that.colWidth = tableWidth / dataTotal;
|
|
573
|
+
that.showScrollX = false;
|
|
574
|
+
} else {
|
|
575
|
+
that.rowWidth = dataTotal * 200;
|
|
576
|
+
that.showScrollX = true;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// that.rowWidth = 200 * that.data.length;
|
|
580
|
+
/* if (that.selfPropsObj.colWidth === "half") { //
|
|
581
|
+
that.colWidth = (tableWidth - 10) / dataTotal;
|
|
582
|
+
} */
|
|
583
|
+
|
|
584
|
+
that.showTable = true;
|
|
585
|
+
});
|
|
586
|
+
},
|
|
587
|
+
// 竖向滚动监测,赋值给左侧表头滚动,保持同步
|
|
588
|
+
tableScroll (event) {
|
|
589
|
+
const leftEle = document.getElementsByClassName("DshCrossTable-left")[0]; // 左侧内容表头
|
|
590
|
+
const leftBodyEle = document.getElementsByClassName("DshCrossTable-left-body")[0]; // 左侧
|
|
591
|
+
const rightHeaderEle = document.getElementsByClassName("DshCrossTable-right-header")[0] || {}; // 右头
|
|
592
|
+
const rightFooterEle = document.getElementsByClassName("DshCrossTable-right-footer")[0] || {}; // 右低
|
|
593
|
+
|
|
594
|
+
// 上下滚动
|
|
595
|
+
leftBodyEle.scrollTop = event.srcElement.scrollTop;
|
|
596
|
+
if (this.selfPropsObj.showCheck && this.selfPropsObj.showIndex) {
|
|
597
|
+
if (event.srcElement.scrollTop !== 0) {
|
|
598
|
+
rightHeaderEle.style.boxShadow = "0px 0px 5px 0px #dddddd";
|
|
599
|
+
rightFooterEle.style.boxShadow = "0px 0px 5px 0px #dddddd";
|
|
600
|
+
} else {
|
|
601
|
+
rightHeaderEle.style.boxShadow = rightFooterEle.style.boxShadow = "none";
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// 左右滚动
|
|
606
|
+
rightHeaderEle.scrollLeft = rightFooterEle.scrollLeft = event.srcElement.scrollLeft;
|
|
607
|
+
if (event.srcElement.scrollLeft !== 0) {
|
|
608
|
+
leftEle.style.boxShadow = "0px 0px 3px 0px #dddddd";
|
|
609
|
+
} else {
|
|
610
|
+
leftEle.style.boxShadow = "none";
|
|
611
|
+
}
|
|
612
|
+
},
|
|
613
|
+
|
|
614
|
+
// 点击某行
|
|
615
|
+
clickRow (row) {
|
|
616
|
+
this.$emit("clickRow", row);
|
|
617
|
+
},
|
|
618
|
+
// 点击某行的选择框
|
|
619
|
+
clickRowCheckbox (row) {
|
|
620
|
+
this.curRow = row;
|
|
621
|
+
this.curRow.bool = !this.selectIds.includes(row._id);
|
|
622
|
+
},
|
|
623
|
+
// 切换全选
|
|
624
|
+
selectAll (bool) {
|
|
625
|
+
this.$emit("selectAll", this.selectIds, this.selections, bool);
|
|
626
|
+
this.changeSelect();
|
|
627
|
+
},
|
|
628
|
+
// 切换选择
|
|
629
|
+
select (selectIds) {
|
|
630
|
+
this.$emit("select", this.selectIds, this.selections, this.curRow, this.curRow.bool);
|
|
631
|
+
this.changeSelect();
|
|
632
|
+
},
|
|
633
|
+
// 改变选择项
|
|
634
|
+
changeSelect () {
|
|
635
|
+
this.$emit("changeSelect", this.selectIds, this.selections);
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
watch: {
|
|
639
|
+
data (newVal, oldVal) {
|
|
640
|
+
this.init();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
</script>
|
|
645
|
+
|
|
646
|
+
<style lang="less">
|
|
647
|
+
.DshCrossTable {
|
|
648
|
+
width: 100%;
|
|
649
|
+
height: 100%;
|
|
650
|
+
display: flex;
|
|
651
|
+
flex-direction: row;
|
|
652
|
+
|
|
653
|
+
&-left,
|
|
654
|
+
&-right {
|
|
655
|
+
border-top: 1px solid #eeeeee;
|
|
656
|
+
border-bottom: 1px solid #eeeeee;
|
|
657
|
+
overflow: hidden;
|
|
658
|
+
display: flex;
|
|
659
|
+
flex-direction: column;
|
|
660
|
+
|
|
661
|
+
&-header {
|
|
662
|
+
width: 100%;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
&-body {
|
|
666
|
+
width: 100%;
|
|
667
|
+
flex: 1;
|
|
668
|
+
min-height: 0px;
|
|
669
|
+
overflow: scroll;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
&-footer {
|
|
673
|
+
width: 100%;
|
|
674
|
+
height: 38px;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
&-left {
|
|
679
|
+
width: 160px;
|
|
680
|
+
height: 100%;
|
|
681
|
+
border-left: 1px solid #eeeeee;
|
|
682
|
+
border-right: 1px solid #eeeeee;
|
|
683
|
+
// background: #F7F9FD;
|
|
684
|
+
z-index: 2;
|
|
685
|
+
|
|
686
|
+
&-header {
|
|
687
|
+
overflow: hidden;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
&-body {
|
|
691
|
+
overflow: hidden;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
&-footer {
|
|
695
|
+
overflow: hidden;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
&-right {
|
|
700
|
+
flex: 1;
|
|
701
|
+
min-width: 0px;
|
|
702
|
+
height: 100%;
|
|
703
|
+
border-right: 1px solid #eeeeee;
|
|
704
|
+
|
|
705
|
+
&-header {
|
|
706
|
+
overflow: hidden;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
&-body {
|
|
710
|
+
overflow: scroll;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
&-footer {
|
|
714
|
+
overflow: hidden;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
&-row {
|
|
719
|
+
// height: 40px;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
&-col {
|
|
723
|
+
font-weight: bold;
|
|
724
|
+
color: #5D5D5D;
|
|
725
|
+
|
|
726
|
+
&-checkbox,
|
|
727
|
+
&-index,
|
|
728
|
+
&-operation {}
|
|
729
|
+
|
|
730
|
+
&-Checkbox {}
|
|
731
|
+
|
|
732
|
+
&-index {}
|
|
733
|
+
|
|
734
|
+
&-content {
|
|
735
|
+
.crossTable-col {
|
|
736
|
+
width: 100%;
|
|
737
|
+
.dsh-flex-row-center-center();
|
|
738
|
+
|
|
739
|
+
&-title {
|
|
740
|
+
flex: 1;
|
|
741
|
+
min-width: 0px;
|
|
742
|
+
height: 100%;
|
|
743
|
+
.dsh-ellipsis();
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
&-sign {
|
|
747
|
+
#dsh-sign-change();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
&-operation {}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
&-td {
|
|
756
|
+
|
|
757
|
+
&-checkbox,
|
|
758
|
+
&-index,
|
|
759
|
+
&-operation {}
|
|
760
|
+
|
|
761
|
+
&-Checkbox {}
|
|
762
|
+
|
|
763
|
+
&-index {}
|
|
764
|
+
|
|
765
|
+
&-content {}
|
|
766
|
+
|
|
767
|
+
&-operation {}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
table {
|
|
771
|
+
width: 100%;
|
|
772
|
+
|
|
773
|
+
tr {
|
|
774
|
+
height: 39px;
|
|
775
|
+
font-size: 12px;
|
|
776
|
+
overflow: hidden;
|
|
777
|
+
|
|
778
|
+
td {
|
|
779
|
+
display: inline-block;
|
|
780
|
+
width: 200px;
|
|
781
|
+
height: 40px;
|
|
782
|
+
line-height: 40px;
|
|
783
|
+
padding: 0 10px;
|
|
784
|
+
border-right: 1px solid #EDEDED;
|
|
785
|
+
border-bottom: 1px solid #EDEDED;
|
|
786
|
+
cursor: pointer;
|
|
787
|
+
overflow: hidden;
|
|
788
|
+
|
|
789
|
+
.td-content {
|
|
790
|
+
width: 100%;
|
|
791
|
+
height: 100%;
|
|
792
|
+
padding: 8px 0px;
|
|
793
|
+
line-height: 22px;
|
|
794
|
+
vertical-align: middle;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.cross-table-box {
|
|
801
|
+
height: 38px;
|
|
802
|
+
padding: 7px 0;
|
|
803
|
+
|
|
804
|
+
&-content {
|
|
805
|
+
width: auto;
|
|
806
|
+
border-radius: 2px;
|
|
807
|
+
border: 1px solid #6daef2;
|
|
808
|
+
font-size: 12px !important;
|
|
809
|
+
color: #6DAEF2;
|
|
810
|
+
cursor: pointer;
|
|
811
|
+
height: 24px;
|
|
812
|
+
display: inline-block;
|
|
813
|
+
line-height: 24px;
|
|
814
|
+
padding: 0 5px;
|
|
815
|
+
overflow: hidden;
|
|
816
|
+
word-break: keep-all;
|
|
817
|
+
white-space: nowrap;
|
|
818
|
+
text-overflow: ellipsis;
|
|
819
|
+
|
|
820
|
+
i {
|
|
821
|
+
margin-right: 5px;
|
|
822
|
+
font-size: 12px !important;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
</style>
|