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,669 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="briGantt">
|
|
3
|
+
<div class="briGantt-top">
|
|
4
|
+
<div class="bri-scrollbar0">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</div>
|
|
7
|
+
<!-- 时间渲染 -->
|
|
8
|
+
<div class="briGantt-timer" :style="{width: clientWidth + 'px'}">
|
|
9
|
+
<a class="briGantt-timer-icon briGantt-timer-icon-left" @click="preTime"><Icon type="ios-arrow-back" /></a>
|
|
10
|
+
<div class="briGantt-timer-bg"></div>
|
|
11
|
+
<div class="bri-scrollbar0 briGantt-timer-main" ref="briGanttTimer" v-on:scroll="handleScroll($event, [{ ref: 'briGanttArea', direction: 'scrollLeft' }])">
|
|
12
|
+
<table :style="{tableLayout:'fixed', width: tableWidth}" class="briGantt-tableBox">
|
|
13
|
+
<thead class="briGantt-table-thead">
|
|
14
|
+
<tr>
|
|
15
|
+
<th class="briGantt-table-th"
|
|
16
|
+
v-for="timeItem in simpleData"
|
|
17
|
+
:key="timeItem.key"
|
|
18
|
+
:colspan="timeItem.colspan"
|
|
19
|
+
:style="{...timeItem.style}"
|
|
20
|
+
>
|
|
21
|
+
<Tooltip :content="timeItem.fullName" placement="top" :transfer="true" :transfer-class-name="`briGantt-transfer-tooltip-${themeName}`">
|
|
22
|
+
{{ timeItem.name }}
|
|
23
|
+
</Tooltip>
|
|
24
|
+
<div v-if="timeItem.now" class="briGantt-line-now"></div>
|
|
25
|
+
</th>
|
|
26
|
+
</tr>
|
|
27
|
+
</thead>
|
|
28
|
+
</table>
|
|
29
|
+
</div>
|
|
30
|
+
<a class="briGantt-timer-icon briGantt-timer-icon-right" @click="nextTime"><Icon type="ios-arrow-forward" /></a>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="briGantt-bottom">
|
|
34
|
+
<div class="briGantt-bottom-title" v-if="title">{{ title }}</div>
|
|
35
|
+
<div class="briGantt-bottom-content">
|
|
36
|
+
<!-- 数据映射 -->
|
|
37
|
+
<div v-if="table" class="bri-scrollbar0 briGantt-tabledata" ref="briGanttColumn" v-on:scroll="handleScroll($event, [{ ref: 'briGanttArea', direction: 'scrollTop' }])">
|
|
38
|
+
<table class="briGantt-tableBox briGantt-table">
|
|
39
|
+
<tbody>
|
|
40
|
+
<tr class="briGantt-table-tr" v-for="(row, rowIndex) in table" :key="rowIndex">
|
|
41
|
+
<td class="briGantt-table-td" v-for="(col, colIndex) in row"
|
|
42
|
+
:key="colIndex"
|
|
43
|
+
:colspan="col.colspan"
|
|
44
|
+
:rowspan="col.rowspan"
|
|
45
|
+
:style="col.rowspan > 1 ? {background: '#fff',padding: '0 10px',fontWeight:500} : {padding: '0 10px'}"
|
|
46
|
+
v-html="col.label"
|
|
47
|
+
></td>
|
|
48
|
+
</tr>
|
|
49
|
+
</tbody>
|
|
50
|
+
</table>
|
|
51
|
+
</div>
|
|
52
|
+
<!-- 区域映射 -->
|
|
53
|
+
<div class="briGantt-data bri-scrollbar" :class="`briGantt-data-${type}`" ref="briGanttArea" v-on:scroll="handleScroll($event, [{ ref: 'briGanttTimer', direction: 'scrollLeft' }, { ref:'briGanttColumn', direction:'scrollTop' }, { ref:'briGanttScrollbar', direction:'scrollLeft' }])">
|
|
54
|
+
<table :style="{tableLayout:'fixed', width: tableWidth}" class="briGantt-tableBox briGantt-table" border="0" cellspacing="0" cellpadding="0" >
|
|
55
|
+
<tr v-if="computedData.length === 0">
|
|
56
|
+
<td :colspan="timeData.length" class="briGantt-table-td">暂无数据</td>
|
|
57
|
+
</tr>
|
|
58
|
+
<tbody v-if="type==='table'">
|
|
59
|
+
<tr v-if="computedData.length === 0">
|
|
60
|
+
<td :colspan="timeData.length" class="briGantt-table-td">暂无数据</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr class="briGantt-table-tr" v-for="(taskItem, taskIndex) in computedData" :key="taskIndex" style="border-left: none">
|
|
63
|
+
<td class="briGantt-table-td"
|
|
64
|
+
v-for="(timeItem, timeIndex) in taskItem"
|
|
65
|
+
:key="timeIndex"
|
|
66
|
+
:colspan="timeItem.colspan"
|
|
67
|
+
>
|
|
68
|
+
<slot v-if="timeItem.isApply" name="table" v-bind:task="timeItem.task" v-bind:time="timeItem"><div class="briGantt-table-td-main" :style="timeItem.style"></div></slot>
|
|
69
|
+
<slot v-else name="tabletd" v-bind:preTime="taskItem[timeIndex-1]" v-bind:nextTime="taskItem[timeIndex+1]" v-bind:task="timeItem.task" v-bind:time="timeItem" ></slot>
|
|
70
|
+
</td>
|
|
71
|
+
</tr>
|
|
72
|
+
</tbody>
|
|
73
|
+
<tbody v-else-if="type==='chart'">
|
|
74
|
+
<tr class="briGantt-chart-tr" v-for="(taskItem, taskIndex) in computedData" :key="taskIndex">
|
|
75
|
+
<td class="briGantt-chart-td"
|
|
76
|
+
v-for="(timeItem, timeIndex) in taskItem"
|
|
77
|
+
:key="timeIndex"
|
|
78
|
+
:colspan="timeItem.colspan">
|
|
79
|
+
<div v-if="timeItem.isApply" class="briGantt-chart-td-main">
|
|
80
|
+
<slot name="chart" v-bind:task="timeItem.task" v-bind:chartItem="timeItem">
|
|
81
|
+
<Tooltip placement="right" transfer :transfer-class-name="`briGantt-transfer-tooltip-${themeName}`" style="width:100%">
|
|
82
|
+
<div
|
|
83
|
+
class="briGantt-chart-td-main-center"
|
|
84
|
+
:style="{
|
|
85
|
+
background:$getColor(timeItem.style.background),
|
|
86
|
+
minWidth: minTdWidth,
|
|
87
|
+
border: `1px solid ${timeItem.style.background}`,
|
|
88
|
+
padding: timeItem.task.progressField == 100 ? '' : '1px'}"
|
|
89
|
+
>
|
|
90
|
+
<slot name="chartCenter" v-bind:task="timeItem.task" v-bind:chartItem="timeItem">
|
|
91
|
+
<div
|
|
92
|
+
class="ms-ellipsis"
|
|
93
|
+
:style="{
|
|
94
|
+
background:timeItem.style.background,
|
|
95
|
+
width: `${timeItem.task.progressField}%`
|
|
96
|
+
}"
|
|
97
|
+
>
|
|
98
|
+
{{ timeItem.task.label }}
|
|
99
|
+
</div>
|
|
100
|
+
</slot>
|
|
101
|
+
</div>
|
|
102
|
+
<div slot="content" class="briGantt-chart-td-main-center-tooltip">
|
|
103
|
+
<span
|
|
104
|
+
class="briGantt-chart-td-main-center-tooltip-select"
|
|
105
|
+
:style="{...timeItem.style}"
|
|
106
|
+
>
|
|
107
|
+
</span>
|
|
108
|
+
{{timeItem.task.select}}
|
|
109
|
+
<div>完成度:{{timeItem.task.progressField}}%</div>
|
|
110
|
+
<div>{{ timeItem.task.label }}</div>
|
|
111
|
+
</div>
|
|
112
|
+
</Tooltip>
|
|
113
|
+
</slot>
|
|
114
|
+
</div>
|
|
115
|
+
<slot v-else name="charttd"
|
|
116
|
+
v-bind:task="timeItem.task"
|
|
117
|
+
v-bind:time="timeItem"
|
|
118
|
+
v-bind:preTime="taskItem[timeIndex-1]"
|
|
119
|
+
v-bind:nextTime="taskItem[timeIndex+1]">
|
|
120
|
+
<div class="briGantt-chart-td-greyLine"></div>
|
|
121
|
+
</slot>
|
|
122
|
+
</td>
|
|
123
|
+
</tr>
|
|
124
|
+
</tbody>
|
|
125
|
+
</table>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<!-- 底部滚动条 -->
|
|
130
|
+
<!-- <div class="briGantt-scrollbar">
|
|
131
|
+
<div class="briGantt-scrollbar-main bri-scrollbar"
|
|
132
|
+
ref="briGanttScrollbar"
|
|
133
|
+
:style="{ width: clientWidth + 'px' }"
|
|
134
|
+
v-on:scroll="handleScroll($event, [{ ref: 'briGanttTimer', direction: 'scrollLeft' }, { ref:'briGanttArea', direction:'scrollLeft' }, { ref:'briGanttBlue', direction:'scrollLeft' }])">
|
|
135
|
+
<div :style="{width: tableWidth}"></div>
|
|
136
|
+
</div>
|
|
137
|
+
</div> -->
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</template>
|
|
141
|
+
<script>
|
|
142
|
+
function getDate (hours) {
|
|
143
|
+
const currentDate = new Date();
|
|
144
|
+
const currentYear = currentDate.getFullYear();
|
|
145
|
+
const currentMonth = currentDate.getMonth();
|
|
146
|
+
const currentDay = currentDate.getDate();
|
|
147
|
+
const timeStamp = new Date(
|
|
148
|
+
currentYear,
|
|
149
|
+
currentMonth,
|
|
150
|
+
currentDay,
|
|
151
|
+
0,
|
|
152
|
+
0,
|
|
153
|
+
0
|
|
154
|
+
).getTime();
|
|
155
|
+
return new Date(timeStamp + hours * 60 * 60 * 1000).getTime();
|
|
156
|
+
}
|
|
157
|
+
function getMonth (N) {
|
|
158
|
+
const currentDate = new Date();
|
|
159
|
+
const currentYear = currentDate.getFullYear();
|
|
160
|
+
const currentMonth = currentDate.getMonth();
|
|
161
|
+
return new Date(currentYear, currentMonth + N, 1).getTime();
|
|
162
|
+
}
|
|
163
|
+
// 示例数据
|
|
164
|
+
let tasks = [
|
|
165
|
+
{
|
|
166
|
+
id: 1,
|
|
167
|
+
label: "Make some noise",
|
|
168
|
+
user:
|
|
169
|
+
'<a href="https://www.google.com/search?q=John+Doe" target="_blank" style="color:#0077c0;">John Doe</a>',
|
|
170
|
+
start: getDate(-24 * 5),
|
|
171
|
+
end: getDate(0),
|
|
172
|
+
select: "紧急",
|
|
173
|
+
duration: 15 * 24 * 60 * 60 * 1000,
|
|
174
|
+
percent: 85,
|
|
175
|
+
type: "project",
|
|
176
|
+
style: {
|
|
177
|
+
background: "orange",
|
|
178
|
+
main: "rgba(109,174,242,1)"
|
|
179
|
+
}
|
|
180
|
+
// collapsed: true,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 2,
|
|
184
|
+
label: "With great power comes great responsibility",
|
|
185
|
+
user:
|
|
186
|
+
'<a href="https://www.google.com/search?q=Peter+Parker" target="_blank" style="color:#0077c0;">Peter Parker</a>',
|
|
187
|
+
parentId: 1,
|
|
188
|
+
start: getDate(-24 * 20),
|
|
189
|
+
duration: 20 * 24 * 60 * 60 * 1000,
|
|
190
|
+
percent: 50,
|
|
191
|
+
select: "重要",
|
|
192
|
+
type: "milestone",
|
|
193
|
+
collapsed: true,
|
|
194
|
+
style: {
|
|
195
|
+
background: "red",
|
|
196
|
+
main: "rgba(240,143,145,1)"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: 3,
|
|
201
|
+
label: "Courage is being scared to death, but saddling up anyway.",
|
|
202
|
+
user:
|
|
203
|
+
'<a href="https://www.google.com/search?q=John+Wayne" target="_blank" style="color:#0077c0;">John Wayne</a>',
|
|
204
|
+
parentId: 2,
|
|
205
|
+
select: "普通",
|
|
206
|
+
start: getDate(-24 * 3),
|
|
207
|
+
duration: 2 * 24 * 60 * 60 * 1000,
|
|
208
|
+
percent: 100,
|
|
209
|
+
type: "task",
|
|
210
|
+
style: {
|
|
211
|
+
background: "rgba(255,248,242,1)",
|
|
212
|
+
main: "rgba(255,190,114,1)"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: 4,
|
|
217
|
+
label: "Put that toy AWAY!",
|
|
218
|
+
user:
|
|
219
|
+
'<a href="https://www.google.com/search?q=Clark+Kent" target="_blank" style="color:#0077c0;">Clark Kent</a>',
|
|
220
|
+
start: getDate(-24 * 2),
|
|
221
|
+
duration: 2 * 24 * 60 * 60 * 1000,
|
|
222
|
+
select: "紧急",
|
|
223
|
+
percent: 50,
|
|
224
|
+
type: "task",
|
|
225
|
+
dependentOn: [3],
|
|
226
|
+
style: {
|
|
227
|
+
background: "rgba(235,248,240,1)",
|
|
228
|
+
main: "rgba(137,213,166,1)"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: 5,
|
|
233
|
+
label: "Put that toy AWAY!",
|
|
234
|
+
select: "紧急",
|
|
235
|
+
user:
|
|
236
|
+
'<a href="https://www.google.com/search?q=Clark+Kent" target="_blank" style="color:#0077c0;">Clark Kent</a>',
|
|
237
|
+
start: getDate(1 * 24),
|
|
238
|
+
end: getDate(1 * 24),
|
|
239
|
+
// duration: 1 * 24 * 60 * 60 * 1000,
|
|
240
|
+
percent: 50,
|
|
241
|
+
type: "task",
|
|
242
|
+
dependentOn: [3],
|
|
243
|
+
style: {
|
|
244
|
+
background: "rgba(235,248,240,1)",
|
|
245
|
+
main: "rgba(137,213,166,1)"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
];
|
|
249
|
+
|
|
250
|
+
export default {
|
|
251
|
+
name: "briGantt",
|
|
252
|
+
components: {},
|
|
253
|
+
props: {
|
|
254
|
+
tasks: Array,
|
|
255
|
+
options: {
|
|
256
|
+
type: Object,
|
|
257
|
+
default () {
|
|
258
|
+
return {};
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
value: {
|
|
262
|
+
type: Object,
|
|
263
|
+
default () {
|
|
264
|
+
return {};
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
propsObj: {
|
|
268
|
+
type: Object,
|
|
269
|
+
default () {
|
|
270
|
+
return {};
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
// 是否展示示例数据
|
|
274
|
+
showEs: {
|
|
275
|
+
type: Boolean,
|
|
276
|
+
default: false
|
|
277
|
+
},
|
|
278
|
+
title: String,
|
|
279
|
+
// 展示类型, 分图标和表格,默认表格
|
|
280
|
+
type: {
|
|
281
|
+
type: String,
|
|
282
|
+
default: "table"
|
|
283
|
+
},
|
|
284
|
+
dimension: {
|
|
285
|
+
type: String,
|
|
286
|
+
default: "quarter"
|
|
287
|
+
},
|
|
288
|
+
showCloumns: {
|
|
289
|
+
type: Boolean,
|
|
290
|
+
default: true
|
|
291
|
+
},
|
|
292
|
+
table: Array,
|
|
293
|
+
// 距离今天个数
|
|
294
|
+
count: {
|
|
295
|
+
type: Number,
|
|
296
|
+
default: 5
|
|
297
|
+
},
|
|
298
|
+
// 展示日期间隔
|
|
299
|
+
step: {
|
|
300
|
+
type: Number,
|
|
301
|
+
default: 1
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
computed: {
|
|
305
|
+
// 默认列表
|
|
306
|
+
defaultTasks () {
|
|
307
|
+
if (this.showEs) {
|
|
308
|
+
return tasks;
|
|
309
|
+
} else {
|
|
310
|
+
return this.tasks || [];
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
// 表格宽度
|
|
314
|
+
tableWidth () {
|
|
315
|
+
let timeDataWidth = this.simpleData.length * 50;
|
|
316
|
+
let clientWidth = this.clientWidth;
|
|
317
|
+
if (this.computedCountStep.stepKind === "month") {
|
|
318
|
+
timeDataWidth = this.timeData.length * 3;
|
|
319
|
+
}
|
|
320
|
+
if (timeDataWidth < clientWidth) {
|
|
321
|
+
return "100%";
|
|
322
|
+
} else {
|
|
323
|
+
return timeDataWidth + "px";
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
minTdWidth () {
|
|
327
|
+
let minWidth = 2;
|
|
328
|
+
if (this.tableWidth.includes("px")) {
|
|
329
|
+
minWidth = parseInt(this.tableWidth) / this.timeData.length;
|
|
330
|
+
} else {
|
|
331
|
+
minWidth = parseInt(this.clientWidth) / this.timeData.length;
|
|
332
|
+
}
|
|
333
|
+
minWidth > 20 && (minWidth = 2);
|
|
334
|
+
return minWidth + "px";
|
|
335
|
+
},
|
|
336
|
+
// 间隔及时间,当前选择时间维度
|
|
337
|
+
computedCountStep () {
|
|
338
|
+
this.refreshStepCount();
|
|
339
|
+
return this.dimensionObject[this.dimension] || { count: this.count, step: this.step };
|
|
340
|
+
},
|
|
341
|
+
// 任务数据
|
|
342
|
+
taskData () {
|
|
343
|
+
/**
|
|
344
|
+
* task 默认数据
|
|
345
|
+
*/
|
|
346
|
+
let tasks = this.defaultTasks;
|
|
347
|
+
for (let task of tasks) {
|
|
348
|
+
if (typeof task.x === "undefined") {
|
|
349
|
+
task.x = 0;
|
|
350
|
+
}
|
|
351
|
+
if (typeof task.y === "undefined") {
|
|
352
|
+
task.y = 0;
|
|
353
|
+
}
|
|
354
|
+
if (typeof task.width === "undefined") {
|
|
355
|
+
task.width = 0;
|
|
356
|
+
}
|
|
357
|
+
if (typeof task.height === "undefined") {
|
|
358
|
+
task.height = 0;
|
|
359
|
+
}
|
|
360
|
+
if (typeof task.mouseOver === "undefined") {
|
|
361
|
+
task.mouseOver = false;
|
|
362
|
+
}
|
|
363
|
+
if (typeof task.collapsed === "undefined") {
|
|
364
|
+
task.collapsed = false;
|
|
365
|
+
}
|
|
366
|
+
if (typeof task.dependentOn === "undefined") {
|
|
367
|
+
task.dependentOn = [];
|
|
368
|
+
}
|
|
369
|
+
if (typeof task.parentId === "undefined") {
|
|
370
|
+
task.parentId = null;
|
|
371
|
+
}
|
|
372
|
+
if (typeof task.style === "undefined") {
|
|
373
|
+
task.style = {};
|
|
374
|
+
}
|
|
375
|
+
if (typeof task.children === "undefined") {
|
|
376
|
+
task.children = [];
|
|
377
|
+
}
|
|
378
|
+
if (typeof task.allChildren === "undefined") {
|
|
379
|
+
task.allChildren = [];
|
|
380
|
+
}
|
|
381
|
+
if (typeof task.parents === "undefined") {
|
|
382
|
+
task.parents = [];
|
|
383
|
+
}
|
|
384
|
+
if (typeof task.parent === "undefined") {
|
|
385
|
+
task.parent = null;
|
|
386
|
+
}
|
|
387
|
+
if (typeof task.startTime === "undefined") {
|
|
388
|
+
task.startTime = new Date(task.start).valueOf();
|
|
389
|
+
}
|
|
390
|
+
if (typeof task.endTime === "undefined" && task.hasOwnProperty("end")) {
|
|
391
|
+
task.endTime = new Date(task.end).valueOf();
|
|
392
|
+
} else if (typeof task.endTime === "undefined" && task.hasOwnProperty("duration")) {
|
|
393
|
+
task.endTime = task.startTime + task.duration - (1 * 24 * 60 * 60 * 1000);
|
|
394
|
+
}
|
|
395
|
+
if (typeof task.duration === "undefined" && task.hasOwnProperty("endTime")) {
|
|
396
|
+
task.duration = task.endTime - task.startTime;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return tasks;
|
|
400
|
+
},
|
|
401
|
+
// 时间数据
|
|
402
|
+
simpleData () {
|
|
403
|
+
// 小于今天
|
|
404
|
+
let { count, step, stepKind } = this.computedCountStep;
|
|
405
|
+
let data = [
|
|
406
|
+
{ key: getDate(0),
|
|
407
|
+
endKey: getDate((step - 1) * 24 + 23.9999),
|
|
408
|
+
name: "今天",
|
|
409
|
+
colspan: 1,
|
|
410
|
+
fullName: this.dateFormat(getDate(0), "yyyy-MM-dd"),
|
|
411
|
+
style: { color: this.$store.getters.systemConfig.themeColor, fontWeight: 500 },
|
|
412
|
+
now: true
|
|
413
|
+
}
|
|
414
|
+
];
|
|
415
|
+
let preCount = this.preCount * count + count;
|
|
416
|
+
let nextCount = this.nextCount * count + count;
|
|
417
|
+
for (let i = -step; i >= -(preCount * step); i -= step) {
|
|
418
|
+
let key = stepKind === "month" ? getMonth(i) : getDate(i * 24);
|
|
419
|
+
data.unshift({
|
|
420
|
+
colspan: 1,
|
|
421
|
+
key: key,
|
|
422
|
+
endKey: getDate((i + step - 1) * 24 + 23.9999),
|
|
423
|
+
name: this.getDayName(key, stepKind),
|
|
424
|
+
fullName: this.dateFormat(key, "yyyy-MM-dd"),
|
|
425
|
+
style: this.dateFormat(key, "d") == "1" && { fontWeight: 500 }
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
// 大于今天
|
|
429
|
+
for (let i = step; i <= nextCount * step; i += step) {
|
|
430
|
+
let key = stepKind === "month" ? getMonth(i) : getDate(i * 24);
|
|
431
|
+
data.push({
|
|
432
|
+
colspan: 1,
|
|
433
|
+
key: key,
|
|
434
|
+
endKey: getDate((i + step - 1) * 24 + 23.9999),
|
|
435
|
+
name: this.getDayName(key, stepKind),
|
|
436
|
+
fullName: this.dateFormat(key, "yyyy-MM-dd"),
|
|
437
|
+
style: this.dateFormat(key, "d") == "1" && { fontWeight: 500 }
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
return data;
|
|
441
|
+
},
|
|
442
|
+
timeData () {
|
|
443
|
+
let { count, step, stepKind } = this.computedCountStep;
|
|
444
|
+
let data = [];
|
|
445
|
+
let preCount = this.preCount * count + count;
|
|
446
|
+
let nextCount = this.nextCount * count + count;
|
|
447
|
+
let startTime = -(preCount * step); // 个数
|
|
448
|
+
let endTime = nextCount * step;
|
|
449
|
+
// 年度以月为分隔符
|
|
450
|
+
if (stepKind === "month") {
|
|
451
|
+
startTime = (getMonth(-preCount) - getMonth(0)) / 24 / 60 / 60 / 1000;
|
|
452
|
+
endTime = (getMonth(nextCount) - getMonth(0)) / 24 / 60 / 60 / 1000;
|
|
453
|
+
}
|
|
454
|
+
for (let i = startTime; i <= endTime; i++) {
|
|
455
|
+
let key = getDate(i * 24);
|
|
456
|
+
data.push({
|
|
457
|
+
now: this.dateFormat(key, "yyyy-MM-dd") === this.dateFormat(new Date(), "yyyy-MM-dd"),
|
|
458
|
+
key: key,
|
|
459
|
+
endKey: getDate(i * 24 + 23.9999),
|
|
460
|
+
name: this.getDayName(key, stepKind),
|
|
461
|
+
fullName: this.dateFormat(key, "yyyy-MM-dd")
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
return data;
|
|
465
|
+
},
|
|
466
|
+
// 任务时间结合数据
|
|
467
|
+
computedData () {
|
|
468
|
+
return this.taskData.map(taskItem => {
|
|
469
|
+
let tr = [];
|
|
470
|
+
this.timeData.forEach(timeItem => {
|
|
471
|
+
let flag = this.filterTaskDate(taskItem, timeItem);
|
|
472
|
+
if (flag) {
|
|
473
|
+
let isEndStep = new Date(timeItem.endKey) > new Date(taskItem.endTime);
|
|
474
|
+
if (tr[tr.length - 1] && tr[tr.length - 1].isApply) {
|
|
475
|
+
tr[tr.length - 1].colspan++;
|
|
476
|
+
// 判断是不是结束日期,当前节点日期startEnd endTime, endKey
|
|
477
|
+
if (isEndStep) {
|
|
478
|
+
tr[tr.length - 1].isEndStep = isEndStep;
|
|
479
|
+
}
|
|
480
|
+
} else {
|
|
481
|
+
let defaultStyle = {
|
|
482
|
+
background: "rgba(232,243,253,1)",
|
|
483
|
+
border: "1px solid rgba(109,174,242,1)",
|
|
484
|
+
main: "rgba(109,174,242,1)"
|
|
485
|
+
};
|
|
486
|
+
let obj = {
|
|
487
|
+
colspan: 1,
|
|
488
|
+
...timeItem,
|
|
489
|
+
style: taskItem.style || defaultStyle,
|
|
490
|
+
task: taskItem,
|
|
491
|
+
isApply: true
|
|
492
|
+
};
|
|
493
|
+
if (isEndStep) {
|
|
494
|
+
obj.isEndStep = isEndStep;
|
|
495
|
+
}
|
|
496
|
+
tr.push(obj);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
} else {
|
|
500
|
+
let obj = {
|
|
501
|
+
colspan: 1,
|
|
502
|
+
...timeItem,
|
|
503
|
+
task: taskItem,
|
|
504
|
+
isApply: false
|
|
505
|
+
};
|
|
506
|
+
tr.push(obj);
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
return tr;
|
|
510
|
+
});
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
theme () {
|
|
514
|
+
return this.propsObj.theme || {};
|
|
515
|
+
},
|
|
516
|
+
themeName () {
|
|
517
|
+
return this.theme.name;
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
data () {
|
|
521
|
+
return {
|
|
522
|
+
// 当前客户端宽度
|
|
523
|
+
clientWidth: 0,
|
|
524
|
+
// 向下点了几次
|
|
525
|
+
nextCount: 0,
|
|
526
|
+
// 向上点了几次
|
|
527
|
+
preCount: 0,
|
|
528
|
+
// 时间维度
|
|
529
|
+
dimensionObject: {
|
|
530
|
+
doubleWeek: { name: "按周", count: 3, step: 1, stepKind: "day" },
|
|
531
|
+
week: { name: "双周", count: 7, step: 1, stepKind: "day" },
|
|
532
|
+
month: { name: "按月", count: 7, step: 2, stepKind: "day" },
|
|
533
|
+
quarter: { name: "季度", count: 9, step: 5, stepKind: "day" },
|
|
534
|
+
year: { name: "按年", count: 6, step: 1, stepKind: "month" }
|
|
535
|
+
},
|
|
536
|
+
nowOffsetLeft: 0
|
|
537
|
+
};
|
|
538
|
+
},
|
|
539
|
+
created () {
|
|
540
|
+
this.init();
|
|
541
|
+
},
|
|
542
|
+
mounted () {
|
|
543
|
+
// 宽度调整
|
|
544
|
+
window.onresize = this.refreshWidth;
|
|
545
|
+
},
|
|
546
|
+
methods: {
|
|
547
|
+
init () {
|
|
548
|
+
// 赋初值
|
|
549
|
+
setTimeout(() => {
|
|
550
|
+
this.refreshWidth();
|
|
551
|
+
});
|
|
552
|
+
},
|
|
553
|
+
// 比较时间
|
|
554
|
+
filterTaskDate (taskItem, timeItem) {
|
|
555
|
+
let flag = (new Date(taskItem.startTime) <= new Date(timeItem.endKey)) && (taskItem.endTime ? ((new Date(timeItem.key) <= new Date(taskItem.endTime))) : taskItem.endInfinite);
|
|
556
|
+
return flag;
|
|
557
|
+
},
|
|
558
|
+
// 获得日期显示格式
|
|
559
|
+
getDayName (key, stepKind) {
|
|
560
|
+
let name = this.dateFormat(key, "M月d日");
|
|
561
|
+
if (name === "1日") {
|
|
562
|
+
name = this.dateFormat(key, "M月d日");
|
|
563
|
+
}
|
|
564
|
+
if (stepKind === "month") {
|
|
565
|
+
name = this.dateFormat(key, "M月");
|
|
566
|
+
if (name === "1月") {
|
|
567
|
+
name = `${this.dateFormat(key, "yyyy年M月")}`;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return name;
|
|
571
|
+
},
|
|
572
|
+
// 左右按钮重置
|
|
573
|
+
refreshStepCount () {
|
|
574
|
+
this.preCount = 0;
|
|
575
|
+
this.nextCount = 0;
|
|
576
|
+
},
|
|
577
|
+
// 重新计算宽度
|
|
578
|
+
refreshWidth () {
|
|
579
|
+
this.clientWidth = this.$refs.briGanttArea ? this.$refs.briGanttArea.clientWidth : 0;
|
|
580
|
+
},
|
|
581
|
+
// 重新渲染
|
|
582
|
+
refresh () {
|
|
583
|
+
|
|
584
|
+
},
|
|
585
|
+
dateFormat (date, fmt) {
|
|
586
|
+
let time = new Date(date);
|
|
587
|
+
let o = {
|
|
588
|
+
"M+": time.getMonth() + 1, // 月份
|
|
589
|
+
"d+": time.getDate(), // 日
|
|
590
|
+
"h+": time.getHours(), // 小时
|
|
591
|
+
"m+": time.getMinutes(), // 分
|
|
592
|
+
"s+": time.getSeconds(), // 秒
|
|
593
|
+
"q+": Math.floor((time.getMonth() + 3) / 3), // 季度
|
|
594
|
+
"S": time.getMilliseconds() // 毫秒
|
|
595
|
+
};
|
|
596
|
+
if (/(y+)/.test(fmt)) {
|
|
597
|
+
fmt = fmt.replace(RegExp.$1, (time.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
598
|
+
}
|
|
599
|
+
for (let k in o) {
|
|
600
|
+
if (new RegExp("(" + k + ")").test(fmt)) {
|
|
601
|
+
fmt = fmt.replace(
|
|
602
|
+
RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return fmt;
|
|
606
|
+
},
|
|
607
|
+
// 绑定同步滚动
|
|
608
|
+
handleScroll (el, scrollList) {
|
|
609
|
+
scrollList.forEach(({ref, direction} = item) => {
|
|
610
|
+
this.$refs[ref] && (this.$refs[ref][direction] = el.target[direction]);
|
|
611
|
+
});
|
|
612
|
+
},
|
|
613
|
+
// 点击上一节点
|
|
614
|
+
preTime () {
|
|
615
|
+
let briGanttTimer = this.$refs.briGanttTimer;
|
|
616
|
+
let timerWidth = briGanttTimer.clientWidth; // 盒子宽度
|
|
617
|
+
let scrollLeft = briGanttTimer.scrollLeft; // 滚动距离
|
|
618
|
+
if (scrollLeft === 0) {
|
|
619
|
+
// 已经滑到尽头,加载时间数据
|
|
620
|
+
this.preCount++;
|
|
621
|
+
this.$nextTick(() => {
|
|
622
|
+
this.slideTo(briGanttTimer, scrollLeft - timerWidth);
|
|
623
|
+
});
|
|
624
|
+
} else {
|
|
625
|
+
this.slideTo(briGanttTimer, scrollLeft - timerWidth);
|
|
626
|
+
}
|
|
627
|
+
},
|
|
628
|
+
// 点击下一节点
|
|
629
|
+
nextTime () {
|
|
630
|
+
let briGanttTimer = this.$refs.briGanttTimer;
|
|
631
|
+
let timerWidth = briGanttTimer.clientWidth; // 盒子宽度
|
|
632
|
+
let tableWidth = parseInt(this.tableWidth); // table 总宽度
|
|
633
|
+
let scrollLeft = briGanttTimer.scrollLeft; // 滚动距离
|
|
634
|
+
let distance = tableWidth - timerWidth; // 当前滚动条距离顶部的距离
|
|
635
|
+
if (scrollLeft < distance) {
|
|
636
|
+
// 未滑到尽头
|
|
637
|
+
this.slideTo(briGanttTimer, scrollLeft + timerWidth);
|
|
638
|
+
} else {
|
|
639
|
+
// 已经滑到尽头,加载时间数据
|
|
640
|
+
this.nextCount++;
|
|
641
|
+
this.$nextTick(() => {
|
|
642
|
+
this.slideTo(briGanttTimer, scrollLeft + timerWidth);
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
// 滚动到指定位置 增加滚动效果
|
|
647
|
+
slideTo (ref, target) {
|
|
648
|
+
let currScrollLeft = ref.scrollLeft; // 当前的距离
|
|
649
|
+
let distance = target - currScrollLeft;
|
|
650
|
+
let speed = distance / 10; // 每时刻速度
|
|
651
|
+
let speedTarget = currScrollLeft + speed;
|
|
652
|
+
let timer = setInterval(function () {
|
|
653
|
+
if (distance > 0 ? (speedTarget > target) : (speedTarget < target)) {
|
|
654
|
+
clearInterval(timer);
|
|
655
|
+
} else {
|
|
656
|
+
ref.scrollTo(speedTarget, 0);
|
|
657
|
+
speedTarget += speed;
|
|
658
|
+
}
|
|
659
|
+
}, 10);
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
filters: {
|
|
663
|
+
|
|
664
|
+
},
|
|
665
|
+
destroyed () {
|
|
666
|
+
window.onresize = null;
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
</script>
|