doway-coms 1.1.75 → 1.1.77
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/package.json +50 -50
- package/packages/BaseGantt/index.js +10 -0
- package/packages/BaseGantt/src/index.vue +580 -0
- package/packages/BaseGridAdjust/index.js +10 -0
- package/packages/BaseGridAdjust/src/index.vue +158 -0
- package/packages/BasePulldown/src/index.vue +8 -8
- package/packages/index.js +3 -1
- package/dist/css/chunk-vendors.7f83d8f9.css +0 -8
- package/dist/css/index.7946d50b.css +0 -1
- package/dist/favicon.ico +0 -0
- package/dist/js/chunk-vendors.28fda91d.js +0 -340
- package/dist/js/index.49bc6add.js +0 -2
- package/lib/doway-coms.common.js +0 -120397
- package/lib/doway-coms.css +0 -1
- package/lib/doway-coms.umd.js +0 -120407
- package/lib/doway-coms.umd.min.js +0 -328
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "doway-coms",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "doway组件库",
|
|
5
|
-
"author": "dowaysoft",
|
|
6
|
-
"main": "packages/index.js",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"dev": "vue-cli-service serve",
|
|
10
|
-
"build": "vue-cli-service build",
|
|
11
|
-
"lint": "vue-cli-service lint",
|
|
12
|
-
"lib": "vue-cli-service build --target lib --name doway-coms --dest lib packages/index.js",
|
|
13
|
-
"build:test": "vue-cli-service build --report"
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"vue
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"xe-
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@vue/cli-plugin-babel": "~4.2.0",
|
|
30
|
-
"@vue/cli-plugin-eslint": "~4.2.0",
|
|
31
|
-
"@vue/cli-plugin-vuex": "~4.2.0",
|
|
32
|
-
"@vue/cli-service": "~4.2.0",
|
|
33
|
-
"babel-eslint": "^10.0.3",
|
|
34
|
-
"babel-plugin-component": "^1.1.1",
|
|
35
|
-
"babel-plugin-import": "^1.13.6",
|
|
36
|
-
"eslint": "^6.7.2",
|
|
37
|
-
"eslint-plugin-vue": "^6.1.2",
|
|
38
|
-
"extract-text-webpack-plugin": "^3.0.2",
|
|
39
|
-
"less-loader": "^6.0.0",
|
|
40
|
-
"node-sass": "8.0.0",
|
|
41
|
-
"sass-loader": "10.4.1",
|
|
42
|
-
"vue-template-compiler": "^2.6.11"
|
|
43
|
-
},
|
|
44
|
-
"bundleDependencies":false,
|
|
45
|
-
"repository": {
|
|
46
|
-
"type": "git",
|
|
47
|
-
"url": "https://www.npmjs.com/package/doway-coms.git"
|
|
48
|
-
},
|
|
49
|
-
"keywords": []
|
|
50
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "doway-coms",
|
|
3
|
+
"version": "1.1.77",
|
|
4
|
+
"description": "doway组件库",
|
|
5
|
+
"author": "dowaysoft",
|
|
6
|
+
"main": "packages/index.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "vue-cli-service serve",
|
|
10
|
+
"build": "vue-cli-service build",
|
|
11
|
+
"lint": "vue-cli-service lint",
|
|
12
|
+
"lib": "vue-cli-service build --target lib --name doway-coms --dest lib packages/index.js",
|
|
13
|
+
"build:test": "vue-cli-service build --report"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"ant-design-vue": "1.7.8",
|
|
17
|
+
"axios": "0.18.0",
|
|
18
|
+
"js-cookie": "2.2.0",
|
|
19
|
+
"vee-validate": "3.4.14",
|
|
20
|
+
"vue": "2.7.14",
|
|
21
|
+
"vue-router": "3.6.5",
|
|
22
|
+
"vuedraggable": "^2.24.3",
|
|
23
|
+
"vuex": "3.6.2",
|
|
24
|
+
"vxe-table": "3.5.4",
|
|
25
|
+
"xe-clipboard": "1.10.2",
|
|
26
|
+
"xe-utils": "3.5.4"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@vue/cli-plugin-babel": "~4.2.0",
|
|
30
|
+
"@vue/cli-plugin-eslint": "~4.2.0",
|
|
31
|
+
"@vue/cli-plugin-vuex": "~4.2.0",
|
|
32
|
+
"@vue/cli-service": "~4.2.0",
|
|
33
|
+
"babel-eslint": "^10.0.3",
|
|
34
|
+
"babel-plugin-component": "^1.1.1",
|
|
35
|
+
"babel-plugin-import": "^1.13.6",
|
|
36
|
+
"eslint": "^6.7.2",
|
|
37
|
+
"eslint-plugin-vue": "^6.1.2",
|
|
38
|
+
"extract-text-webpack-plugin": "^3.0.2",
|
|
39
|
+
"less-loader": "^6.0.0",
|
|
40
|
+
"node-sass": "8.0.0",
|
|
41
|
+
"sass-loader": "10.4.1",
|
|
42
|
+
"vue-template-compiler": "^2.6.11"
|
|
43
|
+
},
|
|
44
|
+
"bundleDependencies": false,
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://www.npmjs.com/package/doway-coms.git"
|
|
48
|
+
},
|
|
49
|
+
"keywords": []
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// 导入组件,组件必须声明 name
|
|
2
|
+
import BaseGantt from './src/index.vue';
|
|
3
|
+
import VXETable from 'vxe-table'
|
|
4
|
+
// 为组件提供 install 安装方法,供按需引入
|
|
5
|
+
BaseGantt.install = function(Vue) {
|
|
6
|
+
Vue.use(VXETable)
|
|
7
|
+
Vue.component(BaseGantt.name, BaseGantt);
|
|
8
|
+
};
|
|
9
|
+
// 默认导出组件
|
|
10
|
+
export default BaseGantt;
|
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div style="display: flex">
|
|
4
|
+
<div style="flex: 1">
|
|
5
|
+
<slot name="toolLeftContent"></slot>
|
|
6
|
+
</div>
|
|
7
|
+
<div>
|
|
8
|
+
<a-space>
|
|
9
|
+
<a-radio-group
|
|
10
|
+
:size="'small'"
|
|
11
|
+
v-model="timeViewValue"
|
|
12
|
+
button-style="solid"
|
|
13
|
+
@change="timeViewChange"
|
|
14
|
+
>
|
|
15
|
+
<a-radio-button value="day">
|
|
16
|
+
天
|
|
17
|
+
</a-radio-button>
|
|
18
|
+
<a-radio-button value="1">
|
|
19
|
+
1小时
|
|
20
|
+
</a-radio-button>
|
|
21
|
+
<a-radio-button value="2">
|
|
22
|
+
2小时
|
|
23
|
+
</a-radio-button>
|
|
24
|
+
<a-radio-button value="4">
|
|
25
|
+
4小时
|
|
26
|
+
</a-radio-button>
|
|
27
|
+
<a-radio-button value="8">
|
|
28
|
+
8小时
|
|
29
|
+
</a-radio-button>
|
|
30
|
+
<a-radio-button value="12">
|
|
31
|
+
12小时
|
|
32
|
+
</a-radio-button>
|
|
33
|
+
</a-radio-group>
|
|
34
|
+
</a-space>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<vxe-grid
|
|
38
|
+
border
|
|
39
|
+
show-header-overflow
|
|
40
|
+
ref="headDay"
|
|
41
|
+
class="head-grid"
|
|
42
|
+
:size="'small'"
|
|
43
|
+
header-cell-class-name="header-cell-day"
|
|
44
|
+
>
|
|
45
|
+
<template #customSearchHeader>
|
|
46
|
+
<vxe-input
|
|
47
|
+
v-model="searchValue"
|
|
48
|
+
placeholder="搜索"
|
|
49
|
+
type="search"
|
|
50
|
+
@input="onSearch"
|
|
51
|
+
></vxe-input>
|
|
52
|
+
</template>
|
|
53
|
+
<template #dateWeekHeader="{ column }">
|
|
54
|
+
<div>
|
|
55
|
+
<div>{{ column.params.date }}</div>
|
|
56
|
+
<div>{{ column.params.week }}</div>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
</vxe-grid>
|
|
60
|
+
<vxe-grid
|
|
61
|
+
border
|
|
62
|
+
show-header-overflow
|
|
63
|
+
ref="headHour"
|
|
64
|
+
class="head-grid"
|
|
65
|
+
:size="'small'"
|
|
66
|
+
v-show="hourCols.length > 0"
|
|
67
|
+
>
|
|
68
|
+
</vxe-grid>
|
|
69
|
+
|
|
70
|
+
<!-- <div class="gantt-line-area" ref="lineArea">
|
|
71
|
+
<div
|
|
72
|
+
class="gantt-line"
|
|
73
|
+
v-for="loopLine in lines"
|
|
74
|
+
:key="loopLine"
|
|
75
|
+
:style="{ left: loopLine + 'px', height: lineHeight + 'px' }"
|
|
76
|
+
></div>
|
|
77
|
+
</div> -->
|
|
78
|
+
<div
|
|
79
|
+
class="gantt-bar-tooltip"
|
|
80
|
+
v-if="ganttBarTooltip.show === true"
|
|
81
|
+
:style="{
|
|
82
|
+
left: ganttBarTooltip.left + 'px',
|
|
83
|
+
top: ganttBarTooltip.top + 'px'
|
|
84
|
+
}"
|
|
85
|
+
>
|
|
86
|
+
<slot name="itemTip" :item="ganttBarTooltip.item"></slot>
|
|
87
|
+
</div>
|
|
88
|
+
<vxe-grid
|
|
89
|
+
border
|
|
90
|
+
resizable
|
|
91
|
+
auto-resize
|
|
92
|
+
ref="bodyGrid"
|
|
93
|
+
show-overflow
|
|
94
|
+
class="mytable-scrollbar"
|
|
95
|
+
:show-header="false"
|
|
96
|
+
:size="'small'"
|
|
97
|
+
:height="computedHeight"
|
|
98
|
+
:row-config="{
|
|
99
|
+
isCurrent: isCurrent,
|
|
100
|
+
isHover: true
|
|
101
|
+
}"
|
|
102
|
+
:cell-class-name="cellClassName"
|
|
103
|
+
:row-class-name="rowClassName"
|
|
104
|
+
@cell-click="cellClick"
|
|
105
|
+
@scroll="bodyScroll"
|
|
106
|
+
:loading="loading"
|
|
107
|
+
@filter-change="filterChangeEvent"
|
|
108
|
+
>
|
|
109
|
+
<template #content="{ row, rowIndex }">
|
|
110
|
+
<div>
|
|
111
|
+
<div class="gantt-line-area" v-if="rowIndex === 0" ref="lineArea">
|
|
112
|
+
<div
|
|
113
|
+
class="gantt-line"
|
|
114
|
+
v-for="loopLine in lines"
|
|
115
|
+
:key="loopLine"
|
|
116
|
+
:style="{ left: loopLine + 'px', height: lineHeight + 'px' }"
|
|
117
|
+
></div>
|
|
118
|
+
</div>
|
|
119
|
+
<div
|
|
120
|
+
v-for="loopItem in row.items"
|
|
121
|
+
:key="loopItem.id"
|
|
122
|
+
class="gantt-bar"
|
|
123
|
+
@mouseenter="ganttBarMouseEnter($event, loopItem, rowIndex)"
|
|
124
|
+
@mouseleave="ganttBarMouseLeave($event, loopItem)"
|
|
125
|
+
:style="{
|
|
126
|
+
marginLeft: loopItem.left + 'px',
|
|
127
|
+
width: loopItem.width + 'px'
|
|
128
|
+
}"
|
|
129
|
+
>
|
|
130
|
+
<slot :item="loopItem" name="itemContent"></slot>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</template>
|
|
134
|
+
<template #customCell="{ row, column }">
|
|
135
|
+
<slot name="customCell" :item="{ row, column }"></slot>
|
|
136
|
+
</template>
|
|
137
|
+
</vxe-grid>
|
|
138
|
+
</div>
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<script>
|
|
142
|
+
import { Space, Radio } from "ant-design-vue";
|
|
143
|
+
import XEUtils from 'xe-utils'
|
|
144
|
+
import moment from 'moment'
|
|
145
|
+
import draggable from 'vuedraggable'
|
|
146
|
+
export default {
|
|
147
|
+
name: "BaseGantt",
|
|
148
|
+
components: {
|
|
149
|
+
draggable,
|
|
150
|
+
'a-space': Space,
|
|
151
|
+
'a-radio-button': Radio.Button,
|
|
152
|
+
'a-radio-group': Radio.Group,
|
|
153
|
+
},
|
|
154
|
+
data() {
|
|
155
|
+
return {
|
|
156
|
+
searchValue: '',
|
|
157
|
+
timeViewValue: 'day',
|
|
158
|
+
loading: false,
|
|
159
|
+
rowColData: {},
|
|
160
|
+
minDate: null,
|
|
161
|
+
maxDate: null,
|
|
162
|
+
monthCols: [],
|
|
163
|
+
fixedColWidth: 0,
|
|
164
|
+
colWidth: 55,
|
|
165
|
+
splitHour: 4,
|
|
166
|
+
dayCols: [],
|
|
167
|
+
hourCols: [],
|
|
168
|
+
headerHeight: 0,
|
|
169
|
+
eqpWidth: 100,
|
|
170
|
+
rowHeight: 40,
|
|
171
|
+
lines: [],
|
|
172
|
+
lineHeight: 0,
|
|
173
|
+
dateRange: [],
|
|
174
|
+
ganttBarTooltip: {
|
|
175
|
+
show: false,
|
|
176
|
+
left: 0,
|
|
177
|
+
top: 0,
|
|
178
|
+
item: {},
|
|
179
|
+
color: ''
|
|
180
|
+
},
|
|
181
|
+
rows: [],
|
|
182
|
+
weekDay: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
props: {
|
|
186
|
+
showSeachHeader: {
|
|
187
|
+
type: Boolean,
|
|
188
|
+
default: false
|
|
189
|
+
},
|
|
190
|
+
isCurrent: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
default: false
|
|
193
|
+
},
|
|
194
|
+
timeValue: {
|
|
195
|
+
type: String,
|
|
196
|
+
default: 'day'
|
|
197
|
+
},
|
|
198
|
+
height: {
|
|
199
|
+
default: 'auto'
|
|
200
|
+
},
|
|
201
|
+
leftCols: {
|
|
202
|
+
type: Array,
|
|
203
|
+
default: function() {
|
|
204
|
+
return [{ field: 'eqp', width: 100, fixed: 'left' }]
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
cellClassName: {
|
|
208
|
+
type: Function,
|
|
209
|
+
default: function() {}
|
|
210
|
+
},
|
|
211
|
+
rowClassName: {
|
|
212
|
+
type: Function,
|
|
213
|
+
default: function() {}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
computed: {
|
|
217
|
+
computedHeight: function() {
|
|
218
|
+
return this.height - this.headerHeight
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
mounted() {
|
|
222
|
+
this.timeViewValue = this.timeValue
|
|
223
|
+
},
|
|
224
|
+
created() {},
|
|
225
|
+
methods: {
|
|
226
|
+
filterChangeEvent({ column }) {},
|
|
227
|
+
// headerDayCellStyle({ column, columnIndex }){
|
|
228
|
+
// return {
|
|
229
|
+
// paddingLeft:'4px',
|
|
230
|
+
// paddingRight:'4px'
|
|
231
|
+
// }
|
|
232
|
+
// },
|
|
233
|
+
/**
|
|
234
|
+
* 视图改变后初始化表头
|
|
235
|
+
*/
|
|
236
|
+
setLoading(b) {
|
|
237
|
+
this.loading = b
|
|
238
|
+
},
|
|
239
|
+
timeViewChange() {
|
|
240
|
+
this.initHeaders(this.dateRange)
|
|
241
|
+
this.initContent()
|
|
242
|
+
},
|
|
243
|
+
initHeaders(dateRange) {
|
|
244
|
+
this.dateRange = dateRange
|
|
245
|
+
let contentWidth = 0
|
|
246
|
+
let minDate = moment(this.dateRange[0])
|
|
247
|
+
let maxDate = moment(this.dateRange[1])
|
|
248
|
+
let splitCount = 1
|
|
249
|
+
let diffDays = maxDate.diff(minDate, 'day')
|
|
250
|
+
this.monthCols = []
|
|
251
|
+
this.dayCols = []
|
|
252
|
+
this.hourCols = []
|
|
253
|
+
this.lines = []
|
|
254
|
+
let bodyCols = []
|
|
255
|
+
this.fixedColWidth = 0
|
|
256
|
+
for (let i = 0; i < this.leftCols.length; i++) {
|
|
257
|
+
if (this.leftCols[i].fixed == 'left') {
|
|
258
|
+
this.fixedColWidth = this.fixedColWidth + this.leftCols[i].width
|
|
259
|
+
}
|
|
260
|
+
let obj = {
|
|
261
|
+
field: this.leftCols[i].field,
|
|
262
|
+
title: this.leftCols[i].title,
|
|
263
|
+
fixed: this.leftCols[i].fixed,
|
|
264
|
+
width: this.leftCols[i].width
|
|
265
|
+
// filters:[{data:null}],
|
|
266
|
+
// filterRender:{name: 'input'}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (this.leftCols[i].slots) {
|
|
270
|
+
obj.slots = this.leftCols[i].slots
|
|
271
|
+
}
|
|
272
|
+
this.monthCols.push()
|
|
273
|
+
|
|
274
|
+
// tmp.filters=undefined
|
|
275
|
+
// tmp.filterRender=undefined
|
|
276
|
+
//去掉天这一行的标题
|
|
277
|
+
// else{
|
|
278
|
+
// tmp.width+=width/
|
|
279
|
+
// }
|
|
280
|
+
// this.dayCols.push(tmp)
|
|
281
|
+
// obj.filters=[{data:null}]
|
|
282
|
+
// obj.filterRender={name:'input'}
|
|
283
|
+
bodyCols.push(obj)
|
|
284
|
+
if (this.timeViewValue !== 'day') {
|
|
285
|
+
this.splitHour = parseInt(this.timeViewValue)
|
|
286
|
+
this.hourCols.push(obj)
|
|
287
|
+
this.colWidth = 60
|
|
288
|
+
splitCount = 24 / this.splitHour
|
|
289
|
+
} else {
|
|
290
|
+
this.splitHour = 24
|
|
291
|
+
this.colWidth = 130
|
|
292
|
+
splitCount = 1
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
let tmp = {
|
|
297
|
+
type: 'seq',
|
|
298
|
+
fixed: 'left',
|
|
299
|
+
title: '',
|
|
300
|
+
|
|
301
|
+
width: this.fixedColWidth
|
|
302
|
+
}
|
|
303
|
+
if (this.showSeachHeader) {
|
|
304
|
+
tmp.slots = {
|
|
305
|
+
header: 'customSearchHeader'
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
this.dayCols.push(tmp)
|
|
309
|
+
|
|
310
|
+
let tempYearMonthCol = null
|
|
311
|
+
for (let i = 0; i <= diffDays; i++) {
|
|
312
|
+
if (tempYearMonthCol === null) {
|
|
313
|
+
tempYearMonthCol = {
|
|
314
|
+
title: minDate.format('YYYY-MM'),
|
|
315
|
+
field: minDate.format('YYYY-MM'),
|
|
316
|
+
width: this.colWidth * splitCount
|
|
317
|
+
}
|
|
318
|
+
this.monthCols.push(tempYearMonthCol)
|
|
319
|
+
} else {
|
|
320
|
+
tempYearMonthCol.width =
|
|
321
|
+
tempYearMonthCol.width + this.colWidth * splitCount
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
//添加天数
|
|
325
|
+
let tempDayCol = {
|
|
326
|
+
title: minDate.format('YYYY年MM月DD日'),
|
|
327
|
+
field: minDate.format('YYYY-MM-DD'),
|
|
328
|
+
width: this.colWidth * splitCount,
|
|
329
|
+
align: 'center',
|
|
330
|
+
slots: {
|
|
331
|
+
header: 'dateWeekHeader'
|
|
332
|
+
},
|
|
333
|
+
params: {
|
|
334
|
+
date: minDate.format('YYYY年MM月DD日'),
|
|
335
|
+
week: this.weekDay[minDate.format('E') - 1]
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
this.dayCols.push(tempDayCol)
|
|
339
|
+
//添加小时
|
|
340
|
+
if (this.timeViewValue !== 'day') {
|
|
341
|
+
for (let j = 0; j < splitCount; j++) {
|
|
342
|
+
let tempHour = j * this.splitHour
|
|
343
|
+
tempHour = '000' + tempHour
|
|
344
|
+
tempHour = tempHour.substr(tempHour.length - 2, 2)
|
|
345
|
+
contentWidth = contentWidth + this.colWidth
|
|
346
|
+
this.hourCols.push({
|
|
347
|
+
field: minDate.format('YYYY-MM-DD') + ' ' + tempHour + ':00:00',
|
|
348
|
+
title: tempHour,
|
|
349
|
+
width: this.colWidth
|
|
350
|
+
})
|
|
351
|
+
}
|
|
352
|
+
} else {
|
|
353
|
+
contentWidth = contentWidth + tempDayCol.width
|
|
354
|
+
}
|
|
355
|
+
minDate.add(1, 'day')
|
|
356
|
+
if (minDate.format('YYYY-MM') !== tempYearMonthCol.field) {
|
|
357
|
+
tempYearMonthCol = null
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
let colLength = this.dayCols.length
|
|
361
|
+
// this.$refs.headMonth.reloadColumn(this.monthCols)
|
|
362
|
+
this.$refs.headDay.reloadColumn(this.dayCols)
|
|
363
|
+
if (this.timeViewValue !== 'day') {
|
|
364
|
+
this.headerHeight = 160
|
|
365
|
+
colLength = this.hourCols.length
|
|
366
|
+
this.$refs.headHour.reloadColumn(this.hourCols)
|
|
367
|
+
} else {
|
|
368
|
+
this.headerHeight = 120
|
|
369
|
+
}
|
|
370
|
+
for (let i = 0; i < colLength; i++) {
|
|
371
|
+
this.lines.push(i * this.colWidth)
|
|
372
|
+
}
|
|
373
|
+
bodyCols.push({
|
|
374
|
+
field: 'content',
|
|
375
|
+
title: '内容',
|
|
376
|
+
width: contentWidth,
|
|
377
|
+
className: 'custom-cell',
|
|
378
|
+
slots: {
|
|
379
|
+
default: 'content'
|
|
380
|
+
}
|
|
381
|
+
})
|
|
382
|
+
this.$refs.bodyGrid.reloadColumn(bodyCols)
|
|
383
|
+
// this.$refs.lineArea.style.marginLeft =
|
|
384
|
+
// ((this.fixedColWidth-this.colWidth)) + 'px'
|
|
385
|
+
},
|
|
386
|
+
loadData(rows) {
|
|
387
|
+
this.rows = rows
|
|
388
|
+
this.initContent()
|
|
389
|
+
},
|
|
390
|
+
initContent() {
|
|
391
|
+
let splitMinutes = XEUtils.multiply(this.splitHour, 60)
|
|
392
|
+
let minDateTime = this.dateRange[0]
|
|
393
|
+
for (let i = 0; i < this.rows.length; i++) {
|
|
394
|
+
this.rows[i]['content'] = ''
|
|
395
|
+
for (let j = 0; j < this.rows[i].items.length; j++) {
|
|
396
|
+
let diffMiniutes = moment(this.rows[i].items[j].start).diff(
|
|
397
|
+
moment(minDateTime),
|
|
398
|
+
'minutes'
|
|
399
|
+
)
|
|
400
|
+
let tempLeft = XEUtils.divide(
|
|
401
|
+
XEUtils.multiply(this.colWidth, diffMiniutes),
|
|
402
|
+
splitMinutes
|
|
403
|
+
)
|
|
404
|
+
//计算左边距
|
|
405
|
+
this.rows[i].items[j]['left'] = tempLeft
|
|
406
|
+
//计算宽度
|
|
407
|
+
let ordMinutes = moment(this.rows[i].items[j].end).diff(
|
|
408
|
+
moment(this.rows[i].items[j].start),
|
|
409
|
+
'minutes'
|
|
410
|
+
)
|
|
411
|
+
let tempWidth = XEUtils.divide(
|
|
412
|
+
XEUtils.multiply(this.colWidth, ordMinutes),
|
|
413
|
+
splitMinutes
|
|
414
|
+
)
|
|
415
|
+
this.rows[i].items[j]['width'] = tempWidth
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
this.lineHeight = this.rows.length * 40
|
|
419
|
+
this.$refs.bodyGrid.reloadData(this.rows)
|
|
420
|
+
},
|
|
421
|
+
ganttBarMouseEnter(evt, ordInfo, rowIndex) {
|
|
422
|
+
this.ganttBarTooltip.left = evt.clientX //ordInfo.left + this.eqpWidth
|
|
423
|
+
this.ganttBarTooltip.top =
|
|
424
|
+
evt.clientY + evt.target.offsetHeight - evt.offsetY // (rowIndex + 1) * this.rowHeight
|
|
425
|
+
this.ganttBarTooltip.item = ordInfo
|
|
426
|
+
this.ganttBarTooltip.show = true
|
|
427
|
+
},
|
|
428
|
+
ganttBarMouseLeave(evt, ordInfo) {
|
|
429
|
+
this.ganttBarTooltip.show = false
|
|
430
|
+
},
|
|
431
|
+
bodyScroll(scrollInfo) {
|
|
432
|
+
if (scrollInfo.isX === true) {
|
|
433
|
+
// this.$refs.lineArea.style.marginLeft =
|
|
434
|
+
// (scrollInfo.scrollLeft-(this.fixedColWidth-this.colWidth)) * -1 + 'px'
|
|
435
|
+
|
|
436
|
+
// this.$refs.headMonth.scrollTo(scrollInfo.scrollLeft)
|
|
437
|
+
this.$refs.headDay.scrollTo(scrollInfo.scrollLeft)
|
|
438
|
+
this.$refs.headHour.scrollTo(scrollInfo.scrollLeft)
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
setCurrentRow(row) {
|
|
442
|
+
this.$refs.bodyGrid.setCurrentRow(row)
|
|
443
|
+
},
|
|
444
|
+
getTableData() {
|
|
445
|
+
return this.$refs.bodyGrid.getTableData().fullData
|
|
446
|
+
},
|
|
447
|
+
cellClick(scope) {
|
|
448
|
+
this.$emit('cellClick', scope)
|
|
449
|
+
},
|
|
450
|
+
onSearch() {
|
|
451
|
+
this.$emit('search', this.searchValue)
|
|
452
|
+
},
|
|
453
|
+
scrollRow(row) {
|
|
454
|
+
this.$refs.bodyGrid.scrollToRow(row)
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
</script>
|
|
459
|
+
|
|
460
|
+
<style lang="scss">
|
|
461
|
+
.custom-cell > div {
|
|
462
|
+
// background:blue;
|
|
463
|
+
// background-color: blue !important;
|
|
464
|
+
// overflow: unset !important;
|
|
465
|
+
padding-left: 0px !important;
|
|
466
|
+
padding-right: 0px !important;
|
|
467
|
+
}
|
|
468
|
+
.head-grid
|
|
469
|
+
.vxe-table
|
|
470
|
+
.vxe-table--render-wrapper
|
|
471
|
+
.vxe-table--main-wrapper
|
|
472
|
+
.vxe-table--body-wrapper {
|
|
473
|
+
height: 0px !important;
|
|
474
|
+
}
|
|
475
|
+
.head-grid .vxe-table .vxe-table--empty-content {
|
|
476
|
+
display: none;
|
|
477
|
+
}
|
|
478
|
+
.header-cell-day .vxe-cell {
|
|
479
|
+
padding-left: 5px !important;
|
|
480
|
+
padding-right: 5px !important;
|
|
481
|
+
}
|
|
482
|
+
.mytable-scrollbar .vxe-body--column.col-blue {
|
|
483
|
+
background-color: #e6f7ff;
|
|
484
|
+
color: #ffffff;
|
|
485
|
+
cursor: pointer;
|
|
486
|
+
/* font-weight: bold; */
|
|
487
|
+
}
|
|
488
|
+
</style>
|
|
489
|
+
<style lang="scss" scoped>
|
|
490
|
+
.gantt-bar {
|
|
491
|
+
position: absolute;
|
|
492
|
+
top: 8px;
|
|
493
|
+
z-index: 2;
|
|
494
|
+
// float:left;
|
|
495
|
+
height: 30px;
|
|
496
|
+
cursor: pointer;
|
|
497
|
+
overflow: hidden;
|
|
498
|
+
border-radius: 5px;
|
|
499
|
+
}
|
|
500
|
+
.gantt-bar :hover {
|
|
501
|
+
background-color: darkgrey;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.gantt-line-area {
|
|
505
|
+
position: absolute;
|
|
506
|
+
z-index: 1;
|
|
507
|
+
margin-left: -1px;
|
|
508
|
+
margin-top: -20px;
|
|
509
|
+
}
|
|
510
|
+
.gantt-line {
|
|
511
|
+
position: absolute;
|
|
512
|
+
width: 1px;
|
|
513
|
+
background-color: #e8eaec;
|
|
514
|
+
}
|
|
515
|
+
.gantt-bar-tooltip {
|
|
516
|
+
position: fixed;
|
|
517
|
+
z-index: 10;
|
|
518
|
+
border: 1px solid #0b0b0b;
|
|
519
|
+
padding: 3px;
|
|
520
|
+
border-radius: 3px;
|
|
521
|
+
// background: red;
|
|
522
|
+
}
|
|
523
|
+
/*滚动条整体部分*/
|
|
524
|
+
.mytable-scrollbar ::-webkit-scrollbar {
|
|
525
|
+
width: 10px;
|
|
526
|
+
height: 10px;
|
|
527
|
+
z-index: 10;
|
|
528
|
+
}
|
|
529
|
+
/*滚动条的轨道*/
|
|
530
|
+
.mytable-scrollbar ::-webkit-scrollbar-track {
|
|
531
|
+
background-color: #ffffff;
|
|
532
|
+
z-index: 10;
|
|
533
|
+
}
|
|
534
|
+
/*滚动条里面的小方块,能向上向下移动*/
|
|
535
|
+
.mytable-scrollbar ::-webkit-scrollbar-thumb {
|
|
536
|
+
background-color: #bfbfbf;
|
|
537
|
+
border-radius: 5px;
|
|
538
|
+
border: 1px solid #f1f1f1;
|
|
539
|
+
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
540
|
+
z-index: 10;
|
|
541
|
+
}
|
|
542
|
+
.mytable-scrollbar ::-webkit-scrollbar-thumb:hover {
|
|
543
|
+
background-color: #a8a8a8;
|
|
544
|
+
z-index: 10;
|
|
545
|
+
}
|
|
546
|
+
.mytable-scrollbar ::-webkit-scrollbar-thumb:active {
|
|
547
|
+
background-color: #787878;
|
|
548
|
+
z-index: 10;
|
|
549
|
+
}
|
|
550
|
+
/*边角,即两个滚动条的交汇处*/
|
|
551
|
+
.mytable-scrollbar ::-webkit-scrollbar-corner {
|
|
552
|
+
background-color: #ffffff;
|
|
553
|
+
z-index: 10;
|
|
554
|
+
}
|
|
555
|
+
</style>
|
|
556
|
+
<style>
|
|
557
|
+
.mytable-scrollbar .vxe-body--column.col-red {
|
|
558
|
+
background-color: rgb(227, 9, 53);
|
|
559
|
+
color: rgb(55, 55, 55);
|
|
560
|
+
/* font-weight: bold; */
|
|
561
|
+
}
|
|
562
|
+
.mytable-scrollbar .vxe-body--column.col-orange {
|
|
563
|
+
background-color: rgb(237, 216, 20);
|
|
564
|
+
color: rgb(55, 55, 55);
|
|
565
|
+
/* font-weight: bold; */
|
|
566
|
+
}
|
|
567
|
+
/*.mytable-scrollbar .vxe-body--column.col-grey {*/
|
|
568
|
+
/* background-color: rgb(140, 140, 138);*/
|
|
569
|
+
/* color: rgb(55, 55, 55);*/
|
|
570
|
+
/* !* font-weight: bold; *!*/
|
|
571
|
+
/*}*/
|
|
572
|
+
/*.mytable-scrollbar .vxe-body--column.col-blue {*/
|
|
573
|
+
/* background-color: #1890ff;*/
|
|
574
|
+
/* color: rgb(55, 55, 55);*/
|
|
575
|
+
/* !* font-weight: bold; *!*/
|
|
576
|
+
/*}*/
|
|
577
|
+
.row-blue {
|
|
578
|
+
background-color: lightskyblue;
|
|
579
|
+
}
|
|
580
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// 导入组件,组件必须声明 name
|
|
2
|
+
import BaseGridAdjust from './src/index.vue';
|
|
3
|
+
import VXETable from 'vxe-table'
|
|
4
|
+
// 为组件提供 install 安装方法,供按需引入
|
|
5
|
+
BaseGridAdjust.install = function(Vue) {
|
|
6
|
+
Vue.use(VXETable)
|
|
7
|
+
Vue.component(BaseGridAdjust.name, BaseGridAdjust);
|
|
8
|
+
};
|
|
9
|
+
// 默认导出组件
|
|
10
|
+
export default BaseGridAdjust;
|