add:照明系统/通风系统 交互改动

This commit is contained in:
chenpingsen
2024-08-20 14:13:40 +08:00
parent 400839e865
commit 2d40e8d26d
17 changed files with 446 additions and 207 deletions

View File

@@ -1,4 +1,4 @@
const prefix = '/carbon-smart';
const prefix = '/carbon-smart/api';
// 照明系统及相关接口
export enum lightingManage {
// 主页 ========================================================

View File

@@ -1,4 +1,4 @@
const prefix = '/carbon-smart';
const prefix = '/carbon-smart/api';
// 空调系统及相关接口
export enum airConditionControl {
// 主页 ======================================================

View File

@@ -1,4 +1,4 @@
const prefix = '/carbon-smart';
const prefix = '/carbon-smart/api';
// 照明系统及相关接口
export enum planManage {
/**
@@ -10,4 +10,6 @@ export enum planManage {
getTableData = prefix + '/deviceCtrlPlan/getActivatedPlanList',
// 提交计划状态修改
submitTransData = prefix + '/deviceCtrlPlan/activePlanByIdList',
// 用于确认当前是否有计划正在运行
getRunningPlan = prefix + '/deviceCtrlPlan/getRunningPlan',
}

View File

@@ -1,5 +1,5 @@
// 前缀
const prefix = '/carbon-smart';
const prefix = '/carbon-smart/api';
// 通风系统相关接口
export enum ventilating {
// 排风扇相关 =============================================

View File

@@ -1,7 +1,12 @@
<template>
<div class="div-add">
<button class="add" @click="addModal">添加</button>
<a-popconfirm title="是否提交以上修改?" ok-text="确定" cancel-text="取消" @confirm="sendTable">
<a-popconfirm
title="是否提交以上修改?"
placement="bottomLeft"
ok-text="确定"
cancel-text="取消"
@confirm="sendTable">
<button class="add" style="margin-left: 20px">执行</button>
</a-popconfirm>
</div>
@@ -47,6 +52,7 @@
title="此操作将移除该数据"
ok-text="确定"
cancel-text="取消"
placement="topRight"
@confirm="deletePlan(row)">
<div class="tabDelete">删除</div>
</a-popconfirm>
@@ -55,7 +61,7 @@
</tbody>
</table>
<div class="out-dialog" v-if="addVisible">
<div class="content" v-if="addVisible">
<div class="content">
<div class="div-operation"></div>
<span class="text-operation">计划库</span>
</div>
@@ -132,7 +138,15 @@
// 计划启用/禁用事件
const togglePlan = (state: number) => {
dataSource.value.forEach((item: any) => {
item.executeStatus.value = state;
// 执行中 无法修改为待执行
if (state == 1) {
if (item.executeStatus.value != 2) {
item.executeStatus.value = state;
}
// 任何状态都可以修改为 暂停
} else {
item.executeStatus.value = state;
}
});
};
@@ -155,20 +169,33 @@
const deletePlan = (row: any) => {
row.executeStatus.value = 0;
};
// 重启表格中的计划(将当前任意状态,修改为待执行 = 1
// 重启表格中的计划(将当前非 执行中 状态,修改为待执行 = 1
const startPlan = (row: any) => {
if (row.executeStatus.value == 1) {
return message.info('该数据已是待执行状态,无需再次修改');
}
if (row.executeStatus.value == 2) {
return message.info('执行中的状态已被启用,无需修改');
}
row.executeStatus.value = 1;
};
// 将对表格的修改统一发送
const sendTable = () => {
http.post(airConditionControl.submitTableData, dataSource.value).then(() => {
message.success('操作成功');
getTable();
getLeftPlan();
});
http
.post(
airConditionControl.submitTableData +
`?projectId=${state.projectId}${state.siteId ? `&siteId=${state.siteId}` : ''}`,
dataSource.value,
)
.then((res) => {
if (res.retcode == 0) {
message.success('操作成功');
getTable();
getLeftPlan();
} else {
message.info(res.msg);
}
});
};
// tab页弹窗部分 ====================================================
@@ -225,7 +252,7 @@
getLeftPlan();
});
};
// 穿梭框交互
const filterOption = (inputValue: string, option: any) => {
return option.description.indexOf(inputValue) > -1;
};

View File

@@ -11,7 +11,7 @@
</thead>
<tbody>
<tr
:style="{ color: row.ctrlResult == 0 ? 'red' : 'white' }"
:style="{ color: row.ctrlResult == 1 ? 'red' : 'white' }"
v-for="(row, index) in dataSource"
:key="index"
@click="handleRowClick(row.id, index)"
@@ -20,7 +20,7 @@
<td>{{ row.startTime }}</td>
<td>{{ row.operationContent }}</td>
<td>{{ row.createUser }}</td>
<td>{{ row.ctrlResult ? '成功' : '失败' }}</td>
<td>{{ row.ctrlResult ? '失败' : '成功' }}</td>
</tr>
</tbody>
</table>
@@ -163,6 +163,8 @@
};
// 刷新功能(右下角)
const reset = () => {
trIndex.value = -1;
logModalVisible.value = false;
pagination.value = {
pageSize: 10,
pageNum: 1,
@@ -172,13 +174,8 @@
};
// 点击日志行事件
const handleRowClick = (id: any, index: any) => {
// 忽略无效点击
if (index === trIndex.value) {
return;
} else {
trIndex.value = index;
getLogDetail(id);
}
trIndex.value = index;
getLogDetail(id);
};
// 日志详情业务 ==================================================
@@ -200,7 +197,7 @@
const cxList = ref([]);
</script>
<style lang="less" scoped>
@import './dialogStyle.less';
@import '../style/dialogStyle.less';
// 右下角添加按钮
.div-add {

View File

@@ -56,14 +56,15 @@
ref="tabs1Ref"
@reset="reset"
@reload="reload"
@changeArea="changeArea"
@reset-all="resetDrawer"
@change-area="changeArea"
:treeData="treeData" />
</a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render>
<tabs2 />
<tabs2 ref="tabs2Ref" @reset-all="resetDrawer" />
</a-tab-pane>
<a-tab-pane key="3" tab="日志">
<tabs3 />
<tabs3 ref="tabs3Ref" @reset-all="resetDrawer" />
</a-tab-pane>
</a-tabs>
</a-drawer>
@@ -269,8 +270,29 @@
const toggleDrawer = () => {
visible.value = !visible.value;
};
// 当其中一个tab产生了数据修改可以调用该方法重置所有tab
const resetDrawer = () => {
// 设备点阵重置
getBulbs();
// tab1重置
reload();
tabs1Ref.value.refresh();
// tab2 tab3 可能未加载
try {
// tab2重置
tabs2Ref.value.reset();
} catch {}
try {
// tab3重置
tabs3Ref.value.reset();
} catch {}
};
// 抽屉tab1组件的引用
const tabs1Ref = ref();
// 抽屉tab2组件的引用
const tabs2Ref = ref();
// 抽屉tab3组件的引用
const tabs3Ref = ref();
</script>
<style lang="less" scoped>
@import './index.less';

View File

@@ -7,7 +7,9 @@
<img src="/asset/image//bulbLogo/21962.png" alt="" />
<span class="tag-text">{{ blub.regionName + ' > ' + blub.deviceGroupName }}</span></div
>
<button class="right-button">{{ record.runStatus.label }}</button>
<button class="right-button">{{
record?.runStatus?.label ? record.runStatus.label : '--'
}}</button>
</div>
<div class="light-tag-box">
<div class="tag-box-item">
@@ -36,25 +38,25 @@
<div class="icon-box" :style="props.blub.styleText">
<!-- 正常=0 -->
<img
v-if="record.runStatus.value == 0"
v-if="record?.runStatus?.value == 0"
class="icon-item"
src="/asset/image/bulbLogo/on.png"
alt="" />
<!-- 故障=1 -->
<img
v-if="record.runStatus.value == 1"
v-if="record?.runStatus?.value == 1"
class="icon-item"
src="/asset/image/bulbLogo/off.png"
alt="" />
<!-- 维修=2 -->
<img
v-if="record.runStatus.value == 2"
v-if="record?.runStatus?.value == 2"
class="icon-item"
src="/asset/image/bulbLogo/repair.png"
alt="" />
<!-- 警告=3 -->
<img
v-if="record.runStatus.value == 3"
v-if="record?.runStatus?.value == 3"
class="icon-item"
src="/asset/image/bulbLogo/alarm.png"
alt="" />

View File

@@ -265,12 +265,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 { lightingManage } from '/@/api/IlluminationInfo';
import { planManage } from '/@/api/planManage';
// 全局变量
import { items } from '/@/store/item';
@@ -299,12 +300,24 @@
},
},
});
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(['changeArea', 'reset', 'reload']);
const emit = defineEmits(['changeArea', 'reset', 'reload', 'resetAll']);
// 照明区域业务 =======================================================================
@@ -666,22 +679,21 @@
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) => {
props.treeData.find((v: any) => {
@@ -729,6 +741,55 @@
if (!changeList.value.length && !lockList.value.length) {
return message.info('未产生任何修改');
}
http
.get(planManage.getRunningPlan, {
deviceType: 1,
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(lightingManage.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(lightingManage.getChangeList, {
sceneList: changeList.value,
@@ -737,11 +798,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(() => {});
@@ -792,7 +853,7 @@
.then((res) => {
let data = res.data;
// 修改请求发送了,但操作时产生了失败结果
if (data.retcode != 0) {
if (res.retcode != 0) {
// 直接提示并跳出
return message.warning(data.msg);
}
@@ -803,8 +864,8 @@
} else {
message.info(`${data.successList.length}条修改成功,${data.failList.length}条修改失败`);
}
emit('reload');
refresh(true);
emit('resetAll');
})
.catch(() => {});
};
@@ -829,8 +890,6 @@
changeLine,
// 重置当前选择
refresh,
resetLockList,
resetChangeList,
});
</script>
<style lang="less" scoped>

View File

@@ -1,7 +1,12 @@
<template>
<div class="div-add">
<button class="add" @click="addModal">添加</button>
<a-popconfirm title="是否提交以上修改?" ok-text="确定" cancel-text="取消" @confirm="sendTable">
<a-popconfirm
title="是否提交以上修改?"
placement="bottomLeft"
ok-text="确定"
cancel-text="取消"
@confirm="sendTable">
<button class="add" style="margin-left: 20px">执行</button>
</a-popconfirm>
</div>
@@ -47,6 +52,7 @@
title="此操作将移除该数据"
ok-text="确定"
cancel-text="取消"
placement="topRight"
@confirm="deletePlan(row)">
<div class="tabDelete">删除</div>
</a-popconfirm>
@@ -55,7 +61,7 @@
</tbody>
</table>
<div class="out-dialog" v-if="addVisible">
<div class="content" v-if="addVisible">
<div class="content">
<div class="div-operation"></div>
<span class="text-operation">计划库</span>
</div>
@@ -93,18 +99,22 @@
// 初始化 ===========================================================
onMounted(() => {
// 获得枚举
getStateEnum();
// 计划表格
getTable();
// 穿梭框原始数据
getLeftPlan();
// 获得穿梭框 与 表格数据
reset();
});
// 全局变量
const state = items();
// 获得任务状态枚举
const getStateEnum = async () => {
let enumData = await getEnum({ params: { enumType: 'PlanExecuteStatus' } });
stateList.value = enumData.data;
};
/**
* @method resetAll 刷新3个tab中的全部数据修改计划会影响tab1数据信息生成tab3日志
*/
const emit = defineEmits(['resetAll']);
// tab页部分 ========================================================
@@ -132,7 +142,15 @@
// 计划启用/禁用事件
const togglePlan = (state: number) => {
dataSource.value.forEach((item: any) => {
item.executeStatus.value = state;
// 执行中 无法修改为待执行
if (state == 1) {
if (item.executeStatus.value != 2) {
item.executeStatus.value = state;
}
// 任何状态都可以修改为 暂停
} else {
item.executeStatus.value = state;
}
});
};
@@ -160,6 +178,9 @@
if (row.executeStatus.value == 1) {
return message.info('该数据已是待执行状态,无需再次修改');
}
if (row.executeStatus.value == 2) {
return message.info('执行中的状态已被启用,无需修改');
}
row.executeStatus.value = 1;
};
// 将对表格的修改统一发送
@@ -173,14 +194,21 @@
.then((res) => {
if (res.retcode == 0) {
message.success('操作成功');
getTable();
getLeftPlan();
// 刷新数据
emit('resetAll');
} else {
message.info(res.msg);
}
});
};
const reset = () => {
// 计划表格
getTable();
// 穿梭框原始数据
getLeftPlan();
};
// tab页弹窗部分 ====================================================
// 添加弹窗控制变量
@@ -204,7 +232,7 @@
deviceType: 1,
})
.then((res) => {
let arr = [];
let arr: Array<Object> = [];
res.data.forEach((item: any) => {
arr.push({
key: item.id,
@@ -231,14 +259,18 @@
http.post(planManage.submitTransData, targetKeys.value).then(() => {
message.success('添加成功');
// 如果发送成功,则刷新表格
getTable();
getLeftPlan();
reset();
});
};
const filterOption = (inputValue: string, option: any) => {
return option.description.indexOf(inputValue) > -1;
};
// 向外暴露方法
defineExpose({
reset,
});
</script>
<style lang="less" scoped>
@import '../style/dialogStyle.less';

View File

@@ -11,7 +11,7 @@
</thead>
<tbody>
<tr
:style="{ color: row.ctrlResult == 0 ? 'red' : 'white' }"
:style="{ color: row.ctrlResult == 1 ? 'red' : 'white' }"
v-for="(row, index) in dataSource"
:key="index"
@click="handleRowClick(row.id, index)"
@@ -20,7 +20,7 @@
<td>{{ row.startTime }}</td>
<td>{{ row.operationContent }}</td>
<td>{{ row.createUser }}</td>
<td>{{ row.ctrlResult ? '成功' : '失败' }}</td>
<td>{{ row.ctrlResult ? '失败' : '成功' }}</td>
</tr>
</tbody>
</table>
@@ -31,6 +31,7 @@
show-size-changer
:total="pagination.total"
@change="getTable(true)" />
<div style="width: 100%; height: 40px"></div>
<div class="out-dialog" :class="{ showDialog: logModalVisible }" v-if="logModalVisible">
<div class="content">
@@ -54,9 +55,17 @@
<div class="btn-item">
<div class="left">控制模式</div>
<div class="right">
<span>手动</span>
<span>{{
item.autoStatusBefore.label.indexOf('模式') != -1
? item.autoStatusBefore.label.replace('模式', '')
: item.autoStatusBefore.label
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span></div
<span>{{
item.autoStatusAfter.label.indexOf('模式') != -1
? item.autoStatusAfter.label.replace('模式', '')
: item.autoStatusAfter.label
}}</span></div
>
</div>
<div class="btn-item">
@@ -163,6 +172,8 @@
};
// 刷新功能(右下角)
const reset = () => {
trIndex.value = -1;
logModalVisible.value = false;
pagination.value = {
pageSize: 10,
pageNum: 1,
@@ -172,13 +183,8 @@
};
// 点击日志行事件
const handleRowClick = (id: any, index: any) => {
// 忽略无效点击
if (index === trIndex.value) {
return;
} else {
trIndex.value = index;
getLogDetail(id);
}
trIndex.value = index;
getLogDetail(id);
};
// 日志详情业务 ==================================================
@@ -197,7 +203,13 @@
}
});
};
// 日志详情
const cxList = ref([]);
// 向外暴露方法
defineExpose({
reset,
});
</script>
<style lang="less" scoped>
@import '../style/dialogStyle.less';

View File

@@ -1,3 +1,4 @@
// 颜色变量
:root {
// 电梯
// 正常

View File

@@ -1,3 +1,4 @@
// 设备群控 > 抽屉 > 控制面板 & 日志 的附加弹窗
.out-dialog {
position: fixed;
right: 496px;

View File

@@ -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) => {
@@ -676,6 +693,55 @@
if (!changeList.value.length && !lockList.value.length) {
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,
@@ -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>

View File

@@ -11,7 +11,7 @@
</thead>
<tbody>
<tr
:style="{ color: row.ctrlResult == 0 ? 'red' : 'white' }"
:style="{ color: row.ctrlResult == 1 ? 'red' : 'white' }"
v-for="(row, index) in dataSource"
:key="index"
@click="handleRowClick(row.id, index)"
@@ -20,7 +20,7 @@
<td>{{ row.startTime }}</td>
<td>{{ row.operationContent }}</td>
<td>{{ row.createUser }}</td>
<td>{{ row.ctrlResult ? '成功' : '失败' }}</td>
<td>{{ row.ctrlResult ? '失败' : '成功' }}</td>
</tr>
</tbody>
</table>
@@ -31,6 +31,7 @@
show-size-changer
:total="pagination.total"
@change="getTable(true)" />
<div style="width: 100%; height: 40px"></div>
<div class="out-dialog" :class="{ showDialog: logModalVisible }" v-if="logModalVisible">
<div class="content">
@@ -54,9 +55,17 @@
<div class="btn-item">
<div class="left">控制模式</div>
<div class="right">
<span>手动</span>
<span>{{
item.autoStatusBefore.label.indexOf('模式') != -1
? item.autoStatusBefore.label.replace('模式', '')
: item.autoStatusBefore.label
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span></div
<span>{{
item.autoStatusAfter.label.indexOf('模式') != -1
? item.autoStatusAfter.label.replace('模式', '')
: item.autoStatusAfter.label
}}</span></div
>
</div>
<div class="btn-item">
@@ -193,6 +202,8 @@
};
// 刷新功能(右下角)
const reset = () => {
trIndex.value = -1;
logModalVisible.value = false;
// state.setLoading(true);
pagination.value = {
pageSize: 10,
@@ -203,13 +214,8 @@
};
// 点击日志行事件
const handleRowClick = (id: any, index: any) => {
// 忽略无效点击
if (index === trIndex.value) {
return;
} else {
trIndex.value = index;
getLogDetail(id);
}
trIndex.value = index;
getLogDetail(id);
};
// 日志详情业务 ==================================================
@@ -229,6 +235,11 @@
});
};
const cxList = ref([]);
// 向外暴露方法
defineExpose({
reset,
});
</script>
<style lang="less" scoped>
@import '../../style/dialogStyle.less';

View File

@@ -52,6 +52,7 @@
title="此操作将移除该数据"
ok-text="确定"
cancel-text="取消"
placement="topRight"
@confirm="deletePlan(row)">
<div class="tabDelete">删除</div>
</a-popconfirm>
@@ -60,7 +61,7 @@
</tbody>
</table>
<div class="out-dialog" v-if="addVisible">
<div class="content" v-if="addVisible">
<div class="content">
<div class="div-operation"></div>
<span class="text-operation">计划库</span>
</div>
@@ -126,6 +127,11 @@
}
});
/**
* @method resetAll 刷新3个tab中的全部数据修改计划会影响tab1数据信息生成tab3日志
*/
const emit = defineEmits(['resetAll']);
// tab页部分 ========================================================
// 设置枚举的颜色 与 文本
@@ -150,7 +156,15 @@
// 计划启用/禁用事件
const togglePlan = (state: number) => {
dataSource.value.forEach((item: any) => {
item.executeStatus.value = state;
// 执行中 无法修改为待执行
if (state == 1) {
if (item.executeStatus.value != 2) {
item.executeStatus.value = state;
}
// 任何状态都可以修改为 暂停
} else {
item.executeStatus.value = state;
}
});
};
@@ -178,6 +192,9 @@
if (row.executeStatus.value == 1) {
return message.info('该数据已是待执行状态,无需再次修改');
}
if (row.executeStatus.value == 2) {
return message.info('执行中的状态已被启用,无需修改');
}
row.executeStatus.value = 1;
};
// 将对表格的修改统一发送
@@ -187,13 +204,24 @@
url + `?projectId=${state.projectId}${state.siteId ? `&siteId=${state.siteId}` : ''}`,
dataSource.value,
)
.then(() => {
message.success('操作成功');
getTable();
getLeftPlan();
.then((res) => {
if (res.retcode == 0) {
message.success('操作成功');
// 刷新数据
emit('resetAll');
} else {
message.info(res.msg);
}
});
};
const reset = () => {
// 计划表格
getTable();
// 穿梭框原始数据
getLeftPlan();
};
// tab页弹窗部分 ====================================================
// 添加弹窗控制变量
@@ -244,14 +272,18 @@
http.post(planManage.submitTransData, targetKeys.value).then(() => {
message.success('添加成功');
// 如果发送成功,则刷新表格
getTable();
getLeftPlan();
reset();
});
};
const filterOption = (inputValue: string, option: any) => {
return option.description.indexOf(inputValue) > -1;
};
// 向外暴露方法
defineExpose({
reset,
});
</script>
<style lang="less" scoped>
@import '../../style/dialogStyle.less';

