(false);
const deleteMessage = computed(() => {
- return `确定删除“${activePoint.value.name}”吗?删除后设备所处区域的实拍图或平面图及设备点位将一 并被删除,请谨慎操作。`;
+ return `'确定删除“${activePoint.value.name}”吗?删除后设备所处区域的实拍图或平面图及设备点位将一并被删除,请谨慎操作。`;
});
// 插入文件绘制图
@@ -255,6 +255,7 @@ function afterFinishEdit(record) {
}
return item;
});
+ fetchDeviceList();
console.log("afterFinishEdit", record);
nextTick(() => {
refreshCanvas(); // 新增无需刷新获取当前点位下设备
@@ -318,17 +319,19 @@ async function fetchDeviceByPoint() {
// 新增设备完成后更新数据
function afterAddDevice(record) {
- currDeviceList.value = [...toRaw(currDeviceList.value), record];
- deviceList.value = toRaw(deviceList.value).filter(item => {
- if (item.id === record?.device_id) {
- Object.assign(item, {
- wd_id: record?.id,
- workshop_name: record?.workshop_name,
- is_binding: true
- });
- }
- return item;
- });
+ fetchDeviceByPoint();
+ fetchDeviceList();
+ // currDeviceList.value = [...toRaw(currDeviceList.value), record];
+ // deviceList.value = toRaw(deviceList.value).filter(item => {
+ // if (item.id === record?.device_id) {
+ // Object.assign(item, {
+ // wd_id: record?.id,
+ // workshop_name: record?.workshop_name,
+ // is_binding: true
+ // });
+ // }
+ // return item;
+ // });
console.log("新增完成", deviceList.value, record);
}
@@ -371,18 +374,24 @@ async function editDevice({ editParams, callback }) {
// 完成删除设备
function afterDeleteDevice(record) {
+ const deleteDeviceIds = JSON.parse(record);
currDeviceList.value = toRaw(currDeviceList.value).filter(
- item => item.id !== record.id
+ item => !deleteDeviceIds.includes(item?.id)
);
deviceList.value = toRaw(deviceList.value).filter(item => {
- if (item.id === record?.device_id) {
+ if (deleteDeviceIds.includes(item?.wd_id)) {
item.wd_id = undefined;
item.workshop_name = undefined;
item.is_binding = false;
}
return item;
});
- console.log("删除完成", deviceList.value, record);
+ console.log(
+ currDeviceList.value,
+ "删除完成",
+ deviceList.value,
+ deleteDeviceIds
+ );
}
onMounted(() => {
@@ -439,7 +448,7 @@ provide("canvasEditor", canvasEditor);
-
+
@@ -486,6 +495,7 @@ provide("canvasEditor", canvasEditor);