提交:项目详情页 场景控制 添加 场景触发日志,以及执行一次的操作
This commit is contained in:
parent
e4b1b2553f
commit
11a717959a
|
@ -215,3 +215,20 @@ export function projectSceneChangeStatus(data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 新增
|
||||||
|
export function projectSceneSingleRun(id) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/scene/execOnece/" + id,
|
||||||
|
method: "post"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询 场景控制 日志 列表
|
||||||
|
export function projectSceneLoggingList(query) {
|
||||||
|
return request({
|
||||||
|
url: "/iot/scene/log",
|
||||||
|
method: "get",
|
||||||
|
params: query
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,379 @@
|
||||||
|
<template>
|
||||||
|
<div class="e-scene-logging">
|
||||||
|
<div class="device-children-header">
|
||||||
|
<div class="left-link-home" @click="handleLinkToHome">
|
||||||
|
<icon class="iconfont iconfanhui_1"></icon>
|
||||||
|
<span class="link-bt-title">返回</span>
|
||||||
|
</div>
|
||||||
|
<div class="lift-gateway-info">
|
||||||
|
<span class="gateway-label">场景名称:</span>
|
||||||
|
<span class="gateway-adders">{{ sceneInfo.sceneName || '--'
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="right-operate">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.method"
|
||||||
|
size="small"
|
||||||
|
width="300"
|
||||||
|
style="margin-right: 10px"
|
||||||
|
placeholder="触发方式"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(value, keys) in triggerMethod"
|
||||||
|
:key="keys"
|
||||||
|
:label="value"
|
||||||
|
:value="keys"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
|
||||||
|
<el-date-picker
|
||||||
|
v-model="time"
|
||||||
|
size="small"
|
||||||
|
@change="queryTimeChange"
|
||||||
|
:clearable="false"
|
||||||
|
type="datetimerange"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
style="margin-right: 10px"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
|
||||||
|
<div class="operate-refresh" @click="handleRefresh">查询</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-children-center">
|
||||||
|
<el-table
|
||||||
|
v-loading="tableLoading"
|
||||||
|
:data="tableList"
|
||||||
|
:height="total > 0 ? '530px' : '270px'"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
type="index"
|
||||||
|
label="序号"
|
||||||
|
align="center"
|
||||||
|
:index="
|
||||||
|
(idx) => {
|
||||||
|
return idx + 1 + (queryParams.pageNum - 1) * queryParams.pageSize;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
width="80px"
|
||||||
|
></el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="触发方式"
|
||||||
|
width="150px"
|
||||||
|
align="center"
|
||||||
|
prop="method"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.method">
|
||||||
|
{{ triggerMethod[scope.row.method]}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="内容"
|
||||||
|
align="left"
|
||||||
|
prop="content"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.content">
|
||||||
|
{{ scope.row.content }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
width="160px"
|
||||||
|
prop="createTime"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.createTime">
|
||||||
|
{{ scope.row.createTime }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { projectSceneLoggingList } from "@/api/iot/project_new";
|
||||||
|
const triggerMethod = {
|
||||||
|
MANUAL: "手动触发",
|
||||||
|
TIMER: "定时触发",
|
||||||
|
DEVICE: "设备触发",
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
name: "ELogging",
|
||||||
|
props: {
|
||||||
|
sceneInfo: {
|
||||||
|
type: Object,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
sourceId: {
|
||||||
|
type: [String, Number],
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
},
|
||||||
|
tableLoading: true,
|
||||||
|
tableList: [],
|
||||||
|
projectModelList: [],
|
||||||
|
tableSelectList: [],
|
||||||
|
stompClient: null,
|
||||||
|
socket_flag: true,
|
||||||
|
timeout_flag: null,
|
||||||
|
total: 0,
|
||||||
|
time: [],
|
||||||
|
triggerMethod,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.newTime();
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
newTime() {
|
||||||
|
const startTime = this.parseTime(new Date(), "{y}-{m}-{d} 00:00:00");
|
||||||
|
const endTime = this.parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}");
|
||||||
|
this.time = [startTime, endTime];
|
||||||
|
this.queryParams.startDate = startTime;
|
||||||
|
this.queryParams.endDate = endTime;
|
||||||
|
},
|
||||||
|
queryTimeChange(val) {
|
||||||
|
if (val) {
|
||||||
|
this.queryParams.startDate = this.parseTime(
|
||||||
|
val[0],
|
||||||
|
"{y}-{m}-{d} {h}:{i}:{s}"
|
||||||
|
);
|
||||||
|
this.queryParams.endDate = this.parseTime(
|
||||||
|
val[1],
|
||||||
|
"{y}-{m}-{d} {h}:{i}:{s}"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.queryParams.startDate = null;
|
||||||
|
this.queryParams.endDate = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleLinkToHome() {
|
||||||
|
this.$emit("handleLinkToHome");
|
||||||
|
},
|
||||||
|
// 处理数据 成为表格可用 列数据
|
||||||
|
handleTableFilter(list) {
|
||||||
|
var resultList = [];
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach((v) => {
|
||||||
|
resultList.push({
|
||||||
|
label: v["unitName"] ? `${v["name"]}(${v["unitName"]})` : v["name"],
|
||||||
|
align: "center",
|
||||||
|
prop: v["key"],
|
||||||
|
width: list.length > 5 ? "200px" : "",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
},
|
||||||
|
// 查询 子设备列表数据---需要考虑到型号的问题
|
||||||
|
getList() {
|
||||||
|
this.tableList = [];
|
||||||
|
this.tableLoading = true;
|
||||||
|
projectSceneLoggingList(
|
||||||
|
Object.assign(
|
||||||
|
{
|
||||||
|
sceneId: this.sourceId,
|
||||||
|
},
|
||||||
|
this.queryParams
|
||||||
|
)
|
||||||
|
).then((res) => {
|
||||||
|
this.tableList = res.rows;
|
||||||
|
this.total = res.total;
|
||||||
|
this.tableLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleRefresh() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
// 表格 分页查询
|
||||||
|
handleQuery(e) {
|
||||||
|
this.queryParams = Object.assign(this.queryParams, e);
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.e-scene-logging {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
.device-children-header {
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.left-link-home {
|
||||||
|
width: 70px;
|
||||||
|
height: 32px;
|
||||||
|
background: #f4f5f7;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #6b778c;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
.link-bt-title {
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.lift-gateway-info {
|
||||||
|
width: calc(100% - 920px);
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-left: 10px;
|
||||||
|
// justify-content: space-around;
|
||||||
|
.gateway-label {
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #6b778c;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: inline-block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.gateway-adders {
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #344567;
|
||||||
|
width: calc(95% - 60px);
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: inline-block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.gateway-did {
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #344567;
|
||||||
|
width: calc(55% - 20% - 80px);
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: inline-block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.gateway-stu {
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #009003;
|
||||||
|
width: calc(18% - 80px);
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: inline-block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.off-line {
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.right-operate {
|
||||||
|
width: 870px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #344567;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
cursor: default;
|
||||||
|
.operate-refresh {
|
||||||
|
width: 60px;
|
||||||
|
height: 32px;
|
||||||
|
background: #f4f5f7;
|
||||||
|
border-radius: 5px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin: 0 5px;
|
||||||
|
}
|
||||||
|
.operate-onekey-on {
|
||||||
|
width: 75px;
|
||||||
|
height: 30px;
|
||||||
|
background: #f4f5f7;
|
||||||
|
border-radius: 5px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin: 0 5px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #344567;
|
||||||
|
}
|
||||||
|
.but-disable {
|
||||||
|
color: #6b778c;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.device-children-center {
|
||||||
|
.children-device-operate {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
align-items: baseline;
|
||||||
|
cursor: default;
|
||||||
|
> span {
|
||||||
|
display: block;
|
||||||
|
width: 50px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 13px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #1890ff;
|
||||||
|
align-items: center;
|
||||||
|
> i {
|
||||||
|
font-size: 16px;
|
||||||
|
margin-right: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.span-disable {
|
||||||
|
color: #6b778c;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.children-device-online {
|
||||||
|
font-size: 13px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #009003;
|
||||||
|
}
|
||||||
|
.children-device-offline {
|
||||||
|
font-size: 13px;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,179 +1,186 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="e-scene-manage">
|
<div class="e-scene-manage">
|
||||||
<el-row :gutter="10" class="mb8">
|
<div v-show="!isLoggingViewShow">
|
||||||
<el-col :span="1.5">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-button
|
<el-col :span="1.5">
|
||||||
type="primary"
|
<el-button
|
||||||
plain
|
type="primary"
|
||||||
icon="el-icon-plus"
|
plain
|
||||||
size="mini"
|
icon="el-icon-plus"
|
||||||
@click="handleAdd"
|
size="mini"
|
||||||
>新增</el-button
|
@click="handleAdd"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="handleQuery" size="mini">刷新</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<div class="e-alarm-table">
|
||||||
|
<el-table
|
||||||
|
v-loading="tableLoading"
|
||||||
|
:data="tableList"
|
||||||
|
:height="total > 0 ? '530px' : '270px'"
|
||||||
>
|
>
|
||||||
<el-button @click="handleQuery" size="mini">刷新</el-button>
|
<el-table-column
|
||||||
</el-col>
|
type="index"
|
||||||
</el-row>
|
label="序号"
|
||||||
|
align="center"
|
||||||
|
:index="indexFormatter"
|
||||||
|
width="80px"
|
||||||
|
></el-table-column>
|
||||||
|
|
||||||
<div class="e-alarm-table">
|
<el-table-column
|
||||||
<el-table
|
label="场景名称"
|
||||||
v-loading="tableLoading"
|
width="200px"
|
||||||
:data="tableList"
|
align="left"
|
||||||
:height="total > 0 ? '530px' : '270px'"
|
prop="sceneName"
|
||||||
>
|
>
|
||||||
<el-table-column
|
<template slot-scope="scope">
|
||||||
type="index"
|
<span class="lay-table-textarea" :title="scope.row.sceneName">
|
||||||
label="序号"
|
{{ scope.row.sceneName }}
|
||||||
align="center"
|
</span>
|
||||||
:index="indexFormatter"
|
</template>
|
||||||
width="80px"
|
</el-table-column>
|
||||||
></el-table-column>
|
<el-table-column
|
||||||
|
label="场景编码"
|
||||||
|
align="left"
|
||||||
|
width="200"
|
||||||
|
prop="sceneCode"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.sceneCode">
|
||||||
|
{{ scope.row.sceneCode }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="场景模式"
|
||||||
|
align="left"
|
||||||
|
width="120"
|
||||||
|
prop="relation"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.relation">
|
||||||
|
{{ scope.row.relation }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column
|
<el-table-column label="状态" align="center" prop="runStatus">
|
||||||
label="场景名称"
|
<template slot-scope="scope">
|
||||||
width="200px"
|
<span class="lay-table-textarea">
|
||||||
align="left"
|
{{ scope.row.runStatus == "0" ? "启用" : "停止" }}
|
||||||
prop="sceneName"
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
width="160px"
|
||||||
|
prop="createTime"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span class="lay-table-textarea" :title="scope.row.createTime">
|
||||||
|
{{ scope.row.createTime }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
width="300"
|
||||||
|
prop="alarmTime"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
>编辑</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
:icon="
|
||||||
|
scope.row.runStatus == '0'
|
||||||
|
? 'el-icon-open'
|
||||||
|
: 'el-icon-turn-off'
|
||||||
|
"
|
||||||
|
@click="handleChangeStatus(scope.row)"
|
||||||
|
>{{ scope.row.runStatus == "0" ? "停止" : "启用" }}</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-video-play"
|
||||||
|
@click="handleSingleRun(scope.row)"
|
||||||
|
>执行</el-button
|
||||||
|
>
|
||||||
|
|
||||||
|
<el-button size="mini" type="text" @click="handleLoggingView(scope.row)" icon="el-icon-takeaway-box"
|
||||||
|
>指令历史</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="page.pageNum"
|
||||||
|
:limit.sync="page.pageSize"
|
||||||
|
@pagination="getTableList"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="e-dialog">
|
||||||
|
<!-- 添加或修改建筑类型对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible="open"
|
||||||
|
@close="open = false"
|
||||||
|
class="eldialog-wrap"
|
||||||
|
width="880px"
|
||||||
|
append-to-body
|
||||||
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<el-form
|
||||||
<span class="lay-table-textarea" :title="scope.row.sceneName">
|
ref="form"
|
||||||
{{ scope.row.sceneName }}
|
:model="form"
|
||||||
</span>
|
style="padding-right: 20px"
|
||||||
</template>
|
:rules="rules"
|
||||||
</el-table-column>
|
label-width="100px"
|
||||||
<el-table-column
|
>
|
||||||
label="场景编码"
|
<el-row :gutter="10">
|
||||||
align="left"
|
<el-col :span="12">
|
||||||
width="200"
|
<el-form-item label="场景名称:" prop="sceneName">
|
||||||
prop="sceneCode"
|
<el-input
|
||||||
>
|
v-model="form.sceneName"
|
||||||
<template slot-scope="scope">
|
placeholder="请输入场景名称"
|
||||||
<span class="lay-table-textarea" :title="scope.row.sceneCode">
|
/>
|
||||||
{{ scope.row.sceneCode }}
|
</el-form-item>
|
||||||
</span>
|
</el-col>
|
||||||
</template>
|
<el-col :span="12">
|
||||||
</el-table-column>
|
<el-form-item label="场景编码:" prop="sceneCode">
|
||||||
<el-table-column
|
<el-input
|
||||||
label="场景模式"
|
v-model="form.sceneCode"
|
||||||
align="left"
|
placeholder="请输入场景编码"
|
||||||
width="120"
|
/>
|
||||||
prop="relation"
|
</el-form-item>
|
||||||
>
|
</el-col>
|
||||||
<template slot-scope="scope">
|
<!-- <el-col :span="24">
|
||||||
<span class="lay-table-textarea" :title="scope.row.relation">
|
|
||||||
{{ scope.row.relation }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column
|
|
||||||
label="状态"
|
|
||||||
align="center"
|
|
||||||
prop="runStatus"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span class="lay-table-textarea">
|
|
||||||
{{ scope.row.runStatus == '0' ? "启用" : "停止" }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="创建时间" align="center" width="160px" prop="createTime">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span class="lay-table-textarea" :title="scope.row.createTime">
|
|
||||||
{{ scope.row.createTime }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<!-- <el-table-column label="执行设备" align="left" prop="triggerDevices">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span class="lay-table-textarea" :title="scope.row.triggerDevices">
|
|
||||||
{{ scope.row.triggerDevices }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
<el-table-column
|
|
||||||
label="操作"
|
|
||||||
align="center"
|
|
||||||
width="200"
|
|
||||||
prop="alarmTime"
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
@click="handleUpdate(scope.row)"
|
|
||||||
>编辑</el-button
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
:icon="scope.row.runStatus == '0' ? 'el-icon-video-pause' : 'el-icon-video-play'"
|
|
||||||
@click="handleChangeStatus(scope.row)"
|
|
||||||
>{{ scope.row.runStatus == '0' ? '停止' : '启用' }}</el-button
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
>删除</el-button
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- <el-button size="mini" type="text" icon="el-icon-search"
|
|
||||||
>详情</el-button
|
|
||||||
> -->
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total > 0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="page.pageNum"
|
|
||||||
:limit.sync="page.pageSize"
|
|
||||||
@pagination="getTableList"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="e-dialog">
|
|
||||||
<!-- 添加或修改建筑类型对话框 -->
|
|
||||||
<el-dialog
|
|
||||||
:title="title"
|
|
||||||
:visible="open"
|
|
||||||
@close="open = false"
|
|
||||||
class="eldialog-wrap"
|
|
||||||
width="880px"
|
|
||||||
append-to-body
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
ref="form"
|
|
||||||
:model="form"
|
|
||||||
style="padding-right: 20px"
|
|
||||||
:rules="rules"
|
|
||||||
label-width="100px"
|
|
||||||
>
|
|
||||||
<el-row :gutter="10">
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="场景名称:" prop="sceneName">
|
|
||||||
<el-input
|
|
||||||
v-model="form.sceneName"
|
|
||||||
placeholder="请输入场景名称"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="场景编码:" prop="sceneCode">
|
|
||||||
<el-input
|
|
||||||
v-model="form.sceneCode"
|
|
||||||
placeholder="请输入场景编码"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<!-- <el-col :span="24">
|
|
||||||
<el-form-item label="描述" prop="buildingTypeName">
|
<el-form-item label="描述" prop="buildingTypeName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.buildingTypeName"
|
v-model="form.buildingTypeName"
|
||||||
|
@ -181,54 +188,7 @@
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col> -->
|
</el-col> -->
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<span
|
|
||||||
class="e-form-item__label"
|
|
||||||
style="
|
|
||||||
text-align: right;
|
|
||||||
vertical-align: middle;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #606266;
|
|
||||||
width: 80px;
|
|
||||||
word-break: break-all;
|
|
||||||
font-weight: 600;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
触发器列表:
|
|
||||||
</span>
|
|
||||||
<div>
|
|
||||||
<e-tag-card
|
|
||||||
style="margin-top: 5px"
|
|
||||||
v-for="(item, idx) in form.triggers"
|
|
||||||
:key="item.guid || getGuid()"
|
|
||||||
type="info"
|
|
||||||
>
|
|
||||||
<e-scene-triggers
|
|
||||||
slot="body"
|
|
||||||
:dataItem="item"
|
|
||||||
:sourceId="sourceId"
|
|
||||||
@change="
|
|
||||||
(v) => {
|
|
||||||
form.triggers[idx] = v;
|
|
||||||
}
|
|
||||||
"
|
|
||||||
@handleDel="
|
|
||||||
(v) => {
|
|
||||||
form.triggers.splice(idx, 1);
|
|
||||||
}
|
|
||||||
"
|
|
||||||
></e-scene-triggers>
|
|
||||||
</e-tag-card>
|
|
||||||
</div>
|
|
||||||
<el-button
|
|
||||||
icon="el-icon-plus"
|
|
||||||
type="text"
|
|
||||||
@click="handleAddTrigger"
|
|
||||||
>新增触发器</el-button
|
|
||||||
>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<div>
|
|
||||||
<span
|
<span
|
||||||
class="e-form-item__label"
|
class="e-form-item__label"
|
||||||
style="
|
style="
|
||||||
|
@ -240,50 +200,105 @@
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
"
|
"
|
||||||
>执行动作:</span
|
|
||||||
>
|
>
|
||||||
</div>
|
触发器列表:
|
||||||
<div>
|
</span>
|
||||||
<e-tag-card
|
<div>
|
||||||
style="margin-top: 5px"
|
<e-tag-card
|
||||||
v-for="(item, idx) in form.actions"
|
style="margin-top: 5px"
|
||||||
:key="item.guid || getGuid()"
|
v-for="(item, idx) in form.triggers"
|
||||||
type="info"
|
:key="item.guid || getGuid()"
|
||||||
|
type="info"
|
||||||
|
>
|
||||||
|
<e-scene-triggers
|
||||||
|
slot="body"
|
||||||
|
:dataItem="item"
|
||||||
|
:sourceId="sourceId"
|
||||||
|
@change="
|
||||||
|
(v) => {
|
||||||
|
form.triggers[idx] = v;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@handleDel="
|
||||||
|
(v) => {
|
||||||
|
form.triggers.splice(idx, 1);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
></e-scene-triggers>
|
||||||
|
</e-tag-card>
|
||||||
|
</div>
|
||||||
|
<el-button
|
||||||
|
icon="el-icon-plus"
|
||||||
|
type="text"
|
||||||
|
@click="handleAddTrigger"
|
||||||
|
>新增触发器</el-button
|
||||||
>
|
>
|
||||||
<e-scene-action
|
</el-col>
|
||||||
slot="body"
|
<el-col :span="24">
|
||||||
:dataItem="item"
|
<div>
|
||||||
:sourceId="sourceId"
|
<span
|
||||||
@change="
|
class="e-form-item__label"
|
||||||
(v) => {
|
style="
|
||||||
form.actions[idx] = v;
|
text-align: right;
|
||||||
}
|
vertical-align: middle;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
width: 80px;
|
||||||
|
word-break: break-all;
|
||||||
|
font-weight: 600;
|
||||||
"
|
"
|
||||||
@handleDel="
|
>执行动作:</span
|
||||||
(v) => {
|
>
|
||||||
form.actions.splice(idx, 1);
|
</div>
|
||||||
}
|
<div>
|
||||||
"
|
<e-tag-card
|
||||||
/>
|
style="margin-top: 5px"
|
||||||
</e-tag-card>
|
v-for="(item, idx) in form.actions"
|
||||||
</div>
|
:key="item.guid || getGuid()"
|
||||||
<el-button
|
type="info"
|
||||||
type="text"
|
>
|
||||||
icon="el-icon-plus"
|
<e-scene-action
|
||||||
@click="handleAddAction"
|
slot="body"
|
||||||
>新增动作</el-button
|
:dataItem="item"
|
||||||
>
|
:sourceId="sourceId"
|
||||||
</el-col>
|
@change="
|
||||||
</el-row>
|
(v) => {
|
||||||
</el-form>
|
form.actions[idx] = v;
|
||||||
<div slot="footer" class="dialog-footer">
|
}
|
||||||
<el-button type="primary" size="mini" @click="submitForm"
|
"
|
||||||
>确 定</el-button
|
@handleDel="
|
||||||
>
|
(v) => {
|
||||||
<el-button @click="cancel" size="mini">取 消</el-button>
|
form.actions.splice(idx, 1);
|
||||||
</div>
|
}
|
||||||
</el-dialog>
|
"
|
||||||
|
/>
|
||||||
|
</e-tag-card>
|
||||||
|
</div>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="handleAddAction"
|
||||||
|
>新增动作</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" size="mini" @click="submitForm"
|
||||||
|
>确 定</el-button
|
||||||
|
>
|
||||||
|
<el-button @click="cancel" size="mini">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<e-logging v-if="isLoggingViewShow"
|
||||||
|
:sourceId="loggingSourceId"
|
||||||
|
:sceneInfo="loggingSourceObject"
|
||||||
|
@handleLinkToHome="() => {
|
||||||
|
isLoggingViewShow = false;
|
||||||
|
}"
|
||||||
|
></e-logging>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
@ -293,12 +308,14 @@ import {
|
||||||
projectSceneUpdate,
|
projectSceneUpdate,
|
||||||
projectSceneDetail,
|
projectSceneDetail,
|
||||||
projectSceneDelete,
|
projectSceneDelete,
|
||||||
projectSceneChangeStatus
|
projectSceneChangeStatus,
|
||||||
|
projectSceneSingleRun,
|
||||||
} from "@/api/iot/project_new";
|
} from "@/api/iot/project_new";
|
||||||
import DialogTemplate from "@/components/DialogTemplate";
|
import DialogTemplate from "@/components/DialogTemplate";
|
||||||
import ESceneTriggers from "./ESceneTriggers/index";
|
import ESceneTriggers from "./ESceneTriggers/index";
|
||||||
import ETagCard from "@/components/Cards/ETagCard";
|
import ETagCard from "@/components/Cards/ETagCard";
|
||||||
import ESceneAction from "./ESceneAction/index";
|
import ESceneAction from "./ESceneAction/index";
|
||||||
|
import ELogging from './ELogging'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ESceneManage",
|
name: "ESceneManage",
|
||||||
|
@ -328,15 +345,18 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: { DialogTemplate, ESceneTriggers, ETagCard, ESceneAction },
|
components: { DialogTemplate, ESceneTriggers, ETagCard, ESceneAction, ELogging },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryParams: {},
|
queryParams: {},
|
||||||
|
isLoggingViewShow: false,
|
||||||
|
loggingSourceId: null,
|
||||||
|
loggingSourceObject: {},
|
||||||
page: {
|
page: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
orderByColumn: "createTime",
|
orderByColumn: "createTime",
|
||||||
isAsc: "desc"
|
isAsc: "desc",
|
||||||
},
|
},
|
||||||
title: "新增场景",
|
title: "新增场景",
|
||||||
total: 0,
|
total: 0,
|
||||||
|
@ -457,6 +477,7 @@ export default {
|
||||||
!e.sceneActionDevices[0]["deviceKey"])
|
!e.sceneActionDevices[0]["deviceKey"])
|
||||||
) {
|
) {
|
||||||
this.msgError("执行条件中有条件未选择设备或者分组!");
|
this.msgError("执行条件中有条件未选择设备或者分组!");
|
||||||
|
|
||||||
isTrue = false;
|
isTrue = false;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
@ -516,15 +537,19 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleChangeStatus(row) {
|
handleChangeStatus(row) {
|
||||||
this.$confirm(row.runStatus ? '是否停止场景?' : '是否开启场景?', "提示", {
|
this.$confirm(
|
||||||
confirmButtonText: "确定",
|
row.runStatus == "0" ? "是否停止场景?" : "是否开启场景?",
|
||||||
cancelButtonText: "取消",
|
"提示",
|
||||||
type: "warning",
|
{
|
||||||
})
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}
|
||||||
|
)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
return projectSceneChangeStatus({
|
return projectSceneChangeStatus({
|
||||||
recordId: row.recordId,
|
recordId: row.recordId,
|
||||||
runStatus: row.runStatus == '0' ? '1' : '0'
|
runStatus: row.runStatus == "0" ? "1" : "0",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -532,6 +557,29 @@ export default {
|
||||||
this.msgSuccess("成功");
|
this.msgSuccess("成功");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleLoggingView(row) {
|
||||||
|
this.loggingSourceId = row.recordId;
|
||||||
|
this.loggingSourceObject = row;
|
||||||
|
this.isLoggingViewShow = true;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 场景 执行一次 方法
|
||||||
|
* @param {*} row
|
||||||
|
*/
|
||||||
|
handleSingleRun(row) {
|
||||||
|
this.$confirm("是否确认执行一次此场景?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
return projectSceneSingleRun(row.recordId);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.handleQuery();
|
||||||
|
this.msgSuccess("请求成功!");
|
||||||
|
});
|
||||||
|
},
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const projectIds = row.recordId;
|
const projectIds = row.recordId;
|
||||||
this.$confirm("是否删除该选项?", "警告", {
|
this.$confirm("是否删除该选项?", "警告", {
|
||||||
|
|
Loading…
Reference in New Issue