|
@ -137,6 +137,7 @@ |
|
|
title="此操作将会撤销修改" |
|
|
title="此操作将会撤销修改" |
|
|
ok-text="确定" |
|
|
ok-text="确定" |
|
|
cancel-text="取消" |
|
|
cancel-text="取消" |
|
|
|
|
|
placement="bottomRight" |
|
|
@confirm="delBtn(item)" |
|
|
@confirm="delBtn(item)" |
|
|
@cancel="changeCancel"> |
|
|
@cancel="changeCancel"> |
|
|
<button class="cxbtn">撤销</button> |
|
|
<button class="cxbtn">撤销</button> |
|
@ -146,9 +147,9 @@ |
|
|
<div class="btn-item"> |
|
|
<div class="btn-item"> |
|
|
<div class="left">控制模式</div> |
|
|
<div class="left">控制模式</div> |
|
|
<div class="right"> |
|
|
<div class="right"> |
|
|
<span>手动</span> |
|
|
<span>{{ item.stateBefore.autoStatus.label.replace('模式', '') }}</span> |
|
|
<img src="/asset/image/bulbLogo/22406.png" alt="" /> |
|
|
<img src="/asset/image/bulbLogo/22406.png" alt="" /> |
|
|
<span>自动</span></div |
|
|
<span>{{ item.stateAfter.autoStatus.label.replace('模式', '') }}</span></div |
|
|
> |
|
|
> |
|
|
</div> |
|
|
</div> |
|
|
<div class="btn-item"> |
|
|
<div class="btn-item"> |
|
@ -230,12 +231,13 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<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 { 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 { http } from '/nerv-lib/util/http'; |
|
|
import { ventilating } from '/@/api/ventilatingSystem'; |
|
|
import { ventilating } from '/@/api/ventilatingSystem'; |
|
|
|
|
|
import { planManage } from '/@/api/planManage'; |
|
|
// 全局变量 |
|
|
// 全局变量 |
|
|
import { items } from '/@/store/item'; |
|
|
import { items } from '/@/store/item'; |
|
|
|
|
|
|
|
@ -247,12 +249,15 @@ |
|
|
if (props.type == '排风扇') { |
|
|
if (props.type == '排风扇') { |
|
|
url.getList = ventilating.getChangeList1; |
|
|
url.getList = ventilating.getChangeList1; |
|
|
url.sendList = ventilating.sendChangeList1; |
|
|
url.sendList = ventilating.sendChangeList1; |
|
|
|
|
|
url.deviceType = 3; |
|
|
} else if (props.type == '风幕机') { |
|
|
} else if (props.type == '风幕机') { |
|
|
url.getList = ventilating.getChangeList2; |
|
|
url.getList = ventilating.getChangeList2; |
|
|
url.sendList = ventilating.sendChangeList2; |
|
|
url.sendList = ventilating.sendChangeList2; |
|
|
|
|
|
url.deviceType = 4; |
|
|
} else { |
|
|
} else { |
|
|
url.getList = ventilating.getChangeList3; |
|
|
url.getList = ventilating.getChangeList3; |
|
|
url.sendList = ventilating.sendChangeList3; |
|
|
url.sendList = ventilating.sendChangeList3; |
|
|
|
|
|
url.deviceType = 5; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
// 分区初始化,以 1-1 作为默认回路 |
|
|
// 分区初始化,以 1-1 作为默认回路 |
|
@ -266,6 +271,7 @@ |
|
|
const url = { |
|
|
const url = { |
|
|
getList: '', |
|
|
getList: '', |
|
|
sendList: '', |
|
|
sendList: '', |
|
|
|
|
|
deviceType: 0, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 与父组件的交互 =================================================================== |
|
|
// 与父组件的交互 =================================================================== |
|
@ -282,12 +288,24 @@ |
|
|
type: String, |
|
|
type: String, |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
() => props.treeData, |
|
|
|
|
|
(newValue) => { |
|
|
|
|
|
// 重新为照明回路赋值 |
|
|
|
|
|
buttons2.value = newValue[0].childList; |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
deep: true, |
|
|
|
|
|
}, |
|
|
|
|
|
); |
|
|
/** 向上传递方法 |
|
|
/** 向上传递方法 |
|
|
* @method changeArea 用于控制俯视图的选中状态 |
|
|
* @method changeArea 用于控制俯视图的选中状态 |
|
|
* @method reset 用于重置按钮区 |
|
|
* @method reset 用于重置按钮区 |
|
|
* @method reload 用于刷新一次页面 |
|
|
* @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) => { |
|
|
changeList.value.forEach((item: any) => { |
|
|
resetChangeList(item); |
|
|
resetChangeList(item); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
changeList.value = []; |
|
|
|
|
|
if (!reload) { |
|
|
|
|
|
lockList.value.forEach((item: any) => { |
|
|
lockList.value.forEach((item: any) => { |
|
|
resetLockList(item); |
|
|
resetLockList(item); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
lockList.value = []; |
|
|
|
|
|
// 默认选择第一个楼层 |
|
|
// 默认选择第一个楼层 |
|
|
let data = props.treeData[0]; |
|
|
let data = props.treeData[0]; |
|
|
// 默认选中 |
|
|
// 默认选中 |
|
|
data.selected = true; |
|
|
data.selected = true; |
|
|
// 默认选中 1-1 分区 回路 |
|
|
// 默认选中 1-1 分区 回路 |
|
|
buttons2.value = data.childList; |
|
|
buttons2.value = data.childList; |
|
|
|
|
|
console.log(buttons2.value, '222222222222222222222222'); |
|
|
resetMode(); |
|
|
resetMode(); |
|
|
|
|
|
} |
|
|
|
|
|
changeList.value = []; |
|
|
|
|
|
lockList.value = []; |
|
|
}; |
|
|
}; |
|
|
// 将已修改的禁用/启用状态改回 |
|
|
// 将已修改的禁用/启用状态改回 |
|
|
const resetLockList = (item: any) => { |
|
|
const resetLockList = (item: any) => { |
|
@ -677,6 +694,55 @@ |
|
|
return message.info('未产生任何修改'); |
|
|
return message.info('未产生任何修改'); |
|
|
} |
|
|
} |
|
|
http |
|
|
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, { |
|
|
.post(url.getList, { |
|
|
sceneList: changeList.value, |
|
|
sceneList: changeList.value, |
|
|
lockList: lockList.value, |
|
|
lockList: lockList.value, |
|
@ -684,11 +750,11 @@ |
|
|
siteId: state.siteId, |
|
|
siteId: state.siteId, |
|
|
}) |
|
|
}) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
if (res.msg === 'success') { |
|
|
if (res.retcode == 0) { |
|
|
diffList.value = res.data; |
|
|
diffList.value = res.data; |
|
|
executeVisible.value = true; |
|
|
executeVisible.value = true; |
|
|
} else { |
|
|
} else { |
|
|
message.warning('获取修改内容失败'); |
|
|
message.error('获取修改内容失败'); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch(() => {}); |
|
|
.catch(() => {}); |
|
@ -736,9 +802,22 @@ |
|
|
projectId: state.projectId, |
|
|
projectId: state.projectId, |
|
|
siteId: state.siteId, |
|
|
siteId: state.siteId, |
|
|
}) |
|
|
}) |
|
|
.then(() => { |
|
|
.then((res) => { |
|
|
emit('reload'); |
|
|
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); |
|
|
refresh(true); |
|
|
|
|
|
emit('resetAll'); |
|
|
}) |
|
|
}) |
|
|
.catch(() => {}); |
|
|
.catch(() => {}); |
|
|
}; |
|
|
}; |
|
@ -759,6 +838,8 @@ |
|
|
defineExpose({ |
|
|
defineExpose({ |
|
|
// 回路切换 |
|
|
// 回路切换 |
|
|
changeLine, |
|
|
changeLine, |
|
|
|
|
|
// 重置当前选择 |
|
|
|
|
|
refresh, |
|
|
}); |
|
|
}); |
|
|
</script> |
|
|
</script> |
|
|
<style lang="less" scoped> |
|
|
<style lang="less" scoped> |
|
|