123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657 |
- <template>
- <view style="overflow: auto; height: 100%">
- <!-- 建议放在外层 -->
- <u-navbar :title="name" @leftClick="backPage" :bgImage="backPic">
- <view class="u-nav-slot" slot="left">
- <u-icon name="arrow-left" size="20"> </u-icon>
- </view>
- </u-navbar>
- <view class="main">
- <view class="u-page container">
- <div class="button-grid flcard" v-if="this.TabCur == 'gate'">
- <u-button
- type="primary"
- shape="circle"
- text="打开前门"
- @click="showPasswordDialog('frontGateOpen_S')"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="关闭前门"
- @click="showPasswordDialog('frontGateClose_S')"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="打开后门"
- @click="showPasswordDialog('rearGateOpen_S')"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="关闭后门"
- @click="showPasswordDialog('rearGateClose_S')"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="打开前后门"
- @click="showPasswordDialog('sameTimeOpen')"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="关闭前后门"
- @click="showPasswordDialog('sameTimeClose')"
- ></u-button>
- </div>
- <div
- class="button-grid flcard"
- v-if="this.TabCur == 'window' && this.nwindownum == 1"
- >
- <u-button
- type="primary"
- shape="circle"
- text="设定面积"
- @click="showPasswordDialog('frontSetValue')"
- ></u-button>
- </div>
- <div
- class="button-grid flcard"
- v-if="this.TabCur == 'window' && this.nwindownum == 2"
- >
- <u-button
- type="primary"
- shape="circle"
- text="设定前窗面积"
- @click="showPasswordDialog('frontSetValue')"
- ></u-button>
- <u-button
- type="primary"
- shape="circle"
- text="设定后窗面积"
- @click="showPasswordDialog('rearSetValue')"
- ></u-button>
- </div>
- <div class="flcard" v-if="this.TabCur == 'gate'">
- <doorAnimate
- :gatestate1="frontGateStatus"
- :gatestate2="rearGateStatus"
- :videoURL="viedeoUrl"
- :height="height"
- :doorcount="ndoorcount"
- ></doorAnimate>
- </div>
- <div class="flcard" v-if="this.TabCur == 'windrect'">
- <windrectAnimate
- :state="state"
- :title="title"
- :videoURL="viedeoUrl"
- :height="height"
- :type="deviceType"
- ></windrectAnimate>
- </div>
- <div class="flcard" v-if="this.TabCur == 'fanlocal'">
- <fanlocalAnimate
- :fan1State="fan1State"
- :fan2State="fan2State"
- :title="title"
- :videoURL="viedeoUrl"
- :height="height"
- ></fanlocalAnimate>
- </div>
- <div
- class="flcard"
- v-if="this.TabCur == 'window' && this.nwindownum == 1"
- >
- <windowAnimate
- :windowAngle="windowAngle"
- :height="height"
- :windowcount="nwindownum"
- ></windowAnimate>
- </div>
- <div
- class="flcard"
- v-if="this.TabCur == 'window' && this.nwindownum == 2"
- >
- <windowAnimate
- :windowAngle="windowAngle"
- :windowAngle1="windowAngle1"
- :height="height"
- :windowcount="nwindownum"
- ></windowAnimate>
- </div>
- <div class="flcard">
- <div class="flex-container">
- <div
- class="itemback"
- v-for="(item, index) in typeList"
- :key="index"
- v-show="item.appShow == 1"
- >
- <div class="datacardtime" v-if="item.monitorcode == 'readTime'">
- <view
- class="demo-layout bg-purple-light"
- style="margin-top: 10rpx; color: #3787fe"
- >
- {{ tableData[item.monitorcode] }}
- </view>
- </div>
- <div class="datacard" v-if="item.monitorcode !== 'readTime'">
- <div class="left-content">
- <view v-if="item.monitorcode == 'ndoortype'"
- class="demo-layout bg-purple-light"
- style="margin-top: 10rpx; color: #3787fe"
- >
- {{ tableData[item.monitorcode] == '1'?'行人':tableData[item.monitorcode] == '2'?'行车':'-' }}
- </view>
- <view v-else
- class="demo-layout bg-purple-light"
- style="margin-top: 10rpx; color: #3787fe"
- >
- {{ tableData[item.monitorcode] == null || tableData[item.monitorcode] == ''?'-':tableData[item.monitorcode]}}
- </view>
- <div class="spacer"></div>
- <!-- 间距 -->
- <view
- class="demo-layout bg-purple-light"
- style="color: #677799"
- >
- {{ item.des }}
- </view>
- </div>
- <div
- class="right-content"
- :style="{
- backgroundImage:
- item.monitorcode === 'frontRearDP' ||
- item.monitorcode === 'frontRearDifference'
- ? 'url(\'../../../../static/model/Pa.png\')'
- : item.monitorcode === 'sourcePressure'
- ? 'url(\'../../../../static/model/MPa.png\')'
- : item.monitorcode === 'frontGateOpen'
- ? 'url(\'../../../../static/model/doorNet.png\')'
- : item.monitorcode === 'rearGateOpen'
- ? 'url(\'../../../../static/model/doorNet.png\')'
- : item.monitorcode === 'midGateOpen'
- ? 'url(\'../../../../static/model/doorNet.png\')'
- : item.monitorcode === 'warnFlag'
- ? 'url(\'../../../../static/model/9432.png\')'
- : item.monitorcode === 'netStatus'
- ? 'url(\'../../../../static/model/9431.png\')'
- : item.monitorcode === 'm3'
- ? 'url(\'../../../../static/model/windM3.png\')'
- : item.monitorcode === 'fsectarea'
- ? 'url(\'../../../../static/model/duanArea.png\')'
- : item.monitorcode === 'incipientWindSpeed1' ||
- item.monitorcode === 'incipientWindSpeed2' ||
- item.monitorcode === 'incipientWindSpeed3' ||
- item.monitorcode === 'va'
- ? 'url(\'../../../../static/model/fengsu.png\')'
- : 'url(\'\')',
- backgroundSize: '100% 100%',
- }"
- ></div>
- </div>
- </div>
- </div>
- </div>
- </view>
- </view>
- <view class="passwordPopup">
- <u-popup
- :show="show"
- mode="bottom"
- :round="14"
- :safeAreaInsetBottom="false"
- >
- <view style="margin-top: 15px" v-if="this.TabCur == 'window'"
- >风窗面积:</view
- >
- <u-input
- style="margin-top: 15px"
- v-model="windowArea"
- v-if="this.TabCur == 'window'"
- ></u-input>
- <view style="margin-top: 15px">请输入密码:</view>
- <u-input
- style="margin-top: 15px"
- v-model="password"
- type="password"
- ></u-input>
- <view class="btns">
- <u-button type="primary" shape="circle" @click="confirmPassword()"
- >确认</u-button
- >
- <u-button shape="circle" @click="cancelPassword()">取消</u-button>
- </view>
- </u-popup>
- </view>
- </view>
- </template>
- <script>
- import api from "@/api/api";
- import initDictOptions from "@/common/util/dictUtil.js";
- import doorAnimate from "../doorAnimate/doorAnimate.vue";
- import windowAnimate from "../windowAnimate/windowAnimate.vue";
- import windrectAnimate from "../windrectAnimate/windrectAnimate.vue";
- import fanlocalAnimate from "../fanlocalAnimate/fanlocalAnimate2.vue";
- export default {
- data() {
- return {
- tableData: [], //监测数据
- typeList: [], //展示字段
- itemId: "", // 初始化 itemId
- name: "", // 初始化 name
- deviceid: "", //初始化设备id
- TabCur: "",
- checked: [],
- backPic: "url(../../../../static/topnavbar.png)",
- frontAngle: "", //风窗打开角度
- nwindownum: "", //风窗道数
- ndoorcount: "", //风门道数
- deviceType: "", //设备类型
- show: false, //密码弹窗是否显示
- password: "", //控制设备密码
- paramcode: "", //控制字段
- height: "200px",
- popupStyle: {
- // 弹窗样式
- "background-color": "#fff",
- padding: "20px",
- "box-shadow": "0 2px 4px rgba(0, 0, 0, 0.1)",
- },
- frontGateStatus: "", //前门状态
- rearGateStatus: "", //后门状态
- windowAngle: 0, //前窗打开角度
- windowAngle1: 0, //后窗打开角度
- windowArea: "", //风窗面积设定值
- viedeoUrl: "", //监控url
- sign:"",
- title:"测风设备",
- fan1State:'',
- fan2State:''
- };
- },
- onLoad(query) {
- //保存id到 data 中 可以在整个页面中使用
- this.itemId = query.id;
- this.name = query.name;
- this.TabCur = query.type;
- this.ndoorcount = 2;
- },
- components: { doorAnimate, windowAnimate,windrectAnimate,fanlocalAnimate },
- created() {
- this.getShowList(this.TabCur);
- this.getDeviceInfo(this.itemId);
- this.getVideoUrlById(this.itemId);
- },
- mounted() {
- this.startTimer();
- },
- methods: {
- startTimer() {
- this.timer = setInterval(() => {
- // 执行定时任务
- this.getDeviceInfo(this.itemId);
- }, 5000);
- },
- stopTimer() {
- // 停止定时器
- clearInterval(this.timer);
- },
- // 返回上一个页面
- backPage() {
- this.$destroy();
- uni.navigateBack({
- delta: 1,
- });
- },
- //获取app展示字段数据
- getShowList(type) {
- const params = {
- devicekind: type,
- pagetype: "detail",
- pageNo: 1,
- pageSize: 100,
- };
- new Promise((resolve, reject) => {
- api
- .getShowColumList(params)
- .then((response) => {
- if (response.data.code == 200) {
- this.typeList = response.data.result.records;
- console.log(this.typeList,'ssssssssssssssssc sa a ')
- } else {
- resolve(response);
- }
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- //获取详情数据
- getDeviceInfo(ID) {
- let IDString = String(ID); // 将 ID 转换为字符串
- new Promise((resolve, reject) => {
- api
- .getDeviceMonitor({ devicetype: this.TabCur, ids: IDString })
- .then((response) => {
- if (response.data.code == 200 && response.data.result.msgTxt[0].datalist.length>0) {
- var result = response.data.result.msgTxt[0].datalist[0];
- this.tableData =
- result.readData;
- if (this.tableData.frontGateOpen == "1") {
- this.tableData.frontGateOpen = "打开";
- } else {
- this.tableData.frontGateOpen = "关闭";
- }
- if (this.tableData.midGateOpen == "1") {
- this.tableData.midGateOpen = "打开";
- } else {
- this.tableData.midGateOpen = "关闭";
- }
- if (this.tableData.rearGateOpen == "1") {
- this.tableData.rearGateOpen = "打开";
- } else {
- this.tableData.rearGateOpen = "关闭";
- }
- this.fan1State = result.readData.Fan1StartStatus
- this.fan2State = result.readData.Fan2StartStatus
- this.nwindownum =
- result.nwindownum;
- this.ndoorcount =
- result.ndoorcount;
- this.deviceType =
- result.deviceType;
- this.state =
- result.readData.sign;
- this.frontGateStatus = this.tableData.frontGateOpen;
- this.rearGateStatus = this.tableData.rearGateOpen;
- var maxarea = result.maxarea;
- this.windowAngle =
- (this.tableData.forntArea / maxarea) * 100 * 0.9;
- this.windowAngle1 =
- (this.tableData.rearArea / maxarea) * 100 * 0.9;
- this.$forceUpdate()
- } else {
- resolve(response);
- }
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- //获取监控URL 通过ID获取
- getVideoUrlById(ID) {
- let IDString = String(ID); // 将 ID 转换为字符串
- new Promise((resolve, reject) => {
- api
- .getCameraById({ deviceid: IDString })
- .then((response) => {
- if (response.data.code == 200) {
- if(response.data.result.records.length>0){
- this.viedeoUrl = response.data.result.records[0].addr;
- }
- } else {
- resolve(response);
- }
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- //设备控制
- ctrlDevice(pass) {
- let IDString = String(this.itemId); // 将 ID 转换为字符串
- const params = {
- deviceid: IDString,
- devicetype: this.deviceType,
- paramcode: this.paramcode,
- password: pass,
- value: this.windowArea,
- };
- new Promise((resolve, reject) => {
- api
- .controlDevice(params)
- .then((response) => {
- if (response.data.code == 200) {
- this.getDeviceInfo(IDString);
- // console.log("操作成功");
- } else {
- resolve(response);
- }
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- // 显示密码输入弹窗
- showPasswordDialog(controlCode) {
- this.paramcode = controlCode;
- this.show = true;
- },
- // 取消密码输入
- cancelPassword() {
- this.show = false;
- },
- confirmPassword() {
- this.ctrlDevice(this.password);
- // 发起请求后关闭密码输入弹窗
- this.show = false;
- }
- },
- destroyed() {
- // 停止定时器
- this.stopTimer();
- },
- };
- </script>
- <style>
- passwordPopup {
- height: 300rpx;
- background-color: #fff;
- }
- .top-nav {
- background-image: url(../../../../static/topnavbar.png);
- background-size: cover; /* 背景图片大小适应 */
- height: 100%;
- }
- .top-nav2 {
- background-color: #ffffff;
- }
- .main {
- margin-top: 100rpx;
- }
- .container {
- display: flex;
- flex-direction: column;
- }
- .button-grid {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- gap: 5px; /* 可以根据需要调整行列之间的间距 */
- }
- .flcard {
- padding: 20rpx;
- background-color: #ffffff;
- margin-bottom: 5rpx;
- }
- .additional-div {
- grid-column: span 2; /* 让附加内容跨越三列 */
- display: flex;
- align-items: center;
- }
- .checkbox-group {
- margin-left: 10px; /* 可以根据需要调整间距 */
- }
- .card {
- background-color: #ffffff;
- margin: auto;
- margin-top: 20rpx;
- width: 90%;
- height: 280rpx;
- border: 1rpx solid #000000;
- border-radius: 20rpx;
- }
- .flex-containe {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- }
- .itemback {
- flex: 0 0 calc(33.33% - 10px); /* 使用calc函数计算每个项目的宽度,减去间距 */
- margin: 5px; /* 间距设置为5px */
- }
- .datacardtime {
- display: flex;
- width: 100%;
- flex: 1;
- margin: 1%;
- float: left;
- height: 50rpx;
- text-align: center;
- background: linear-gradient(
- to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08)
- );
- }
- .datacard {
- display: flex;
- width: 48%;
- flex: 1;
- margin: 1%;
- float: left;
- height: 100rpx;
- text-align: center;
- background: linear-gradient(
- to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08)
- );
- }
- .left-content {
- width: 50%;
- display: flex;
- flex-direction: column;
- }
- .spacer {
- height: 10rpx;
- }
- .right-content {
- width: 50%; /* 右侧内容占据50%宽度 */
- background-image: url(../../../../static/model/Pa.png);
- background-size: 100% 125%;
- }
- /*风窗样式*/
- div.autowindow_new {
- width: 200px;
- height: 200px;
- background-image: url(../../../../static/window/window-bk.png);
- background-size: 100% 100%;
- perspective: 800px;
- }
- /*风窗1 2 3 4*/
- div.window_new_1 {
- margin-top: 12px;
- margin-left: 15px;
- width: 170px;
- height: 30px;
- background-color: crimson;
- box-sizing: border-box;
- float: left;
- z-index: 1;
- /* transition: all 2s; */
- background-image: url(../../../../static/window/window_new1.png);
- background-size: 100% 100%;
- }
- div.window_new_2 {
- margin-top: 2px;
- margin-left: 15px;
- width: 170px;
- height: 29px;
- background-color: crimson;
- box-sizing: border-box;
- float: left;
- z-index: 1;
- /* transition: all 2s; */
- background-image: url(../../../../static/window/window_new1.png);
- background-size: 100% 100%;
- }
- div.window_new_3 {
- margin-top: 2px;
- margin-left: 15px;
- width: 170px;
- height: 29px;
- background-color: crimson;
- box-sizing: border-box;
- float: left;
- z-index: 1;
- /* transition: all 2s; */
- background-image: url(../../../../static/window/window_new1.png);
- background-size: 100% 100%;
- }
- div.window_new_4 {
- margin-top: 2px;
- margin-left: 15px;
- width: 170px;
- height: 29px;
- background-color: crimson;
- box-sizing: border-box;
- float: left;
- z-index: 1;
- /* transition: all 2s; */
- background-image: url(../../../../static/window/window_new1.png);
- background-size: 100% 100%;
- }
- div.window_new_5 {
- margin-top: 2px;
- margin-left: 15px;
- width: 170px;
- height: 29px;
- background-color: crimson;
- box-sizing: border-box;
- float: left;
- z-index: 1;
- /* transition: all 2s; */
- background-image: url(../../../../static/window/window_new1.png);
- background-size: 100% 100%;
- }
- div.window_new_1 {
- transition: all 2s ease;
- transform-origin: center center;
- }
- div.window_new_2 {
- transition: all 2s ease;
- transform-origin: center center;
- }
- div.window_new_3 {
- transition: all 2s ease;
- transform-origin: center center;
- }
- div.window_new_4 {
- transition: all 2s ease;
- transform-origin: center center;
- }
- div.window_new_5 {
- transition: all 2s ease;
- transform-origin: center center;
- }
- .btns {
- display: flex;
- margin-top: 15px;
- }
- </style>
|