inl-app-manager 1.5.43 → 1.5.45
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/dist/elements/index.js +139 -50
- package/dist/index.js +139 -50
- package/package.json +5 -4
- package/rollup.config.cjs +2 -0
- package/rollup.config.ts +1 -1
- package/entry.js +0 -14
package/dist/elements/index.js
CHANGED
|
@@ -2940,6 +2940,9 @@ const props$c = {
|
|
|
2940
2940
|
countDown: {
|
|
2941
2941
|
type: Number,
|
|
2942
2942
|
default: 10
|
|
2943
|
+
},
|
|
2944
|
+
getContainer: {
|
|
2945
|
+
type: Function
|
|
2943
2946
|
}
|
|
2944
2947
|
};
|
|
2945
2948
|
const AlarmVideo = defineComponent({
|
|
@@ -3087,7 +3090,7 @@ const AlarmVideo = defineComponent({
|
|
|
3087
3090
|
"footer": null,
|
|
3088
3091
|
"width": 900,
|
|
3089
3092
|
"centered": true,
|
|
3090
|
-
"getContainer": () => document.getElementById("alarmLinkage")
|
|
3093
|
+
"getContainer": _props.getContainer || (() => document.getElementById("alarmLinkage") || document.body)
|
|
3091
3094
|
}, {
|
|
3092
3095
|
default: () => [createVNode("div", {
|
|
3093
3096
|
"class": "body"
|
|
@@ -3172,7 +3175,7 @@ const AlarmVideo = defineComponent({
|
|
|
3172
3175
|
}
|
|
3173
3176
|
});
|
|
3174
3177
|
|
|
3175
|
-
const BROKERURL = "ws://" + location.host + "/mtip-app-center-websocket";
|
|
3178
|
+
const BROKERURL = (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/mtip-app-center-websocket";
|
|
3176
3179
|
const SUBSCRINBURL = "/queue/alarm";
|
|
3177
3180
|
const Props$1 = createCardProps({
|
|
3178
3181
|
title: {
|
|
@@ -3234,65 +3237,149 @@ const AlarmLinkage = defineComponent({
|
|
|
3234
3237
|
}
|
|
3235
3238
|
const alarmList = ref([]);
|
|
3236
3239
|
const clientId = ref("");
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3240
|
+
let client;
|
|
3241
|
+
let hasConnected = false;
|
|
3242
|
+
let isLoadingAlarmData = false;
|
|
3243
|
+
const pendingAlarmMessages = [];
|
|
3244
|
+
const loadAlarmData = async () => {
|
|
3245
|
+
isLoadingAlarmData = true;
|
|
3246
|
+
try {
|
|
3247
|
+
const {
|
|
3248
|
+
data
|
|
3249
|
+
} = await getInitialAlarmLinkage(props.appId, props.systemUuid);
|
|
3250
|
+
const alarmFeed = Array.isArray(data?.alarmFeed) ? data.alarmFeed : [];
|
|
3251
|
+
alarmFeed.filter(item => Array.isArray(item.alarmList) && item.alarmList.length > 0).forEach(item => {
|
|
3252
|
+
item.instanceUuid = item.alarmList[0].instanceUuid;
|
|
3253
|
+
});
|
|
3254
|
+
alarmList.value = alarmFeed;
|
|
3255
|
+
if (data?.clientId && data.clientId !== clientId.value) {
|
|
3256
|
+
const previousClientId = clientId.value;
|
|
3257
|
+
clientId.value = data.clientId;
|
|
3258
|
+
if (previousClientId) {
|
|
3259
|
+
void closeAlarmLink(props.appId, props.systemUuid, previousClientId).catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u65E7\u76D1\u542C\u5173\u95ED\u5931\u8D25", error));
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
} finally {
|
|
3263
|
+
isLoadingAlarmData = false;
|
|
3264
|
+
if (clientId.value && pendingAlarmMessages.length) {
|
|
3265
|
+
const pendingMessages = pendingAlarmMessages.splice(0);
|
|
3266
|
+
pendingMessages.forEach(({
|
|
3267
|
+
message: message2,
|
|
3268
|
+
receivedClientId
|
|
3269
|
+
}) => processAlarmMessage(message2, receivedClientId));
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
};
|
|
3273
|
+
const processAlarmMessage = (message2, receivedClientId = clientId.value) => {
|
|
3274
|
+
let obj;
|
|
3275
|
+
try {
|
|
3276
|
+
obj = JSON.parse(message2.body);
|
|
3277
|
+
} catch (error) {
|
|
3278
|
+
console.error("\u62A5\u8B66\u8054\u52A8\u6D88\u606F\u89E3\u6790\u5931\u8D25", error);
|
|
3279
|
+
return;
|
|
3280
|
+
}
|
|
3281
|
+
const targetClientIds = obj?.webSocketClientIdList;
|
|
3282
|
+
const isTargetClient = [receivedClientId, clientId.value].some(id => id && targetClientIds?.includes?.(id));
|
|
3283
|
+
if (!isTargetClient) {
|
|
3284
|
+
return;
|
|
3285
|
+
}
|
|
3286
|
+
const alarms = Array.isArray(obj?.alarmList) ? obj.alarmList : [];
|
|
3287
|
+
alarms.forEach(alarm => {
|
|
3288
|
+
if (!alarm) return;
|
|
3289
|
+
const instanceUuid = alarm.instanceUuid || obj.instanceUuid;
|
|
3290
|
+
if (!instanceUuid) return;
|
|
3291
|
+
const isClear = alarm.status === "CLEAR_ALARM";
|
|
3292
|
+
const prevInstance = alarmList.value.find(item => item.instanceUuid === instanceUuid);
|
|
3293
|
+
if (prevInstance) {
|
|
3294
|
+
if (!Array.isArray(prevInstance.alarmList)) {
|
|
3295
|
+
prevInstance.alarmList = [];
|
|
3296
|
+
}
|
|
3297
|
+
const idx = prevInstance.alarmList.findIndex(item => item.id === alarm.id);
|
|
3298
|
+
if (idx > -1 && isClear) {
|
|
3299
|
+
prevInstance.alarmList.splice(idx, 1);
|
|
3300
|
+
if (!prevInstance.alarmList.length) {
|
|
3301
|
+
const prevInstIdx = alarmList.value.findIndex(item => item === prevInstance);
|
|
3302
|
+
if (prevInstIdx > -1) alarmList.value.splice(prevInstIdx, 1);
|
|
3303
|
+
}
|
|
3304
|
+
} else if (idx === -1 && !isClear) {
|
|
3305
|
+
prevInstance.alarmList.push(alarm);
|
|
3306
|
+
prevInstance.alarmList.sort((a, b) => a.level - b.level);
|
|
3307
|
+
} else if (idx > -1 && !isClear) {
|
|
3308
|
+
prevInstance.alarmList.splice(idx, 1, alarm);
|
|
3309
|
+
}
|
|
3310
|
+
prevInstance.highLevel = Math.max(prevInstance.highLevel || 0, alarm.level || 0);
|
|
3311
|
+
} else if (!isClear) {
|
|
3312
|
+
alarmList.value.push({
|
|
3313
|
+
...obj,
|
|
3314
|
+
instanceUuid,
|
|
3315
|
+
alarmList: [alarm]
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3245
3318
|
});
|
|
3246
|
-
clientId.value = data.clientId;
|
|
3247
|
-
client.activate();
|
|
3248
3319
|
};
|
|
3249
|
-
|
|
3250
|
-
if (
|
|
3320
|
+
const handleAlarmMessage = message2 => {
|
|
3321
|
+
if (!clientId.value || isLoadingAlarmData) {
|
|
3322
|
+
if (pendingAlarmMessages.length < 50) {
|
|
3323
|
+
pendingAlarmMessages.push({
|
|
3324
|
+
message: message2,
|
|
3325
|
+
receivedClientId: clientId.value
|
|
3326
|
+
});
|
|
3327
|
+
}
|
|
3328
|
+
return;
|
|
3329
|
+
}
|
|
3330
|
+
processAlarmMessage(message2);
|
|
3331
|
+
};
|
|
3332
|
+
const refreshTimer = useIntervalFn(() => {
|
|
3333
|
+
if (!clientId.value) return;
|
|
3334
|
+
void refreshAlarmLink(props.appId, props.systemUuid, clientId.value).catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u76D1\u542C\u5237\u65B0\u5931\u8D25", error));
|
|
3335
|
+
}, 1e3 * 60 * 10, {
|
|
3336
|
+
immediate: false
|
|
3251
3337
|
});
|
|
3252
|
-
|
|
3338
|
+
client = new Client({
|
|
3253
3339
|
brokerURL: BROKERURL,
|
|
3254
3340
|
onConnect: () => {
|
|
3255
3341
|
console.log("\u62A5\u8B66\u8054\u52A8\u5DF2\u8FDE\u63A5");
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
if (idx > -1 && isClear) {
|
|
3273
|
-
prevInstance.alarmList.splice(idx, 1);
|
|
3274
|
-
if (!prevInstance.alarmList.length) {
|
|
3275
|
-
const prevInstIdx = alarmList.value.findIndex(item => item === prevInstance);
|
|
3276
|
-
if (prevInstIdx > -1) alarmList.value.splice(prevInstIdx, 1);
|
|
3277
|
-
}
|
|
3278
|
-
} else if (idx === -1 && !isClear) {
|
|
3279
|
-
prevInstance.alarmList.push(alarm);
|
|
3280
|
-
prevInstance.alarmList.sort((a, b) => a.level - b.level);
|
|
3281
|
-
} else if (idx > -1 && !isClear) {
|
|
3282
|
-
prevInstance.alarmList.splice(idx, 1, alarm);
|
|
3283
|
-
}
|
|
3284
|
-
prevInstance.highLevel = Math.max(prevInstance.highLevel, alarm.level);
|
|
3285
|
-
} else if (!isClear) {
|
|
3286
|
-
alarmList.value.push(obj);
|
|
3287
|
-
}
|
|
3288
|
-
});
|
|
3342
|
+
refreshTimer.resume();
|
|
3343
|
+
client.subscribe(SUBSCRINBURL, handleAlarmMessage);
|
|
3344
|
+
if (hasConnected) {
|
|
3345
|
+
void loadAlarmData().catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u91CD\u8FDE\u540E\u83B7\u53D6\u62A5\u8B66\u5931\u8D25", error));
|
|
3346
|
+
}
|
|
3347
|
+
hasConnected = true;
|
|
3348
|
+
},
|
|
3349
|
+
onWebSocketClose: () => {
|
|
3350
|
+
refreshTimer.pause();
|
|
3351
|
+
console.warn("\u62A5\u8B66\u8054\u52A8\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u7B49\u5F85\u81EA\u52A8\u91CD\u8FDE");
|
|
3352
|
+
},
|
|
3353
|
+
onWebSocketError: error => {
|
|
3354
|
+
console.error("\u62A5\u8B66\u8054\u52A8 WebSocket \u5F02\u5E38", error);
|
|
3355
|
+
},
|
|
3356
|
+
onStompError: frame => {
|
|
3357
|
+
console.error("\u62A5\u8B66\u8054\u52A8 STOMP \u5F02\u5E38", frame.headers?.message || frame);
|
|
3289
3358
|
}
|
|
3290
3359
|
});
|
|
3360
|
+
const init = async () => {
|
|
3361
|
+
try {
|
|
3362
|
+
client.activate();
|
|
3363
|
+
await loadAlarmData();
|
|
3364
|
+
} catch (error) {
|
|
3365
|
+
console.error("\u62A5\u8B66\u8054\u52A8\u521D\u59CB\u5316\u5931\u8D25", error);
|
|
3366
|
+
void client.deactivate();
|
|
3367
|
+
}
|
|
3368
|
+
};
|
|
3369
|
+
onMounted(() => {
|
|
3370
|
+
if (isPreview.value) void init();
|
|
3371
|
+
});
|
|
3291
3372
|
const modalRef = ref();
|
|
3373
|
+
const linkageContainer = ref();
|
|
3292
3374
|
whenever(() => !modalRef.value?.visible, () => alarmList.value = []);
|
|
3375
|
+
let cleaned = false;
|
|
3293
3376
|
const clean = () => {
|
|
3377
|
+
if (cleaned) return;
|
|
3378
|
+
cleaned = true;
|
|
3379
|
+
refreshTimer.pause();
|
|
3380
|
+
void client.deactivate();
|
|
3294
3381
|
if (clientId.value) {
|
|
3295
|
-
closeAlarmLink(props.appId, props.systemUuid, clientId.value);
|
|
3382
|
+
void closeAlarmLink(props.appId, props.systemUuid, clientId.value).catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u5173\u95ED\u76D1\u542C\u5931\u8D25", error));
|
|
3296
3383
|
}
|
|
3297
3384
|
};
|
|
3298
3385
|
onBeforeUnmount(clean);
|
|
@@ -3305,6 +3392,7 @@ const AlarmLinkage = defineComponent({
|
|
|
3305
3392
|
*/
|
|
3306
3393
|
customCardBody: () => {
|
|
3307
3394
|
return createVNode("div", {
|
|
3395
|
+
"ref": linkageContainer,
|
|
3308
3396
|
"class": "inl-card-alarm-linkage",
|
|
3309
3397
|
"id": "alarmLinkage"
|
|
3310
3398
|
}, [createVNode("div", null, ["\u62A5\u8B66\u6291\u5236"]), createVNode(AlarmVideo, {
|
|
@@ -3313,7 +3401,8 @@ const AlarmLinkage = defineComponent({
|
|
|
3313
3401
|
"alarmData": alarmList.value,
|
|
3314
3402
|
"countDown": props.rollTime,
|
|
3315
3403
|
"keep": true,
|
|
3316
|
-
"theme": props.darkTheme ? "dark" : "light"
|
|
3404
|
+
"theme": props.darkTheme ? "dark" : "light",
|
|
3405
|
+
"getContainer": () => linkageContainer.value || document.body
|
|
3317
3406
|
}, null)]);
|
|
3318
3407
|
}
|
|
3319
3408
|
}),
|
package/dist/index.js
CHANGED
|
@@ -9930,6 +9930,9 @@ const props$4 = {
|
|
|
9930
9930
|
countDown: {
|
|
9931
9931
|
type: Number,
|
|
9932
9932
|
default: 10
|
|
9933
|
+
},
|
|
9934
|
+
getContainer: {
|
|
9935
|
+
type: Function
|
|
9933
9936
|
}
|
|
9934
9937
|
};
|
|
9935
9938
|
const AlarmVideo = defineComponent({
|
|
@@ -10077,7 +10080,7 @@ const AlarmVideo = defineComponent({
|
|
|
10077
10080
|
"footer": null,
|
|
10078
10081
|
"width": 900,
|
|
10079
10082
|
"centered": true,
|
|
10080
|
-
"getContainer": () => document.getElementById("alarmLinkage")
|
|
10083
|
+
"getContainer": _props.getContainer || (() => document.getElementById("alarmLinkage") || document.body)
|
|
10081
10084
|
}, {
|
|
10082
10085
|
default: () => [createVNode("div", {
|
|
10083
10086
|
"class": "body"
|
|
@@ -10162,7 +10165,7 @@ const AlarmVideo = defineComponent({
|
|
|
10162
10165
|
}
|
|
10163
10166
|
});
|
|
10164
10167
|
|
|
10165
|
-
const BROKERURL = "ws://" + location.host + "/mtip-app-center-websocket";
|
|
10168
|
+
const BROKERURL = (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/mtip-app-center-websocket";
|
|
10166
10169
|
const SUBSCRINBURL = "/queue/alarm";
|
|
10167
10170
|
const Props$1 = createCardProps({
|
|
10168
10171
|
title: {
|
|
@@ -10224,65 +10227,149 @@ const AlarmLinkage = defineComponent({
|
|
|
10224
10227
|
}
|
|
10225
10228
|
const alarmList = ref([]);
|
|
10226
10229
|
const clientId = ref("");
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10230
|
+
let client;
|
|
10231
|
+
let hasConnected = false;
|
|
10232
|
+
let isLoadingAlarmData = false;
|
|
10233
|
+
const pendingAlarmMessages = [];
|
|
10234
|
+
const loadAlarmData = async () => {
|
|
10235
|
+
isLoadingAlarmData = true;
|
|
10236
|
+
try {
|
|
10237
|
+
const {
|
|
10238
|
+
data
|
|
10239
|
+
} = await getInitialAlarmLinkage(props.appId, props.systemUuid);
|
|
10240
|
+
const alarmFeed = Array.isArray(data?.alarmFeed) ? data.alarmFeed : [];
|
|
10241
|
+
alarmFeed.filter(item => Array.isArray(item.alarmList) && item.alarmList.length > 0).forEach(item => {
|
|
10242
|
+
item.instanceUuid = item.alarmList[0].instanceUuid;
|
|
10243
|
+
});
|
|
10244
|
+
alarmList.value = alarmFeed;
|
|
10245
|
+
if (data?.clientId && data.clientId !== clientId.value) {
|
|
10246
|
+
const previousClientId = clientId.value;
|
|
10247
|
+
clientId.value = data.clientId;
|
|
10248
|
+
if (previousClientId) {
|
|
10249
|
+
void closeAlarmLink(props.appId, props.systemUuid, previousClientId).catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u65E7\u76D1\u542C\u5173\u95ED\u5931\u8D25", error));
|
|
10250
|
+
}
|
|
10251
|
+
}
|
|
10252
|
+
} finally {
|
|
10253
|
+
isLoadingAlarmData = false;
|
|
10254
|
+
if (clientId.value && pendingAlarmMessages.length) {
|
|
10255
|
+
const pendingMessages = pendingAlarmMessages.splice(0);
|
|
10256
|
+
pendingMessages.forEach(({
|
|
10257
|
+
message: message2,
|
|
10258
|
+
receivedClientId
|
|
10259
|
+
}) => processAlarmMessage(message2, receivedClientId));
|
|
10260
|
+
}
|
|
10261
|
+
}
|
|
10262
|
+
};
|
|
10263
|
+
const processAlarmMessage = (message2, receivedClientId = clientId.value) => {
|
|
10264
|
+
let obj;
|
|
10265
|
+
try {
|
|
10266
|
+
obj = JSON.parse(message2.body);
|
|
10267
|
+
} catch (error) {
|
|
10268
|
+
console.error("\u62A5\u8B66\u8054\u52A8\u6D88\u606F\u89E3\u6790\u5931\u8D25", error);
|
|
10269
|
+
return;
|
|
10270
|
+
}
|
|
10271
|
+
const targetClientIds = obj?.webSocketClientIdList;
|
|
10272
|
+
const isTargetClient = [receivedClientId, clientId.value].some(id => id && targetClientIds?.includes?.(id));
|
|
10273
|
+
if (!isTargetClient) {
|
|
10274
|
+
return;
|
|
10275
|
+
}
|
|
10276
|
+
const alarms = Array.isArray(obj?.alarmList) ? obj.alarmList : [];
|
|
10277
|
+
alarms.forEach(alarm => {
|
|
10278
|
+
if (!alarm) return;
|
|
10279
|
+
const instanceUuid = alarm.instanceUuid || obj.instanceUuid;
|
|
10280
|
+
if (!instanceUuid) return;
|
|
10281
|
+
const isClear = alarm.status === "CLEAR_ALARM";
|
|
10282
|
+
const prevInstance = alarmList.value.find(item => item.instanceUuid === instanceUuid);
|
|
10283
|
+
if (prevInstance) {
|
|
10284
|
+
if (!Array.isArray(prevInstance.alarmList)) {
|
|
10285
|
+
prevInstance.alarmList = [];
|
|
10286
|
+
}
|
|
10287
|
+
const idx = prevInstance.alarmList.findIndex(item => item.id === alarm.id);
|
|
10288
|
+
if (idx > -1 && isClear) {
|
|
10289
|
+
prevInstance.alarmList.splice(idx, 1);
|
|
10290
|
+
if (!prevInstance.alarmList.length) {
|
|
10291
|
+
const prevInstIdx = alarmList.value.findIndex(item => item === prevInstance);
|
|
10292
|
+
if (prevInstIdx > -1) alarmList.value.splice(prevInstIdx, 1);
|
|
10293
|
+
}
|
|
10294
|
+
} else if (idx === -1 && !isClear) {
|
|
10295
|
+
prevInstance.alarmList.push(alarm);
|
|
10296
|
+
prevInstance.alarmList.sort((a, b) => a.level - b.level);
|
|
10297
|
+
} else if (idx > -1 && !isClear) {
|
|
10298
|
+
prevInstance.alarmList.splice(idx, 1, alarm);
|
|
10299
|
+
}
|
|
10300
|
+
prevInstance.highLevel = Math.max(prevInstance.highLevel || 0, alarm.level || 0);
|
|
10301
|
+
} else if (!isClear) {
|
|
10302
|
+
alarmList.value.push({
|
|
10303
|
+
...obj,
|
|
10304
|
+
instanceUuid,
|
|
10305
|
+
alarmList: [alarm]
|
|
10306
|
+
});
|
|
10307
|
+
}
|
|
10235
10308
|
});
|
|
10236
|
-
clientId.value = data.clientId;
|
|
10237
|
-
client.activate();
|
|
10238
10309
|
};
|
|
10239
|
-
|
|
10240
|
-
if (
|
|
10310
|
+
const handleAlarmMessage = message2 => {
|
|
10311
|
+
if (!clientId.value || isLoadingAlarmData) {
|
|
10312
|
+
if (pendingAlarmMessages.length < 50) {
|
|
10313
|
+
pendingAlarmMessages.push({
|
|
10314
|
+
message: message2,
|
|
10315
|
+
receivedClientId: clientId.value
|
|
10316
|
+
});
|
|
10317
|
+
}
|
|
10318
|
+
return;
|
|
10319
|
+
}
|
|
10320
|
+
processAlarmMessage(message2);
|
|
10321
|
+
};
|
|
10322
|
+
const refreshTimer = useIntervalFn(() => {
|
|
10323
|
+
if (!clientId.value) return;
|
|
10324
|
+
void refreshAlarmLink(props.appId, props.systemUuid, clientId.value).catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u76D1\u542C\u5237\u65B0\u5931\u8D25", error));
|
|
10325
|
+
}, 1e3 * 60 * 10, {
|
|
10326
|
+
immediate: false
|
|
10241
10327
|
});
|
|
10242
|
-
|
|
10328
|
+
client = new Client({
|
|
10243
10329
|
brokerURL: BROKERURL,
|
|
10244
10330
|
onConnect: () => {
|
|
10245
10331
|
console.log("\u62A5\u8B66\u8054\u52A8\u5DF2\u8FDE\u63A5");
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
} else if (idx > -1 && !isClear) {
|
|
10272
|
-
prevInstance.alarmList.splice(idx, 1, alarm);
|
|
10273
|
-
}
|
|
10274
|
-
prevInstance.highLevel = Math.max(prevInstance.highLevel, alarm.level);
|
|
10275
|
-
} else if (!isClear) {
|
|
10276
|
-
alarmList.value.push(obj);
|
|
10277
|
-
}
|
|
10278
|
-
});
|
|
10332
|
+
refreshTimer.resume();
|
|
10333
|
+
client.subscribe(SUBSCRINBURL, handleAlarmMessage);
|
|
10334
|
+
if (hasConnected) {
|
|
10335
|
+
void loadAlarmData().catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u91CD\u8FDE\u540E\u83B7\u53D6\u62A5\u8B66\u5931\u8D25", error));
|
|
10336
|
+
}
|
|
10337
|
+
hasConnected = true;
|
|
10338
|
+
},
|
|
10339
|
+
onWebSocketClose: () => {
|
|
10340
|
+
refreshTimer.pause();
|
|
10341
|
+
console.warn("\u62A5\u8B66\u8054\u52A8\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u7B49\u5F85\u81EA\u52A8\u91CD\u8FDE");
|
|
10342
|
+
},
|
|
10343
|
+
onWebSocketError: error => {
|
|
10344
|
+
console.error("\u62A5\u8B66\u8054\u52A8 WebSocket \u5F02\u5E38", error);
|
|
10345
|
+
},
|
|
10346
|
+
onStompError: frame => {
|
|
10347
|
+
console.error("\u62A5\u8B66\u8054\u52A8 STOMP \u5F02\u5E38", frame.headers?.message || frame);
|
|
10348
|
+
}
|
|
10349
|
+
});
|
|
10350
|
+
const init = async () => {
|
|
10351
|
+
try {
|
|
10352
|
+
client.activate();
|
|
10353
|
+
await loadAlarmData();
|
|
10354
|
+
} catch (error) {
|
|
10355
|
+
console.error("\u62A5\u8B66\u8054\u52A8\u521D\u59CB\u5316\u5931\u8D25", error);
|
|
10356
|
+
void client.deactivate();
|
|
10279
10357
|
}
|
|
10358
|
+
};
|
|
10359
|
+
onMounted(() => {
|
|
10360
|
+
if (isPreview.value) void init();
|
|
10280
10361
|
});
|
|
10281
10362
|
const modalRef = ref();
|
|
10363
|
+
const linkageContainer = ref();
|
|
10282
10364
|
whenever(() => !modalRef.value?.visible, () => alarmList.value = []);
|
|
10365
|
+
let cleaned = false;
|
|
10283
10366
|
const clean = () => {
|
|
10367
|
+
if (cleaned) return;
|
|
10368
|
+
cleaned = true;
|
|
10369
|
+
refreshTimer.pause();
|
|
10370
|
+
void client.deactivate();
|
|
10284
10371
|
if (clientId.value) {
|
|
10285
|
-
closeAlarmLink(props.appId, props.systemUuid, clientId.value);
|
|
10372
|
+
void closeAlarmLink(props.appId, props.systemUuid, clientId.value).catch(error => console.error("\u62A5\u8B66\u8054\u52A8\u5173\u95ED\u76D1\u542C\u5931\u8D25", error));
|
|
10286
10373
|
}
|
|
10287
10374
|
};
|
|
10288
10375
|
onBeforeUnmount(clean);
|
|
@@ -10295,6 +10382,7 @@ const AlarmLinkage = defineComponent({
|
|
|
10295
10382
|
*/
|
|
10296
10383
|
customCardBody: () => {
|
|
10297
10384
|
return createVNode("div", {
|
|
10385
|
+
"ref": linkageContainer,
|
|
10298
10386
|
"class": "inl-card-alarm-linkage",
|
|
10299
10387
|
"id": "alarmLinkage"
|
|
10300
10388
|
}, [createVNode("div", null, ["\u62A5\u8B66\u6291\u5236"]), createVNode(AlarmVideo, {
|
|
@@ -10303,7 +10391,8 @@ const AlarmLinkage = defineComponent({
|
|
|
10303
10391
|
"alarmData": alarmList.value,
|
|
10304
10392
|
"countDown": props.rollTime,
|
|
10305
10393
|
"keep": true,
|
|
10306
|
-
"theme": props.darkTheme ? "dark" : "light"
|
|
10394
|
+
"theme": props.darkTheme ? "dark" : "light",
|
|
10395
|
+
"getContainer": () => linkageContainer.value || document.body
|
|
10307
10396
|
}, null)]);
|
|
10308
10397
|
}
|
|
10309
10398
|
}),
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.45",
|
|
4
4
|
"name": "inl-app-manager",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "cross-env NODE_ENV=production node --max_old_space_size=8192 node_modules/rollup/dist/bin/rollup --config rollup.config.
|
|
7
|
-
"dev": "cross-env NODE_ENV=development node --max_old_space_size=8192 node_modules/rollup/dist/bin/rollup --config rollup.config.
|
|
6
|
+
"build": "cross-env NODE_ENV=production node --max_old_space_size=8192 node_modules/rollup/dist/bin/rollup --config rollup.config.cjs --bundleConfigAsCjs",
|
|
7
|
+
"dev": "cross-env NODE_ENV=development node --max_old_space_size=8192 node_modules/rollup/dist/bin/rollup --config rollup.config.cjs --bundleConfigAsCjs -w",
|
|
8
8
|
"site": "vite ./site",
|
|
9
9
|
"test": "echo 123"
|
|
10
10
|
},
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
22
22
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
23
23
|
"@types/less": "^3.0.7",
|
|
24
|
+
"@types/lodash": "^4.17.14",
|
|
24
25
|
"@types/lodash-es": "^4.17.12",
|
|
25
26
|
"@types/node": "^20.17.12",
|
|
26
27
|
"@types/vue": "^2.0.0",
|
|
@@ -89,4 +90,4 @@
|
|
|
89
90
|
"cheerio": "1.0.0-rc.12"
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
}
|
|
93
|
+
}
|
package/rollup.config.ts
CHANGED
|
@@ -12,7 +12,7 @@ import alias from "@rollup/plugin-alias";
|
|
|
12
12
|
import postcss from "rollup-plugin-postcss";
|
|
13
13
|
import cssnano from "cssnano";
|
|
14
14
|
import { defineConfig } from "rollup";
|
|
15
|
-
import { entry } from "./entry";
|
|
15
|
+
import { entry } from "./entry.cjs";
|
|
16
16
|
|
|
17
17
|
const onwarn = (warning, rollupWarn) => {
|
|
18
18
|
// 剔除无用警告
|