doway-coms 2.2.34 → 2.3.2

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