View File

@@ -137,13 +137,17 @@
</div>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板">
<fanControl :treeData="treeData" :type="`排风扇`" />
<fanControl
ref="tabs1Ref"
@reset-all="resetDrawer"
:treeData="treeData"
:type="`排风扇`" />
</a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render>
<fanPlant :status="stateList" :type="3" />
<fanPlant ref="tabs2Ref" @reset-all="resetDrawer" :status="stateList" :type="3" />
</a-tab-pane>
<a-tab-pane key="3" tab="日志">
<fanLog :type="3" />
<fanLog ref="tabs3Ref" @reset-all="resetDrawer" :type="3" />
</a-tab-pane>
</a-tabs>
</a-drawer>
@@ -194,13 +198,17 @@
</div>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板">
<fanControl :treeData="treeData" :type="`风幕机`" />
<fanControl
ref="tabs1Ref"
@reset-all="resetDrawer"
:treeData="treeData"
:type="`风幕机`" />
</a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render>
<fanPlant :status="stateList" :type="4" />
<fanPlant ref="tabs2Ref" @reset-all="resetDrawer" :status="stateList" :type="4" />
</a-tab-pane>
<a-tab-pane key="3" tab="日志">
<fanLog :type="4" />
<fanLog ref="tabs3Ref" @reset-all="resetDrawer" :type="4" />
</a-tab-pane>
</a-tabs>
</a-drawer>
@@ -250,13 +258,17 @@
</div>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板">
<fanControl :treeData="treeData" :type="`电动窗`" />
<fanControl
ref="tabs1Ref"
@reset-all="resetDrawer"
:treeData="treeData"
:type="`电动窗`" />
</a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render>
<fanPlant :status="stateList" :type="5" />
<fanPlant ref="tabs2Ref" @reset-all="resetDrawer" :status="stateList" :type="5" />
</a-tab-pane>
<a-tab-pane key="3" tab="日志">
<fanLog :type="5" />
<fanLog ref="tabs3Ref" @reset-all="resetDrawer" :type="5" />
</a-tab-pane>
</a-tabs>
</a-drawer>
@@ -351,6 +363,15 @@
const toggleDrawer = () => {
visible.value = !visible.value;
};
// 当前设备的请求URL
let url = '';
// 刷新当前的树形结构数据
const reload = () => {
http.get(url, { projectId: state.projectId, siteId: state.siteId }).then((res) => {
const data = res.data;
treeData.value = data[0].childList;
});
};
// 抽屉中tab1 - 控制面板 =================================================================
@@ -359,7 +380,6 @@
const getTree = async (type: number, index: number) => {
// 切换时默认选择tab1
activeKey.value = '1';
let url;
if (type == 1) {
url = ventilating.getTree1;
} else if (type == 2) {
@@ -489,93 +509,33 @@
},
]);
// 排风扇
const fanData = ref([
// {
// title: '排风扇',
// styleText: { left: '43.2%', bottom: '77.8%' },
// type: 'fan',
// lineType: '1',
// },
// {
// title: '排风扇',
// styleText: { left: '50%', bottom: '77.8%' },
// type: 'fan',
// lineType: '2',
// },
// {
// title: '排风扇',
// styleText: { left: '41.2%', bottom: '27.8%' },
// type: 'fan',
// lineType: '1',
// },
// {
// title: '排风扇',
// styleText: { left: '51.2%', bottom: '27.8%' },
// type: 'fan',
// lineType: '2',
// },
]);
const fanData = ref([]);
// 风幕机
const airCurtainData = ref([
// {
// title: '风幕机',
// styleText: { left: '38%', bottom: '57.8%' },
// type: 'airCurtain',
// },
// {
// title: '风幕机',
// styleText: { left: '58.5%', bottom: '57.3%' },
// type: 'airCurtain',
// },
// {
// title: '风幕机',
// styleText: { left: '64.2%', bottom: '22.8%' },
// type: 'airCurtain',
// },
]);
const airCurtainData = ref([]);
// 电动窗
const windowData = ref([
// {
// title: '电动窗1',
// styleText: { left: '32%', bottom: '28%' },
// type: 'window',
// },
// {
// title: '电动窗2',
// styleText: { left: '33.5%', bottom: '42.8%' },
// type: 'window',
// },
// {
// title: '电动窗3',
// styleText: { left: '35%', bottom: '57.8%' },
// type: 'window',
// },
// {
// title: '电动窗4',
// styleText: { left: '36.5%', bottom: '72.8%' },
// type: 'window',
// },
// {
// title: '电动窗5',
// styleText: { left: '66%', bottom: '28%' },
// type: 'window',
// },
// {
// title: '电动窗6',
// styleText: { left: '64%', bottom: '42.8%' },
// type: 'window',
// },
// {
// title: '电动窗7',
// styleText: { left: '62%', bottom: '57.8%' },
// type: 'window',
// },
// {
// title: '电动窗8',
// styleText: { left: '60%', bottom: '72.8%' },
// type: 'window',
// },
]);
const windowData = ref([]);
// 当其中一个tab产生了数据修改可以调用该方法重置所有tab
const resetDrawer = () => {
// tab1重置
reload();
tabs1Ref.value.refresh();
// tab2 tab3 可能未加载
try {
// tab2重置
tabs2Ref.value.reset();
} catch {}
try {
// tab3重置
tabs3Ref.value.reset();
} catch {}
};
// 抽屉tab1组件的引用
const tabs1Ref = ref();
// 抽屉tab2组件的引用
const tabs2Ref = ref();
// 抽屉tab3组件的引用
const tabs3Ref = ref();
onMounted(() => {
// 获得枚举
getStateEnum();