cnhis-design-vue 3.1.33-beta.9 → 3.1.33
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/es/components/big-table/index.d.ts +1 -1
- package/es/components/big-table/src/BigTable.vue.d.ts +1 -1
- package/es/components/big-table/src/BigTable.vue2.js +7 -9
- package/es/components/big-table/src/components/edit-form/edit-input.js +1 -1
- package/es/components/big-table/src/components/edit-form/edit-select.js +1 -1
- package/es/components/big-table/src/components/edit-form/edit-time.js +5 -3
- package/es/components/big-table/src/components/edit-form/useCommon.d.ts +2 -1
- package/es/components/big-table/src/components/edit-form/useCommon.js +7 -3
- package/es/components/big-table/src/hooks/useFormat.js +1 -1
- package/es/components/button-print/index.d.ts +13 -0
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +13 -0
- package/es/components/button-print/src/ButtonPrint.vue2.js +6 -1
- package/es/components/button-print/src/utils/print.d.ts +2 -2
- package/es/components/button-print/src/utils/print.js +7 -4
- package/es/components/fabric-chart/index.d.ts +133 -2
- package/es/components/fabric-chart/src/BirthProcessChart.vue.d.ts +132 -0
- package/es/components/fabric-chart/src/BirthProcessChart.vue.js +62 -8
- package/es/components/fabric-chart/src/FabricChart.vue.d.ts +133 -2
- package/es/components/fabric-chart/src/FabricChart.vue.js +2 -2
- package/es/components/fabric-chart/src/TemperatureChart.vue.d.ts +1 -2
- package/es/components/fabric-chart/src/TemperatureChart.vue.js +17 -9
- package/es/components/fabric-chart/src/components/PopupMenu.js +2 -2
- package/es/components/fabric-chart/src/components/PopupTip.vue.d.ts +3 -2
- package/es/components/fabric-chart/src/hooks/index.d.ts +1 -0
- package/es/components/fabric-chart/src/hooks/index.js +1 -0
- package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +23 -1
- package/es/components/fabric-chart/src/hooks/useBirthProcess.js +305 -9
- package/es/components/fabric-chart/src/hooks/useCenter.d.ts +0 -2
- package/es/components/fabric-chart/src/hooks/useCenter.js +27 -45
- package/es/components/fabric-chart/src/hooks/useCommon.d.ts +8 -0
- package/es/components/fabric-chart/src/hooks/useCommon.js +32 -0
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.d.ts +5 -2
- package/es/components/fabric-chart/src/hooks/useCumputedPoint.js +27 -10
- package/es/components/fabric-chart/src/hooks/useLeft.d.ts +1 -1
- package/es/components/fabric-chart/src/hooks/useLeft.js +12 -7
- package/es/components/fabric-chart/src/interface.d.ts +1 -0
- package/es/components/fabric-chart/src/utils/utils.d.ts +11 -0
- package/es/components/fabric-chart/src/utils/utils.js +27 -0
- package/es/components/iho-table/index.d.ts +4 -3
- package/es/components/iho-table/src/IhoTable.vue.d.ts +4 -3
- package/es/components/iho-table/src/IhoTable.vue.js +6 -4
- package/es/components/iho-table/src/components/IhoTableColumn.js +1 -1
- package/es/components/iho-table/src/constants/index.d.ts +3 -3
- package/es/components/iho-table/src/constants/index.js +0 -1
- package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +5 -1
- package/es/components/iho-table/src/hooks/tapHooks/index.js +10 -9
- package/es/components/iho-table/src/hooks/tapHooks/useDataHooks.d.ts +2 -2
- package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +119 -119
- package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.d.ts +5 -3
- package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.js +1 -1
- package/es/components/iho-table/src/hooks/tapHooks/useFieldHooks.d.ts +16 -4
- package/es/components/iho-table/src/hooks/tapHooks/useFieldHooks.js +9 -4
- package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +6 -1
- package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.d.ts +51 -24
- package/es/components/iho-table/src/plugins/filterPlugin/filter.vue.js +37 -51
- package/es/components/iho-table/src/plugins/filterPlugin/index.js +181 -20
- package/es/components/iho-table/src/plugins/filterPlugin/types.d.ts +2 -6
- package/es/components/iho-table/src/plugins/filterPlugin/types.js +0 -7
- package/es/components/iho-table/src/plugins/index.js +1 -1
- package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +7 -4
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/editSeparate.vue.js +3 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +3 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +3 -5
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/seqRendererPlugin.js +5 -2
- package/es/components/iho-table/src/plugins/rowGroupSettingPlugin/rowGroupUtils.js +7 -4
- package/es/components/iho-table/src/plugins/virtualTreePlugin/index.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +10 -12
- package/es/components/iho-table/src/types/pluginType.d.ts +28 -12
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +1 -1
- package/es/components/info-header/src/InfoHeader.vue.js +1 -1
- package/es/components/info-header/style/index.css +1 -1
- package/es/components/keyboard/index.d.ts +62 -1
- package/es/components/keyboard/src/Keyboard.vue.d.ts +62 -1
- package/es/components/keyboard/src/Keyboard.vue.js +4 -1
- package/es/components/keyboard/src/components/NumberPanel.vue.d.ts +67 -5
- package/es/components/keyboard/src/components/NumberPanel.vue.js +48 -26
- package/es/components/keyboard/style/index.css +1 -1
- package/package.json +2 -2
- package/es/components/big-table/src/components/edit-form/dist/edit-date.d.ts +0 -36
- package/es/components/big-table/src/components/edit-form/dist/edit-select.d.ts +0 -37
- package/es/components/big-table/src/components/edit-form/dist/edit-time.d.ts +0 -45
- package/es/components/fabric-chart/src/constants/index.d.ts +0 -4
- package/es/components/fabric-chart/src/constants/index.js +0 -4
- package/es/components/form-render/src/components/renderer/dist/levelSearchCascader.d.ts +0 -65
- package/es/components/form-render/src/components/renderer/dist/radio.d.ts +0 -64
- package/es/components/form-render/src/components/renderer/dist/remoteSearch.d.ts +0 -46
- package/es/components/form-render/src/components/renderer/dist/search.d.ts +0 -56
- package/es/components/form-render/src/components/renderer/dist/select.d.ts +0 -55
- package/es/components/iho-table/src/components/dist/IhoTableColumn.d.ts +0 -20
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/dist/index.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dist/inputRendererPlugin.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dist/numberRendererPlugin.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dist/timeRendererPlugin.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/dist/editSelect.d.ts +0 -42
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/dist/index.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/dist/index.d.ts +0 -3
|
@@ -1,13 +1,304 @@
|
|
|
1
|
-
import { onMounted, nextTick } from 'vue';
|
|
1
|
+
import { reactive, onMounted, nextTick } from 'vue';
|
|
2
|
+
import { useBirthProcessCumputedPoint } from './useCumputedPoint.js';
|
|
2
3
|
import useGrid from './useGrid.js';
|
|
3
|
-
import { drawText, defaultTextStyle, defaultRectStyle } from './useDraw.js';
|
|
4
|
+
import { drawLine, drawPoint, drawText, defaultTextStyle, defaultRectStyle } from './useDraw.js';
|
|
4
5
|
import { fabric } from '../utils/index.js';
|
|
6
|
+
import { getIndex, isEffectiveNode } from '../utils/utils.js';
|
|
7
|
+
import useCommmon from './useCommon.js';
|
|
8
|
+
import { cloneDeep } from 'lodash-es';
|
|
5
9
|
|
|
6
|
-
function useBirthProcess(canvas, propItems) {
|
|
10
|
+
function useBirthProcess(canvas, propItems, emits) {
|
|
11
|
+
const { cumputedX, cumputedY, getXValue, getYValue } = useBirthProcessCumputedPoint(propItems);
|
|
12
|
+
const { getEqualXTypes } = useCommmon(canvas);
|
|
13
|
+
const {
|
|
14
|
+
xAxis,
|
|
15
|
+
grid,
|
|
16
|
+
originX,
|
|
17
|
+
originY,
|
|
18
|
+
xCellWidth,
|
|
19
|
+
endY,
|
|
20
|
+
startTime,
|
|
21
|
+
leftAddAreaWidth,
|
|
22
|
+
leftScales,
|
|
23
|
+
rightScales,
|
|
24
|
+
yCellHeight,
|
|
25
|
+
endX,
|
|
26
|
+
scaleValues,
|
|
27
|
+
canvasWidth,
|
|
28
|
+
borderStyle,
|
|
29
|
+
rightAddAreaWidth,
|
|
30
|
+
event,
|
|
31
|
+
originYCervix
|
|
32
|
+
} = propItems;
|
|
33
|
+
const pointTipProps = reactive({
|
|
34
|
+
show: false,
|
|
35
|
+
point: { x: 0, y: 0 },
|
|
36
|
+
list: []
|
|
37
|
+
});
|
|
38
|
+
const pointMenuProps = reactive({
|
|
39
|
+
show: false,
|
|
40
|
+
point: { x: 0, y: 0 },
|
|
41
|
+
list: [],
|
|
42
|
+
target: null
|
|
43
|
+
});
|
|
44
|
+
const yScaleValue = cloneDeep(scaleValues);
|
|
45
|
+
const gridPoints = /* @__PURE__ */ new Set();
|
|
7
46
|
useGrid(canvas, propItems, true);
|
|
47
|
+
function drawPolyLine() {
|
|
48
|
+
yScaleValue.forEach((item, dataIndex) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const pointList = [];
|
|
51
|
+
const lineList = [];
|
|
52
|
+
(_a = item.data) == null ? void 0 : _a.forEach((v, index) => {
|
|
53
|
+
const points = getPointer(v, item);
|
|
54
|
+
drawPointLine(points, v, index);
|
|
55
|
+
});
|
|
56
|
+
Promise.all(pointList).then((res) => {
|
|
57
|
+
const lineListFilter = lineList.filter((v) => v);
|
|
58
|
+
let prevPoint = null;
|
|
59
|
+
res = res.filter((v) => {
|
|
60
|
+
if (v && prevPoint) {
|
|
61
|
+
prevPoint.nextPoint = v;
|
|
62
|
+
v.prevPoint = prevPoint;
|
|
63
|
+
}
|
|
64
|
+
prevPoint = v || prevPoint;
|
|
65
|
+
v == null ? void 0 : v.bringToFront();
|
|
66
|
+
return v;
|
|
67
|
+
});
|
|
68
|
+
canvas.value.add(...lineListFilter, ...res);
|
|
69
|
+
res.forEach((v) => {
|
|
70
|
+
v == null ? void 0 : v.bringToFront();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
function drawPointLine(points, v, index) {
|
|
74
|
+
let point;
|
|
75
|
+
let line;
|
|
76
|
+
const { pointAttr = {}, lineAttr = {}, title = "", key, type: pointType = "circle" } = item;
|
|
77
|
+
const nextV = item.data[index + 1];
|
|
78
|
+
const nextPoint = getPointer(nextV, item);
|
|
79
|
+
if (points && nextPoint && !v.breakpoint) {
|
|
80
|
+
line = drawLine([...points, ...nextPoint], {
|
|
81
|
+
...lineAttr
|
|
82
|
+
});
|
|
83
|
+
} else if (points && !nextPoint && !v.breakpoint) {
|
|
84
|
+
const nextLinePoint = getPointer(nextV, item);
|
|
85
|
+
line = nextLinePoint ? drawLine([...points, ...nextLinePoint], {
|
|
86
|
+
...lineAttr
|
|
87
|
+
}) : null;
|
|
88
|
+
}
|
|
89
|
+
const previousLine = lineList[index - 1];
|
|
90
|
+
const pointAttrNew = {
|
|
91
|
+
origin: {
|
|
92
|
+
data: v,
|
|
93
|
+
title,
|
|
94
|
+
key: key || "",
|
|
95
|
+
dataIndex,
|
|
96
|
+
index
|
|
97
|
+
},
|
|
98
|
+
leftLine: previousLine,
|
|
99
|
+
rightLine: line,
|
|
100
|
+
...pointAttr,
|
|
101
|
+
...propItems.event
|
|
102
|
+
};
|
|
103
|
+
if (previousLine) {
|
|
104
|
+
point = drawPoint(pointType, {
|
|
105
|
+
left: previousLine.get("x2"),
|
|
106
|
+
top: previousLine.get("y2"),
|
|
107
|
+
...pointAttrNew
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
if (points) {
|
|
111
|
+
pointAttrNew.leftLine = null;
|
|
112
|
+
point = drawPoint(pointType, {
|
|
113
|
+
left: points[0],
|
|
114
|
+
top: points[1],
|
|
115
|
+
...pointAttrNew
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
lineList.push(line);
|
|
120
|
+
if (point) {
|
|
121
|
+
setPointEvent(point);
|
|
122
|
+
pointList.push(point);
|
|
123
|
+
gridPoints.add(point);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function setPointEvent(point) {
|
|
129
|
+
if (event.hovered) {
|
|
130
|
+
point.on("mouseover", () => {
|
|
131
|
+
setPopup(point);
|
|
132
|
+
});
|
|
133
|
+
point.on("mouseout", () => {
|
|
134
|
+
pointTipProps.show = false;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
point.on("moving", () => {
|
|
138
|
+
moveLimit(point);
|
|
139
|
+
updateLine(point);
|
|
140
|
+
event.hovered && setPopup(point);
|
|
141
|
+
});
|
|
142
|
+
point.on("mouseup", (event2) => {
|
|
143
|
+
pointTipProps.show = false;
|
|
144
|
+
if (event2.button === 1) {
|
|
145
|
+
const { key } = point.origin;
|
|
146
|
+
const params = {
|
|
147
|
+
...point.origin,
|
|
148
|
+
data: {
|
|
149
|
+
...point.origin.data,
|
|
150
|
+
time: getXValue(point.left),
|
|
151
|
+
value: getYValue(key, point.top)
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
canvas.value.discardActiveObject();
|
|
155
|
+
emits("change", params);
|
|
156
|
+
updateData(params, "change");
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function updateData(params, mode = "add") {
|
|
161
|
+
const { dataIndex, data, index, key } = params;
|
|
162
|
+
const item = yScaleValue.find((v) => v.key === key);
|
|
163
|
+
switch (mode) {
|
|
164
|
+
case "delete":
|
|
165
|
+
item.data.splice(index, 0);
|
|
166
|
+
break;
|
|
167
|
+
case "change":
|
|
168
|
+
item.data[index] = data;
|
|
169
|
+
break;
|
|
170
|
+
default: {
|
|
171
|
+
const index2 = getIndex(data.time, item.data);
|
|
172
|
+
console.log("index :>> ", index2);
|
|
173
|
+
item.data.splice(index2, 0, data);
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
redrawPoints();
|
|
178
|
+
}
|
|
179
|
+
function getRemovePoints(points) {
|
|
180
|
+
const removePoints = [];
|
|
181
|
+
points.forEach((point) => {
|
|
182
|
+
point && removePoints.push(point);
|
|
183
|
+
(point == null ? void 0 : point.leftLine) && removePoints.push(point == null ? void 0 : point.leftLine);
|
|
184
|
+
(point == null ? void 0 : point.rightLine) && removePoints.push(point == null ? void 0 : point.rightLine);
|
|
185
|
+
});
|
|
186
|
+
return removePoints;
|
|
187
|
+
}
|
|
188
|
+
function redrawPoints() {
|
|
189
|
+
var _a;
|
|
190
|
+
gridPoints.size && ((_a = canvas.value) == null ? void 0 : _a.remove(...getRemovePoints([...gridPoints])));
|
|
191
|
+
gridPoints.clear();
|
|
192
|
+
drawPolyLine();
|
|
193
|
+
}
|
|
194
|
+
function updateLine(point) {
|
|
195
|
+
var _a, _b;
|
|
196
|
+
(_a = point.leftLine) == null ? void 0 : _a.setCoords().set({ x2: point.left, y2: point.top });
|
|
197
|
+
(_b = point.rightLine) == null ? void 0 : _b.setCoords().set({ x1: point.left, y1: point.top });
|
|
198
|
+
}
|
|
199
|
+
function moveLimit(point) {
|
|
200
|
+
const limitLeft = point.prevPoint ? point.prevPoint.left : originX;
|
|
201
|
+
const limitRight = point.nextPoint ? point.nextPoint.left : endX;
|
|
202
|
+
point.setCoords();
|
|
203
|
+
["cervix", "fetalPresentation"].includes(point.origin.key) && point.top < originYCervix && point.set("top", originYCervix);
|
|
204
|
+
point.top < originY && point.set("top", originY);
|
|
205
|
+
point.top > endY && point.set("top", endY);
|
|
206
|
+
point.left < limitLeft && point.set("left", limitLeft);
|
|
207
|
+
point.left > limitRight && point.set("left", limitRight);
|
|
208
|
+
}
|
|
209
|
+
function setPopup(point) {
|
|
210
|
+
const { title, key } = point.origin;
|
|
211
|
+
pointTipProps.point = {
|
|
212
|
+
x: point.left,
|
|
213
|
+
y: point.top
|
|
214
|
+
};
|
|
215
|
+
pointTipProps.list = [`${title} ${getYValue(key, point.top)}`, `\u65F6\u95F4 ${getXValue(point.left).slice(-5)}`];
|
|
216
|
+
pointTipProps.show = true;
|
|
217
|
+
}
|
|
218
|
+
function getPointer(v, item) {
|
|
219
|
+
if (isEffectiveNode(v) && isLimit(v.time)) {
|
|
220
|
+
const x = cumputedX(v.time);
|
|
221
|
+
const y = cumputedY(item.key, item.range, v.value);
|
|
222
|
+
return [x, y < originY ? originY : y > endY ? endY : y];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function isLimit(time) {
|
|
226
|
+
const maxMinute = startTime + 24 * 60 * 60 * 1e3;
|
|
227
|
+
const getTime = new Date(time).getTime();
|
|
228
|
+
return getTime >= startTime && getTime <= maxMinute;
|
|
229
|
+
}
|
|
230
|
+
function setCanvasEvent() {
|
|
231
|
+
if (!propItems.event.evented)
|
|
232
|
+
return;
|
|
233
|
+
canvas.value.on("mouse:up", (event2) => {
|
|
234
|
+
if (event2.button === 3) {
|
|
235
|
+
const { x = 0, y = 0 } = event2.pointer || {};
|
|
236
|
+
if (x >= originX && x <= endX && y >= originY && y <= endY) {
|
|
237
|
+
pointMenuProps.point = { x, y };
|
|
238
|
+
pointMenuProps.show = true;
|
|
239
|
+
if (!event2.target) {
|
|
240
|
+
pointMenuProps.target = null;
|
|
241
|
+
pointMenuProps.list = ["\u65B0\u589E\u8282\u70B9"];
|
|
242
|
+
yScaleValue.forEach((item) => {
|
|
243
|
+
if (!getEqualXTypes(x, "key").includes(item.key)) {
|
|
244
|
+
if (["cervix", "fetalPresentation"].includes(item.key) && y < originYCervix)
|
|
245
|
+
return;
|
|
246
|
+
pointMenuProps.list.push(getPointMenuList(item, event2.pointer));
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
if (pointMenuProps.list.length === 1) {
|
|
250
|
+
pointMenuProps.show = false;
|
|
251
|
+
console.log("\u5F53\u524D\u65F6\u95F4\u6BB5\u5185\u65E0\u53EF\u65B0\u589E\u8282\u70B9");
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
pointMenuProps.target = event2.target;
|
|
255
|
+
pointMenuProps.list = ["\u5220\u9664\u8282\u70B9"];
|
|
256
|
+
yScaleValue.forEach((item) => {
|
|
257
|
+
if (getEqualXTypes(x, "key").includes(item.key)) {
|
|
258
|
+
pointMenuProps.list.push({
|
|
259
|
+
...getPointMenuList(item, event2.pointer),
|
|
260
|
+
mode: "delete",
|
|
261
|
+
index: event2.target.origin.index
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
function getPointMenuList(item, pointer) {
|
|
270
|
+
const dataIndex = yScaleValue.findIndex((_item) => _item.key === item.key);
|
|
271
|
+
return {
|
|
272
|
+
renderItem: () => item.title,
|
|
273
|
+
origin: {
|
|
274
|
+
title: item.title,
|
|
275
|
+
unit: item.unit,
|
|
276
|
+
dataIndex,
|
|
277
|
+
key: item.key
|
|
278
|
+
},
|
|
279
|
+
pointer
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function clickMenu({ item, target }) {
|
|
284
|
+
console.log("item :>> ", item);
|
|
285
|
+
const params = {
|
|
286
|
+
data: {
|
|
287
|
+
time: getXValue(item.pointer.x),
|
|
288
|
+
value: getYValue(item.origin.key, item.pointer.y)
|
|
289
|
+
},
|
|
290
|
+
...item.origin
|
|
291
|
+
};
|
|
292
|
+
if (item.mode === "delete") {
|
|
293
|
+
emits("delete", params);
|
|
294
|
+
updateData(params, "delete");
|
|
295
|
+
} else {
|
|
296
|
+
emits("add", params);
|
|
297
|
+
updateData(params);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
8
300
|
function drawXScale() {
|
|
9
|
-
const {
|
|
10
|
-
const { show, startTime, range = [0, 23], position = "top", style } = xAxis.time;
|
|
301
|
+
const { show, startTime: startTime2, range = [0, 23], position = "top", style } = xAxis.time;
|
|
11
302
|
const { show: processTimeShow, range: processTimeRange = [0, 23], style: processTimeStyle } = xAxis.processTime;
|
|
12
303
|
if (show || processTimeShow) {
|
|
13
304
|
const timeList = [];
|
|
@@ -17,7 +308,7 @@ function useBirthProcess(canvas, propItems) {
|
|
|
17
308
|
const left = originX + xCellWidth / 2;
|
|
18
309
|
for (let i = 0; i < grid.mainXCell; i++) {
|
|
19
310
|
if (show) {
|
|
20
|
-
const currentTime = i === 0 ? +
|
|
311
|
+
const currentTime = i === 0 ? +startTime2.slice(11, 13) : getCurrentTime(timeList.at(-1), range);
|
|
21
312
|
timeList.push(currentTime);
|
|
22
313
|
const top = position == "top" ? originY - 15 : endY + 15;
|
|
23
314
|
timeTextList.push(
|
|
@@ -53,7 +344,6 @@ function useBirthProcess(canvas, propItems) {
|
|
|
53
344
|
return lastTime + 1 > range[1] ? range[0] : lastTime + 1;
|
|
54
345
|
}
|
|
55
346
|
function drawYScale() {
|
|
56
|
-
const { leftAddAreaWidth, leftScales, rightScales, originY, endY, yCellHeight, endX } = propItems;
|
|
57
347
|
let baseLeft = leftAddAreaWidth;
|
|
58
348
|
[...leftScales, ...rightScales].forEach((item, index) => {
|
|
59
349
|
const { range, spaceValue, width, title, titleStyle, layout } = item;
|
|
@@ -94,13 +384,12 @@ function useBirthProcess(canvas, propItems) {
|
|
|
94
384
|
function getScaleNumberList(range, spaceValue) {
|
|
95
385
|
const list = [];
|
|
96
386
|
const [min, max] = range;
|
|
97
|
-
for (let i = min; i <= max; i += spaceValue) {
|
|
387
|
+
for (let i = min; spaceValue > 0 ? i <= max : i >= max; i += spaceValue) {
|
|
98
388
|
list.push(i);
|
|
99
389
|
}
|
|
100
390
|
return list;
|
|
101
391
|
}
|
|
102
392
|
function drawBorder() {
|
|
103
|
-
const { canvasWidth, borderStyle, endY, leftAddAreaWidth, rightAddAreaWidth } = propItems;
|
|
104
393
|
const border = new fabric.Rect({
|
|
105
394
|
...borderStyle,
|
|
106
395
|
width: canvasWidth - leftAddAreaWidth - rightAddAreaWidth,
|
|
@@ -116,8 +405,15 @@ function useBirthProcess(canvas, propItems) {
|
|
|
116
405
|
drawYScale();
|
|
117
406
|
drawXScale();
|
|
118
407
|
drawBorder();
|
|
408
|
+
drawPolyLine();
|
|
409
|
+
setCanvasEvent();
|
|
119
410
|
});
|
|
120
411
|
});
|
|
412
|
+
return {
|
|
413
|
+
pointTipProps,
|
|
414
|
+
pointMenuProps,
|
|
415
|
+
clickMenu
|
|
416
|
+
};
|
|
121
417
|
}
|
|
122
418
|
|
|
123
419
|
export { useBirthProcess };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { fabric } from '../utils';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
|
-
import { IPointType } from '../interface';
|
|
5
4
|
export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, addRenderItem: Function | undefined): {
|
|
6
5
|
pointTipProps: {
|
|
7
6
|
show: boolean;
|
|
@@ -25,7 +24,6 @@ export declare function useCenter(canvas: Ref<fabric.Canvas>, propItems: IPropIt
|
|
|
25
24
|
target: any;
|
|
26
25
|
}) => void;
|
|
27
26
|
setPopup: (point: any) => void;
|
|
28
|
-
getEqualXTypes: (pointX: number) => IPointType[];
|
|
29
27
|
isAddPoint: (x: number) => boolean;
|
|
30
28
|
updateData: (params: any, mode?: string) => void;
|
|
31
29
|
redrawPoints: () => void;
|
|
@@ -4,38 +4,17 @@ import { drawLine, defaultStyle, drawPoint, drawText, drawArrow } from './useDra
|
|
|
4
4
|
import useGrid from './useGrid.js';
|
|
5
5
|
import { useShadow } from './useShadow.js';
|
|
6
6
|
import { TEMPERATURE_MENU, PAIN_MENU, OVERLAP } from './constant.js';
|
|
7
|
+
import useCommmon from './useCommon.js';
|
|
7
8
|
import { cloneDeep } from 'lodash-es';
|
|
9
|
+
import { getPointArr, isEffectiveNode, getIndex, deleteProperty } from '../utils/utils.js';
|
|
8
10
|
|
|
9
|
-
function isEffectiveNode(node) {
|
|
10
|
-
return (node == null ? void 0 : node.time) && ((node == null ? void 0 : node.value) || (node == null ? void 0 : node.value) === 0);
|
|
11
|
-
}
|
|
12
|
-
function getPointArr(arr) {
|
|
13
|
-
let _arr = [];
|
|
14
|
-
return arr.reduce((pre, cur, index) => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
_arr.push([cur.left, cur.top]);
|
|
17
|
-
if (((_b = (_a = cur.origin) == null ? void 0 : _a.data) == null ? void 0 : _b.breakpoint) || arr.length - 1 === index) {
|
|
18
|
-
pre.push(_arr);
|
|
19
|
-
_arr = [];
|
|
20
|
-
}
|
|
21
|
-
return pre;
|
|
22
|
-
}, []);
|
|
23
|
-
}
|
|
24
|
-
function deleteProperty(data, list) {
|
|
25
|
-
list.map((v) => v.type).forEach((key) => {
|
|
26
|
-
if (Reflect.has(data, key))
|
|
27
|
-
Reflect.deleteProperty(data, key);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function getIndex(time, list) {
|
|
31
|
-
const index = list.findIndex((v) => new Date(v.time).getTime() > new Date(time).getTime());
|
|
32
|
-
return !~index ? list.length : index;
|
|
33
|
-
}
|
|
34
11
|
function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, getYValue, addRenderItem) {
|
|
35
12
|
useGrid(canvas, propItems);
|
|
13
|
+
const { getEqualXTypes, repeatTip, maxLimitTip, minLimitTip } = useCommmon(canvas);
|
|
36
14
|
const {
|
|
37
15
|
left,
|
|
38
16
|
xScaleList,
|
|
17
|
+
xCellWidth,
|
|
39
18
|
yCellHeight,
|
|
40
19
|
originX,
|
|
41
20
|
endX,
|
|
@@ -168,7 +147,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
168
147
|
pointMenuProps.target = null;
|
|
169
148
|
pointMenuProps.list = ["\u65B0\u589E\u8282\u70B9"];
|
|
170
149
|
itemList.forEach((v) => {
|
|
171
|
-
if (!getEqualXTypes(x).includes(v.bigType)) {
|
|
150
|
+
if (!getEqualXTypes(x, "type", xCellWidth).includes(v.bigType)) {
|
|
172
151
|
const newY = ["pain"].includes(v.bigType) ? painOriginY : vitalSignsOriginY;
|
|
173
152
|
if (y >= newY.originY && y <= newY.endY) {
|
|
174
153
|
pointMenuProps.list.push({
|
|
@@ -185,25 +164,16 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
185
164
|
}
|
|
186
165
|
}
|
|
187
166
|
});
|
|
188
|
-
|
|
167
|
+
const isLimitAdd = isAddPoint(x);
|
|
168
|
+
if (!isLimitAdd || pointMenuProps.list.length === 1) {
|
|
189
169
|
pointMenuProps.show = false;
|
|
190
|
-
|
|
170
|
+
pointMenuProps.list.length === 1 && isLimitAdd && repeatTip();
|
|
191
171
|
}
|
|
192
172
|
}
|
|
193
173
|
}
|
|
194
174
|
}
|
|
195
175
|
});
|
|
196
176
|
}
|
|
197
|
-
function getEqualXTypes(pointX) {
|
|
198
|
-
const types = [];
|
|
199
|
-
const left2 = cumputedX(getXValue(pointX));
|
|
200
|
-
canvas.value.forEachObject((obj) => {
|
|
201
|
-
if (obj.origin && left2 === obj.left) {
|
|
202
|
-
types.push(obj.origin.type);
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
return [...new Set(types)];
|
|
206
|
-
}
|
|
207
177
|
function drawOverlapPoint() {
|
|
208
178
|
var _a;
|
|
209
179
|
const pulseObj = yScaleValue.find((item) => item.type === "pulse");
|
|
@@ -440,7 +410,9 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
440
410
|
const { pointAttr = {}, lineAttr = {}, title = "", key, type: pointType = "circle" } = _item;
|
|
441
411
|
const nextV = item.list[index + 1];
|
|
442
412
|
const nextPoint = getPointer(nextV, scaleValue);
|
|
443
|
-
|
|
413
|
+
const isNonePain = isNoneValuePain(type, item.list[index].value);
|
|
414
|
+
const isNextNonePain = nextPoint && isNoneValuePain(type, nextV.value);
|
|
415
|
+
if (points && nextPoint && !v.breakpoint && !isNonePain && !isNextNonePain) {
|
|
444
416
|
line = drawLine([...points, ...nextPoint], {
|
|
445
417
|
...lineAttr
|
|
446
418
|
});
|
|
@@ -454,6 +426,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
454
426
|
line
|
|
455
427
|
});
|
|
456
428
|
}
|
|
429
|
+
const currentPointType = v.pacemakerShow && type == "pulse" ? pacemaker.value : isNonePain ? 0 : pointType;
|
|
457
430
|
const previousLine = lineList[index - 1];
|
|
458
431
|
const pointAttrNew = {
|
|
459
432
|
origin: {
|
|
@@ -470,13 +443,14 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
470
443
|
otherObj,
|
|
471
444
|
lockMovementX: true,
|
|
472
445
|
...v.pacemakerShow && type == "pulse" ? pacemaker.style : pointAttr,
|
|
473
|
-
...propItems.event
|
|
446
|
+
...propItems.event,
|
|
447
|
+
...isNonePain ? { selectable: false, evented: false } : {}
|
|
474
448
|
};
|
|
475
|
-
const currentPointType = v.pacemakerShow && type == "pulse" ? pacemaker.value : pointType;
|
|
476
449
|
if (previousLine) {
|
|
450
|
+
const y = previousLine.get("y2");
|
|
477
451
|
point = drawPoint(currentPointType, {
|
|
478
452
|
left: previousLine.get("x2"),
|
|
479
|
-
top:
|
|
453
|
+
top: isNonePain ? y - 5 : y,
|
|
480
454
|
...pointAttrNew
|
|
481
455
|
});
|
|
482
456
|
} else {
|
|
@@ -484,7 +458,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
484
458
|
pointAttrNew.leftLine = null;
|
|
485
459
|
point = drawPoint(currentPointType, {
|
|
486
460
|
left: points[0],
|
|
487
|
-
top: points[1],
|
|
461
|
+
top: isNonePain ? points[1] - 5 : points[1],
|
|
488
462
|
...pointAttrNew
|
|
489
463
|
});
|
|
490
464
|
}
|
|
@@ -502,6 +476,9 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
502
476
|
}
|
|
503
477
|
}
|
|
504
478
|
}
|
|
479
|
+
function isNoneValuePain(type, value) {
|
|
480
|
+
return type === "pain" && value == 0;
|
|
481
|
+
}
|
|
505
482
|
function setPointEvent(point) {
|
|
506
483
|
if (event.hovered) {
|
|
507
484
|
point.on("mouseover", () => {
|
|
@@ -601,8 +578,14 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
601
578
|
const day = `00${d.getDate()}`.slice(-2);
|
|
602
579
|
const todayTime = new Date(`${d.getFullYear()}-${month}-${day} 23:59:59`).getTime();
|
|
603
580
|
const pointTime = new Date(`${getXValue(x)}:00`).getTime();
|
|
604
|
-
if (hospitalizationDate && pointTime < new Date(hospitalizationDate).getTime()
|
|
581
|
+
if (hospitalizationDate && pointTime < new Date(hospitalizationDate).getTime()) {
|
|
582
|
+
minLimitTip();
|
|
605
583
|
return false;
|
|
584
|
+
}
|
|
585
|
+
if (pointTime > todayTime) {
|
|
586
|
+
maxLimitTip();
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
606
589
|
return true;
|
|
607
590
|
}
|
|
608
591
|
function clickMenu({ item, target }) {
|
|
@@ -680,7 +663,6 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
680
663
|
pointMenuProps,
|
|
681
664
|
clickMenu,
|
|
682
665
|
setPopup,
|
|
683
|
-
getEqualXTypes,
|
|
684
666
|
isAddPoint,
|
|
685
667
|
updateData,
|
|
686
668
|
redrawPoints
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { fabric } from '../utils';
|
|
3
|
+
export default function useCommmon(canvas: Ref<fabric.Canvas>): {
|
|
4
|
+
getEqualXTypes: (pointX: number, field: string, range?: number) => string[];
|
|
5
|
+
repeatTip: () => void;
|
|
6
|
+
maxLimitTip: () => void;
|
|
7
|
+
minLimitTip: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMessage } from 'naive-ui';
|
|
2
|
+
|
|
3
|
+
function useCommmon(canvas) {
|
|
4
|
+
const $message = useMessage();
|
|
5
|
+
function getEqualXTypes(pointX, field, range = 6) {
|
|
6
|
+
const types = [];
|
|
7
|
+
const half = range / 2;
|
|
8
|
+
canvas.value.forEachObject((obj) => {
|
|
9
|
+
if (obj.origin && !obj.origin.isMenu && obj.left >= pointX - half && obj.left <= pointX + half) {
|
|
10
|
+
types.push(obj.origin[field]);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return [...new Set(types)];
|
|
14
|
+
}
|
|
15
|
+
function repeatTip() {
|
|
16
|
+
$message.warning("\u8BE5\u65F6\u6BB5\u5DF2\u5B58\u5728\u6570\u503C\u4E0D\u80FD\u65B0\u589E");
|
|
17
|
+
}
|
|
18
|
+
function maxLimitTip() {
|
|
19
|
+
$message.warning("\u672A\u6765\u65F6\u95F4\u4E0D\u5141\u8BB8\u5F55\u5165");
|
|
20
|
+
}
|
|
21
|
+
function minLimitTip() {
|
|
22
|
+
$message.warning("\u4E0D\u5141\u8BB8\u5C0F\u4E8E\u5165\u9662\u65F6\u95F4");
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
getEqualXTypes,
|
|
26
|
+
repeatTip,
|
|
27
|
+
maxLimitTip,
|
|
28
|
+
minLimitTip
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { useCommmon as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPointType } from '../interface';
|
|
2
2
|
import { AnyObject } from '../../../../../es/shared/types';
|
|
3
|
-
export declare function useCumputedPoint(propItems:
|
|
3
|
+
export declare function useCumputedPoint(propItems: AnyObject): {
|
|
4
4
|
cumputedX: (value: number | string, setAllCenter?: boolean) => any;
|
|
5
5
|
cumputedY: (type: IPointType, scaleValueList: number[], value: number | string) => number;
|
|
6
6
|
getXValue: (pointX: number) => string | undefined;
|
|
@@ -8,4 +8,7 @@ export declare function useCumputedPoint(propItems: IPropItems): {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function useBirthProcessCumputedPoint(propItems: AnyObject): {
|
|
10
10
|
cumputedX: (value: number | string) => any;
|
|
11
|
+
cumputedY: (key: string, range: [number, number], value: number | string) => number;
|
|
12
|
+
getXValue: (pointX: number) => string;
|
|
13
|
+
getYValue: (key: string, pointY: number) => number;
|
|
11
14
|
};
|
|
@@ -11,11 +11,7 @@ function useCumputedPoint(propItems) {
|
|
|
11
11
|
const index = xScaleList.findIndex((v) => v.end >= time);
|
|
12
12
|
if (index > -1) {
|
|
13
13
|
const item = xScaleList[index];
|
|
14
|
-
|
|
15
|
-
return item.left;
|
|
16
|
-
} else {
|
|
17
|
-
return item.center;
|
|
18
|
-
}
|
|
14
|
+
return item.center;
|
|
19
15
|
}
|
|
20
16
|
}
|
|
21
17
|
function cumputedY(type, scaleValueList, value) {
|
|
@@ -57,15 +53,36 @@ function useCumputedPoint(propItems) {
|
|
|
57
53
|
};
|
|
58
54
|
}
|
|
59
55
|
function useBirthProcessCumputedPoint(propItems) {
|
|
60
|
-
const { xAxis, originX, originY, xCellWidth } = propItems;
|
|
56
|
+
const { xAxis, originX, originY, xCellWidth, endY, timeXCell, startTime, scaleValues } = propItems;
|
|
61
57
|
function cumputedX(value) {
|
|
62
58
|
const time = new Date(value).getTime();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
return (time - startTime) / timeXCell + originX;
|
|
60
|
+
}
|
|
61
|
+
function cumputedY(key, range, value) {
|
|
62
|
+
const [minValue] = range;
|
|
63
|
+
return endY - (+value - minValue) / propItems[`${key}YCell`];
|
|
64
|
+
}
|
|
65
|
+
function getXValue(pointX) {
|
|
66
|
+
const time = (pointX - originX) * timeXCell + startTime;
|
|
67
|
+
const d = new Date(time);
|
|
68
|
+
const month = `00${d.getMonth() + 1}`.slice(-2);
|
|
69
|
+
const day = `00${d.getDate()}`.slice(-2);
|
|
70
|
+
const hours = `00${d.getHours()}`.slice(-2);
|
|
71
|
+
const minutes = `00${d.getMinutes()}`.slice(-2);
|
|
72
|
+
const date = `${d.getFullYear()}-${month}-${day} ${hours}:${minutes}`;
|
|
73
|
+
return date;
|
|
74
|
+
}
|
|
75
|
+
function getYValue(key, pointY) {
|
|
76
|
+
const item = scaleValues.find((item2) => key === item2.key);
|
|
77
|
+
const [minValue] = (item == null ? void 0 : item.range) || [0];
|
|
78
|
+
const y = (endY - pointY) * propItems[`${key}YCell`] + minValue;
|
|
79
|
+
return Math.floor(y * 100) / 100;
|
|
66
80
|
}
|
|
67
81
|
return {
|
|
68
|
-
cumputedX
|
|
82
|
+
cumputedX,
|
|
83
|
+
cumputedY,
|
|
84
|
+
getXValue,
|
|
85
|
+
getYValue
|
|
69
86
|
};
|
|
70
87
|
}
|
|
71
88
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { fabric } from '../utils';
|
|
3
3
|
import { IPropItems } from '../interface';
|
|
4
|
-
export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, setPopup: Function, pointTipProps: any,
|
|
4
|
+
export declare function useLeft(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any, setPopup: Function, pointTipProps: any, cumputedX: Function, cumputedY: Function, getXValue: Function, getYValue: Function, isAddPoint: Function, updateData: Function): {
|
|
5
5
|
drawScaleValue: (yScaleValueList: any[]) => void;
|
|
6
6
|
};
|