|
|
@ -171,6 +171,7 @@ |
|
|
|
title="此操作将会撤销修改" |
|
|
|
ok-text="确定" |
|
|
|
cancel-text="取消" |
|
|
|
placement="bottomRight" |
|
|
|
@confirm="delBtn(item)" |
|
|
|
@cancel="changeCancel"> |
|
|
|
<button class="cxbtn">撤销</button> |
|
|
@ -180,22 +181,24 @@ |
|
|
|
<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> |
|
|
|
<span>{{ item.stateAfter.autoStatus.label.replace('模式', '') }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="btn-item"> |
|
|
|
<div class="left"> 亮度 </div> |
|
|
|
<div class="left"> 温度 </div> |
|
|
|
<div class="right"> |
|
|
|
<!-- 数字0也会被判为false,故只判断undefined 和 null --> |
|
|
|
<span>{{ |
|
|
|
item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--' |
|
|
|
item.stateBefore.temperature != null ? item.stateBefore.temperature + '℃' : '--' |
|
|
|
}}</span> |
|
|
|
<img src="/asset/image/bulbLogo/22406.png" alt="" /> |
|
|
|
<span>{{ |
|
|
|
item?.stateAfter?.brightness != undefined ? item.stateAfter.brightness : '--' |
|
|
|
}}</span> |
|
|
|
<span> |
|
|
|
{{ |
|
|
|
item.stateAfter.temperature != null ? item.stateAfter.temperature + '℃' : '--' |
|
|
|
}} |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="btn-item"> |
|
|
@ -211,14 +214,14 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="btn-item"> |
|
|
|
<div class="left"> 色温 </div> |
|
|
|
<div class="left"> 风速 </div> |
|
|
|
<div class="right"> |
|
|
|
<span>{{ |
|
|
|
item?.stateBefore?.color != undefined ? item.stateBefore.color : '--' |
|
|
|
item.stateBefore.windSpeed != null ? item.stateBefore.windSpeed + 'm/s' : '--' |
|
|
|
}}</span> |
|
|
|
<img src="/asset/image/bulbLogo/22406.png" alt="" /> |
|
|
|
<span> |
|
|
|
{{ item?.stateAfter?.color != undefined ? item.stateAfter.color : '--' }} |
|
|
|
{{ item.stateAfter.windSpeed != null ? item.stateAfter.windSpeed + 'm/s' : '--' }} |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -269,8 +272,8 @@ |
|
|
|
import { message } from 'ant-design-vue'; |
|
|
|
// 请求 |
|
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
|
import { lightingManage } from '/@/api/IlluminationInfo'; |
|
|
|
import { airConditionControl } from '/@/api/airConditionControlSystem'; |
|
|
|
import { planManage } from '/@/api/planManage'; |
|
|
|
// 全局变量 |
|
|
|
import { items } from '/@/store/item'; |
|
|
|
|
|
|
@ -303,8 +306,9 @@ |
|
|
|
* @method changeArea 用于控制俯视图的选中状态 |
|
|
|
* @method reset 用于重置按钮区 |
|
|
|
* @method reload 用于刷新一次页面 |
|
|
|
* @method resetAll 刷新所有tab,对计划进行修改时,需刷新tab2与tab3 |
|
|
|
*/ |
|
|
|
const emit = defineEmits(['changeArea', 'reset', 'reload']); |
|
|
|
const emit = defineEmits(['changeArea', 'reset', 'reload', 'resetAll']); |
|
|
|
|
|
|
|
// 照明区域业务 ======================================================================= |
|
|
|
|
|
|
@ -439,6 +443,10 @@ |
|
|
|
treePid: '', |
|
|
|
childList: [], |
|
|
|
}); |
|
|
|
// 依托父组件传值,重置回路 |
|
|
|
const setButtons2 = (data: any) => { |
|
|
|
buttons2.value = data; |
|
|
|
}; |
|
|
|
// 照明回路的按钮切换 |
|
|
|
const changeLine = (button: any) => { |
|
|
|
// 根据按钮状态,展示禁用/启用按钮文本 |
|
|
@ -666,22 +674,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; |
|
|
|
// 将选中线路重置 |
|
|
|
resetMode(); |
|
|
|
} |
|
|
|
changeList.value = []; |
|
|
|
lockList.value = []; |
|
|
|
// 默认选择第一个楼层 |
|
|
|
let data = props.treeData[0]; |
|
|
|
// 默认选中 |
|
|
|
data.selected = true; |
|
|
|
// 默认选中 1-1 分区 回路 |
|
|
|
buttons2.value = data.childList; |
|
|
|
// 将选中线路重置 |
|
|
|
resetMode(); |
|
|
|
}; |
|
|
|
// 将已修改的禁用/启用状态改回 |
|
|
|
const resetLockList = (item: any) => { |
|
|
@ -727,10 +733,59 @@ |
|
|
|
}; |
|
|
|
// 右下角的执行事件 |
|
|
|
const showModal = () => { |
|
|
|
if (!changeList.value.length) { |
|
|
|
if (!changeList.value.length && !lockList.value.length) { |
|
|
|
return message.info('未产生任何修改'); |
|
|
|
} |
|
|
|
http |
|
|
|
.get(planManage.getRunningPlan, { |
|
|
|
deviceType: 2, |
|
|
|
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(airConditionControl.submitChangeList, { |
|
|
|
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(airConditionControl.getChangeList, { |
|
|
|
sceneList: changeList.value, |
|
|
|
lockList: lockList.value, |
|
|
@ -738,7 +793,7 @@ |
|
|
|
siteId: state.siteId, |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
if (res.msg === 'success') { |
|
|
|
if (res.retcode == 0) { |
|
|
|
diffList.value = res.data; |
|
|
|
executeVisible.value = true; |
|
|
|
} else { |
|
|
@ -790,10 +845,24 @@ |
|
|
|
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(() => {}); |
|
|
|
}; |
|
|
|
|
|
|
|
// 其他业务 ======================================================================== |
|
|
@ -814,6 +883,10 @@ |
|
|
|
changeArea, |
|
|
|
// 回路切换 |
|
|
|
changeLine, |
|
|
|
// 重置当前选择 |
|
|
|
refresh, |
|
|
|
// 由父组件反向刷新当前选中的回路 |
|
|
|
setButtons2, |
|
|
|
}); |
|
|
|
</script> |
|
|
|
<style lang="less" scoped> |
|
|
|