Browse Source

游泳馆检测添加加载动画

yygjk
lzp 10 months ago
parent
commit
e5f37487c5
  1. 28
      src/views/index.vue

28
src/views/index.vue

@ -1,25 +1,26 @@
<template> <template>
<div style="padding: 16px;min-height: calc(100vh - 84px);display: flex; justify-content: center;align-items: center;"> <div v-loading="loading"
style="padding: 16px;min-height: calc(100vh - 84px);display: flex; justify-content: center;align-items: center;">
<div class="div-box"> <div class="div-box">
<div class="div-box-title"> 游泳馆远程监测 </div> <div class="div-box-title"> 游泳馆远程监测 </div>
<div class="div-ul"> <div class="div-ul">
<div class="div-li"> <div class="div-li">
<div> <div>
<span>温度</span> <span>温度</span>
{{ deviceInfo.temperature || '-'}} {{ deviceInfo.temperature || '-' }}
</div> </div>
<div> <span>湿度</span> <div> <span>湿度</span>
{{ deviceInfo.humidity || '-'}}%</div> {{ deviceInfo.humidity || '-' }}%</div>
</div> </div>
<!-- ON开启 OFF关闭 --> <!-- ON开启 OFF关闭 -->
<div class="div-li"> <div class="div-li">
<div> <div>
<span>TVOC</span> <span>TVOC</span>
{{ deviceInfo.tvoc || '-'}} {{ deviceInfo.tvoc || '-' }}
</div> </div>
<div> <div>
<span>TDS</span> <span>TDS</span>
{{ deviceInfo.tds || '-'}} {{ deviceInfo.tds || '-' }}
</div> </div>
</div> </div>
</div> </div>
@ -93,9 +94,9 @@ export default {
deviceId: _id, deviceId: _id,
}).then(({ data: { deviceAttributesList: records } }) => { }).then(({ data: { deviceAttributesList: records } }) => {
this.loading = false; this.loading = false;
const findAttr = (id, defaultValue = '0') => const findAttr = (id, defaultValue = '0') =>
records.find(row => row.id === id)?.attributeValue ; records.find(row => row.id === id)?.attributeValue;
this.deviceInfo = { this.deviceInfo = {
temperature: findAttr(447173913707267), // temperature: findAttr(447173913707267), //
humidity: findAttr(447173913707268), // 湿 humidity: findAttr(447173913707268), // 湿
@ -108,7 +109,7 @@ export default {
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
let param = {"Wen":`#${this.form.threshold}`} // let param = { "Wen": `#${this.form.threshold}` } //
sendAttribute({ sendAttribute({
"attributeParams": JSON.stringify(param), // JSON "attributeParams": JSON.stringify(param), // JSON
"deviceId": this.deviceId // id "deviceId": this.deviceId // id
@ -116,7 +117,7 @@ export default {
this.getAttributes(this.deviceId); // id this.getAttributes(this.deviceId); // id
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
this.open = false; this.open = false;
}); });
} }
}); });
@ -155,15 +156,18 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 12px; margin-bottom: 12px;
div { div {
flex: 1 flex: 1
} }
span { span {
color: #666; color: #666;
} }
} }
.div-li:last-child { .div-li:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
} }
</style> </style>

Loading…
Cancel
Save