bl-common-vue3 3.8.129 → 3.8.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -511,23 +511,28 @@ export default defineComponent({
|
|
|
511
511
|
message.error(t('AttachmentInfo.index.559728-10'));
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
|
-
|
|
515
|
-
|
|
514
|
+
try {
|
|
515
|
+
const response = await fetch(url);
|
|
516
|
+
if (!response.ok) {
|
|
517
|
+
message.error(t('common.action.fail'));
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
const blob = await response.blob();
|
|
521
|
+
const downloadUrl = window.URL.createObjectURL(blob);
|
|
522
|
+
|
|
523
|
+
const a = document.createElement('a');
|
|
524
|
+
a.href = downloadUrl;
|
|
525
|
+
a.setAttribute('download', name || url); // 设置下载的文件名
|
|
526
|
+
document.body.appendChild(a);
|
|
527
|
+
a.click();
|
|
528
|
+
document.body.removeChild(a);
|
|
529
|
+
|
|
530
|
+
// 释放 URL 对象
|
|
531
|
+
window.URL.revokeObjectURL(downloadUrl);
|
|
532
|
+
} catch (_) {
|
|
533
|
+
// 网络、跨域或文件读取失败也需明确反馈,不能留下未处理的下载异常。
|
|
516
534
|
message.error(t('common.action.fail'));
|
|
517
|
-
return;
|
|
518
535
|
}
|
|
519
|
-
const blob = await response.blob();
|
|
520
|
-
const downloadUrl = window.URL.createObjectURL(blob);
|
|
521
|
-
|
|
522
|
-
const a = document.createElement('a');
|
|
523
|
-
a.href = downloadUrl;
|
|
524
|
-
a.setAttribute('download', name || url); // 设置下载的文件名
|
|
525
|
-
document.body.appendChild(a);
|
|
526
|
-
a.click();
|
|
527
|
-
document.body.removeChild(a);
|
|
528
|
-
|
|
529
|
-
// 释放 URL 对象
|
|
530
|
-
window.URL.revokeObjectURL(downloadUrl);
|
|
531
536
|
};
|
|
532
537
|
|
|
533
538
|
// 删除文件
|
|
@@ -1045,7 +1045,9 @@ export default defineComponent({
|
|
|
1045
1045
|
let checkedKeys = getInitKeys(initKeys, "village");
|
|
1046
1046
|
let forCount = 0
|
|
1047
1047
|
const setResult = (key, value) => {
|
|
1048
|
-
|
|
1048
|
+
if (value != null) {
|
|
1049
|
+
result[key].push(value);
|
|
1050
|
+
}
|
|
1049
1051
|
let totalLength = 0;
|
|
1050
1052
|
for (let key in result) {
|
|
1051
1053
|
totalLength += result[key].length;
|
|
@@ -1139,11 +1141,11 @@ export default defineComponent({
|
|
|
1139
1141
|
if (arrKey.length == 8) {
|
|
1140
1142
|
setResult("roomList", room)
|
|
1141
1143
|
// 如果 showSub 为 true 且该房间有子房间,获取子房间并加入结果
|
|
1142
|
-
if (props.showSub &&room.sub_room_count > 0) {
|
|
1144
|
+
if (room && props.showSub && room.sub_room_count > 0) {
|
|
1143
1145
|
await getSubRooms(room);
|
|
1144
1146
|
if (room.children && room.children.length) {
|
|
1145
1147
|
room.children.forEach(subRoom => {
|
|
1146
|
-
if (!subRoom.disabled) {
|
|
1148
|
+
if (subRoom && !subRoom.disabled) {
|
|
1147
1149
|
setResult("roomList", subRoom);
|
|
1148
1150
|
}
|
|
1149
1151
|
});
|
|
@@ -1176,7 +1178,9 @@ export default defineComponent({
|
|
|
1176
1178
|
(item) => item.id == roomId
|
|
1177
1179
|
);
|
|
1178
1180
|
if (arrKey.length == 6) {
|
|
1179
|
-
|
|
1181
|
+
if (room) {
|
|
1182
|
+
state.selectedKeys.push(room.key)
|
|
1183
|
+
}
|
|
1180
1184
|
setResult("roomList", room);
|
|
1181
1185
|
} else {
|
|
1182
1186
|
if (arrKey.length == 8) {
|
|
@@ -1311,11 +1315,11 @@ export default defineComponent({
|
|
|
1311
1315
|
// 如果 showSub 为 true,遍历每个房间获取子房间
|
|
1312
1316
|
if (props.showSub) {
|
|
1313
1317
|
for (let room of list) {
|
|
1314
|
-
if (!room
|
|
1318
|
+
if (!room?.isLeaf || room?.sub_room_count > 0) {
|
|
1315
1319
|
await getSubRooms(room);
|
|
1316
1320
|
if (room.children && room.children.length) {
|
|
1317
1321
|
room.children.forEach(subRoom => {
|
|
1318
|
-
if (!subRoom.disabled) {
|
|
1322
|
+
if (subRoom && !subRoom.disabled) {
|
|
1319
1323
|
result.roomList.push(subRoom);
|
|
1320
1324
|
}
|
|
1321
1325
|
});
|
|
@@ -1334,6 +1338,7 @@ export default defineComponent({
|
|
|
1334
1338
|
return index === firstIndex;
|
|
1335
1339
|
});
|
|
1336
1340
|
// 去重
|
|
1341
|
+
result.roomList = result.roomList.filter(Boolean)
|
|
1337
1342
|
if (result.roomList && result.roomList.length > 0) {
|
|
1338
1343
|
result.roomList = Array.from(new Set(result.roomList.map(item => item.id)))
|
|
1339
1344
|
.map(id => result.roomList.find(item => item.id === id));
|
|
@@ -1343,11 +1348,11 @@ export default defineComponent({
|
|
|
1343
1348
|
// 如果没有选中楼层但选中了房间,且 showSub 为 true,也需要处理子房间
|
|
1344
1349
|
emit("getloading", 1);
|
|
1345
1350
|
for (let room of result.roomList) {
|
|
1346
|
-
if (!room
|
|
1351
|
+
if (room&&(!room?.isLeaf || room?.sub_room_count > 0)) {
|
|
1347
1352
|
await getSubRooms(room);
|
|
1348
|
-
if (room
|
|
1353
|
+
if (room?.children && room.children?.length) {
|
|
1349
1354
|
room.children.forEach(subRoom => {
|
|
1350
|
-
if (!subRoom.disabled) {
|
|
1355
|
+
if (subRoom && !subRoom.disabled) {
|
|
1351
1356
|
result.roomList.push(subRoom);
|
|
1352
1357
|
}
|
|
1353
1358
|
});
|
|
@@ -1355,6 +1360,7 @@ export default defineComponent({
|
|
|
1355
1360
|
}
|
|
1356
1361
|
}
|
|
1357
1362
|
// 去重
|
|
1363
|
+
result.roomList = result.roomList.filter(Boolean);
|
|
1358
1364
|
if (result.roomList && result.roomList.length > 0) {
|
|
1359
1365
|
result.roomList = Array.from(new Set(result.roomList.map(item => item.id)))
|
|
1360
1366
|
.map(id => result.roomList.find(item => item.id === id));
|
|
@@ -1769,6 +1775,10 @@ export default defineComponent({
|
|
|
1769
1775
|
// 获取子房间
|
|
1770
1776
|
const getSubRooms = (room) => {
|
|
1771
1777
|
return new Promise((resolve) => {
|
|
1778
|
+
if (!room) {
|
|
1779
|
+
resolve( []);
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1772
1782
|
if (room.isLeaf || (room.children && room.children.length)) {
|
|
1773
1783
|
resolve(room.children || []);
|
|
1774
1784
|
return;
|