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,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 {