Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
|
37db6c8e07 | 4 months ago |
|
03b7c1d7e5 | 4 months ago |
|
12079ffb64 | 4 months ago |
|
95f3d9dabe | 4 months ago |
|
f3c98ea020 | 4 months ago |
|
d71e90323f | 4 months ago |
|
76ebaea6be | 4 months ago |
|
27a6b21ab3 | 4 months ago |
|
6d8b06cc33 | 4 months ago |
|
f0f822fc1f | 4 months ago |
|
2f969b9e3a | 4 months ago |
|
bdc8dae729 | 4 months ago |
|
28989fe11f | 4 months ago |
|
413841f7db | 4 months ago |
|
60dee5a31a | 4 months ago |
12 changed files with 259 additions and 174 deletions
@ -1,16 +1,16 @@ |
|||
# 页面标题 |
|||
VUE_APP_TITLE = 智能化衣柜 |
|||
VUE_APP_TITLE = 智能居家数据监护 |
|||
|
|||
# 生产环境配置 |
|||
NODE_ENV = 'production' |
|||
|
|||
|
|||
# 大唐 |
|||
VUE_APP_BASE_API = '/commen_api/' |
|||
VUE_APP_IMG_URL = '/commen_api/' |
|||
VUE_APP_API_QZURL = '/commen_api/' |
|||
VUE_APP_BASE_API = '/multimodal/' |
|||
VUE_APP_IMG_URL = '/multimodal/' |
|||
VUE_APP_API_QZURL = '/multimodal/' |
|||
|
|||
# 访问路径 |
|||
VUE_APP_PUBLIC_PATH = '/commen/' |
|||
VUE_APP_PUBLIC_PATH = '/multimodal_yf/safetySys/' |
|||
|
|||
|
|||
|
@ -1,115 +1,40 @@ |
|||
import request from "@/utils/request"; |
|||
// ------ 教务处学校管理 ------
|
|||
|
|||
// 学校列表
|
|||
export function schoolList(data) { |
|||
// 获取设备信息
|
|||
export function attributes(data) { |
|||
return request({ |
|||
url: "/school/list", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// 新增/修改学校
|
|||
export function schoolAdd(data) { |
|||
return request({ |
|||
url: "/school/add", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// 新增/修改学校
|
|||
export function schoolDel(data) { |
|||
return request({ |
|||
url: "/school/del", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
|
|||
// ------ 教务处评审管理 ------
|
|||
// 评审列表
|
|||
export function commentList(data) { |
|||
return request({ |
|||
url: "/come/list", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// 评审详情
|
|||
export function reviewDetails(data) { |
|||
return request({ |
|||
url: "/come/detail", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// ------ 专家评审 ------
|
|||
// 学校列表
|
|||
|
|||
export function expertschoolist(data) { |
|||
return request({ |
|||
url: "/expert/school/list", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// 评审详情
|
|||
export function expertReviewDetails(data) { |
|||
return request({ |
|||
url: "/expert/comment/list", |
|||
method: "post", |
|||
data: data, |
|||
url: "/app/device/attributes", |
|||
method: "get", |
|||
params: data, |
|||
}); |
|||
} |
|||
// 评审
|
|||
export function expertReviewAdd(data) { |
|||
// 根据项目key查找项目id
|
|||
export function queryProjectInfoByKey(data) { |
|||
return request({ |
|||
url: "/expert/comment/add", |
|||
method: "post", |
|||
data: data, |
|||
url: "/app/device/queryProjectInfoByKey", |
|||
method: "get", |
|||
params: data, |
|||
}); |
|||
} |
|||
// ------ 分片相关接口 ------
|
|||
|
|||
// 校验文件是否已上传
|
|||
export function register(data) { |
|||
// 根据项目id查找设备列表
|
|||
export function deviceList(data) { |
|||
return request({ |
|||
url: "/mediaUpload/register", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// 校验分片是否已上传
|
|||
export function checkchunk(data) { |
|||
return request({ |
|||
url: "/mediaUpload/checkchunk", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// 循环上传分片
|
|||
export function uploadchunk(data) { |
|||
return request({ |
|||
url: "/mediaUpload/uploadchunk", |
|||
method: "post", |
|||
data: data, |
|||
headers: { |
|||
"Content-Type": "multipart/form-data", |
|||
}, |
|||
url: "/app/device/list", |
|||
method: "get", |
|||
params: data, |
|||
}); |
|||
} |
|||
// 合并分片
|
|||
export function mergechunks(data) { |
|||
// 下发属性
|
|||
export function sendAttribute(data) { |
|||
return request({ |
|||
url: "/mediaUpload/mergechunks", |
|||
url: "/app/device/sendAttribute", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
} |
|||
// 合并后上传文件
|
|||
export function addFile(data) { |
|||
// 下发命令
|
|||
export function sendCommand(data) { |
|||
return request({ |
|||
url: "/netdisk/file/add", |
|||
url: "/app/device/sendCommand", |
|||
method: "post", |
|||
data: data, |
|||
}); |
|||
|
@ -1,86 +1,243 @@ |
|||
<template> |
|||
<div style="padding: 16px"> |
|||
<!-- <img src="./welcome.5e305008.png" style="" /> --> |
|||
<div style="padding: 16px;min-height: calc(100vh - 84px);display: flex; justify-content: center;align-items: center;"> |
|||
<div class="div-box"> |
|||
<div class="div-box-title"> 智能居家数据监护 </div> |
|||
<div class="div-ul"> |
|||
<div class="div-li"> |
|||
<div> |
|||
<span>温度:</span>{{ deviceInfo.temperature || '-' }}℃ |
|||
</div> |
|||
<div> <span>湿度:</span>{{ deviceInfo.humidity || '-' }}% |
|||
</div> |
|||
</div> |
|||
<!-- ON:开启 OFF:关闭 --> |
|||
<div class="div-li"> |
|||
<div> |
|||
<span>CO:</span>{{ deviceInfo.co || '-' }}PPM |
|||
</div> |
|||
<div> |
|||
<span>预警:</span> |
|||
<el-switch disabled active-value="1" inactive-value="0" v-model="deviceInfo.warning" active-color="#13ce66" |
|||
inactive-color="#ff4949"> |
|||
</el-switch> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="div-tips"><span>阈值设定:</span>{{ getThreshold() }} <i class="el-icon-edit" |
|||
style="color: rgb(64, 158, 255);margin-left: 4px;cursor: pointer;" @click="handleSettings"></i></div> |
|||
</div> |
|||
<!-- 添加或修改公告对话框 --> |
|||
<el-dialog title="阈值设定" :visible.sync="open" width="780px" append-to-body> |
|||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
|||
<el-form-item label="温度" prop="temperature"> |
|||
<el-input v-model="form.temperature" placeholder="请输入温度" /> |
|||
</el-form-item> |
|||
<el-form-item label="湿度" prop="humidity"> |
|||
<el-input v-model="form.humidity" placeholder="请输入湿度" /> |
|||
</el-form-item> |
|||
<el-form-item label="CO" prop="co"> |
|||
<el-input v-model="form.co" placeholder="请输入CO" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="submitForm">确 定</el-button> |
|||
<el-button @click="open = false">取 消</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { queryProjectInfoByKey, deviceList, attributes, sendAttribute, sendCommand } from "@/api/school"; |
|||
export default { |
|||
name: "Index", |
|||
data() { |
|||
return { |
|||
deviceId: "", // 设备id |
|||
deviceInfo: { |
|||
temperature: 0, // 温度 |
|||
threshold: 0, // 阈值 |
|||
}, |
|||
open: false, |
|||
value2: false, |
|||
loading: false, |
|||
// 表单参数 |
|||
form: {}, |
|||
// 表单校验 |
|||
rules: { |
|||
temperature: [ |
|||
{ required: true, message: "温度不能为空", trigger: "blur" } |
|||
], |
|||
humidity: [ |
|||
{ required: true, message: "湿度不能为空", trigger: "blur" } |
|||
], |
|||
co: [ |
|||
{ required: true, message: "CO不能为空", trigger: "blur" } |
|||
], |
|||
}, |
|||
// 版本号 |
|||
version: "3.8.9", |
|||
}; |
|||
}, |
|||
created() { |
|||
this.getqueryProjectInfoByKey() // 根据项目key查找项目id |
|||
}, |
|||
methods: { |
|||
goTarget(href) { |
|||
window.open(href, "_blank"); |
|||
// 阈值设定弹窗 |
|||
handleSettings() { |
|||
this.open = true; |
|||
this.form = { |
|||
temperature: this.deviceInfo.temperature1, // 温度 |
|||
humidity: this.deviceInfo.humidity1, // 湿度 |
|||
co: this.deviceInfo.co1, // CO |
|||
}; |
|||
// this.$message.success(''); |
|||
}, |
|||
|
|||
// 根据项目key查找项目id |
|||
getqueryProjectInfoByKey() { |
|||
this.loading = true; |
|||
queryProjectInfoByKey({ |
|||
projectKey: "qKStHKKt" |
|||
}).then(res => { |
|||
this.getDeviceList(res.data.id) // 根据项目id查找设备列表 |
|||
}); |
|||
}, |
|||
// 根据项目id查找设备列表 |
|||
getDeviceList(_id) { |
|||
deviceList({ |
|||
projectId: _id |
|||
}).then(res => { |
|||
const w2Device = res.rows.find(device => device.deviceName === "S1"); |
|||
this.deviceId = w2Device.id; |
|||
this.getAttributes(this.deviceId); // 根据设备id查找设备信息 |
|||
}) |
|||
}, |
|||
|
|||
// 根据设备id查找设备信息 |
|||
getAttributes(_id) { |
|||
attributes({ |
|||
deviceId: _id, |
|||
}).then(res => { |
|||
this.loading = false; |
|||
// 获取温度和阈值信息,并赋值给deviceInfo |
|||
let deviceAttributesList = res.data.deviceAttributesList |
|||
// 温度、温度阈值 |
|||
let temperature = deviceAttributesList.find(row => row.id === 447247444691968)?.attributeValue; |
|||
let temperature1 = deviceAttributesList.find(row => row.id === 447247458859777)?.attributeValue; |
|||
// 湿度、湿度阈值 |
|||
let humidity = deviceAttributesList.find(row => row.id === 447247449387520)?.attributeValue; |
|||
let humidity1 = deviceAttributesList.find(row => row.id === 447247458859778)?.attributeValue; |
|||
// CO、CO阈值 |
|||
let co = deviceAttributesList.find(row => row.id === 447247453780224)?.attributeValue; |
|||
let co1 = deviceAttributesList.find(row => row.id === 447247458859779)?.attributeValue; |
|||
|
|||
// 预警 |
|||
let warning = deviceAttributesList.find(row => row.id === 447247458859776)?.attributeValue; |
|||
|
|||
this.deviceInfo = { |
|||
temperature: temperature, // 温度 |
|||
temperature1: temperature1, // 温度 |
|||
humidity: humidity, // 湿度 |
|||
humidity1: humidity1, // 湿度 |
|||
co: co, // CO |
|||
co1: co1, // CO |
|||
warning: warning || 0, // 预警 |
|||
} |
|||
|
|||
}); |
|||
}, |
|||
getThreshold() { |
|||
return `温度:${this.deviceInfo.temperature1 || '-'}℃ 湿度:${this.deviceInfo.humidity1 || '-'}% CO:${this.deviceInfo.co1 || '-'}PPM`; |
|||
}, |
|||
/** 下发属性 */ |
|||
submitForm: function () { |
|||
this.$refs["form"].validate(valid => { |
|||
if (valid) { |
|||
let attributeParams = { |
|||
temperature: this.form.temperature, // 温度 |
|||
humidity: this.form.humidity, // 湿度 |
|||
co: this.form.co, // CO |
|||
} |
|||
sendAttribute({ |
|||
"attributeAndValues": [ |
|||
{ |
|||
"attributeIdentifier": "tempThreshold", |
|||
"attributeValue": this.form.temperature |
|||
}, |
|||
{ |
|||
"attributeIdentifier": "humiThreshold", |
|||
"attributeValue": this.form.humidity |
|||
}, |
|||
{ |
|||
"attributeIdentifier": "coThreshold", |
|||
"attributeValue": this.form.co |
|||
} |
|||
], // 阈值JSON字符串 |
|||
"deviceId": this.deviceId // 设备id |
|||
}).then(response => { |
|||
this.getAttributes(this.deviceId); // 根据设备id查找设备信息 |
|||
this.$modal.msgSuccess("操作成功"); |
|||
this.open = false; |
|||
|
|||
}); |
|||
} |
|||
}); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped lang="scss"> |
|||
.home { |
|||
blockquote { |
|||
padding: 10px 20px; |
|||
margin: 0 0 20px; |
|||
font-size: 17.5px; |
|||
border-left: 5px solid #eee; |
|||
} |
|||
hr { |
|||
margin-top: 20px; |
|||
margin-bottom: 20px; |
|||
border: 0; |
|||
border-top: 1px solid #eee; |
|||
} |
|||
.col-item { |
|||
margin-bottom: 20px; |
|||
} |
|||
.div-box { |
|||
transform: scale(1.4); |
|||
width: 500px; |
|||
box-sizing: border-box; |
|||
padding: 16px; |
|||
border: 1px solid #ccc; |
|||
border-radius: 10px; |
|||
|
|||
ul { |
|||
padding: 0; |
|||
margin: 0; |
|||
} |
|||
|
|||
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif; |
|||
font-size: 13px; |
|||
color: #676a6c; |
|||
overflow-x: hidden; |
|||
|
|||
ul { |
|||
list-style-type: none; |
|||
.div-box-title { |
|||
font-size: 20px; |
|||
font-weight: bold; |
|||
margin-bottom: 20px; |
|||
text-align: center; |
|||
border-bottom: 1px solid #ccc; |
|||
padding-bottom: 16px; |
|||
} |
|||
} |
|||
|
|||
h4 { |
|||
margin-top: 0px; |
|||
.div-ul { |
|||
.div-li>div:nth-of-type(1) { |
|||
border-right: 1px solid #ccc; |
|||
margin-right: 16px; |
|||
} |
|||
|
|||
h2 { |
|||
margin-top: 10px; |
|||
font-size: 26px; |
|||
font-weight: 100; |
|||
} |
|||
.div-li { |
|||
font-size: 18px; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
margin-bottom: 12px; |
|||
|
|||
p { |
|||
margin-top: 10px; |
|||
div { |
|||
flex: 1; |
|||
align-items: center; |
|||
} |
|||
|
|||
b { |
|||
font-weight: 700; |
|||
span { |
|||
color: #666; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.update-log { |
|||
ol { |
|||
display: block; |
|||
list-style-type: decimal; |
|||
margin-block-start: 1em; |
|||
margin-block-end: 1em; |
|||
margin-inline-start: 0; |
|||
margin-inline-end: 0; |
|||
padding-inline-start: 40px; |
|||
} |
|||
.div-tips { |
|||
font-size: 18px; |
|||
line-height: 22px; |
|||
display: flex; |
|||
align-items: center; |
|||
|
|||
span { |
|||
color: #666; |
|||
} |
|||
} |
|||
</style> |
|||
|
Loading…
Reference in new issue