bri-components 1.5.22 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -83
- package/lib/styles/bundle.css +12 -12
- package/lib/styles/font/fontello.svg +31 -31
- package/package.json +127 -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 +435 -434
- package/src/components/controls/base/BriUpload/BriUploadImage.vue +430 -377
- package/src/components/controls/base/BriUpload/uploadList.vue +738 -727
- package/src/components/controls/base/BriUpload/uploadMixin.js +453 -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 +587 -585
- 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/DshSelect/DshSelectAll.vue +269 -269
- package/src/components/controls/base/DshSwitch/DshSwitch.vue +115 -115
- package/src/components/controls/control.less +324 -324
- package/src/components/controls/controlMap.js +117 -117
- 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 -325
- 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/correlation.vue +135 -135
- package/src/components/controls/senior/flatTable.vue +138 -138
- package/src/components/controls/senior/selectDepartments.vue +397 -399
- package/src/components/controls/senior/selectUsers/departMenu.vue +296 -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 +334 -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/other/DshVideoPlayer.vue +184 -0
- 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 -4
- package/src/index.js +287 -285
- 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 +3 -5
- package/lib/0.bri-components.min.js +0 -1
- package/lib/1.bri-components.min.js +0 -1
- package/lib/10.bri-components.min.js +0 -1
- package/lib/11.bri-components.min.js +0 -1
- package/lib/2.bri-components.min.js +0 -1
- package/lib/3.bri-components.min.js +0 -1
- package/lib/4.bri-components.min.js +0 -1
- package/lib/5.bri-components.min.js +0 -1
- package/lib/6.bri-components.min.js +0 -1
- package/lib/7.bri-components.min.js +0 -1
- package/lib/8.bri-components.min.js +0 -1
- package/lib/9.bri-components.min.js +0 -1
- package/lib/bri-components.min.js +0 -18
- package/src/utils/table.js +0 -175
|
@@ -1,404 +1,404 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="DshList">
|
|
3
|
-
<!-- 表头 -->
|
|
4
|
-
<div class="list-cols">
|
|
5
|
-
<!-- 左 -->
|
|
6
|
-
<div
|
|
7
|
-
v-if="multiple"
|
|
8
|
-
class="list-cols-left"
|
|
9
|
-
>
|
|
10
|
-
<Checkbox
|
|
11
|
-
v-model="isSelectAll"
|
|
12
|
-
@on-change="selectAll"
|
|
13
|
-
></Checkbox>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<!-- 右 -->
|
|
17
|
-
<div
|
|
18
|
-
class="list-cols-right row"
|
|
19
|
-
:style="{
|
|
20
|
-
paddingLeft: multiple ? '48px' : '0px',
|
|
21
|
-
}"
|
|
22
|
-
>
|
|
23
|
-
<div
|
|
24
|
-
v-if="sequence"
|
|
25
|
-
class="row-item"
|
|
26
|
-
style="minWidth: 60px; textAlign: center;"
|
|
27
|
-
>
|
|
28
|
-
序号
|
|
29
|
-
</div>
|
|
30
|
-
<div
|
|
31
|
-
v-for="col in selfColumns"
|
|
32
|
-
:key="col._key"
|
|
33
|
-
class="row-item"
|
|
34
|
-
:style="{
|
|
35
|
-
flexBasis: (col.width || col.minWidth) + `px`,
|
|
36
|
-
textAlign: col._align,
|
|
37
|
-
flexGrow: 1,
|
|
38
|
-
display: 'flex',
|
|
39
|
-
justifyContent: getFlexLayout(col._align)
|
|
40
|
-
}"
|
|
41
|
-
>
|
|
42
|
-
<bri-tooltip
|
|
43
|
-
transfer
|
|
44
|
-
:content="col._name"
|
|
45
|
-
>
|
|
46
|
-
<span class="dsh-ellipsis">
|
|
47
|
-
{{ col._name }}
|
|
48
|
-
</span>
|
|
49
|
-
</bri-tooltip>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<!-- 行 -->
|
|
55
|
-
<div class="list-rows">
|
|
56
|
-
<!-- 加载 -->
|
|
57
|
-
<bri-loading
|
|
58
|
-
v-if="isLoading"
|
|
59
|
-
class="list-loading"
|
|
60
|
-
>
|
|
61
|
-
{{ loadingText }}
|
|
62
|
-
</bri-loading>
|
|
63
|
-
<template v-else>
|
|
64
|
-
<!-- 有数据 -->
|
|
65
|
-
<template v-if="data.length">
|
|
66
|
-
<div
|
|
67
|
-
v-if="multiple"
|
|
68
|
-
class="list-rows-left"
|
|
69
|
-
>
|
|
70
|
-
<CheckboxGroup
|
|
71
|
-
v-model="selectIds"
|
|
72
|
-
@on-change="selectRow"
|
|
73
|
-
>
|
|
74
|
-
<Checkbox
|
|
75
|
-
v-for="row in data"
|
|
76
|
-
:key="row._id"
|
|
77
|
-
:label="row._id"
|
|
78
|
-
@click.native.stop="clickRowCheckbox(row)"
|
|
79
|
-
>
|
|
80
|
-
{{ "" }}
|
|
81
|
-
</Checkbox>
|
|
82
|
-
</CheckboxGroup>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<div class="list-rows-right">
|
|
86
|
-
<div
|
|
87
|
-
v-for="(row, index) in data"
|
|
88
|
-
:key="row._id"
|
|
89
|
-
class="row"
|
|
90
|
-
:style="{
|
|
91
|
-
paddingLeft: multiple ? '48px' : '0px'
|
|
92
|
-
}"
|
|
93
|
-
@click="clickRow(row)"
|
|
94
|
-
>
|
|
95
|
-
<div
|
|
96
|
-
v-if="sequence"
|
|
97
|
-
class="row-item"
|
|
98
|
-
style="minWidth: 60px; textAlign: center;"
|
|
99
|
-
>
|
|
100
|
-
<div class="row-item-inner">
|
|
101
|
-
{{ index + 1 }}
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<!-- 单元格 -->
|
|
106
|
-
<div
|
|
107
|
-
v-for="(col) in selfColumns"
|
|
108
|
-
:key="col._key"
|
|
109
|
-
class="row-item"
|
|
110
|
-
:style="{
|
|
111
|
-
flexBasis: (col.width || col.minWidth) + `px`,
|
|
112
|
-
textAlign: col._align,
|
|
113
|
-
flexGrow: 1,
|
|
114
|
-
display: 'flex',
|
|
115
|
-
justifyContent: getFlexLayout(col._align)
|
|
116
|
-
}"
|
|
117
|
-
>
|
|
118
|
-
<div class="row-item-inner dsh-ellipsis">
|
|
119
|
-
<dsh-list-render
|
|
120
|
-
v-if="col.renderBodyCell"
|
|
121
|
-
class="ms-ellipsis"
|
|
122
|
-
:row="row"
|
|
123
|
-
:column="col"
|
|
124
|
-
:index="index"
|
|
125
|
-
:render="col.renderBodyCell"
|
|
126
|
-
></dsh-list-render>
|
|
127
|
-
|
|
128
|
-
<template v-else-if="col.formatter">
|
|
129
|
-
<div v-html="col.formatter(row, index)"></div>
|
|
130
|
-
</template>
|
|
131
|
-
|
|
132
|
-
<Tooltip
|
|
133
|
-
v-else-if="row[col._key]"
|
|
134
|
-
:transfer="true"
|
|
135
|
-
max-width="200"
|
|
136
|
-
:placement="index === 0 ? 'bottom-start' : 'top-start'"
|
|
137
|
-
:content="row[col._key]"
|
|
138
|
-
class="list-tooltip"
|
|
139
|
-
>
|
|
140
|
-
<div class="list-tooltip-box">{{ row[col._key] }}</div>
|
|
141
|
-
</Tooltip>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
</template>
|
|
147
|
-
|
|
148
|
-
<!-- 无数据 -->
|
|
149
|
-
<div
|
|
150
|
-
v-else
|
|
151
|
-
class="DshList-nodata"
|
|
152
|
-
>
|
|
153
|
-
{{ noDataText }}
|
|
154
|
-
</div>
|
|
155
|
-
</template>
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
</template>
|
|
159
|
-
|
|
160
|
-
<script>
|
|
161
|
-
export default {
|
|
162
|
-
name: "DshList",
|
|
163
|
-
components: {},
|
|
164
|
-
props: {
|
|
165
|
-
isLoading: {
|
|
166
|
-
type: Boolean,
|
|
167
|
-
default: false
|
|
168
|
-
},
|
|
169
|
-
data: {
|
|
170
|
-
type: Array,
|
|
171
|
-
default () {
|
|
172
|
-
return [];
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
columns: {
|
|
176
|
-
type: Array,
|
|
177
|
-
default () {
|
|
178
|
-
return [];
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
propsObj: {
|
|
183
|
-
type: Object,
|
|
184
|
-
default () {
|
|
185
|
-
return {
|
|
186
|
-
multiple: true,
|
|
187
|
-
sequence: false
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
noDataText: {
|
|
192
|
-
type: String,
|
|
193
|
-
default: "暂无数据…"
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
data () {
|
|
197
|
-
return {
|
|
198
|
-
selections: []
|
|
199
|
-
// curRow: null // 可以不声明
|
|
200
|
-
};
|
|
201
|
-
},
|
|
202
|
-
computed: {
|
|
203
|
-
selfColumns () {
|
|
204
|
-
return this.columns;
|
|
205
|
-
},
|
|
206
|
-
selectIds: {
|
|
207
|
-
get () {
|
|
208
|
-
return this.selections.map(item => item._id);
|
|
209
|
-
},
|
|
210
|
-
set (val) {
|
|
211
|
-
this.selections = this.data.filter(item => val.includes(item._id));
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
isSelectAll: {
|
|
215
|
-
get () {
|
|
216
|
-
return this.data.length > 0 && this.selectIds.length === this.data.length;
|
|
217
|
-
},
|
|
218
|
-
set (bool) {
|
|
219
|
-
this.selections = bool ? this.data : [];
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
multiple () {
|
|
224
|
-
return this.propsObj.multiple !== false;
|
|
225
|
-
},
|
|
226
|
-
sequence () {
|
|
227
|
-
return this.propsObj.sequence && this.propsObj.sequence !== false;
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
created () {},
|
|
231
|
-
methods: {
|
|
232
|
-
/* --- 仅供外部调用 ----- */
|
|
233
|
-
pushSelectIds (ids = []) {
|
|
234
|
-
this.selectIds = [...this.selectIds, ...ids];
|
|
235
|
-
this.changeSelect();
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
// 点击某行
|
|
239
|
-
clickRow (row) {
|
|
240
|
-
this.$emit("clickRow", row);
|
|
241
|
-
},
|
|
242
|
-
// 点击某行的选择框
|
|
243
|
-
clickRowCheckbox (row) {
|
|
244
|
-
this.curRow = row;
|
|
245
|
-
this.curRow.bool = !this.selectIds.includes(row._id);
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
// 切换全选
|
|
249
|
-
selectAll (bool) {
|
|
250
|
-
this.$emit("selectAll", this.selectIds, this.selections, bool);
|
|
251
|
-
this.changeSelect();
|
|
252
|
-
},
|
|
253
|
-
// 切换选择
|
|
254
|
-
selectRow (ids) {
|
|
255
|
-
this.$emit("selectRow", this.selectIds, this.selections, this.curRow.bool, this.curRow);
|
|
256
|
-
this.changeSelect();
|
|
257
|
-
},
|
|
258
|
-
// 改变选择项
|
|
259
|
-
changeSelect () {
|
|
260
|
-
this.$emit("changeSelect", this.selectIds, this.selections);
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
getFlexLayout (align) {
|
|
264
|
-
let map = {
|
|
265
|
-
left: "flex-start",
|
|
266
|
-
center: "center",
|
|
267
|
-
right: "flex-end"
|
|
268
|
-
};
|
|
269
|
-
if (align) {
|
|
270
|
-
return map[align];
|
|
271
|
-
} else {
|
|
272
|
-
return "flex-start";
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
watch: {
|
|
277
|
-
data () {
|
|
278
|
-
this.selections = [];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
</script>
|
|
283
|
-
|
|
284
|
-
<style lang="less">
|
|
285
|
-
.DshList {
|
|
286
|
-
@height:44px;
|
|
287
|
-
|
|
288
|
-
.list {
|
|
289
|
-
&-loading {
|
|
290
|
-
margin-top: 120px;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
&-cols,
|
|
294
|
-
&-rows {
|
|
295
|
-
position: relative;
|
|
296
|
-
|
|
297
|
-
&-left {
|
|
298
|
-
width: 48px;
|
|
299
|
-
text-align: center;
|
|
300
|
-
position: absolute;
|
|
301
|
-
left: 0;
|
|
302
|
-
top: 0;
|
|
303
|
-
|
|
304
|
-
label {
|
|
305
|
-
display: inline-block;
|
|
306
|
-
height: 36px;
|
|
307
|
-
padding: 9px 5px;
|
|
308
|
-
margin: 0px;
|
|
309
|
-
line-height: 18px;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.row {
|
|
314
|
-
width: 100%;
|
|
315
|
-
line-height: 20px;
|
|
316
|
-
display: flex;
|
|
317
|
-
justify-content: space-between;
|
|
318
|
-
|
|
319
|
-
&-item {
|
|
320
|
-
min-width: 120px;
|
|
321
|
-
height: 100%;
|
|
322
|
-
padding: 0 16px;
|
|
323
|
-
font-size: 14px;
|
|
324
|
-
align-items: center;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
&-cols {
|
|
330
|
-
height: @height;
|
|
331
|
-
background: #f0f0f0;
|
|
332
|
-
|
|
333
|
-
&-left {}
|
|
334
|
-
&-right {
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.row {
|
|
339
|
-
font-weight: 700;
|
|
340
|
-
|
|
341
|
-
&-item {
|
|
342
|
-
padding: 10px 16px;
|
|
343
|
-
border-top: 1px #e5e5e5 solid;
|
|
344
|
-
border-bottom: 1px #f0f0f0 solid;
|
|
345
|
-
border-left: 1px #e5e5e5 solid;
|
|
346
|
-
background: #f0f0f0;
|
|
347
|
-
|
|
348
|
-
&:last-child{
|
|
349
|
-
border-right: 1px #e5e5e5 solid;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
&-inner {
|
|
353
|
-
.dsh-ellipsis{
|
|
354
|
-
font-size: 14px;
|
|
355
|
-
color: #666;
|
|
356
|
-
font-weight: 700;
|
|
357
|
-
line-height: 24px;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
&-rows {
|
|
365
|
-
&-left {
|
|
366
|
-
label {
|
|
367
|
-
height: 44px;
|
|
368
|
-
line-height: 20px;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
&-right {}
|
|
373
|
-
|
|
374
|
-
.row {
|
|
375
|
-
height: 44px;
|
|
376
|
-
line-height: 20px;
|
|
377
|
-
cursor: pointer;
|
|
378
|
-
|
|
379
|
-
&-item {
|
|
380
|
-
display: flex;
|
|
381
|
-
border: 1px solid #E5E5E5;
|
|
382
|
-
border-width: 0 0 1px 1px;
|
|
383
|
-
|
|
384
|
-
&:last-child {
|
|
385
|
-
border-width: 0 1px 1px 1px;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
&-inner {
|
|
389
|
-
width: 100%;
|
|
390
|
-
font-size: 14px;
|
|
391
|
-
color: #333;
|
|
392
|
-
font-weight: 400;
|
|
393
|
-
line-height: 24px;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
&-nodata {
|
|
400
|
-
#dsh-nodata();
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="DshList">
|
|
3
|
+
<!-- 表头 -->
|
|
4
|
+
<div class="list-cols">
|
|
5
|
+
<!-- 左 -->
|
|
6
|
+
<div
|
|
7
|
+
v-if="multiple"
|
|
8
|
+
class="list-cols-left"
|
|
9
|
+
>
|
|
10
|
+
<Checkbox
|
|
11
|
+
v-model="isSelectAll"
|
|
12
|
+
@on-change="selectAll"
|
|
13
|
+
></Checkbox>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<!-- 右 -->
|
|
17
|
+
<div
|
|
18
|
+
class="list-cols-right row"
|
|
19
|
+
:style="{
|
|
20
|
+
paddingLeft: multiple ? '48px' : '0px',
|
|
21
|
+
}"
|
|
22
|
+
>
|
|
23
|
+
<div
|
|
24
|
+
v-if="sequence"
|
|
25
|
+
class="row-item"
|
|
26
|
+
style="minWidth: 60px; textAlign: center;"
|
|
27
|
+
>
|
|
28
|
+
序号
|
|
29
|
+
</div>
|
|
30
|
+
<div
|
|
31
|
+
v-for="col in selfColumns"
|
|
32
|
+
:key="col._key"
|
|
33
|
+
class="row-item"
|
|
34
|
+
:style="{
|
|
35
|
+
flexBasis: (col.width || col.minWidth) + `px`,
|
|
36
|
+
textAlign: col._align,
|
|
37
|
+
flexGrow: 1,
|
|
38
|
+
display: 'flex',
|
|
39
|
+
justifyContent: getFlexLayout(col._align)
|
|
40
|
+
}"
|
|
41
|
+
>
|
|
42
|
+
<bri-tooltip
|
|
43
|
+
transfer
|
|
44
|
+
:content="col._name"
|
|
45
|
+
>
|
|
46
|
+
<span class="dsh-ellipsis">
|
|
47
|
+
{{ col._name }}
|
|
48
|
+
</span>
|
|
49
|
+
</bri-tooltip>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<!-- 行 -->
|
|
55
|
+
<div class="list-rows">
|
|
56
|
+
<!-- 加载 -->
|
|
57
|
+
<bri-loading
|
|
58
|
+
v-if="isLoading"
|
|
59
|
+
class="list-loading"
|
|
60
|
+
>
|
|
61
|
+
{{ loadingText }}
|
|
62
|
+
</bri-loading>
|
|
63
|
+
<template v-else>
|
|
64
|
+
<!-- 有数据 -->
|
|
65
|
+
<template v-if="data.length">
|
|
66
|
+
<div
|
|
67
|
+
v-if="multiple"
|
|
68
|
+
class="list-rows-left"
|
|
69
|
+
>
|
|
70
|
+
<CheckboxGroup
|
|
71
|
+
v-model="selectIds"
|
|
72
|
+
@on-change="selectRow"
|
|
73
|
+
>
|
|
74
|
+
<Checkbox
|
|
75
|
+
v-for="row in data"
|
|
76
|
+
:key="row._id"
|
|
77
|
+
:label="row._id"
|
|
78
|
+
@click.native.stop="clickRowCheckbox(row)"
|
|
79
|
+
>
|
|
80
|
+
{{ "" }}
|
|
81
|
+
</Checkbox>
|
|
82
|
+
</CheckboxGroup>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div class="list-rows-right">
|
|
86
|
+
<div
|
|
87
|
+
v-for="(row, index) in data"
|
|
88
|
+
:key="row._id"
|
|
89
|
+
class="row"
|
|
90
|
+
:style="{
|
|
91
|
+
paddingLeft: multiple ? '48px' : '0px'
|
|
92
|
+
}"
|
|
93
|
+
@click="clickRow(row)"
|
|
94
|
+
>
|
|
95
|
+
<div
|
|
96
|
+
v-if="sequence"
|
|
97
|
+
class="row-item"
|
|
98
|
+
style="minWidth: 60px; textAlign: center;"
|
|
99
|
+
>
|
|
100
|
+
<div class="row-item-inner">
|
|
101
|
+
{{ index + 1 }}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<!-- 单元格 -->
|
|
106
|
+
<div
|
|
107
|
+
v-for="(col) in selfColumns"
|
|
108
|
+
:key="col._key"
|
|
109
|
+
class="row-item"
|
|
110
|
+
:style="{
|
|
111
|
+
flexBasis: (col.width || col.minWidth) + `px`,
|
|
112
|
+
textAlign: col._align,
|
|
113
|
+
flexGrow: 1,
|
|
114
|
+
display: 'flex',
|
|
115
|
+
justifyContent: getFlexLayout(col._align)
|
|
116
|
+
}"
|
|
117
|
+
>
|
|
118
|
+
<div class="row-item-inner dsh-ellipsis">
|
|
119
|
+
<dsh-list-render
|
|
120
|
+
v-if="col.renderBodyCell"
|
|
121
|
+
class="ms-ellipsis"
|
|
122
|
+
:row="row"
|
|
123
|
+
:column="col"
|
|
124
|
+
:index="index"
|
|
125
|
+
:render="col.renderBodyCell"
|
|
126
|
+
></dsh-list-render>
|
|
127
|
+
|
|
128
|
+
<template v-else-if="col.formatter">
|
|
129
|
+
<div v-html="col.formatter(row, index)"></div>
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<Tooltip
|
|
133
|
+
v-else-if="row[col._key]"
|
|
134
|
+
:transfer="true"
|
|
135
|
+
max-width="200"
|
|
136
|
+
:placement="index === 0 ? 'bottom-start' : 'top-start'"
|
|
137
|
+
:content="row[col._key]"
|
|
138
|
+
class="list-tooltip"
|
|
139
|
+
>
|
|
140
|
+
<div class="list-tooltip-box">{{ row[col._key] }}</div>
|
|
141
|
+
</Tooltip>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</template>
|
|
147
|
+
|
|
148
|
+
<!-- 无数据 -->
|
|
149
|
+
<div
|
|
150
|
+
v-else
|
|
151
|
+
class="DshList-nodata"
|
|
152
|
+
>
|
|
153
|
+
{{ noDataText }}
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
</template>
|
|
159
|
+
|
|
160
|
+
<script>
|
|
161
|
+
export default {
|
|
162
|
+
name: "DshList",
|
|
163
|
+
components: {},
|
|
164
|
+
props: {
|
|
165
|
+
isLoading: {
|
|
166
|
+
type: Boolean,
|
|
167
|
+
default: false
|
|
168
|
+
},
|
|
169
|
+
data: {
|
|
170
|
+
type: Array,
|
|
171
|
+
default () {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
columns: {
|
|
176
|
+
type: Array,
|
|
177
|
+
default () {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
propsObj: {
|
|
183
|
+
type: Object,
|
|
184
|
+
default () {
|
|
185
|
+
return {
|
|
186
|
+
multiple: true,
|
|
187
|
+
sequence: false
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
noDataText: {
|
|
192
|
+
type: String,
|
|
193
|
+
default: "暂无数据…"
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
data () {
|
|
197
|
+
return {
|
|
198
|
+
selections: []
|
|
199
|
+
// curRow: null // 可以不声明
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
computed: {
|
|
203
|
+
selfColumns () {
|
|
204
|
+
return this.columns;
|
|
205
|
+
},
|
|
206
|
+
selectIds: {
|
|
207
|
+
get () {
|
|
208
|
+
return this.selections.map(item => item._id);
|
|
209
|
+
},
|
|
210
|
+
set (val) {
|
|
211
|
+
this.selections = this.data.filter(item => val.includes(item._id));
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
isSelectAll: {
|
|
215
|
+
get () {
|
|
216
|
+
return this.data.length > 0 && this.selectIds.length === this.data.length;
|
|
217
|
+
},
|
|
218
|
+
set (bool) {
|
|
219
|
+
this.selections = bool ? this.data : [];
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
multiple () {
|
|
224
|
+
return this.propsObj.multiple !== false;
|
|
225
|
+
},
|
|
226
|
+
sequence () {
|
|
227
|
+
return this.propsObj.sequence && this.propsObj.sequence !== false;
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
created () {},
|
|
231
|
+
methods: {
|
|
232
|
+
/* --- 仅供外部调用 ----- */
|
|
233
|
+
pushSelectIds (ids = []) {
|
|
234
|
+
this.selectIds = [...this.selectIds, ...ids];
|
|
235
|
+
this.changeSelect();
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
// 点击某行
|
|
239
|
+
clickRow (row) {
|
|
240
|
+
this.$emit("clickRow", row);
|
|
241
|
+
},
|
|
242
|
+
// 点击某行的选择框
|
|
243
|
+
clickRowCheckbox (row) {
|
|
244
|
+
this.curRow = row;
|
|
245
|
+
this.curRow.bool = !this.selectIds.includes(row._id);
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
// 切换全选
|
|
249
|
+
selectAll (bool) {
|
|
250
|
+
this.$emit("selectAll", this.selectIds, this.selections, bool);
|
|
251
|
+
this.changeSelect();
|
|
252
|
+
},
|
|
253
|
+
// 切换选择
|
|
254
|
+
selectRow (ids) {
|
|
255
|
+
this.$emit("selectRow", this.selectIds, this.selections, this.curRow.bool, this.curRow);
|
|
256
|
+
this.changeSelect();
|
|
257
|
+
},
|
|
258
|
+
// 改变选择项
|
|
259
|
+
changeSelect () {
|
|
260
|
+
this.$emit("changeSelect", this.selectIds, this.selections);
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
getFlexLayout (align) {
|
|
264
|
+
let map = {
|
|
265
|
+
left: "flex-start",
|
|
266
|
+
center: "center",
|
|
267
|
+
right: "flex-end"
|
|
268
|
+
};
|
|
269
|
+
if (align) {
|
|
270
|
+
return map[align];
|
|
271
|
+
} else {
|
|
272
|
+
return "flex-start";
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
watch: {
|
|
277
|
+
data () {
|
|
278
|
+
this.selections = [];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
</script>
|
|
283
|
+
|
|
284
|
+
<style lang="less">
|
|
285
|
+
.DshList {
|
|
286
|
+
@height:44px;
|
|
287
|
+
|
|
288
|
+
.list {
|
|
289
|
+
&-loading {
|
|
290
|
+
margin-top: 120px;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&-cols,
|
|
294
|
+
&-rows {
|
|
295
|
+
position: relative;
|
|
296
|
+
|
|
297
|
+
&-left {
|
|
298
|
+
width: 48px;
|
|
299
|
+
text-align: center;
|
|
300
|
+
position: absolute;
|
|
301
|
+
left: 0;
|
|
302
|
+
top: 0;
|
|
303
|
+
|
|
304
|
+
label {
|
|
305
|
+
display: inline-block;
|
|
306
|
+
height: 36px;
|
|
307
|
+
padding: 9px 5px;
|
|
308
|
+
margin: 0px;
|
|
309
|
+
line-height: 18px;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.row {
|
|
314
|
+
width: 100%;
|
|
315
|
+
line-height: 20px;
|
|
316
|
+
display: flex;
|
|
317
|
+
justify-content: space-between;
|
|
318
|
+
|
|
319
|
+
&-item {
|
|
320
|
+
min-width: 120px;
|
|
321
|
+
height: 100%;
|
|
322
|
+
padding: 0 16px;
|
|
323
|
+
font-size: 14px;
|
|
324
|
+
align-items: center;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
&-cols {
|
|
330
|
+
height: @height;
|
|
331
|
+
background: #f0f0f0;
|
|
332
|
+
|
|
333
|
+
&-left {}
|
|
334
|
+
&-right {
|
|
335
|
+
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.row {
|
|
339
|
+
font-weight: 700;
|
|
340
|
+
|
|
341
|
+
&-item {
|
|
342
|
+
padding: 10px 16px;
|
|
343
|
+
border-top: 1px #e5e5e5 solid;
|
|
344
|
+
border-bottom: 1px #f0f0f0 solid;
|
|
345
|
+
border-left: 1px #e5e5e5 solid;
|
|
346
|
+
background: #f0f0f0;
|
|
347
|
+
|
|
348
|
+
&:last-child{
|
|
349
|
+
border-right: 1px #e5e5e5 solid;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
&-inner {
|
|
353
|
+
.dsh-ellipsis{
|
|
354
|
+
font-size: 14px;
|
|
355
|
+
color: #666;
|
|
356
|
+
font-weight: 700;
|
|
357
|
+
line-height: 24px;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
&-rows {
|
|
365
|
+
&-left {
|
|
366
|
+
label {
|
|
367
|
+
height: 44px;
|
|
368
|
+
line-height: 20px;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
&-right {}
|
|
373
|
+
|
|
374
|
+
.row {
|
|
375
|
+
height: 44px;
|
|
376
|
+
line-height: 20px;
|
|
377
|
+
cursor: pointer;
|
|
378
|
+
|
|
379
|
+
&-item {
|
|
380
|
+
display: flex;
|
|
381
|
+
border: 1px solid #E5E5E5;
|
|
382
|
+
border-width: 0 0 1px 1px;
|
|
383
|
+
|
|
384
|
+
&:last-child {
|
|
385
|
+
border-width: 0 1px 1px 1px;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
&-inner {
|
|
389
|
+
width: 100%;
|
|
390
|
+
font-size: 14px;
|
|
391
|
+
color: #333;
|
|
392
|
+
font-weight: 400;
|
|
393
|
+
line-height: 24px;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
&-nodata {
|
|
400
|
+
#dsh-nodata();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
</style>
|