|
|
@ -12,18 +12,22 @@ |
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="noticeList" max-height="600"> |
|
|
|
<el-table-column label="序号" align="center" prop="noticeId" width="100" /> |
|
|
|
<el-table v-loading="loading" :data="tableList" max-height="600"> |
|
|
|
<el-table-column label="序号" align="center" prop="noticeId" width="100" > |
|
|
|
<template slot-scope="scope"> |
|
|
|
{{scope.$index+1}} |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
label="时间" |
|
|
|
align="center" |
|
|
|
prop="noticeTitle" |
|
|
|
prop="reportTime" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
min-width="100" |
|
|
|
/> |
|
|
|
<el-table-column label="类型" align="center" prop="noticeType" min-width="100"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/> |
|
|
|
|
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
@ -40,55 +44,54 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { queryProjectInfoByKey, deviceList, attributes, sendAttribute, sendCommand } from "@/api/school"; |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "Notice", |
|
|
|
dicts: ['sys_notice_status', 'sys_notice_type'], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
deviceId: "", // 设备id |
|
|
|
deviceInfo: { |
|
|
|
temperature: 0, // 温度 |
|
|
|
threshold: 0, // 阈值 |
|
|
|
}, |
|
|
|
// 遮罩层 |
|
|
|
loading: true, |
|
|
|
// 选中数组 |
|
|
|
ids: [], |
|
|
|
// 非单个禁用 |
|
|
|
single: true, |
|
|
|
// 非多个禁用 |
|
|
|
multiple: true, |
|
|
|
// 显示搜索条件 |
|
|
|
showSearch: true, |
|
|
|
// 总条数 |
|
|
|
total: 0, |
|
|
|
// 公告表格数据 |
|
|
|
tableList: [], |
|
|
|
// 弹出层标题 |
|
|
|
title: "", |
|
|
|
// 是否显示弹出层 |
|
|
|
open: false, |
|
|
|
value2: false, |
|
|
|
loading: false, |
|
|
|
// 查询参数 |
|
|
|
queryParams: { |
|
|
|
pageNum: 1, |
|
|
|
pageSize: 10, |
|
|
|
noticeTitle: undefined, |
|
|
|
createBy: undefined, |
|
|
|
status: undefined |
|
|
|
}, |
|
|
|
// 表单参数 |
|
|
|
form: {}, |
|
|
|
// 表单校验 |
|
|
|
rules: { |
|
|
|
threshold: [ |
|
|
|
{ required: true, message: "阈值不能为空", trigger: "blur" } |
|
|
|
noticeTitle: [ |
|
|
|
{ required: true, message: "公告标题不能为空", trigger: "blur" } |
|
|
|
], |
|
|
|
}, |
|
|
|
// 版本号 |
|
|
|
version: "3.8.9", |
|
|
|
noticeType: [ |
|
|
|
{ required: true, message: "公告类型不能为空", trigger: "change" } |
|
|
|
] |
|
|
|
} |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.getqueryProjectInfoByKey() // 根据项目key查找项目id |
|
|
|
this.getqueryProjectInfoByKey(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 除湿开关 |
|
|
|
handleDehumidification() { |
|
|
|
sendCommand({ |
|
|
|
"commandId": "447173913707264", // 除湿, |
|
|
|
"commandParams": this.deviceInfo.dehumidification, // 0 关闭 1 开启, |
|
|
|
"deviceId": this.deviceId |
|
|
|
}).then(res => { |
|
|
|
this.getDeviceList(res.data.id) // 根据项目id查找设备列表 |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 杀菌灯开关 |
|
|
|
handleLight(){ |
|
|
|
sendCommand({ |
|
|
|
"commandId": "447173913707264", // 除湿, |
|
|
|
"commandParams": this.deviceInfo.dehumidification, // 0 关闭 1 开启, |
|
|
|
"deviceId": this.deviceId |
|
|
|
}).then(res => { |
|
|
|
this.getDeviceList(res.data.id) // 根据项目id查找设备列表 |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 阈值设定弹窗 |
|
|
|
handleSettings() { |
|
|
|
this.open = true; |
|
|
@ -112,35 +115,26 @@ export default { |
|
|
|
deviceList({ |
|
|
|
projectId: _id |
|
|
|
}).then(res => { |
|
|
|
const w2Device = res.rows.find(device => device.deviceName === "W1"); |
|
|
|
const w2Device = res.rows.find(device => device.deviceName === "D1"); |
|
|
|
this.deviceId = w2Device.id; |
|
|
|
this.getAttributes(this.deviceId); // 根据设备id查找设备信息 |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 根据设备id查找设备信息 |
|
|
|
getAttributes(_id) { |
|
|
|
attributes({ |
|
|
|
deviceId: _id, |
|
|
|
}).then(({ data: { deviceAttributeRecordList: records } }) => { |
|
|
|
}).then(res => { |
|
|
|
this.loading = false; |
|
|
|
// 过滤出指定id的数据 |
|
|
|
const findAttr = (id, defaultValue = '-') => |
|
|
|
records.find(row => row.id === id)?.attributeValue || defaultValue; |
|
|
|
// 赋值 |
|
|
|
this.deviceInfo = { |
|
|
|
temperature: findAttr(447173909669888), // 温度 |
|
|
|
humidity: findAttr(447173911846400), // 湿度 |
|
|
|
serialNumber: findAttr(447173913707263), // 序列号 |
|
|
|
light: findAttr(447173913707265, '0'), // 杀菌灯(默认关闭) |
|
|
|
dehumidification: findAttr(447173913707264, '0'), // 除湿(默认关闭) |
|
|
|
}; |
|
|
|
this.tableList = res.data.deviceAttributeRecordList; |
|
|
|
}); |
|
|
|
}, |
|
|
|
/** 下发属性 */ |
|
|
|
submitForm: function () { |
|
|
|
this.$refs["form"].validate(valid => { |
|
|
|
if (valid) { |
|
|
|
let param = { "Wen": `#${this.form.threshold}` } // 阈值 |
|
|
|
let param = {"Wen":`#${this.form.threshold}`} // 阈值 |
|
|
|
sendAttribute({ |
|
|
|
"attributeParams": JSON.stringify(param), // 阈值JSON字符串 |
|
|
|
"deviceId": this.deviceId // 设备id |
|
|
@ -148,13 +142,11 @@ export default { |
|
|
|
this.getAttributes(this.deviceId); // 根据设备id查找设备信息 |
|
|
|
this.$modal.msgSuccess("操作成功"); |
|
|
|
this.open = false; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
/** 查询公告列表 */ |
|
|
|
getList() { |
|
|
|
this.loading = true; |
|
|
@ -171,51 +163,3 @@ export default { |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
.div-box { |
|
|
|
transform: scale(1.4); |
|
|
|
width: 500px; |
|
|
|
box-sizing: border-box; |
|
|
|
padding: 16px; |
|
|
|
border: 1px solid #ccc; |
|
|
|
border-radius: 10px; |
|
|
|
|
|
|
|
.div-box-title { |
|
|
|
font-size: 20px; |
|
|
|
font-weight: bold; |
|
|
|
margin-bottom: 20px; |
|
|
|
text-align: center; |
|
|
|
border-bottom: 1px solid #ccc; |
|
|
|
padding-bottom: 16px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.div-ul { |
|
|
|
.div-li>div:nth-of-type(1) { |
|
|
|
border-right: 1px solid #ccc; |
|
|
|
margin-right: 16px; |
|
|
|
} |
|
|
|
|
|
|
|
.div-li { |
|
|
|
font-size: 18px; |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
margin-bottom: 12px; |
|
|
|
|
|
|
|
div { |
|
|
|
flex: 1 |
|
|
|
} |
|
|
|
|
|
|
|
span { |
|
|
|
color: #666; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.div-tips { |
|
|
|
span { |
|
|
|
color: #666; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|