bri-components 1.5.14 → 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 -727
- 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 -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/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 -4
- 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,251 +1,251 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
ref="DshTags"
|
|
4
|
-
:class="{
|
|
5
|
-
'DshTags': true,
|
|
6
|
-
'DshTags-auto': autoEllipsis
|
|
7
|
-
}"
|
|
8
|
-
>
|
|
9
|
-
<Tag
|
|
10
|
-
v-for="(tagItem, tagIndex) in computedList"
|
|
11
|
-
:key="tagIndex"
|
|
12
|
-
ref="tagItem"
|
|
13
|
-
:style="tagItem.style"
|
|
14
|
-
:class="itemClass || tagItem.class"
|
|
15
|
-
:disabled="getItemDisabled(tagItem)"
|
|
16
|
-
:name="tagIndex"
|
|
17
|
-
:type="propsObj.type"
|
|
18
|
-
:closable="getItemClosable(tagItem)"
|
|
19
|
-
:checkable="propsObj.checkable"
|
|
20
|
-
:checked="propsObj.checked"
|
|
21
|
-
:color="propsObj.color || tagItem.color || 'default'"
|
|
22
|
-
:fade="propsObj.fade || false"
|
|
23
|
-
:size="propsObj.size || 'medium'"
|
|
24
|
-
@click.native="clickTag($event, tagItem, tagIndex)"
|
|
25
|
-
@on-close="deleteTag($event, tagItem, tagIndex)"
|
|
26
|
-
@on-change="changeChecked"
|
|
27
|
-
>
|
|
28
|
-
<slot :tagItem="tagItem">
|
|
29
|
-
<Icon
|
|
30
|
-
v-if="getItemIcon(tagItem)"
|
|
31
|
-
:type="getItemIcon(tagItem)"
|
|
32
|
-
/>
|
|
33
|
-
{{ getItemName(tagItem) }}
|
|
34
|
-
</slot>
|
|
35
|
-
</Tag>
|
|
36
|
-
|
|
37
|
-
<!-- 更多 -->
|
|
38
|
-
<Tag
|
|
39
|
-
v-if="subList.length"
|
|
40
|
-
:type="propsObj.type"
|
|
41
|
-
:checkable="propsObj.checkable"
|
|
42
|
-
:checked="propsObj.checked"
|
|
43
|
-
:color="propsObj.color || 'default'"
|
|
44
|
-
:fade="propsObj.fade || false"
|
|
45
|
-
:size="propsObj.size || 'medium'"
|
|
46
|
-
:disabled="propsObj.disabled"
|
|
47
|
-
>
|
|
48
|
-
<Poptip
|
|
49
|
-
:transfer="true"
|
|
50
|
-
:width="200"
|
|
51
|
-
trigger="hover"
|
|
52
|
-
word-wrap
|
|
53
|
-
placement="bottom"
|
|
54
|
-
popper-class="DshTags-poptip"
|
|
55
|
-
>
|
|
56
|
-
<dsh-icons :list="[{
|
|
57
|
-
customIcon: 'bico-gengduo'
|
|
58
|
-
}]" />
|
|
59
|
-
{{ subList.length }}项
|
|
60
|
-
|
|
61
|
-
<div slot="content">
|
|
62
|
-
<Tag
|
|
63
|
-
v-for="(tagItem, tagIndex) in subList"
|
|
64
|
-
:key="tagIndex"
|
|
65
|
-
:disabled="getItemDisabled(tagItem)"
|
|
66
|
-
:name="tagIndex"
|
|
67
|
-
:type="propsObj.type"
|
|
68
|
-
:closable="getItemClosable(tagItem)"
|
|
69
|
-
:checkable="propsObj.checkable"
|
|
70
|
-
:checked="propsObj.checked"
|
|
71
|
-
:color="propsObj.color || 'default'"
|
|
72
|
-
:fade="propsObj.fade || false"
|
|
73
|
-
:size="propsObj.size || 'medium'"
|
|
74
|
-
class="DshTags-poptip-tag"
|
|
75
|
-
@on-close="deleteTag($event, tagItem, tagIndex + computedList.length)"
|
|
76
|
-
@on-change="changeChecked"
|
|
77
|
-
>
|
|
78
|
-
<slot :tagItem="tagItem">
|
|
79
|
-
<Icon
|
|
80
|
-
v-if="getItemIcon(tagItem)"
|
|
81
|
-
:type="getItemIcon(tagItem)"
|
|
82
|
-
/>
|
|
83
|
-
{{ getItemName(tagItem) }}
|
|
84
|
-
</slot>
|
|
85
|
-
</Tag>
|
|
86
|
-
</div>
|
|
87
|
-
</Poptip>
|
|
88
|
-
</Tag>
|
|
89
|
-
</div>
|
|
90
|
-
</template>
|
|
91
|
-
|
|
92
|
-
<script>
|
|
93
|
-
export default {
|
|
94
|
-
name: "DshTags",
|
|
95
|
-
props: {
|
|
96
|
-
list: {
|
|
97
|
-
type: Array,
|
|
98
|
-
default () {
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
propsObj: {
|
|
103
|
-
type: Object,
|
|
104
|
-
default () {
|
|
105
|
-
return {};
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
itemClass: {
|
|
109
|
-
type: String
|
|
110
|
-
},
|
|
111
|
-
autoEllipsis: {
|
|
112
|
-
type: Boolean,
|
|
113
|
-
default: false
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
model: {
|
|
117
|
-
prop: "list",
|
|
118
|
-
event: "change"
|
|
119
|
-
},
|
|
120
|
-
data () {
|
|
121
|
-
return {
|
|
122
|
-
maxTagCount: undefined,
|
|
123
|
-
|
|
124
|
-
getItemDisabled (item) {
|
|
125
|
-
return !!(this.propsObj.disabled || item._disabled || item.disabled);
|
|
126
|
-
},
|
|
127
|
-
getItemClosable (item) {
|
|
128
|
-
return this.getItemDisabled(item) === false && this.propsObj.closable;
|
|
129
|
-
},
|
|
130
|
-
getItemIcon (item) {
|
|
131
|
-
return (
|
|
132
|
-
this.$dataType(item) === "object"
|
|
133
|
-
? item.icon || item._icon
|
|
134
|
-
: undefined
|
|
135
|
-
) || this.propsObj.icon;
|
|
136
|
-
},
|
|
137
|
-
getItemName (item) {
|
|
138
|
-
return this.$dataType(item) === "object"
|
|
139
|
-
? item.realname || item.full_name || item.name || item._name || item._id
|
|
140
|
-
: item;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
},
|
|
144
|
-
computed: {
|
|
145
|
-
computedList () {
|
|
146
|
-
return this.list.slice(0, this.maxTagCount);
|
|
147
|
-
},
|
|
148
|
-
subList () {
|
|
149
|
-
return this.autoEllipsis && this.maxTagCount
|
|
150
|
-
? this.list.slice(this.maxTagCount)
|
|
151
|
-
: [];
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
created () {},
|
|
155
|
-
mounted () {
|
|
156
|
-
this.callEliipsis();
|
|
157
|
-
|
|
158
|
-
window.addEventListener("resize", this.callEliipsis, true);
|
|
159
|
-
},
|
|
160
|
-
destroyed () {
|
|
161
|
-
window.removeEventListener("resize", this.callEliipsis, true);
|
|
162
|
-
},
|
|
163
|
-
watch: {
|
|
164
|
-
list: function () {
|
|
165
|
-
this.callEliipsis();
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
methods: {
|
|
169
|
-
// 点击标签
|
|
170
|
-
clickTag (event, item, index) {
|
|
171
|
-
this.$emit("clickItem", item, index);
|
|
172
|
-
},
|
|
173
|
-
// 删除标签
|
|
174
|
-
deleteTag (event, item, index) {
|
|
175
|
-
const cb = () => {
|
|
176
|
-
this.list.splice(index, 1);
|
|
177
|
-
this.callEliipsis();
|
|
178
|
-
this.$emit("change", [...this.list]);
|
|
179
|
-
this.$emit("delete", item, index);
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
if (this.propsObj.useDeleteTip === true) {
|
|
183
|
-
this.$Modal.confirm({
|
|
184
|
-
title: "提示",
|
|
185
|
-
content: `确定删除"${this.getItemName(item)}"吗?`,
|
|
186
|
-
onOk: () => {
|
|
187
|
-
cb();
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
} else {
|
|
191
|
-
cb();
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
// 改变标签状态
|
|
195
|
-
changeChecked (checked, name) {
|
|
196
|
-
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
callEliipsis () {
|
|
200
|
-
if (this.autoEllipsis) {
|
|
201
|
-
this.maxTagCount = undefined;
|
|
202
|
-
this.$nextTick(() => {
|
|
203
|
-
this.getAutoEllipsis();
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
getAutoEllipsis () {
|
|
208
|
-
if (this.autoEllipsis) {
|
|
209
|
-
let parWidth = this.$refs.DshTags.clientWidth;
|
|
210
|
-
let tags = this.$refs.tagItem;
|
|
211
|
-
|
|
212
|
-
for (let idx in tags) {
|
|
213
|
-
let el = tags[idx]["$el"];
|
|
214
|
-
let showEllipsis = el.clientWidth + el.offsetLeft > parWidth;
|
|
215
|
-
|
|
216
|
-
if (showEllipsis) {
|
|
217
|
-
// 判断加上... 是否被隐藏
|
|
218
|
-
if (el.clientWidth + el.offsetLeft + 40 < parWidth) {
|
|
219
|
-
this.maxTagCount = idx;
|
|
220
|
-
} else {
|
|
221
|
-
this.maxTagCount = idx - 1;
|
|
222
|
-
}
|
|
223
|
-
break;
|
|
224
|
-
} else {
|
|
225
|
-
this.maxTagCount = undefined;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
</script>
|
|
233
|
-
|
|
234
|
-
<style lang="less">
|
|
235
|
-
.DshTags {
|
|
236
|
-
&-auto {
|
|
237
|
-
overflow: hidden;
|
|
238
|
-
width: 100%;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
&-poptip {
|
|
242
|
-
&-tag {
|
|
243
|
-
margin: 2px 0;
|
|
244
|
-
.dsh-flex-row-between-center();
|
|
245
|
-
}
|
|
246
|
-
.ivu-tag-text {
|
|
247
|
-
.dsh-ellipsis();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="DshTags"
|
|
4
|
+
:class="{
|
|
5
|
+
'DshTags': true,
|
|
6
|
+
'DshTags-auto': autoEllipsis
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<Tag
|
|
10
|
+
v-for="(tagItem, tagIndex) in computedList"
|
|
11
|
+
:key="tagIndex"
|
|
12
|
+
ref="tagItem"
|
|
13
|
+
:style="tagItem.style"
|
|
14
|
+
:class="itemClass || tagItem.class"
|
|
15
|
+
:disabled="getItemDisabled(tagItem)"
|
|
16
|
+
:name="tagIndex"
|
|
17
|
+
:type="propsObj.type"
|
|
18
|
+
:closable="getItemClosable(tagItem)"
|
|
19
|
+
:checkable="propsObj.checkable"
|
|
20
|
+
:checked="propsObj.checked"
|
|
21
|
+
:color="propsObj.color || tagItem.color || 'default'"
|
|
22
|
+
:fade="propsObj.fade || false"
|
|
23
|
+
:size="propsObj.size || 'medium'"
|
|
24
|
+
@click.native="clickTag($event, tagItem, tagIndex)"
|
|
25
|
+
@on-close="deleteTag($event, tagItem, tagIndex)"
|
|
26
|
+
@on-change="changeChecked"
|
|
27
|
+
>
|
|
28
|
+
<slot :tagItem="tagItem">
|
|
29
|
+
<Icon
|
|
30
|
+
v-if="getItemIcon(tagItem)"
|
|
31
|
+
:type="getItemIcon(tagItem)"
|
|
32
|
+
/>
|
|
33
|
+
{{ getItemName(tagItem) }}
|
|
34
|
+
</slot>
|
|
35
|
+
</Tag>
|
|
36
|
+
|
|
37
|
+
<!-- 更多 -->
|
|
38
|
+
<Tag
|
|
39
|
+
v-if="subList.length"
|
|
40
|
+
:type="propsObj.type"
|
|
41
|
+
:checkable="propsObj.checkable"
|
|
42
|
+
:checked="propsObj.checked"
|
|
43
|
+
:color="propsObj.color || 'default'"
|
|
44
|
+
:fade="propsObj.fade || false"
|
|
45
|
+
:size="propsObj.size || 'medium'"
|
|
46
|
+
:disabled="propsObj.disabled"
|
|
47
|
+
>
|
|
48
|
+
<Poptip
|
|
49
|
+
:transfer="true"
|
|
50
|
+
:width="200"
|
|
51
|
+
trigger="hover"
|
|
52
|
+
word-wrap
|
|
53
|
+
placement="bottom"
|
|
54
|
+
popper-class="DshTags-poptip"
|
|
55
|
+
>
|
|
56
|
+
<dsh-icons :list="[{
|
|
57
|
+
customIcon: 'bico-gengduo'
|
|
58
|
+
}]" />
|
|
59
|
+
{{ subList.length }}项
|
|
60
|
+
|
|
61
|
+
<div slot="content">
|
|
62
|
+
<Tag
|
|
63
|
+
v-for="(tagItem, tagIndex) in subList"
|
|
64
|
+
:key="tagIndex"
|
|
65
|
+
:disabled="getItemDisabled(tagItem)"
|
|
66
|
+
:name="tagIndex"
|
|
67
|
+
:type="propsObj.type"
|
|
68
|
+
:closable="getItemClosable(tagItem)"
|
|
69
|
+
:checkable="propsObj.checkable"
|
|
70
|
+
:checked="propsObj.checked"
|
|
71
|
+
:color="propsObj.color || 'default'"
|
|
72
|
+
:fade="propsObj.fade || false"
|
|
73
|
+
:size="propsObj.size || 'medium'"
|
|
74
|
+
class="DshTags-poptip-tag"
|
|
75
|
+
@on-close="deleteTag($event, tagItem, tagIndex + computedList.length)"
|
|
76
|
+
@on-change="changeChecked"
|
|
77
|
+
>
|
|
78
|
+
<slot :tagItem="tagItem">
|
|
79
|
+
<Icon
|
|
80
|
+
v-if="getItemIcon(tagItem)"
|
|
81
|
+
:type="getItemIcon(tagItem)"
|
|
82
|
+
/>
|
|
83
|
+
{{ getItemName(tagItem) }}
|
|
84
|
+
</slot>
|
|
85
|
+
</Tag>
|
|
86
|
+
</div>
|
|
87
|
+
</Poptip>
|
|
88
|
+
</Tag>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
export default {
|
|
94
|
+
name: "DshTags",
|
|
95
|
+
props: {
|
|
96
|
+
list: {
|
|
97
|
+
type: Array,
|
|
98
|
+
default () {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
propsObj: {
|
|
103
|
+
type: Object,
|
|
104
|
+
default () {
|
|
105
|
+
return {};
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
itemClass: {
|
|
109
|
+
type: String
|
|
110
|
+
},
|
|
111
|
+
autoEllipsis: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
model: {
|
|
117
|
+
prop: "list",
|
|
118
|
+
event: "change"
|
|
119
|
+
},
|
|
120
|
+
data () {
|
|
121
|
+
return {
|
|
122
|
+
maxTagCount: undefined,
|
|
123
|
+
|
|
124
|
+
getItemDisabled (item) {
|
|
125
|
+
return !!(this.propsObj.disabled || item._disabled || item.disabled);
|
|
126
|
+
},
|
|
127
|
+
getItemClosable (item) {
|
|
128
|
+
return this.getItemDisabled(item) === false && this.propsObj.closable;
|
|
129
|
+
},
|
|
130
|
+
getItemIcon (item) {
|
|
131
|
+
return (
|
|
132
|
+
this.$dataType(item) === "object"
|
|
133
|
+
? item.icon || item._icon
|
|
134
|
+
: undefined
|
|
135
|
+
) || this.propsObj.icon;
|
|
136
|
+
},
|
|
137
|
+
getItemName (item) {
|
|
138
|
+
return this.$dataType(item) === "object"
|
|
139
|
+
? item.realname || item.full_name || item.name || item._name || item._id
|
|
140
|
+
: item;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
computed: {
|
|
145
|
+
computedList () {
|
|
146
|
+
return this.list.slice(0, this.maxTagCount);
|
|
147
|
+
},
|
|
148
|
+
subList () {
|
|
149
|
+
return this.autoEllipsis && this.maxTagCount
|
|
150
|
+
? this.list.slice(this.maxTagCount)
|
|
151
|
+
: [];
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
created () {},
|
|
155
|
+
mounted () {
|
|
156
|
+
this.callEliipsis();
|
|
157
|
+
|
|
158
|
+
window.addEventListener("resize", this.callEliipsis, true);
|
|
159
|
+
},
|
|
160
|
+
destroyed () {
|
|
161
|
+
window.removeEventListener("resize", this.callEliipsis, true);
|
|
162
|
+
},
|
|
163
|
+
watch: {
|
|
164
|
+
list: function () {
|
|
165
|
+
this.callEliipsis();
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
methods: {
|
|
169
|
+
// 点击标签
|
|
170
|
+
clickTag (event, item, index) {
|
|
171
|
+
this.$emit("clickItem", item, index);
|
|
172
|
+
},
|
|
173
|
+
// 删除标签
|
|
174
|
+
deleteTag (event, item, index) {
|
|
175
|
+
const cb = () => {
|
|
176
|
+
this.list.splice(index, 1);
|
|
177
|
+
this.callEliipsis();
|
|
178
|
+
this.$emit("change", [...this.list]);
|
|
179
|
+
this.$emit("delete", item, index);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
if (this.propsObj.useDeleteTip === true) {
|
|
183
|
+
this.$Modal.confirm({
|
|
184
|
+
title: "提示",
|
|
185
|
+
content: `确定删除"${this.getItemName(item)}"吗?`,
|
|
186
|
+
onOk: () => {
|
|
187
|
+
cb();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
} else {
|
|
191
|
+
cb();
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
// 改变标签状态
|
|
195
|
+
changeChecked (checked, name) {
|
|
196
|
+
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
callEliipsis () {
|
|
200
|
+
if (this.autoEllipsis) {
|
|
201
|
+
this.maxTagCount = undefined;
|
|
202
|
+
this.$nextTick(() => {
|
|
203
|
+
this.getAutoEllipsis();
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
getAutoEllipsis () {
|
|
208
|
+
if (this.autoEllipsis) {
|
|
209
|
+
let parWidth = this.$refs.DshTags.clientWidth;
|
|
210
|
+
let tags = this.$refs.tagItem;
|
|
211
|
+
|
|
212
|
+
for (let idx in tags) {
|
|
213
|
+
let el = tags[idx]["$el"];
|
|
214
|
+
let showEllipsis = el.clientWidth + el.offsetLeft > parWidth;
|
|
215
|
+
|
|
216
|
+
if (showEllipsis) {
|
|
217
|
+
// 判断加上... 是否被隐藏
|
|
218
|
+
if (el.clientWidth + el.offsetLeft + 40 < parWidth) {
|
|
219
|
+
this.maxTagCount = idx;
|
|
220
|
+
} else {
|
|
221
|
+
this.maxTagCount = idx - 1;
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
} else {
|
|
225
|
+
this.maxTagCount = undefined;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<style lang="less">
|
|
235
|
+
.DshTags {
|
|
236
|
+
&-auto {
|
|
237
|
+
overflow: hidden;
|
|
238
|
+
width: 100%;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&-poptip {
|
|
242
|
+
&-tag {
|
|
243
|
+
margin: 2px 0;
|
|
244
|
+
.dsh-flex-row-between-center();
|
|
245
|
+
}
|
|
246
|
+
.ivu-tag-text {
|
|
247
|
+
.dsh-ellipsis();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
</style>
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="DshTitle">
|
|
3
|
-
<slot name="prepend"></slot>
|
|
4
|
-
<Icon
|
|
5
|
-
class="DshTitle-icon"
|
|
6
|
-
:type="propsObj.icon"
|
|
7
|
-
:custom="propsObj.customIcon ? `bico-font ' ${propsObj.customIcon}` : undefined"
|
|
8
|
-
:color="propsObj.color"
|
|
9
|
-
:size="propsObj.size || 14"
|
|
10
|
-
/>
|
|
11
|
-
<slot>
|
|
12
|
-
<span class="DshTitle-name">{{ propsObj.name || propsObj._name }}</span>
|
|
13
|
-
<slot name="append"></slot>
|
|
14
|
-
</slot>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script>
|
|
19
|
-
export default {
|
|
20
|
-
name: "DshTitle",
|
|
21
|
-
props: {
|
|
22
|
-
propsObj: {
|
|
23
|
-
type: Object,
|
|
24
|
-
default () {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
data () {
|
|
30
|
-
return {};
|
|
31
|
-
},
|
|
32
|
-
computed: {},
|
|
33
|
-
created () {},
|
|
34
|
-
methods: {}
|
|
35
|
-
};
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<style lang="less" scoped>
|
|
39
|
-
.DshTitle {
|
|
40
|
-
height: 100%;
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
|
|
45
|
-
&-name {
|
|
46
|
-
margin-left: 8px;
|
|
47
|
-
font-size: @smallTitleSize;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="DshTitle">
|
|
3
|
+
<slot name="prepend"></slot>
|
|
4
|
+
<Icon
|
|
5
|
+
class="DshTitle-icon"
|
|
6
|
+
:type="propsObj.icon"
|
|
7
|
+
:custom="propsObj.customIcon ? `bico-font ' ${propsObj.customIcon}` : undefined"
|
|
8
|
+
:color="propsObj.color"
|
|
9
|
+
:size="propsObj.size || 14"
|
|
10
|
+
/>
|
|
11
|
+
<slot>
|
|
12
|
+
<span class="DshTitle-name">{{ propsObj.name || propsObj._name }}</span>
|
|
13
|
+
<slot name="append"></slot>
|
|
14
|
+
</slot>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
name: "DshTitle",
|
|
21
|
+
props: {
|
|
22
|
+
propsObj: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default () {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
data () {
|
|
30
|
+
return {};
|
|
31
|
+
},
|
|
32
|
+
computed: {},
|
|
33
|
+
created () {},
|
|
34
|
+
methods: {}
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style lang="less" scoped>
|
|
39
|
+
.DshTitle {
|
|
40
|
+
height: 100%;
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
|
|
45
|
+
&-name {
|
|
46
|
+
margin-left: 8px;
|
|
47
|
+
font-size: @smallTitleSize;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "DshRender",
|
|
3
|
-
functional: true,
|
|
4
|
-
props: {
|
|
5
|
-
// formItem: {
|
|
6
|
-
// type: Object,
|
|
7
|
-
// default () {}
|
|
8
|
-
// },
|
|
9
|
-
render: {
|
|
10
|
-
type: Function,
|
|
11
|
-
default () {}
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
data () {
|
|
15
|
-
return {};
|
|
16
|
-
},
|
|
17
|
-
render: (h, ctx) => {
|
|
18
|
-
return ctx.props.render(h, ctx.props, ctx);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
1
|
+
export default {
|
|
2
|
+
name: "DshRender",
|
|
3
|
+
functional: true,
|
|
4
|
+
props: {
|
|
5
|
+
// formItem: {
|
|
6
|
+
// type: Object,
|
|
7
|
+
// default () {}
|
|
8
|
+
// },
|
|
9
|
+
render: {
|
|
10
|
+
type: Function,
|
|
11
|
+
default () {}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
data () {
|
|
15
|
+
return {};
|
|
16
|
+
},
|
|
17
|
+
render: (h, ctx) => {
|
|
18
|
+
return ctx.props.render(h, ctx.props, ctx);
|
|
19
|
+
}
|
|
20
|
+
};
|