|
|
@ -137,6 +137,7 @@ |
|
|
|
title="此操作将会撤销修改" |
|
|
|
ok-text="确定" |
|
|
|
cancel-text="取消" |
|
|
|
placement="bottomRight" |
|
|
|
@confirm="delBtn(item)" |
|
|
|
@cancel="changeCancel"> |
|
|
|
<button class="cxbtn">撤销</button> |
|
|
@ -146,9 +147,9 @@ |
|
|
|
<div class="btn-item"> |
|
|
|
<div class="left">控制模式</div> |
|
|
|
<div class="right"> |
|
|
|
<span>手动</span> |
|
|
|
<span>{{ item.stateBefore.autoStatus.label.replace('模式', '') }}</span> |
|
|
|
<img src="/asset/image/bulbLogo/22406.png" alt="" /> |
|
|
|
<span>自动</span></div |
|
|
|
<span>{{ item.stateAfter.autoStatus.label.replace('模式', '') }}</span></div |
|
|
|
> |
|
|
|
</div> |
|
|
|
<div class="btn-item"> |
|
|
@ -230,12 +231,13 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import { ref, computed, onMounted } from 'vue'; |
|
|
|
import { ref, computed, onMounted, watch } from 'vue'; |
|
|
|
import { DownOutlined, UpOutlined, StopOutlined } from '@ant-design/icons-vue'; |
|
|
|
import { message } from 'ant-design-vue'; |
|
|
|
import { message, Modal } from 'ant-design-vue'; |
|
|
|
// 请求 |
|
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
|
import { ventilating } from '/@/api/ventilatingSystem'; |
|
|
|
import { planManage } from '/@/api/planManage'; |
|
|
|
// 全局变量 |
|
|
|
import { items } from '/@/store/item'; |
|
|
|
|
|
|
@ -247,12 +249,15 @@ |
|
|
|
if (props.type == '排风扇') { |
|
|
|
url.getList = ventilating.getChangeList1; |
|
|
|
url.sendList = ventilating.sendChangeList1; |
|
|
|
url.deviceType = 3; |
|
|
|
} else if (props.type == '风幕机') { |
|
|
|
url.getList = ventilating.getChangeList2; |
|
|
|
url.sendList = ventilating.sendChangeList2; |
|
|
|
url.deviceType = 4; |
|
|
|
} else { |
|
|
|
url.getList = ventilating.getChangeList3; |
|
|
|
url.sendList = ventilating.sendChangeList3; |
|
|
|
url.deviceType = 5; |
|
|
|
} |
|
|
|
}); |
|
|
|
// 分区初始化,以 1-1 作为默认回路 |
|
|
@ -266,6 +271,7 @@ |
|
|
|
const url = { |
|
|
|
getList: '', |
|
|
|
sendList: '', |
|
|
|
deviceType: 0, |
|
|
|
}; |
|
|
|
|
|
|
|
// 与父组件的交互 =================================================================== |
|
|
@ -282,12 +288,24 @@ |
|
|
|
type: String, |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
watch( |
|
|
|
() => props.treeData, |
|
|
|
(newValue) => { |
|
|
|
// 重新为照明回路赋值 |
|
|
|
buttons2.value = newValue[0].childList; |
|
|
|
}, |
|
|
|
{ |
|
|
|
deep: true, |
|
|
|
}, |
|
|
|
); |
|
|
|
/** 向上传递方法 |
|
|
|
* @method changeArea 用于控制俯视图的选中状态 |
|
|
|
* @method reset 用于重置按钮区 |
|
|
|
* @method reload 用于刷新一次页面 |
|
|
|
* @method resetAll 刷新所有tab,对计划进行修改时,需刷新tab2与tab3 |
|
|
|
*/ |
|
|
|
const emit = defineEmits(['reset', 'reload']); |
|
|
|
const emit = defineEmits(['reset', 'reload', 'resetAll']); |
|
|
|
|
|
|
|
// 照明回路业务 ====================================================================== |
|
|
|
|
|
|
@ -613,21 +631,20 @@ |
|
|
|
changeList.value.forEach((item: any) => { |
|
|
|
resetChangeList(item); |
|
|
|
}); |
|
|
|
} |
|
|
|
changeList.value = []; |
|
|
|
if (!reload) { |
|
|
|
lockList.value.forEach((item: any) => { |
|
|
|
resetLockList(item); |
|
|
|
}); |
|
|
|
// 默认选择第一个楼层 |
|
|
|
let data = props.treeData[0]; |
|
|
|
// 默认选中 |
|
|
|
data.selected = true; |
|
|
|
// 默认选中 1-1 分区 回路 |
|
|
|
buttons2.value = data.childList; |
|
|
|
console.log(buttons2.value, '222222222222222222222222'); |
|
|
|
resetMode(); |
|
|
|
} |
|
|
|
changeList.value = []; |
|
|
|
lockList.value = []; |
|
|
|
// 默认选择第一个楼层 |
|
|
|
let data = props.treeData[0]; |
|
|
|
// 默认选中 |
|
|
|
data.selected = true; |
|
|
|
// 默认选中 1-1 分区 回路 |
|
|
|
buttons2.value = data.childList; |
|
|
|
resetMode(); |
|
|
|
}; |
|
|
|
// 将已修改的禁用/启用状态改回 |
|
|
|
const resetLockList = (item: any) => { |
|
|
@ -677,6 +694,55 @@ |
|
|
|
return message.info('未产生任何修改'); |
|
|
|
} |
|
|
|
http |
|
|
|
.get(planManage.getRunningPlan, { |
|
|
|
deviceType: url.deviceType, |
|
|
|
projectId: state.projectId, |
|
|
|
siteId: state.siteId, |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
// 如果有计划正在执行 |
|
|
|
if (res.data && res.data.length) { |
|
|
|
// 此处框架本身存在问题,弹出层在本地环境无法关闭,暂时使用浏览器自带的confirm方法 |
|
|
|
// Modal.confirm({ |
|
|
|
// title: '提示信息', |
|
|
|
// content: '有计划正在执行,点击"确定"将暂停当前计划', |
|
|
|
// onOk() { |
|
|
|
// return new Promise((resolve, reject) => { |
|
|
|
// }); |
|
|
|
// }, |
|
|
|
// onCancel() { }, |
|
|
|
// }); |
|
|
|
|
|
|
|
let flag = window.confirm('有计划正在执行,点击"确定"将暂停当前计划'); |
|
|
|
if (flag) { |
|
|
|
// 如果点击了确定,将先终止所有进行中的计划 |
|
|
|
http |
|
|
|
.post(url.getList, { |
|
|
|
projectId: state.projectId, |
|
|
|
siteId: state.siteId, |
|
|
|
lockList: [], |
|
|
|
sceneList: [], |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
console.log(res, '成功'); |
|
|
|
// 如果重置成功,则获取修改前后对比数据 |
|
|
|
if (res.retcode == 0) { |
|
|
|
sendChangeList(); |
|
|
|
// 未成功提示 |
|
|
|
} else { |
|
|
|
message.error('关闭进行中的任务操作失败,请重新尝试'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 没有计划正在执行,则直接请求 |
|
|
|
} else { |
|
|
|
sendChangeList(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
// 提交控制场景 与 禁用/启用 修改 |
|
|
|
const sendChangeList = () => { |
|
|
|
http |
|
|
|
.post(url.getList, { |
|
|
|
sceneList: changeList.value, |
|
|
|
lockList: lockList.value, |
|
|
@ -684,11 +750,11 @@ |
|
|
|
siteId: state.siteId, |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res.msg === 'success') { |
|
|
|
if (res.retcode == 0) { |
|
|
|
diffList.value = res.data; |
|
|
|
executeVisible.value = true; |
|
|
|
} else { |
|
|
|
message.warning('获取修改内容失败'); |
|
|
|
message.error('获取修改内容失败'); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => {}); |
|
|
@ -736,9 +802,22 @@ |
|
|
|
projectId: state.projectId, |
|
|
|
siteId: state.siteId, |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
emit('reload'); |
|
|
|
.then((res) => { |
|
|
|
let data = res.data; |
|
|
|
// 修改请求发送了,但操作时产生了失败结果 |
|
|
|
if (res.retcode != 0) { |
|
|
|
// 直接提示并跳出 |
|
|
|
return message.warning(data.msg); |
|
|
|
} |
|
|
|
// 所有修改均生效 |
|
|
|
if (data.allSucceed) { |
|
|
|
message.success('修改完成'); |
|
|
|
// allSucceed不为true,则至少有一条数据修改失败 |
|
|
|
} else { |
|
|
|
message.info(`${data.successList.length}条修改成功,${data.failList.length}条修改失败`); |
|
|
|
} |
|
|
|
refresh(true); |
|
|
|
emit('resetAll'); |
|
|
|
}) |
|
|
|
.catch(() => {}); |
|
|
|
}; |
|
|
@ -759,6 +838,8 @@ |
|
|
|
defineExpose({ |
|
|
|
// 回路切换 |
|
|
|
changeLine, |
|
|
|
// 重置当前选择 |
|
|
|
refresh, |
|
|
|
}); |
|
|
|
</script> |
|
|
|
<style lang="less" scoped> |
|
|
|