cnhis-design-vue 2.1.118 → 2.1.120
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/CHANGELOG.md +32 -7
- package/es/affix/index.js +8 -8
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/anchor/index.js +8 -8
- package/es/auto-complete/index.js +8 -8
- package/es/avatar/index.js +8 -8
- package/es/back-top/index.js +8 -8
- package/es/badge/index.js +8 -8
- package/es/base/index.js +8 -8
- package/es/big-table/index.js +108 -97
- package/es/big-table/style.css +1 -1
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +22 -22
- package/es/calendar/index.js +8 -8
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/card-reader-sdk/index.js +1 -1
- package/es/carousel/index.js +8 -8
- package/es/cascader/index.js +8 -8
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/collapse/index.js +8 -8
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/config-provider/index.js +8 -8
- package/es/date-picker/index.js +8 -8
- package/es/descriptions/index.js +8 -8
- package/es/direct/index.js +16 -16
- package/es/divider/index.js +8 -8
- package/es/drag-layout/index.js +3 -3
- package/es/drawer/index.js +8 -8
- package/es/dropdown/index.js +8 -8
- package/es/editor/index.js +1 -1
- package/es/ellipsis/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +573 -75
- package/es/fabric-chart/style.css +1 -1
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +66 -66
- package/es/full-calendar/index.js +709 -552
- package/es/full-calendar/style.css +1 -1
- package/es/index/index.js +1522 -1025
- package/es/index/style.css +1 -1
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/layout/index.js +8 -8
- package/es/list/index.js +8 -8
- package/es/locale-provider/index.js +8 -8
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/menu/index.js +8 -8
- package/es/message/index.js +8 -8
- package/es/multi-chat/index.js +76 -76
- package/es/multi-chat-client/index.js +70 -70
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +14 -14
- package/es/multi-chat-setting/index.js +22 -22
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/page-header/index.js +8 -8
- package/es/pagination/index.js +8 -8
- package/es/popconfirm/index.js +8 -8
- package/es/popover/index.js +8 -8
- package/es/progress/index.js +8 -8
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/result/index.js +8 -8
- package/es/row/index.js +8 -8
- package/es/scale-container/index.js +1 -1
- package/es/scale-view/index.js +27 -27
- package/es/select/index.js +12 -12
- package/es/select-label/index.js +11 -11
- package/es/select-person/index.js +2 -2
- package/es/select-tag/index.js +4 -4
- package/es/shortcut-setter/index.js +10 -10
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/slider-tree/index.js +9 -9
- package/es/space/index.js +8 -8
- package/es/spin/index.js +8 -8
- package/es/statistic/index.js +8 -8
- package/es/steps/index.js +8 -8
- package/es/switch/index.js +8 -8
- package/es/table-filter/index.js +65 -65
- package/es/tabs/index.js +8 -8
- package/es/tag/index.js +9 -9
- package/es/time-picker/index.js +8 -8
- package/es/timeline/index.js +8 -8
- package/es/tooltip/index.js +8 -8
- package/es/transfer/index.js +8 -8
- package/es/tree/index.js +8 -8
- package/es/tree-select/index.js +8 -8
- package/es/upload/index.js +8 -8
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +949 -430
- package/lib/cui.umd.js +949 -430
- package/lib/cui.umd.min.js +58 -58
- package/package.json +1 -1
- package/packages/big-table/src/BigTable.vue +5 -1
- package/packages/big-table/src/utils/headerFilter.js +6 -3
- package/packages/button/src/ButtonPrint/js/print.es.min.js +3 -3
- package/packages/fabric-chart/src/FabricChart.vue +1 -1
- package/packages/fabric-chart/src/fabric-chart/FabricLines.vue +6 -6
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +6 -6
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +14 -10
- package/packages/fabric-chart/src/mixins/draw.js +97 -1
- package/packages/fabric-chart/src/mixins/drawExtracorporealCirculation.js +196 -0
- package/packages/fabric-chart/src/mixins/fabricCommon.js +1 -1
- package/packages/fabric-chart/src/utils/index.js +81 -0
- package/packages/full-calendar/src/FullCalendar.vue +129 -63
- package/packages/full-calendar/src/components/ListTag.vue +18 -11
- package/packages/full-calendar/src/components/Tag.vue +3 -3
- package/packages/full-calendar/src/components/TagDetail.vue +3 -3
- package/packages/full-calendar/src/utils/index.js +24 -0
- package/packages/fabric-chart/src/mixins/type.js +0 -6
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'drawExtracorporealCirculation',
|
|
5
|
+
data() {
|
|
6
|
+
this.extracorporealCirculation = cloneDeep(this.templateData.bottom?.extracorporealCirculation);
|
|
7
|
+
this.extracorporealCirculationObjs = [];
|
|
8
|
+
return {};
|
|
9
|
+
},
|
|
10
|
+
components: {},
|
|
11
|
+
methods: {
|
|
12
|
+
drawExtracorporealCirculation(extracorporealCirculation) {
|
|
13
|
+
const { endX, originX, endY, markHeight, canvasWidth } = this.propItems;
|
|
14
|
+
if (!markHeight || !extracorporealCirculation || !extracorporealCirculation.list?.length) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (this.extracorporealCirculationObjs.length) {
|
|
18
|
+
[...this.extracorporealCirculationObjs].forEach(obj => this.canvas.remove(obj));
|
|
19
|
+
this.extracorporealCirculationObjs = [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { height = 20, extracorporealCirculationStyle, ascendAortaStyle, list = [] } = extracorporealCirculation;
|
|
23
|
+
const y2 = endY + height;
|
|
24
|
+
|
|
25
|
+
let prevEndX;
|
|
26
|
+
let prevLine;
|
|
27
|
+
|
|
28
|
+
list.forEach((item, index) => {
|
|
29
|
+
const xList = this.getExtracorporealCirculationX(item);
|
|
30
|
+
const idx = xList.findIndex(x => x > 0 && x < canvasWidth);
|
|
31
|
+
if (idx === -1) return;
|
|
32
|
+
|
|
33
|
+
let prevShadowBox;
|
|
34
|
+
xList.forEach((x, i) => {
|
|
35
|
+
const nextX = xList[i + 1];
|
|
36
|
+
const prevX = xList[i - 1];
|
|
37
|
+
if (isValid(x) || isValid(nextX)) {
|
|
38
|
+
const x1 = isValid(x) ? x : originX;
|
|
39
|
+
const x2 = isValid(nextX) ? nextX : endX;
|
|
40
|
+
const prevX1 = isValid(prevX) ? prevX : originX;
|
|
41
|
+
const shadowBox = {};
|
|
42
|
+
if (i < xList.length - 1) {
|
|
43
|
+
shadowBox.params = [x1, x2, y2, [0, 2].includes(i) ? extracorporealCirculationStyle : ascendAortaStyle];
|
|
44
|
+
shadowBox.shadowObjs = this.drawShadowBox(...shadowBox.params);
|
|
45
|
+
}
|
|
46
|
+
if (isValid(x)) {
|
|
47
|
+
const key = getKey(i);
|
|
48
|
+
const optLine = this.drawOptLine([x, endY, x, y2], {
|
|
49
|
+
origin: {
|
|
50
|
+
index,
|
|
51
|
+
key,
|
|
52
|
+
data: item[key]
|
|
53
|
+
},
|
|
54
|
+
limitX: {
|
|
55
|
+
x1: i === 0 ? prevEndX ?? originX : prevX1,
|
|
56
|
+
x2
|
|
57
|
+
},
|
|
58
|
+
...([1, 2, 3].includes(i) ? { leftShadowBox: prevShadowBox } : {}),
|
|
59
|
+
...([0, 1, 2].includes(i) ? { rightShadowBox: shadowBox } : {})
|
|
60
|
+
});
|
|
61
|
+
if (i === xList.length - 1) {
|
|
62
|
+
prevEndX = x;
|
|
63
|
+
prevLine = optLine;
|
|
64
|
+
}
|
|
65
|
+
if (i === 0 && prevLine) {
|
|
66
|
+
prevLine.limitX.x2 = shadowBox.params[0];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
prevShadowBox = shadowBox;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
function isValid(x) {
|
|
75
|
+
return x && x > 0 && x < canvasWidth;
|
|
76
|
+
}
|
|
77
|
+
function getKey(i) {
|
|
78
|
+
switch (i) {
|
|
79
|
+
case 0:
|
|
80
|
+
return 'extracorporealCirculationStart';
|
|
81
|
+
case 1:
|
|
82
|
+
return 'closeAscendAorta';
|
|
83
|
+
case 2:
|
|
84
|
+
return 'openAscendAorta';
|
|
85
|
+
case 3:
|
|
86
|
+
return 'extracorporealCirculationEnd';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
drawOptLine(coordinate, props) {
|
|
91
|
+
const optLine = new this.fabric.Line(coordinate, {
|
|
92
|
+
...props,
|
|
93
|
+
stroke: 'transparent',
|
|
94
|
+
strokeWidth: 5,
|
|
95
|
+
hasControls: false,
|
|
96
|
+
hasBorders: false,
|
|
97
|
+
hoverCursor: 'e-resize',
|
|
98
|
+
lockMovementY: true,
|
|
99
|
+
originX: 'center'
|
|
100
|
+
});
|
|
101
|
+
this.setExtracorporealCirculationEvent(optLine);
|
|
102
|
+
this.canvas.add(optLine);
|
|
103
|
+
this.extracorporealCirculationObjs.push(optLine);
|
|
104
|
+
return optLine;
|
|
105
|
+
},
|
|
106
|
+
setExtracorporealCirculationEvent(optLine) {
|
|
107
|
+
this.setPopup(optLine);
|
|
108
|
+
if (this.eventStyle.evented) {
|
|
109
|
+
optLine.on('moving', () => {
|
|
110
|
+
const { left, limitX } = optLine;
|
|
111
|
+
if (left < limitX.x1) {
|
|
112
|
+
optLine.setCoords().set({ x1: limitX.x1, x2: limitX.x1 });
|
|
113
|
+
}
|
|
114
|
+
if (left > limitX.x2) {
|
|
115
|
+
optLine.setCoords().set({ x1: limitX.x2, x2: limitX.x2 });
|
|
116
|
+
}
|
|
117
|
+
this.updateShadowBox(optLine, 'left');
|
|
118
|
+
this.updateShadowBox(optLine, 'right');
|
|
119
|
+
this.showDrapPopup(optLine);
|
|
120
|
+
});
|
|
121
|
+
optLine.on('moved', () => {
|
|
122
|
+
this.isDropVisible = false;
|
|
123
|
+
const params = optLine.origin;
|
|
124
|
+
params.data.time = this.getXValue(optLine.left);
|
|
125
|
+
this.$emit('extracorporealCirculationChange', params);
|
|
126
|
+
const { index, key, data } = params;
|
|
127
|
+
this.extracorporealCirculation.list[index][key] = data;
|
|
128
|
+
this.drawExtracorporealCirculation(this.extracorporealCirculation);
|
|
129
|
+
this.canvas.discardActiveObject();
|
|
130
|
+
this.canvas.forEachObject(obj => {
|
|
131
|
+
if (obj.type && obj.type === 'mark') {
|
|
132
|
+
obj.bringForward();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
updateShadowBox(optLine, direction) {
|
|
139
|
+
const { shadowObjs, params } = optLine[`${direction}ShadowBox`] || {};
|
|
140
|
+
if (!shadowObjs || !params) return;
|
|
141
|
+
shadowObjs.forEach(obj => this.canvas.remove(obj));
|
|
142
|
+
const idx = direction === 'left' ? 1 : 0;
|
|
143
|
+
params[idx] = optLine.left;
|
|
144
|
+
const _shadowObjs = this.drawShadowBox(...params);
|
|
145
|
+
optLine[`${direction}ShadowBox`] = {
|
|
146
|
+
shadowObjs: _shadowObjs,
|
|
147
|
+
params
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
drawShadowBox(x1, x2, y2, { mode, style }) {
|
|
151
|
+
const { endY } = this.propItems;
|
|
152
|
+
const _style = { ...style };
|
|
153
|
+
if (_style.angle) delete _style.angle;
|
|
154
|
+
const points = [
|
|
155
|
+
[x1, endY],
|
|
156
|
+
[x2, endY],
|
|
157
|
+
[x2, y2],
|
|
158
|
+
[x1, y2]
|
|
159
|
+
];
|
|
160
|
+
const polygon = new this.fabric.Polygon(
|
|
161
|
+
points.map(v => ({ x: v[0], y: v[1] })),
|
|
162
|
+
{
|
|
163
|
+
...this.defaultLineStyle,
|
|
164
|
+
..._style,
|
|
165
|
+
stroke: 'transparent',
|
|
166
|
+
...(['slash'].includes(mode) ? { fill: 'transparent' } : {})
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
const shadowLines = [];
|
|
170
|
+
if (['slash'].includes(mode)) {
|
|
171
|
+
// 斜线阴影模式
|
|
172
|
+
shadowLines.push(...this.drawShadow(points, style.angle, _style.space, _style));
|
|
173
|
+
}
|
|
174
|
+
this.canvas.add(polygon, ...shadowLines);
|
|
175
|
+
this.extracorporealCirculationObjs.push(...[polygon, ...shadowLines]);
|
|
176
|
+
return [polygon, ...shadowLines];
|
|
177
|
+
},
|
|
178
|
+
getExtracorporealCirculationX(item) {
|
|
179
|
+
const { extracorporealCirculationStart, closeAscendAorta, openAscendAorta, extracorporealCirculationEnd } = item;
|
|
180
|
+
let x1, x2, x3, x4;
|
|
181
|
+
if (extracorporealCirculationStart) {
|
|
182
|
+
x1 = this.computedX(extracorporealCirculationStart.time);
|
|
183
|
+
}
|
|
184
|
+
if (closeAscendAorta) {
|
|
185
|
+
x2 = this.computedX(closeAscendAorta.time);
|
|
186
|
+
}
|
|
187
|
+
if (openAscendAorta) {
|
|
188
|
+
x3 = this.computedX(openAscendAorta.time);
|
|
189
|
+
}
|
|
190
|
+
if (extracorporealCirculationEnd) {
|
|
191
|
+
x4 = this.computedX(extracorporealCirculationEnd.time);
|
|
192
|
+
}
|
|
193
|
+
return [x1, x2, x3, x4];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const isNumber = num => {
|
|
2
|
+
return typeof num === 'number' && Number.isFinite(num);
|
|
3
|
+
};
|
|
4
|
+
export const isObject = obj => {
|
|
5
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function getTangent(angle) {
|
|
9
|
+
return +Math.tan((angle * Math.PI) / 180);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function nearlyEqual(v1, v2) {
|
|
13
|
+
return Math.abs(v1 - v2) <= 0.0001;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function sortPoints(points) {
|
|
17
|
+
return points.sort((a, b) => a[1] - b[1]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function uniquePoints(points) {
|
|
21
|
+
return points.reduce((fin, point) => {
|
|
22
|
+
if (!hasPoint(fin, point)) fin.push(point);
|
|
23
|
+
return fin;
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
function hasPoint(points, point) {
|
|
27
|
+
return points.some(p => nearlyEqual(p[0], point[0]) && nearlyEqual(p[1], point[1]));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isInPolygon(checkPoint, polygonPoints) {
|
|
32
|
+
let counter = 0;
|
|
33
|
+
let xinters;
|
|
34
|
+
let p1, p2;
|
|
35
|
+
const pointCount = polygonPoints.length;
|
|
36
|
+
p1 = polygonPoints[0];
|
|
37
|
+
|
|
38
|
+
for (let i = 1; i <= pointCount; i++) {
|
|
39
|
+
p2 = polygonPoints[i % pointCount];
|
|
40
|
+
if (checkPoint[0] > Math.min(p1[0], p2[0]) && checkPoint[0] <= Math.max(p1[0], p2[0])) {
|
|
41
|
+
if (checkPoint[1] <= Math.max(p1[1], p2[1])) {
|
|
42
|
+
if (p1[0] != p2[0]) {
|
|
43
|
+
xinters = ((checkPoint[0] - p1[0]) * (p2[1] - p1[1])) / (p2[0] - p1[0]) + p1[1];
|
|
44
|
+
if (p1[1] == p2[1] || checkPoint[1] <= xinters) {
|
|
45
|
+
counter++;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
p1 = p2;
|
|
51
|
+
}
|
|
52
|
+
return counter % 2 !== 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getIntersectionPoint(a, b, c, d) {
|
|
56
|
+
/** 1 解线性方程组, 求线段交点. **/
|
|
57
|
+
// 如果分母为0 则平行或共线, 不相交
|
|
58
|
+
const denominator = (b[1] - a[1]) * (d[0] - c[0]) - (a[0] - b[0]) * (c[1] - d[1]);
|
|
59
|
+
if (denominator === 0) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 线段所在直线的交点坐标 (x , y)
|
|
64
|
+
const x = ((b[0] - a[0]) * (d[0] - c[0]) * (c[1] - a[1]) + (b[1] - a[1]) * (d[0] - c[0]) * a[0] - (d[1] - c[1]) * (b[0] - a[0]) * c[0]) / denominator;
|
|
65
|
+
const y = -((b[1] - a[1]) * (d[1] - c[1]) * (c[0] - a[0]) + (b[0] - a[0]) * (d[1] - c[1]) * a[1] - (d[0] - c[0]) * (b[1] - a[1]) * c[1]) / denominator;
|
|
66
|
+
|
|
67
|
+
/** 2 判断交点是否在两条线段上 **/
|
|
68
|
+
if (
|
|
69
|
+
// 交点在线段1上
|
|
70
|
+
((x - a[0]) * (x - b[0]) < 0 || nearlyEqual(x, a[0]) || nearlyEqual(x, b[0])) &&
|
|
71
|
+
((y - a[1]) * (y - b[1]) < 0 || nearlyEqual(y, a[1]) || nearlyEqual(y, b[1])) &&
|
|
72
|
+
// 且交点也在线段2上
|
|
73
|
+
((x - c[0]) * (x - d[0]) < 0 || nearlyEqual(x, c[0]) || nearlyEqual(x, d[0])) &&
|
|
74
|
+
((y - c[1]) * (y - d[1]) < 0 || nearlyEqual(y, c[1]) || nearlyEqual(y, d[1]))
|
|
75
|
+
) {
|
|
76
|
+
// 返回交点p
|
|
77
|
+
return [x, y];
|
|
78
|
+
}
|
|
79
|
+
// 否则不相交
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
42
|
<TagDetail v-on="$listeners" ref="tagDetailRef"></TagDetail>
|
|
43
|
+
|
|
44
|
+
<div class="c-full-calendar__mask" v-if="!editable"></div>
|
|
43
45
|
</div>
|
|
44
46
|
</template>
|
|
45
47
|
|
|
@@ -55,11 +57,8 @@ import Tag from './components/Tag.vue';
|
|
|
55
57
|
import ListTag from './components/ListTag.vue';
|
|
56
58
|
import TagDetail from './components/TagDetail.vue';
|
|
57
59
|
// import SvgIcon from '@/component/svg/index.vue';
|
|
58
|
-
import { axiosInstance, getScheduleListApi, getScheduleSettingApi, getScheduleDataApi, queryScheduleListApi, saveOrUpdateScheduleApi, delScheduleApi } from './api';
|
|
59
60
|
import vexutils, { moment } from '@/utils/vexutils';
|
|
60
|
-
import {
|
|
61
|
-
|
|
62
|
-
window.moment = moment;
|
|
61
|
+
import { formatDate, weekIsMonth, viewMap, getAddTime } from './utils';
|
|
63
62
|
|
|
64
63
|
export default create({
|
|
65
64
|
name: 'full-calendar',
|
|
@@ -77,13 +76,26 @@ export default create({
|
|
|
77
76
|
[Icon.name]: Icon
|
|
78
77
|
},
|
|
79
78
|
props: {
|
|
80
|
-
serverPrefix: { type: String, default: 'inbox' },
|
|
79
|
+
// serverPrefix: { type: String, default: 'inbox' },
|
|
81
80
|
// userInfo: { type: Object, default: () => {} },
|
|
82
|
-
orgId: { type: String },
|
|
83
|
-
userId: { type: String },
|
|
84
|
-
token: { type: String },
|
|
81
|
+
// orgId: { type: String },
|
|
82
|
+
// userId: { type: String },
|
|
83
|
+
// token: { type: String },
|
|
84
|
+
editable: { type: Boolean, default: true },
|
|
85
85
|
showSearchHeader: { type: Boolean },
|
|
86
|
-
showSidebar: { type: Boolean }
|
|
86
|
+
showSidebar: { type: Boolean },
|
|
87
|
+
queryScheduleList: {
|
|
88
|
+
type: Function,
|
|
89
|
+
default: () => Promise.resolve([])
|
|
90
|
+
},
|
|
91
|
+
saveOrUpdateSchedule: {
|
|
92
|
+
type: Function,
|
|
93
|
+
default: () => Promise.resolve(true)
|
|
94
|
+
},
|
|
95
|
+
delSchedule: {
|
|
96
|
+
type: Function,
|
|
97
|
+
default: () => Promise.resolve(true)
|
|
98
|
+
}
|
|
87
99
|
},
|
|
88
100
|
computed: {
|
|
89
101
|
disabledToday() {
|
|
@@ -137,6 +149,10 @@ export default create({
|
|
|
137
149
|
data() {
|
|
138
150
|
this.tippyInstance = null;
|
|
139
151
|
const { startTime, endTime } = formatDate();
|
|
152
|
+
this.resizeObserver = null;
|
|
153
|
+
this.updateSize = vexutils.throttle(() => {
|
|
154
|
+
this.calendar.updateSize();
|
|
155
|
+
}, 300);
|
|
140
156
|
return {
|
|
141
157
|
calendar: null,
|
|
142
158
|
viewShows: ['list', 'day', 'week', 'month'].map((value, idx) => ({
|
|
@@ -224,73 +240,76 @@ export default create({
|
|
|
224
240
|
};
|
|
225
241
|
},
|
|
226
242
|
beforeCreate() {
|
|
227
|
-
axiosInstance.interceptors.request.use(config => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
async created() {
|
|
234
|
-
// await this.queryScheduleList();
|
|
235
|
-
// await this.getSchedulerList();
|
|
236
|
-
// await this.getSchedulerData();
|
|
243
|
+
// axiosInstance.interceptors.request.use(config => {
|
|
244
|
+
// config.headers['Authorization'] = 'bearer ' + this.token;
|
|
245
|
+
// config.baseURL = '/' + this.serverPrefix;
|
|
246
|
+
// return config;
|
|
247
|
+
// });
|
|
237
248
|
},
|
|
249
|
+
async created() {},
|
|
238
250
|
async mounted() {
|
|
239
251
|
this.calendar = this.$refs.fullCalendar.calendar;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// this.calendar = this.$refs.fullCalendar.calendar;
|
|
244
|
-
// // await this.getScheduleSettingt();
|
|
245
|
-
// // await this.getSchedulerList();
|
|
246
|
-
// // await this.getSchedulerData();
|
|
247
|
-
// } catch (err) {
|
|
248
|
-
// this.loading = false;
|
|
249
|
-
// } finally {
|
|
250
|
-
// this.loading = false;
|
|
251
|
-
// }
|
|
252
|
+
this.setViewTime();
|
|
253
|
+
await this._queryScheduleList();
|
|
254
|
+
this.handleResizeObserver();
|
|
252
255
|
},
|
|
253
256
|
methods: {
|
|
254
|
-
|
|
257
|
+
handleResizeObserver() {
|
|
258
|
+
// 创建 ResizeObserver 实例
|
|
259
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
260
|
+
for (const entry of entries) {
|
|
261
|
+
// // 获取div新的大小
|
|
262
|
+
// const newWidth = entry.contentRect.width;
|
|
263
|
+
// const newHeight = entry.contentRect.height;
|
|
264
|
+
|
|
265
|
+
this.updateSize();
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
// 监听可调整大小的div
|
|
270
|
+
this.resizeObserver.observe(this.$el.parentNode);
|
|
271
|
+
},
|
|
272
|
+
async _queryScheduleList() {
|
|
255
273
|
this.loading = true;
|
|
256
274
|
try {
|
|
257
|
-
const
|
|
258
|
-
...this.currentDate
|
|
259
|
-
userId: this.userId,
|
|
260
|
-
orgId: this.orgId
|
|
275
|
+
const res = await this.queryScheduleList({
|
|
276
|
+
...this.currentDate
|
|
277
|
+
// userId: this.userId,
|
|
278
|
+
// orgId: this.orgId
|
|
261
279
|
});
|
|
262
|
-
if (!data.success) return;
|
|
280
|
+
// if (!data.success) return;
|
|
263
281
|
|
|
264
|
-
if (vexutils.isArray(
|
|
265
|
-
this.calendarOptions.events =
|
|
282
|
+
if (vexutils.isArray(res)) {
|
|
283
|
+
this.calendarOptions.events = res.map(item => ({ ...item, start: item.startTime, end: item.endTime }));
|
|
266
284
|
} else {
|
|
267
285
|
this.calendarOptions.events = [];
|
|
268
286
|
}
|
|
269
|
-
// this.dateValue && this.calendar.gotoDate(this.dateValue._d);
|
|
270
287
|
} catch (error) {
|
|
271
288
|
console.log(error);
|
|
272
289
|
} finally {
|
|
273
290
|
this.loading = false;
|
|
274
291
|
}
|
|
275
292
|
},
|
|
276
|
-
async
|
|
293
|
+
async _saveOrUpdateSchedule(params) {
|
|
294
|
+
this.loading = true;
|
|
277
295
|
try {
|
|
278
|
-
|
|
279
|
-
if (data.success) this.$message.success('保存成功');
|
|
280
|
-
await this.
|
|
296
|
+
await this.saveOrUpdateSchedule(params);
|
|
297
|
+
// if (data.success) this.$message.success('保存成功');
|
|
298
|
+
await this._queryScheduleList();
|
|
281
299
|
} catch (error) {
|
|
282
300
|
console.log(error);
|
|
283
301
|
} finally {
|
|
284
302
|
this.loading = false;
|
|
285
303
|
}
|
|
286
304
|
},
|
|
287
|
-
async
|
|
305
|
+
async _delSchedule(params) {
|
|
306
|
+
this.loading = true;
|
|
288
307
|
try {
|
|
289
|
-
const data = await
|
|
290
|
-
if (data
|
|
291
|
-
this.$message.success('删除成功');
|
|
308
|
+
const data = await this.delSchedule(params);
|
|
309
|
+
if (data) {
|
|
310
|
+
// this.$message.success('删除成功');
|
|
292
311
|
// this.calendarOptions.events = this.calendarOptions.events.filter(item => item.scheduleId === params.scheduleId);
|
|
293
|
-
await this.
|
|
312
|
+
await this._queryScheduleList();
|
|
294
313
|
}
|
|
295
314
|
} catch (error) {
|
|
296
315
|
console.log(error);
|
|
@@ -328,7 +347,7 @@ export default create({
|
|
|
328
347
|
},
|
|
329
348
|
handleDate(changeType) {
|
|
330
349
|
if (this.loading) return;
|
|
331
|
-
const dateValue = changeType ? this.dateValue.clone()[changeType](1, this.viewType) : moment();
|
|
350
|
+
const dateValue = changeType ? this.dateValue.clone()[changeType](1, this.viewType === 'list' ? 'month' : this.viewType) : moment();
|
|
332
351
|
this.dateValue = dateValue;
|
|
333
352
|
switch (changeType) {
|
|
334
353
|
case 'subtract':
|
|
@@ -349,45 +368,81 @@ export default create({
|
|
|
349
368
|
handleCurrentDateChange() {
|
|
350
369
|
const date = moment(this.dateValue).format('YYYY-MM-DD');
|
|
351
370
|
let currentDate = {};
|
|
371
|
+
|
|
352
372
|
switch (this.viewType) {
|
|
353
373
|
case 'day':
|
|
354
374
|
currentDate = formatDate(date, 'day');
|
|
355
375
|
break;
|
|
356
|
-
case '
|
|
357
|
-
currentDate = formatDate(date, '
|
|
376
|
+
case 'list':
|
|
377
|
+
currentDate = formatDate(date, 'month');
|
|
358
378
|
break;
|
|
359
379
|
default:
|
|
360
|
-
|
|
380
|
+
this.setViewTime();
|
|
361
381
|
break;
|
|
362
382
|
}
|
|
363
383
|
Object.assign(this.currentDate, currentDate);
|
|
364
|
-
this.
|
|
384
|
+
this._queryScheduleList();
|
|
385
|
+
},
|
|
386
|
+
setViewTime() {
|
|
387
|
+
const currentDate = {};
|
|
388
|
+
const { activeStart, activeEnd } = this.calendar.view;
|
|
389
|
+
currentDate.startTime = moment(activeStart)
|
|
390
|
+
.clone()
|
|
391
|
+
.startOf('day')
|
|
392
|
+
.format('YYYY-MM-DD HH:mm:ss');
|
|
393
|
+
currentDate.endTime = moment(activeEnd)
|
|
394
|
+
.clone()
|
|
395
|
+
.subtract(1, 'day')
|
|
396
|
+
.endOf('day')
|
|
397
|
+
.format('YYYY-MM-DD HH:mm:ss');
|
|
398
|
+
|
|
399
|
+
Object.assign(this.currentDate, currentDate);
|
|
365
400
|
},
|
|
366
401
|
handleAdd() {
|
|
367
|
-
this.$emit('add',
|
|
402
|
+
this.$emit('add', getAddTime(this.dateValue));
|
|
368
403
|
},
|
|
369
404
|
handleSelect(event, type = 'add') {
|
|
370
405
|
const { start, end, extendedProps, title } = event;
|
|
371
|
-
const startTime =
|
|
372
|
-
const endTime = moment(end).format('YYYY-MM-DD HH:mm:ss');
|
|
406
|
+
const { startTime, endTime } = getAddTime(start, end);
|
|
373
407
|
const params = { ...extendedProps, startTime, endTime, title };
|
|
374
|
-
if (
|
|
408
|
+
if (type === 'edit' || ['day', 'week'].includes(this.viewType)) {
|
|
409
|
+
params.startTime = moment(start).format('YYYY-MM-DD HH:mm:ss');
|
|
410
|
+
params.endTime = moment(end).format('YYYY-MM-DD HH:mm:ss');
|
|
411
|
+
}
|
|
412
|
+
const that = this;
|
|
413
|
+
if (
|
|
414
|
+
moment(start)
|
|
415
|
+
.clone()
|
|
416
|
+
.valueOf() <
|
|
417
|
+
moment()
|
|
418
|
+
.clone()
|
|
419
|
+
.startOf('day')
|
|
420
|
+
.valueOf()
|
|
421
|
+
) {
|
|
375
422
|
this.$confirm({
|
|
376
423
|
title: '提示',
|
|
377
424
|
content: '日程开始时间小于当前时间,是否继续?',
|
|
378
425
|
okText: '确定',
|
|
379
426
|
cancelText: '取消',
|
|
380
427
|
onOk: () => {
|
|
381
|
-
|
|
428
|
+
setEmit();
|
|
382
429
|
},
|
|
383
430
|
onCancel: () => {
|
|
384
431
|
if (type === 'edit') {
|
|
385
|
-
this.
|
|
432
|
+
this._queryScheduleList();
|
|
386
433
|
}
|
|
387
434
|
}
|
|
388
435
|
});
|
|
389
436
|
} else {
|
|
390
|
-
|
|
437
|
+
setEmit();
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function setEmit() {
|
|
441
|
+
if (type === 'add') {
|
|
442
|
+
that.$emit('add', params);
|
|
443
|
+
} else {
|
|
444
|
+
that._saveOrUpdateSchedule(params);
|
|
445
|
+
}
|
|
391
446
|
}
|
|
392
447
|
},
|
|
393
448
|
handleDrop({ event, oldEvent }) {
|
|
@@ -412,17 +467,27 @@ export default create({
|
|
|
412
467
|
this.handleCurrentDateChange();
|
|
413
468
|
}
|
|
414
469
|
},
|
|
415
|
-
beforeDestroy() {
|
|
470
|
+
beforeDestroy() {
|
|
471
|
+
this.resizeObserver = null;
|
|
472
|
+
}
|
|
416
473
|
});
|
|
417
474
|
</script>
|
|
418
475
|
<style lang="less" scoped>
|
|
419
476
|
@primary-color: #2d7aff;
|
|
420
477
|
|
|
421
478
|
.c-full-calendar {
|
|
479
|
+
position: relative;
|
|
422
480
|
display: flex;
|
|
423
481
|
flex-flow: column nowrap;
|
|
424
482
|
width: 100%;
|
|
425
483
|
height: 100%;
|
|
484
|
+
&__mask {
|
|
485
|
+
position: absolute;
|
|
486
|
+
z-index: 1;
|
|
487
|
+
width: 100%;
|
|
488
|
+
height: 100%;
|
|
489
|
+
background-color: rgba(0, 0, 0, 0);
|
|
490
|
+
}
|
|
426
491
|
/deep/ .tag-detail-wrpper {
|
|
427
492
|
display: none;
|
|
428
493
|
}
|
|
@@ -452,7 +517,7 @@ export default create({
|
|
|
452
517
|
.main-wrapper {
|
|
453
518
|
display: flex;
|
|
454
519
|
width: 100%;
|
|
455
|
-
|
|
520
|
+
height: 100%;
|
|
456
521
|
.full-calendar {
|
|
457
522
|
display: flex;
|
|
458
523
|
flex-flow: column nowrap;
|
|
@@ -561,6 +626,7 @@ export default create({
|
|
|
561
626
|
/deep/ .full-calendar__body {
|
|
562
627
|
width: 100%;
|
|
563
628
|
flex: 1;
|
|
629
|
+
overflow-y: scroll;
|
|
564
630
|
box-sizing: border-box;
|
|
565
631
|
|
|
566
632
|
.fc-header-toolbar {
|
|
@@ -33,6 +33,10 @@ export default {
|
|
|
33
33
|
listData: {
|
|
34
34
|
type: Array,
|
|
35
35
|
default: () => []
|
|
36
|
+
},
|
|
37
|
+
dateValue: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: moment()
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
data() {
|
|
@@ -53,18 +57,21 @@ export default {
|
|
|
53
57
|
.clone()
|
|
54
58
|
.startOf('day')
|
|
55
59
|
.valueOf();
|
|
56
|
-
if (
|
|
57
|
-
obj[day]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
if (date.month() === this.dateValue.clone().month()) {
|
|
61
|
+
if (obj[day]) {
|
|
62
|
+
obj[day].list.push({ ...item });
|
|
63
|
+
} else {
|
|
64
|
+
obj[day] = {
|
|
65
|
+
_d: date,
|
|
66
|
+
day,
|
|
67
|
+
week: date.format('ddd'),
|
|
68
|
+
month: date.format('MMM'),
|
|
69
|
+
list: [{ ...item }],
|
|
70
|
+
state: startTime < curValue ? 0 : 1
|
|
71
|
+
};
|
|
72
|
+
}
|
|
67
73
|
}
|
|
74
|
+
|
|
68
75
|
return obj;
|
|
69
76
|
}, {});
|
|
70
77
|
|
|
@@ -21,6 +21,7 @@ import { Tooltip, Icon } from 'ant-design-vue';
|
|
|
21
21
|
import { moment } from '@/utils/vexutils';
|
|
22
22
|
import tippy from 'tippy.js';
|
|
23
23
|
import 'tippy.js/dist/tippy.css';
|
|
24
|
+
import { getAddTime } from '../utils';
|
|
24
25
|
|
|
25
26
|
export default {
|
|
26
27
|
name: 'tag',
|
|
@@ -90,7 +91,7 @@ export default {
|
|
|
90
91
|
const { startTime, endTime, scheduleId } = this.item;
|
|
91
92
|
switch (btn.type) {
|
|
92
93
|
case 'plus-square':
|
|
93
|
-
this.$emit('add',
|
|
94
|
+
this.$emit('add', getAddTime(startTime));
|
|
94
95
|
break;
|
|
95
96
|
case 'form':
|
|
96
97
|
this.$emit('edit', this.item);
|
|
@@ -102,8 +103,7 @@ export default {
|
|
|
102
103
|
okText: '确定',
|
|
103
104
|
cancelText: '取消',
|
|
104
105
|
onOk: () => {
|
|
105
|
-
this.$
|
|
106
|
-
this.tagDetailRef.$parent.delSchedule({ id: scheduleId });
|
|
106
|
+
this.tagDetailRef.$parent._delSchedule({ id: scheduleId });
|
|
107
107
|
},
|
|
108
108
|
onCancel() {}
|
|
109
109
|
});
|