bri-components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/lib/.DS_Store +0 -0
- package/lib/0.bri-components.min.js +2 -0
- package/lib/0.bri-components.min.js.map +1 -0
- package/lib/1.bri-components.min.js +2 -0
- package/lib/1.bri-components.min.js.map +1 -0
- package/lib/2.bri-components.min.js +2 -0
- package/lib/2.bri-components.min.js.map +1 -0
- package/lib/3.bri-components.min.js +2 -0
- package/lib/3.bri-components.min.js.gz +0 -0
- package/lib/3.bri-components.min.js.map +1 -0
- package/lib/4.bri-components.min.js +2 -0
- package/lib/4.bri-components.min.js.gz +0 -0
- package/lib/4.bri-components.min.js.map +1 -0
- package/lib/5.bri-components.min.js +2 -0
- package/lib/5.bri-components.min.js.map +1 -0
- package/lib/6.bri-components.min.js +2 -0
- package/lib/6.bri-components.min.js.map +1 -0
- package/lib/bri-components.min.js +21 -0
- package/lib/bri-components.min.js.gz +0 -0
- package/lib/bri-components.min.js.map +1 -0
- package/lib/styles/bri-components.css +1 -0
- package/lib/styles/bundle.css +14 -0
- package/lib/styles/font/fontello.eot +0 -0
- package/lib/styles/font/fontello.svg +32 -0
- package/lib/styles/font/fontello.ttf +0 -0
- package/lib/styles/font/fontello.woff +0 -0
- package/lib/styles/font/fontello.woff2 +0 -0
- package/package.json +121 -0
- package/src/.DS_Store +0 -0
- package/src/components/controls/base/DshBack.vue +36 -0
- package/src/components/controls/base/DshCascader.vue +366 -0
- package/src/components/controls/base/DshCascaderMultiple.vue +158 -0
- package/src/components/controls/base/DshCheckbox.vue +199 -0
- package/src/components/controls/base/DshCoordinates.vue +497 -0
- package/src/components/controls/base/DshDate.vue +148 -0
- package/src/components/controls/base/DshDaterange.vue +335 -0
- package/src/components/controls/base/DshDivider.vue +59 -0
- package/src/components/controls/base/DshEditor.vue +166 -0
- package/src/components/controls/base/DshInput.vue +139 -0
- package/src/components/controls/base/DshLabels.vue +302 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +425 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -0
- package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -0
- package/src/components/controls/base/DshNumber/DshNumber.vue +148 -0
- package/src/components/controls/base/DshNumberange.vue +137 -0
- package/src/components/controls/base/DshPackage.vue +72 -0
- package/src/components/controls/base/DshSelect.vue +231 -0
- package/src/components/controls/base/DshSwitch.vue +112 -0
- package/src/components/controls/base/DshUndeveloped.vue +39 -0
- package/src/components/controls/base/YSerialNumber.vue +37 -0
- package/src/components/controls/base/ZUpload/YUploadImage.vue +228 -0
- package/src/components/controls/base/ZUpload/index.vue +356 -0
- package/src/components/controls/base/ZUpload/upload-list.vue +277 -0
- package/src/components/controls/base/ZUpload/upload-listItem.vue +0 -0
- package/src/components/controls/base/ZUpload/uploadMixin.js +397 -0
- package/src/components/controls/base/selectMixin.js +110 -0
- package/src/components/controls/base/textMultiple/DshTextMultiple.vue +94 -0
- package/src/components/controls/base/textMultiple/MultipleInput.vue +106 -0
- package/src/components/controls/controlMap.js +94 -0
- package/src/components/controls/controlMixin.js +84 -0
- package/src/components/form/DshAdvSearchForm.vue +341 -0
- package/src/components/form/DshDefaultSearch.vue +203 -0
- package/src/components/form/DshForm.vue +364 -0
- package/src/components/form/searchMixin.js +205 -0
- package/src/components/list/DshBox/DshBox.vue +168 -0
- package/src/components/list/DshBox/DshCard.vue +219 -0
- package/src/components/list/DshBox/DshCrossTable.vue +624 -0
- package/src/components/list/DshBox/DshList.vue +442 -0
- package/src/components/list/DshBox/DshPanel.vue +407 -0
- package/src/components/list/DshBox/DshSingleData.vue +82 -0
- package/src/components/list/DshBox/DshTable.vue +273 -0
- package/src/components/list/DshCascaderTable.vue +817 -0
- package/src/components/list/DshFlatTable.vue +622 -0
- package/src/components/list/ZTree.vue +527 -0
- package/src/components/list/easyTable/index.js +23 -0
- package/src/components/list/easyTable/src/directives/clickoutside.js +32 -0
- package/src/components/list/easyTable/src/mixins/layerAdjustment.js +62 -0
- package/src/components/list/easyTable/src/settings/settings.js +11 -0
- package/src/components/list/easyTable/src/utils/deepClone.js +256 -0
- package/src/components/list/easyTable/src/utils/dom.js +41 -0
- package/src/components/list/easyTable/src/utils/utils.js +190 -0
- package/src/components/list/easyTable/v-checkbox/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox/src/checkbox.vue +127 -0
- package/src/components/list/easyTable/v-checkbox-group/index.js +7 -0
- package/src/components/list/easyTable/v-checkbox-group/src/checkbox-group.vue +68 -0
- package/src/components/list/easyTable/v-dropdown/index.js +7 -0
- package/src/components/list/easyTable/v-dropdown/src/dropdown.vue +337 -0
- package/src/components/list/easyTable/v-table/index.js +7 -0
- package/src/components/list/easyTable/v-table/src/body-cell-merge-mixin.js +141 -0
- package/src/components/list/easyTable/v-table/src/cell-edit-mixin.js +102 -0
- package/src/components/list/easyTable/v-table/src/checkbox-selection-mixin.js +189 -0
- package/src/components/list/easyTable/v-table/src/classes-mixin.js +56 -0
- package/src/components/list/easyTable/v-table/src/drag-width-mixin.js +202 -0
- package/src/components/list/easyTable/v-table/src/export-csv.js +74 -0
- package/src/components/list/easyTable/v-table/src/frozen-columns-mixin.js +134 -0
- package/src/components/list/easyTable/v-table/src/loading.vue +49 -0
- package/src/components/list/easyTable/v-table/src/scroll-bar-control-mixin.js +21 -0
- package/src/components/list/easyTable/v-table/src/scroll-control-mixin.js +92 -0
- package/src/components/list/easyTable/v-table/src/sort-control-mixin.js +108 -0
- package/src/components/list/easyTable/v-table/src/table-empty-mixin.js +73 -0
- package/src/components/list/easyTable/v-table/src/table-empty.vue +66 -0
- package/src/components/list/easyTable/v-table/src/table-filters-mixin.js +126 -0
- package/src/components/list/easyTable/v-table/src/table-footer-mixin.js +122 -0
- package/src/components/list/easyTable/v-table/src/table-resize-mixin.js +279 -0
- package/src/components/list/easyTable/v-table/src/table-row-mouse-events-mixin.js +123 -0
- package/src/components/list/easyTable/v-table/src/table.vue +1565 -0
- package/src/components/list/easyTable/v-table/src/title-cell-merge-mixin.js +115 -0
- package/src/components/list/evTable/EvTable.vue +323 -0
- package/src/components/list/evTable/EvTableMixin.js +26 -0
- package/src/components/other/DshAvatar.vue +149 -0
- package/src/components/other/DshBtnModal.vue +64 -0
- package/src/components/other/DshColorPanel.vue +128 -0
- package/src/components/other/DshEditPanel.vue +130 -0
- package/src/components/other/InfoCascader.vue +258 -0
- package/src/components/other/YNoPermission.vue +45 -0
- package/src/components/other/ZCode.vue +125 -0
- package/src/components/other/ZCollapseTree.vue +84 -0
- package/src/components/other/ZGantt.vue +669 -0
- package/src/components/other/ZIframe.vue +105 -0
- package/src/components/other/ZLoading.vue +59 -0
- package/src/components/other/menu/DshMenu.vue +133 -0
- package/src/components/other/menu/DshMenuNav.vue +104 -0
- package/src/components/pages/Error/Error403.vue +34 -0
- package/src/components/pages/Error/Error404.vue +34 -0
- package/src/components/pages/Error/Error500.vue +34 -0
- package/src/components/pages/Error/error.less +163 -0
- package/src/components/pages/Error/errorBack.vue +38 -0
- package/src/components/small/Ctooltip.vue +90 -0
- package/src/components/small/DshButtons.vue +195 -0
- package/src/components/small/DshControlDefine.vue +110 -0
- package/src/components/small/DshCrumbs.vue +61 -0
- package/src/components/small/DshCrumbsItem.vue +107 -0
- package/src/components/small/DshDropdown.vue +159 -0
- package/src/components/small/DshFileShow.vue +212 -0
- package/src/components/small/DshIcons.vue +63 -0
- package/src/components/small/DshModal.vue +255 -0
- package/src/components/small/DshPage.vue +98 -0
- package/src/components/small/DshSteps.vue +68 -0
- package/src/components/small/DshTabs.vue +227 -0
- package/src/components/small/DshTags.vue +58 -0
- package/src/components/small/DshTdRender.js +21 -0
- package/src/components/small/DshTitle.vue +36 -0
- package/src/components/small/render.js +20 -0
- package/src/components/unit/DshFormItem.vue +157 -0
- package/src/components/unit/DshUnit.vue +72 -0
- package/src/components/unit/unitMixin.js +43 -0
- package/src/datas/.DS_Store +0 -0
- package/src/datas/common/region.json +1 -0
- package/src/datas/common/resourceData.json +20 -0
- package/src/datas/index.js +11 -0
- package/src/index.js +243 -0
- package/src/styles/animate.less +16 -0
- package/src/styles/bundle.css +14 -0
- package/src/styles/common/box.less +157 -0
- package/src/styles/common/common.less +31 -0
- package/src/styles/common/flex.less +282 -0
- package/src/styles/common/index.less +4 -0
- package/src/styles/common/text.less +43 -0
- package/src/styles/components/controls/DshCascader.less +75 -0
- package/src/styles/components/controls/DshCheckbox.less +156 -0
- package/src/styles/components/controls/DshCoordinates.less +72 -0
- package/src/styles/components/controls/DshDaterange.less +49 -0
- package/src/styles/components/controls/DshDivider.less +115 -0
- package/src/styles/components/controls/DshEditor.less +52 -0
- package/src/styles/components/controls/DshInput.less +40 -0
- package/src/styles/components/controls/DshLabels.less +187 -0
- package/src/styles/components/controls/DshNumberange.less +24 -0
- package/src/styles/components/controls/DshPackage.less +25 -0
- package/src/styles/components/controls/DshSelect.less +172 -0
- package/src/styles/components/controls/MultipleInput.less +55 -0
- package/src/styles/components/controls/ZUpload.less +446 -0
- package/src/styles/components/form/DshAdvSearchForm.less +159 -0
- package/src/styles/components/form/DshDefaultSearch.less +71 -0
- package/src/styles/components/index.less +49 -0
- package/src/styles/components/list/DshCascaderTable.less +113 -0
- package/src/styles/components/list/DshCrossTable.less +175 -0
- package/src/styles/components/list/DshFlatTable.less +98 -0
- package/src/styles/components/list/DshSingleData.less +30 -0
- package/src/styles/components/list/evTable.less +79 -0
- package/src/styles/components/list/evtable/animation.less +141 -0
- package/src/styles/components/list/evtable/font/fontello.eot +0 -0
- package/src/styles/components/list/evtable/font/fontello.svg +32 -0
- package/src/styles/components/list/evtable/font/fontello.ttf +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff +0 -0
- package/src/styles/components/list/evtable/font/fontello.woff2 +0 -0
- package/src/styles/components/list/evtable/fontello.less +68 -0
- package/src/styles/components/list/evtable/index.less +5 -0
- package/src/styles/components/list/evtable/v-checkbox.less +167 -0
- package/src/styles/components/list/evtable/v-dropdown.less +235 -0
- package/src/styles/components/list/evtable/v-table.less +334 -0
- package/src/styles/components/list/ivu_reset.less +49 -0
- package/src/styles/components/other/DshEditPanel.less +70 -0
- package/src/styles/components/other/DshMenu.less +37 -0
- package/src/styles/components/other/DshMenuNav.less +82 -0
- package/src/styles/components/other/InfoCascader.less +55 -0
- package/src/styles/components/other/ZCode.less +1 -0
- package/src/styles/components/other/ZCollapseTree.less +62 -0
- package/src/styles/components/other/ZGantt.less +278 -0
- package/src/styles/components/other/ZLoading.less +36 -0
- package/src/styles/components/small/Ctooltip.less +5 -0
- package/src/styles/components/small/DshButtons.less +40 -0
- package/src/styles/components/small/DshControlDefine.less +64 -0
- package/src/styles/components/small/DshDropdown.less +61 -0
- package/src/styles/components/small/DshPage.less +94 -0
- package/src/styles/components/small/DshSteps.less +58 -0
- package/src/styles/components/small/DshTabs.less +82 -0
- package/src/styles/components/small/DshTitle.less +18 -0
- package/src/styles/components/unit/DshFormItem.less +124 -0
- package/src/styles/define.less +374 -0
- package/src/styles/index.less +10 -0
- package/src/styles/reset.less +83 -0
- package/src/styles/variables.less +98 -0
- package/src/styles/view_reset.less +446 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import utils from "../../src/utils/utils.js";
|
|
2
|
+
export default {
|
|
3
|
+
data () {
|
|
4
|
+
return {
|
|
5
|
+
scrollbarWidth: 0
|
|
6
|
+
};
|
|
7
|
+
},
|
|
8
|
+
methods: {
|
|
9
|
+
// 如果存在footer 则横向滚动条体现在footer上
|
|
10
|
+
controlScrollBar () {
|
|
11
|
+
if (this.hasTableFooter) {
|
|
12
|
+
let body = this.$el.querySelector(".v-table-centerview .v-table-body");
|
|
13
|
+
body.style.overflowX = "hidden";
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
setScrollbarWidth () {
|
|
17
|
+
this.scrollbarWidth = utils.getScrollbarWidth();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 鼠标滚动,滚动条改变
|
|
3
|
+
* */
|
|
4
|
+
import utils from "../../src/utils/utils.js";
|
|
5
|
+
export default {
|
|
6
|
+
methods: {
|
|
7
|
+
body0Mousewheel (e) {
|
|
8
|
+
let body2 = this.$el.querySelector(".v-table-centerview .v-table-body");
|
|
9
|
+
let e1 = e.originalEvent || window.event || e;
|
|
10
|
+
let scrollHeight = e1.wheelDelta || e1.detail * (-1);
|
|
11
|
+
body2.scrollTop = (body2.scrollTop - scrollHeight);
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
// 表格内容滚动到顶部(常用与分页)
|
|
15
|
+
bodyScrollTop () {
|
|
16
|
+
let body0 = this.$el.querySelector(".v-table-rightview .v-table-body");
|
|
17
|
+
let body1 = this.$el.querySelector(".v-table-leftview .v-table-body");
|
|
18
|
+
let body2 = this.$el.querySelector(".v-table-centerview .v-table-body");
|
|
19
|
+
|
|
20
|
+
if (body0) {
|
|
21
|
+
body0.scrollTop = 0;
|
|
22
|
+
}
|
|
23
|
+
if (body1) {
|
|
24
|
+
body1.scrollTop = 0;
|
|
25
|
+
}
|
|
26
|
+
body2.scrollTop = 0;
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
body2Scroll (e) {
|
|
30
|
+
let view2 = this.$el.querySelector(".v-table-centerview");
|
|
31
|
+
let body0 = this.$el.querySelector(".v-table-rightview .v-table-body");
|
|
32
|
+
let body1 = this.$el.querySelector(".v-table-leftview .v-table-body");
|
|
33
|
+
let body2 = this.$el.querySelector(".v-table-centerview .v-table-body");
|
|
34
|
+
if (body1) {
|
|
35
|
+
body1.scrollTop = body2.scrollTop;
|
|
36
|
+
}
|
|
37
|
+
if (body0) {
|
|
38
|
+
body0.scrollTop = body2.scrollTop;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
view2.querySelector(".v-table-header").scrollLeft = body2.scrollLeft;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
centerViewFooterScroll () {
|
|
45
|
+
let view2 = this.$el.querySelector(".v-table-centerview");
|
|
46
|
+
let centerViewFooter = this.$el.querySelector(".v-table-centerview .v-table-footer");
|
|
47
|
+
|
|
48
|
+
view2.querySelector(".v-table-header").scrollLeft = centerViewFooter.scrollLeft;
|
|
49
|
+
view2.querySelector(".v-table-body").scrollLeft = centerViewFooter.scrollLeft;
|
|
50
|
+
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// 列表中滚动条控制
|
|
54
|
+
scrollControl () {
|
|
55
|
+
this.unbindEvents();
|
|
56
|
+
// 修复左侧固定列绑定滚动事件失效的问题
|
|
57
|
+
setTimeout(x => {
|
|
58
|
+
let body0 = this.$el.querySelector(".v-table-rightview .v-table-body");
|
|
59
|
+
let body1 = this.$el.querySelector(".v-table-leftview .v-table-body");
|
|
60
|
+
let body2 = this.$el.querySelector(".v-table-centerview .v-table-body");
|
|
61
|
+
let centerViewFooter = this.$el.querySelector(".v-table-centerview .v-table-footer");
|
|
62
|
+
|
|
63
|
+
utils.bind(body0, "mousewheel", this.body0Mousewheel);
|
|
64
|
+
utils.bind(body1, "mousewheel", this.body0Mousewheel);
|
|
65
|
+
utils.bind(body2, "scroll", this.body2Scroll);
|
|
66
|
+
utils.bind(centerViewFooter, "scroll", this.centerViewFooterScroll);
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
unbindEvents () {
|
|
71
|
+
let body0 = this.$el.querySelector(".v-table-rightview .v-table-body");
|
|
72
|
+
let body1 = this.$el.querySelector(".v-table-leftview .v-table-body");
|
|
73
|
+
let body2 = this.$el.querySelector(".v-table-centerview .v-table-body");
|
|
74
|
+
let centerViewFooter = this.$el.querySelector(".v-table-centerview .v-table-footer");
|
|
75
|
+
|
|
76
|
+
utils.unbind(body0, "mousewheel", this.body0Mousewheel);
|
|
77
|
+
utils.unbind(body1, "mousewheel", this.body1Mousewheel);
|
|
78
|
+
utils.unbind(body2, "scroll", this.body2Scroll);
|
|
79
|
+
utils.unbind(centerViewFooter, "scroll", this.centerViewFooterScroll);
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
// 对外暴露的方法
|
|
83
|
+
scrollToTop () {
|
|
84
|
+
this.bodyScrollTop();
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
beforeDestroy () {
|
|
89
|
+
|
|
90
|
+
this.unbindEvents();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 排序
|
|
3
|
+
* */
|
|
4
|
+
export default {
|
|
5
|
+
|
|
6
|
+
data () {
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
sortColumns: {}
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
methods: {
|
|
14
|
+
// 是否允许排序
|
|
15
|
+
enableSort (val) {
|
|
16
|
+
return this.showSort && typeof val === "string";
|
|
17
|
+
},
|
|
18
|
+
// 允许排序的列集合
|
|
19
|
+
setSortColumns () {
|
|
20
|
+
let titleRowsToSortInfo = [];
|
|
21
|
+
this.sortColumns = {};
|
|
22
|
+
|
|
23
|
+
if (this.internalTitleRows.length > 0) {
|
|
24
|
+
this.internalTitleRows.filter((row) => {
|
|
25
|
+
row.filter((column, index) => {
|
|
26
|
+
if (typeof column.orderBy === "string" && column.fields.length === 1) {
|
|
27
|
+
column.field = column.fields[0];
|
|
28
|
+
titleRowsToSortInfo.push(column);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let collection = titleRowsToSortInfo.length > 0 ? titleRowsToSortInfo : this.internalColumns;
|
|
35
|
+
|
|
36
|
+
collection.forEach(item => {
|
|
37
|
+
if (this.enableSort(item.orderBy)) {
|
|
38
|
+
this.sortColumns[item.field] = item.orderBy;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// this.singleSortInit();
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
// 获取当前排序规则
|
|
46
|
+
getCurrentSort (field) {
|
|
47
|
+
|
|
48
|
+
return this.sortColumns[field];
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
// 排序控制
|
|
52
|
+
sortControl (field) {
|
|
53
|
+
|
|
54
|
+
let orderBy = this.sortColumns[field];
|
|
55
|
+
if (this.enableSort(orderBy)) {
|
|
56
|
+
|
|
57
|
+
if (this.sortAlways) {
|
|
58
|
+
this.sortColumns[field] = orderBy === "asc" ? "desc" : "asc";
|
|
59
|
+
} else {
|
|
60
|
+
this.sortColumns[field] = orderBy === "asc" ? "desc"
|
|
61
|
+
: (this.sortColumns[field] === "desc" ? "" : "asc");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!this.multipleSort) {
|
|
65
|
+
|
|
66
|
+
for (let col in this.sortColumns) {
|
|
67
|
+
|
|
68
|
+
if (col !== field) {
|
|
69
|
+
|
|
70
|
+
this.sortColumns[col] = "";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this.$emit("sort-change", {
|
|
75
|
+
field: field,
|
|
76
|
+
sortType: this.sortColumns[field]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
// 单排时只允许保留第一个排序规则(‘asc’或者‘desc’)
|
|
83
|
+
singleSortInit () {
|
|
84
|
+
|
|
85
|
+
let result = false;
|
|
86
|
+
|
|
87
|
+
if (!this.multipleSort && this.sortColumns) {
|
|
88
|
+
|
|
89
|
+
for (let col in this.sortColumns) {
|
|
90
|
+
|
|
91
|
+
if (result) {
|
|
92
|
+
|
|
93
|
+
this.sortColumns[col] = "";
|
|
94
|
+
}
|
|
95
|
+
result = true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
// 对外暴露的方法(重置排序规则)
|
|
101
|
+
resetOrder () {
|
|
102
|
+
|
|
103
|
+
this.setSortColumns();
|
|
104
|
+
|
|
105
|
+
this.$emit("sort-change", this.sortColumns);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// 表格数据为空时的处理逻辑
|
|
2
|
+
import utils from "../../src/utils/utils.js";
|
|
3
|
+
export default {
|
|
4
|
+
|
|
5
|
+
data () {
|
|
6
|
+
return {
|
|
7
|
+
|
|
8
|
+
isTableEmpty: false,
|
|
9
|
+
|
|
10
|
+
// 表格数据为空时表头的高度(若有滚动条会包含滚动条的宽度)
|
|
11
|
+
// tableEmptyContentHeight: 50,
|
|
12
|
+
|
|
13
|
+
// 表格数据为空时的总高度
|
|
14
|
+
tableEmptyHeight: 0
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
methods: {
|
|
19
|
+
|
|
20
|
+
// table 数据为空的处理
|
|
21
|
+
tableEmpty () {
|
|
22
|
+
|
|
23
|
+
let tableData = this.internalTableData;
|
|
24
|
+
let tableEmptyHeight = 0;
|
|
25
|
+
|
|
26
|
+
if (Array.isArray(tableData) && tableData.length > 0) {
|
|
27
|
+
|
|
28
|
+
this.isTableEmpty = false;
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
this.isTableEmpty = true;
|
|
33
|
+
|
|
34
|
+
tableEmptyHeight = this.getTotalColumnsHeight() + this.errorContentHeight;
|
|
35
|
+
|
|
36
|
+
this.tableEmptyHeight = tableEmptyHeight;
|
|
37
|
+
|
|
38
|
+
this.$nextTick(x => {
|
|
39
|
+
|
|
40
|
+
this.tableEmptyScroll();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
tableEmptyScrollEvent (e) {
|
|
46
|
+
|
|
47
|
+
let headerEle = this.$el.querySelector(".v-table-centerview .v-table-header");
|
|
48
|
+
let tableEmptyEle = this.$el.querySelector(".v-table-empty .v-table-empty-scroll");
|
|
49
|
+
|
|
50
|
+
if (headerEle && tableEmptyEle) {
|
|
51
|
+
|
|
52
|
+
headerEle.scrollLeft = tableEmptyEle.scrollLeft;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
// 无数据时的滚动条控制
|
|
58
|
+
tableEmptyScroll () {
|
|
59
|
+
|
|
60
|
+
let tableEmptyEle = this.$el.querySelector(".v-table-empty .v-table-empty-scroll");
|
|
61
|
+
// 无数据时的滚动条控制
|
|
62
|
+
utils.bind(tableEmptyEle, "scroll", this.tableEmptyScrollEvent);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
beforeDestroy () {
|
|
68
|
+
|
|
69
|
+
let tableEmptyEle = this.$el.querySelector(".v-table-empty .v-table-empty-scroll");
|
|
70
|
+
// 无数据时的滚动条控制
|
|
71
|
+
utils.unbind(tableEmptyEle, "scroll", this.tableEmptyScrollEvent);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
|
|
3
|
+
<div class="v-table-empty">
|
|
4
|
+
<!--表格无数据的提示信息-->
|
|
5
|
+
<div class="v-table-empty-content"
|
|
6
|
+
:style="{'height':contentHeight+'px','width':width+'px','top':titleHeight+'px'}">
|
|
7
|
+
<div class="v-table-empty-inner"
|
|
8
|
+
:style="{'height':contentHeight+'px','width':'100%','line-height':contentHeight+'px'}"
|
|
9
|
+
v-html="getCurrentContent"></div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<!--表格无数据的滚动条-->
|
|
13
|
+
<div class="v-table-empty-scroll"
|
|
14
|
+
:style="{'height':contentHeight+'px','width':width+'px','top':titleHeight+'px'}">
|
|
15
|
+
<div class="v-table-empty-inner" :style="{'height':'1px','width':totalColumnsWidth+'px'}"></div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
// import utils from "../../src/utils/utils.js";
|
|
24
|
+
|
|
25
|
+
export default{
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
|
|
29
|
+
// 表头的宽度
|
|
30
|
+
titleHeight: [Number, String],
|
|
31
|
+
|
|
32
|
+
// 内容显示的高度
|
|
33
|
+
contentHeight: [Number, String],
|
|
34
|
+
|
|
35
|
+
// 显示的宽度
|
|
36
|
+
width: [Number, String],
|
|
37
|
+
|
|
38
|
+
// 所有列的宽度和
|
|
39
|
+
totalColumnsWidth: [Number, String],
|
|
40
|
+
|
|
41
|
+
// 没数据时显示的内容
|
|
42
|
+
errorContent: {
|
|
43
|
+
type: [String]
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// 是否正在加载
|
|
47
|
+
isLoading: [Boolean]
|
|
48
|
+
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
computed: {
|
|
52
|
+
// 获取当前要显示的内容
|
|
53
|
+
getCurrentContent () {
|
|
54
|
+
|
|
55
|
+
let result = "";
|
|
56
|
+
|
|
57
|
+
if (!this.isLoading) {
|
|
58
|
+
result = this.errorContent;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
data () {
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
|
|
6
|
+
filterSpecialValue: "__all__"
|
|
7
|
+
};
|
|
8
|
+
},
|
|
9
|
+
methods: {
|
|
10
|
+
|
|
11
|
+
// 初始化 columns filters
|
|
12
|
+
initColumnsFilters () {
|
|
13
|
+
|
|
14
|
+
// 如果是复杂表头
|
|
15
|
+
if (this.isComplexTitle) {
|
|
16
|
+
|
|
17
|
+
this.internalTitleRows.forEach(rows => {
|
|
18
|
+
|
|
19
|
+
rows.forEach(col => {
|
|
20
|
+
|
|
21
|
+
if (this.enableFilters(col.filters, col.fields) && !col.filterMultiple) {
|
|
22
|
+
|
|
23
|
+
col.filters.unshift({label: "全部", value: this.filterSpecialValue, selected: true});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
|
|
29
|
+
this.internalColumns.map(col => {
|
|
30
|
+
|
|
31
|
+
if (this.enableFilters(col.filters) && !col.filterMultiple) {
|
|
32
|
+
|
|
33
|
+
col.filters.unshift({label: "全部", value: this.filterSpecialValue, selected: true});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// 单选条件改变
|
|
40
|
+
filterConditionChange (filterMultiple) {
|
|
41
|
+
|
|
42
|
+
// 单选
|
|
43
|
+
if (!filterMultiple) {
|
|
44
|
+
|
|
45
|
+
this.filterSummary();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* 是否包含 filters 功能
|
|
51
|
+
* fields : 当是复杂表头时,必须保证不是 colspan 的列
|
|
52
|
+
* */
|
|
53
|
+
enableFilters (filters, fields) {
|
|
54
|
+
|
|
55
|
+
let result = false;
|
|
56
|
+
|
|
57
|
+
if (Array.isArray(fields) && fields.length > 1) {
|
|
58
|
+
|
|
59
|
+
result = false;
|
|
60
|
+
}
|
|
61
|
+
if (Array.isArray(filters) && filters.length > 0) {
|
|
62
|
+
|
|
63
|
+
result = true;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
filterEvent () {
|
|
69
|
+
|
|
70
|
+
this.filterSummary();
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
filterSummary () {
|
|
74
|
+
|
|
75
|
+
let result = {};
|
|
76
|
+
let columns = [];
|
|
77
|
+
let tempArr = [];
|
|
78
|
+
|
|
79
|
+
// 复杂表头
|
|
80
|
+
if (this.isComplexTitle) {
|
|
81
|
+
|
|
82
|
+
columns = this.internalTitleRows;
|
|
83
|
+
|
|
84
|
+
columns.forEach(rows => {
|
|
85
|
+
|
|
86
|
+
rows.forEach(col => {
|
|
87
|
+
|
|
88
|
+
tempArr = [];
|
|
89
|
+
if (this.enableFilters(col.filters, col.fields)) {
|
|
90
|
+
|
|
91
|
+
col.filters.forEach(f => {
|
|
92
|
+
|
|
93
|
+
if (f.selected && f.value !== this.filterSpecialValue) {
|
|
94
|
+
tempArr.push(f.value);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
result[col.fields[0]] = tempArr.length > 0 ? tempArr : null;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
|
|
104
|
+
columns = this.internalColumns;
|
|
105
|
+
|
|
106
|
+
columns.forEach(col => {
|
|
107
|
+
|
|
108
|
+
tempArr = [];
|
|
109
|
+
if (this.enableFilters(col.filters)) {
|
|
110
|
+
|
|
111
|
+
col.filters.forEach(f => {
|
|
112
|
+
|
|
113
|
+
if (f.selected && f.value !== this.filterSpecialValue) {
|
|
114
|
+
tempArr.push(f.value);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
result[col.field] = tempArr.length > 0 ? tempArr : null;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this.filterMethod && this.filterMethod(result);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import deepClone from "../../src/utils/deepClone.js";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
data () {
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
|
|
8
|
+
footerTotalHeight: 0
|
|
9
|
+
};
|
|
10
|
+
},
|
|
11
|
+
computed: {
|
|
12
|
+
|
|
13
|
+
frozenFooterCols () {
|
|
14
|
+
let result = [];
|
|
15
|
+
if (this.initInternalFooter.length > 0) {
|
|
16
|
+
this.initInternalFooter.forEach(columns => {
|
|
17
|
+
result.push(columns.filter(col => col.isFrozen));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
},
|
|
22
|
+
frozenRightFooterCols () {
|
|
23
|
+
let result = [];
|
|
24
|
+
if (this.initInternalFooter.length > 0) {
|
|
25
|
+
this.initInternalFooter.forEach(columns => {
|
|
26
|
+
result.push(columns.filter(col => col.isFrozenRight));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
},
|
|
31
|
+
noFrozenFooterCols () {
|
|
32
|
+
let result = [];
|
|
33
|
+
|
|
34
|
+
if (this.initInternalFooter.length > 0) {
|
|
35
|
+
|
|
36
|
+
this.initInternalFooter.forEach(columns => {
|
|
37
|
+
|
|
38
|
+
result.push(columns.filter(col => !col.isFrozen || !col.isFrozenRight));
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
getFooterTotalRowHeight () {
|
|
46
|
+
|
|
47
|
+
if (Array.isArray(this.footer) && this.footer.length > 0) {
|
|
48
|
+
|
|
49
|
+
return this.footer.length * this.footerRowHeight;
|
|
50
|
+
}
|
|
51
|
+
return 0;
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
hasTableFooter () {
|
|
55
|
+
|
|
56
|
+
return Array.isArray(this.footer) && this.footer.length;
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
initInternalFooter () {
|
|
60
|
+
|
|
61
|
+
if (!(Array.isArray(this.footer) && this.footer.length > 0)) {
|
|
62
|
+
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let result = [];
|
|
67
|
+
let resultRow = [];
|
|
68
|
+
let cloneInternalColumns;
|
|
69
|
+
|
|
70
|
+
// 防止排序后对原数组进行干扰
|
|
71
|
+
cloneInternalColumns = deepClone(this.internalColumns);
|
|
72
|
+
|
|
73
|
+
cloneInternalColumns.sort(function (a, b) {
|
|
74
|
+
|
|
75
|
+
if (a.isFrozen) {
|
|
76
|
+
|
|
77
|
+
return -1;
|
|
78
|
+
} else if (b.isFrozen) {
|
|
79
|
+
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
return 0;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
this.footer.forEach((items, rows) => {
|
|
86
|
+
|
|
87
|
+
resultRow = [];
|
|
88
|
+
|
|
89
|
+
items.forEach((value, index) => {
|
|
90
|
+
|
|
91
|
+
resultRow.push({
|
|
92
|
+
content: value,
|
|
93
|
+
width: cloneInternalColumns[index].width,
|
|
94
|
+
align: cloneInternalColumns[index].columnAlign,
|
|
95
|
+
isFrozen: !!cloneInternalColumns[index].isFrozen
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
result.push(resultRow);
|
|
100
|
+
});
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
methods: {
|
|
106
|
+
|
|
107
|
+
// 设置 footer 单元格样式
|
|
108
|
+
setFooterCellClassName (isLeftView, rowIndex, colIndex, value) {
|
|
109
|
+
|
|
110
|
+
let _colIndex = colIndex;
|
|
111
|
+
|
|
112
|
+
// 如果是右列,并且有固定列
|
|
113
|
+
if (!isLeftView && this.hasFrozenColumn) {
|
|
114
|
+
|
|
115
|
+
_colIndex += this.frozenCols.length;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return this.footerCellClassName && this.footerCellClassName(rowIndex, _colIndex, value);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
};
|