添加工艺参数、可燃气体报警仪、压缩机参数的实时数据页面。

This commit is contained in:
liaodeyun 2025-10-01 19:58:57 +08:00
commit c705efe142
15 changed files with 1304 additions and 75 deletions

View File

@ -7,13 +7,11 @@ VITE_SHOW_SOURCEMAP = true
# 是否启用读取配置文件 min # 是否启用读取配置文件 min
#VITE_WEBAPP = 'D://opt//AppUpdateTest' #VITE_WEBAPP = 'D://opt//AppUpdateTest'
VITE_WEBAPP = '' VITE_WEBAPP = ''
#VITE_SERVER_BASEURL = 'http://10.75.15.247:8080/jeecg-boot' #VITE_SERVER_BASEURL = 'http://10.75.166.6:8080/jeecg-boot'
VITE_SERVER_BASEURL = 'http://10.75.166.6:8080/jeecg-boot'
#VITE_SERVER_BASEURL = 'http://10.75.173.194:8080/jeecg-boot'
#VITE_SERVER_BASEURL = 'https://10.75.166.6/test' #VITE_SERVER_BASEURL = 'https://10.75.166.6/test'
#VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot' #VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot'
#VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot' VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/jeecg-boot'
#VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/wwapi' #VITE_SERVER_BASEURL = 'https://szcx.zyyt.sinopec.com/wwapi'

View File

@ -10,6 +10,33 @@ export function gethomelist(config : object) { // 获取房间信息
}) })
} }
// export function gethomelistforApp(config : object) { //
// return http({
// url: '/RoomOperation/RoomOperation/gethomelistforApp',
// method: 'GET',
// data: config
// })
// }
//20250925
export function gethomelistforApp(config : object) { //
return http({
url: '/RoomAPP/RoomAPP/gethomelistforApp',
method: 'GET',
data: config
})
}
//20250925id
export function getfjkzbmforfjidApp(config : object) { //
return http({
url: mqtturl +
"/mqttcontroller/mqttcontroller/getfjkzbmforfjid",
method: 'GET',
data: config
})
}
export function testcontiont(config : object) { // export function testcontiont(config : object) { //
return http({ return http({
url: mqtturl + '/mqttSubclient/mqttSubclient/testgetcontint', url: mqtturl + '/mqttSubclient/mqttSubclient/testgetcontint',
@ -78,9 +105,17 @@ export function listAllRegions(config : object) { // 查询开关状态
}) })
} }
// export function Selecthomelist(config : object) { //
// return http({
// url: '/RoomOperation/RoomOperation/Selecthomelist',
// method: 'GET',
// data: config
// })
// }
//20250925
export function Selecthomelist(config : object) { // export function Selecthomelist(config : object) { //
return http({ return http({
url: '/RoomOperation/RoomOperation/Selecthomelist', url: '/RoomAPP/RoomAPP/SelecthomelistForApp',
method: 'GET', method: 'GET',
data: config data: config
}) })

View File

@ -64,4 +64,12 @@ export function queryJldRbDataByJldID(params : object) { // 获取计量点日
method: 'GET', method: 'GET',
data: params data: params
}) })
}
export function queryGyKrDataByZc(params : object) { //
return http({
url: '/http://10.75.166.6:9999/Gyk/sssj/GetGyKrByZc',
method: 'GET',
data: params
})
} }

View File

@ -29,7 +29,7 @@ export function editUserApi(config : object) {
/*根据部门Cod和角色Id查询用户信息*/ /*根据部门Cod和角色Id查询用户信息*/
export function queryUserByOrgRoleApi(config : object) { export function queryUserByOrgRoleApi(config : object) {
return http({ return http({
url: '/cxcChangesInPersonnel/cxcChangesInPersonnel/queryByDepCodRoleId', url: '/sys/user/queryByDepCodRoleId',
method: 'GET', method: 'GET',
data: config data: config
}) })

View File

@ -7,7 +7,7 @@ const baseUrl = import.meta.env.VITE_SERVER_BASEURL
class socket { class socket {
constructor() { constructor() {
console.log(77777777777777) // console.log(77777777777777)
this.socketUrl = baseUrl this.socketUrl = baseUrl
this.socketStart = false this.socketStart = false
this.socketType = '' this.socketType = ''
@ -50,7 +50,7 @@ class socket {
}) })
// update-end-author:taoyan date:20220422 for: v2.4.6 websocket #3278 // update-end-author:taoyan date:20220422 for: v2.4.6 websocket #3278
uni.onSocketOpen((res) => { uni.onSocketOpen((res) => {
console.log("连接进来了--------53333333333323----") // console.log("--------53333333333323----")
this.socketStart = true this.socketStart = true
callback && callback() callback && callback()
console.log('WebSocket连接已打开') console.log('WebSocket连接已打开')
@ -85,10 +85,10 @@ class socket {
socketReceive() { socketReceive() {
const _this = this const _this = this
uni.onSocketMessage(function (res) { uni.onSocketMessage(function (res) {
console.log('APP:--》收到服务器内容:', res) // console.log('APP:--', res)
console.log('连接路径----', baseUrl) // console.log('----', baseUrl)
if (res.data.startsWith('CONNECTED') || res.data.startsWith('MESSAGE') || res.data.startsWith('RECEIPT')) { if (res.data.startsWith('CONNECTED') || res.data.startsWith('MESSAGE') || res.data.startsWith('RECEIPT')) {
console.log('放行----------', res) // console.log('----------', res)
// STOMP socketTask.onMessage by // STOMP socketTask.onMessage by
return; return;
} }

View File

@ -39,7 +39,7 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <!--
<view class="connection-section"> <view class="connection-section">
<button v-if="!connected" @click="connectWebSocket" class="connect-btn"> <button v-if="!connected" @click="connectWebSocket" class="connect-btn">
连接WebSocket 连接WebSocket
@ -84,7 +84,8 @@
getMqttPushClient, getMqttPushClient,
treeChildList, treeChildList,
listAllRegions, listAllRegions,
Selecthomelist Selecthomelist,
getfjkzbmforfjidApp
} from '@/api/devicecontrol/officedevice'; } from '@/api/devicecontrol/officedevice';
// import socketforleader from '@/common/socketforleader' // import socketforleader from '@/common/socketforleader'
@ -127,7 +128,7 @@
if (res.success) { if (res.success) {
homelist.value = res.result.map((item, index) => ({ homelist.value = res.result.map((item, index) => ({
...item, // ...item, //
homezt: 0, // homezt0 // homezt: 0, // homezt0
})); }));
// //
} }
@ -176,6 +177,21 @@
} }
} }
} }
/**
* 房间信息订阅
*
*/
const getfjkzbmforfjid = () => {
//
for (const item of filteredFloors.value) {
console.log("00000000000--------------",item)
getfjkzbmforfjidApp({fjbid:item.id}).then((res) => {
console.log("订阅成功--------------",res)
}).catch((err) => {
console.log("订阅失败:"+item.fjh+"。失败信息:"+err);
});
}
}
const getfjkzbm = async (item) => { const getfjkzbm = async (item) => {
// console.log("5555----------",item.id) // console.log("5555----------",item.id)
let fjkzbm = {}; let fjkzbm = {};
@ -288,8 +304,10 @@
filteredFloors.value = groupByFloor(selectBydata) filteredFloors.value = groupByFloor(selectBydata)
// console.log("-555---", filteredFloors.value[0].rooms) // console.log("-555---", filteredFloors.value[0].rooms)
// //
getAllswitchByids() console.log("进入房间订阅:")
getfjkzbmforfjid();
// getAllswitchByids()
} }
} }
//----------------end----------- //----------------end-----------
@ -297,7 +315,7 @@
//---------------------------end------------- //---------------------------end-------------
// //
const handlesocketMessage = (jsonString) => { const handlesocketMessage = (jsonString) => {
console.log("1300--666666666666666---", jsonString) // console.log("1300--666666666666666---", jsonString)
try { try {
const messageObj = JSON.parse(jsonString); const messageObj = JSON.parse(jsonString);
@ -378,12 +396,12 @@
uni.sendSocketMessage({ uni.sendSocketMessage({
data: connectFrame data: connectFrame
}); });
console.log("77777777777") // console.log("77777777777")
}); });
// //
socketTask.onMessage((res) => { socketTask.onMessage((res) => {
console.log("8888888888888888888") // console.log("8888888888888888888")
const data = res.data; const data = res.data;
const [commandLine, ...headerLines] = data.split('\n'); const [commandLine, ...headerLines] = data.split('\n');
const emptyLineIndex = headerLines.findIndex(line => line === ''); const emptyLineIndex = headerLines.findIndex(line => line === '');
@ -395,8 +413,8 @@
} }
const body = headerLines.slice(emptyLineIndex + 1).join('\n').replace(/\x00$/, ''); const body = headerLines.slice(emptyLineIndex + 1).join('\n').replace(/\x00$/, '');
console.log("999999999999999", res) // console.log("999999999999999", res)
console.log("121212121212", commandLine) // console.log("121212121212", commandLine)
switch (commandLine) { switch (commandLine) {
case 'CONNECTED': case 'CONNECTED':
connectionStatus.value = 'STOMP已连接'; connectionStatus.value = 'STOMP已连接';

View File

@ -13,30 +13,11 @@
<text class="info-value">{{ room.ssbmname }}</text> <text class="info-value">{{ room.ssbmname }}</text>
</view> </view>
</view> </view>
<!-- 补位元素确保网格始终保持两列布局 -->
<view v-if="floor.rooms.length % 2 !== 0" class="room-placeholder"></view>
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="connection-section">
<button v-if="!connected" @click="connectWebSocket" class="connect-btn">
连接WebSocket
</button>
<button @click="disconnectWebSocket" class="disconnect-btn">
断开连接
</button>
<text :class="['status', connected ? 'connected' : 'disconnected']">
{{ connectionStatus }}
</text>
</view>
<view class="message-container">
<text class="subtitle">消息记录</text>
<scroll-view scroll-y="true" class="message-list">
<view v-for="(item, index) in messages" :key="index" :class="['message-item', item.type]">
<text class="message-content">{{ item.content }}</text>
</view>
</scroll-view>
</view> -->
</view> </view>
</template> </template>
@ -48,11 +29,13 @@
} from 'vue' } from 'vue'
import { import {
gethomelist, gethomelist,
gethomelistforApp,
getMqttPushClient, getMqttPushClient,
selectfjkzbmforfjid, selectfjkzbmforfjid,
createdSwitch, createdSwitch,
listAllRegions, listAllRegions,
Selecthomelist Selecthomelist,
getfjkzbmforfjidApp
} from '@/api/devicecontrol/officedevice'; } from '@/api/devicecontrol/officedevice';
// import useWebSocketService from '@/api/devicecontrol/webSocketService' // import useWebSocketService from '@/api/devicecontrol/webSocketService'
@ -90,18 +73,33 @@
// //
const getofficehomelist = async () => { const getofficehomelist = async () => {
await gethomelist().then((res) => { //20250811,,
await gethomelistforApp().then((res) => {
if (res.success) { if (res.success) {
homelist.value = res.result.map((item, index) => ({ homelist.value = res.result.map((item, index) => ({
...item, ...item,
homezt: 0, // homezt0 // homezt: 0, // homezt0
})); }));
} }
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}); });
filteredFloors.value = groupByFloor(homelist) filteredFloors.value = groupByFloor(homelist)
getAllswitchByids(); // getAllswitchByids();
//
getfjkzbmforfjid();
}
//
const getfjkzbmforfjid = () => {
for (const item of filteredFloors.value) {
getfjkzbmforfjidApp({fjbid:item.id}).then((res) => {
console.log("订阅成功--------------",res)
}).catch((err) => {
console.log("订阅失败:"+item.fjh+"。失败信息:"+err);
});
}
} }
// //
@ -246,7 +244,7 @@
if (res.success) { if (res.success) {
selectBydata.value = res.result; selectBydata.value = res.result;
filteredFloors.value = groupByFloor(selectBydata) filteredFloors.value = groupByFloor(selectBydata)
getAllswitchByids() // getAllswitchByids()
} }
} }
//----------------end----------- //----------------end-----------

View File

@ -62,15 +62,15 @@
<view class="ac-controls" v-if="ktpd"> <view class="ac-controls" v-if="ktpd">
<button class="ac-btn" :class="{ 'active': acMode === 1 }" @click="conditioning(1)"> <button class="ac-btn" :class="{ 'active': acMode === 1 }" @click="conditioning(1)">
<uni-icons type="snow" size="20" color="#3498db"></uni-icons> <!-- <uni-icons type="snow" size="20" color="#3498db"></uni-icons> -->
<text>制冷 25°C</text> <text>制冷 25°C</text>
</button> </button>
<button class="ac-btn" :class="{ 'active': acMode === 2 }" @click="conditioning(2)"> <button class="ac-btn" :class="{ 'active': acMode === 2 }" @click="conditioning(2)">
<uni-icons type="fire" size="20" color="#e74c3c"></uni-icons> <!-- <uni-icons type="fire" size="20" color="#e74c3c"></uni-icons> -->
<text>制热 27°C</text> <text>制热 27°C</text>
</button> </button>
<button class="ac-btn" :class="{ 'active': acMode === 0 }" @click="conditioning(0)"> <button class="ac-btn" :class="{ 'active': acMode === 0 }" @click="conditioning(0)">
<uni-icons type="close" size="20" color="#7f8c8d"></uni-icons> <!-- <uni-icons type="close" size="20" color="#7f8c8d"></uni-icons> -->
<text>关闭空调</text> <text>关闭空调</text>
</button> </button>
</view> </view>

View File

@ -335,17 +335,13 @@
roleId: '1554379432313397250', roleId: '1554379432313397250',
orgCode: code orgCode: code
}).then(res => { }).then(res => {
if (res.result.length > 0) { model.hr = res.result.user.username
model.hr = res.result[0].username hrData.value = res.result.list.map(item => {
} return {
if (!code) { label: item.realname,
hrData.value = res.result.map(item => { value: item.username
return { }
label: item.realname, })
value: item.username
}
})
}
}) })
} }
@ -364,8 +360,6 @@
getZwmcAndExa() getZwmcAndExa()
/*获取工作单位*/ /*获取工作单位*/
queryDepName() queryDepName()
/*获取劳资员*/
getHrList()
/*获取*/ /*获取*/
queryHisDate() queryHisDate()
}); });

View File

@ -1,8 +1,336 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom',
navigationBarTitleText: '站场工艺参数实时数据',
},
}
</route>
<template> <template>
</template> <PageLayout navTitle="站场工艺参数实时数据" routeMethod="pushTab">
<!-- 标题行 -->
<wd-text :text="stationName ? stationName: ' '"
style="color: blue;font-size:18px;text-align: center;margin: 5px;"></wd-text>
<wd-cell :title="'时间:' + nowDateTime " center>
<wd-button custom-class="custom-value" size="small" plain clickable
@click="handleStop">{{caijiText}}</wd-button>
<wd-button custom-class="custom-value" size="small" plain clickable
@click="handleRightClick">选择站场</wd-button>
<script> </wd-cell>
<scroll-view direction="vertical" class="scroll-container">
<view class="container">
<view>
<view class="field-item">
<text class="titlejl">参数名称</text>
<text class="field-value">参数数值</text>
<text class="field-dw">单位</text>
</view>
</view>
<view v-for="(item, index) in jlData" :key="index" class="card">
<view>
<view class="field-item">
<text class="titlejl">{{ item.jldname }}:</text>
<text class="field-value">{{ formatNumber(item.gyvalue) || '-' }}</text>
<text class="field-dw">{{ (item.jlddw) || '-' }}
</text>
</view>
</view>
</view>
</view>
</scroll-view>
<wd-popup v-model="selectZc" position="bottom" custom-style="width:100%;height: 300px;" @close="handleClose">
<view style="font-size: 18px;text-align: center;color: blue;margin: 10px;">选择采输气站场</view>
<cxc-szcx-stationJl-select v-model="stationID" returnCodeOrID="id" @change="onChange">
</cxc-szcx-stationJl-select>
</wd-popup>
<wd-popup v-model="sssjFlag" position="bottom" custom-style="width:100%;height: 70vh;" @close="handleClose">
<sssj-chart :jldData="jldData"></sssj-chart>
</wd-popup>
<wd-popup v-model="lssjFlag" position="bottom" custom-style="width:100%;height: 70vh;" @close="handleClose">
<lssj-chart :jldData="jldData"></lssj-chart>
</wd-popup>
</PageLayout>
</template>
<script setup>
import {
queryJldZcList,
queryJldDataByZc
} from '@/api/production'
import {
ref,
onMounted,
computed,
nextTick,
watchEffect,
onUnmounted,
} from 'vue';
import {
onHide,
onShow
} from '@dcloudio/uni-app'
import {
formatDate
} from '@/utils/dateTime.ts';
import SssjChart from './chart/sssjChart'
import LssjChart from './chart/lssjChart'
const res = wx.getSystemInfoSync();
const statusHeight = res.statusBarHeight; //
const cusnavbarheight = (statusHeight + 30) + "px";
const selectZc = ref(false)
const lssjFlag = ref(false)
const sssjFlag = ref(false)
const nowDateTime = ref("")
const caijiText = ref("停止采集")
const stationList = ref([])
const stationID = ref("")
const stationName = ref(" ")
const jlData = ref([])
const jldData = ref({})
const GyKrByzc = ref('https://szcx.zyyt.sinopec.com/Gyk/sssj/GetGyKrByZc')
function openSssjChart(e) {
sssjFlag.value = true;
console.log(11, e)
jldData.value = e
console.log(selectZc.value)
}
function openlssjChart(e) {
lssjFlag.value = true;
jldData.value = e
console.log(selectZc.value)
}
function handleRightClick() {
selectZc.value = true;
console.log(selectZc.value)
}
function handleClose() {
console.log(selectZc.value)
}
function onChange(e, data) {
console.log(2, e, data.value);
stationID.value = e
stationName.value = data.value.title
getScData(); //
}
function handleStop() {
if (caijiText.value === "停止采集") {
console.log('清除定时器,停止采集')
caijiText.value = "开始采集"
clearInterval(timer2.value);
timer2.value = null;
} else {
console.log('开始采集,打开定时器')
caijiText.value = "停止采集"
websocketheart()
}
}
const websock = ref(null);
const timer2 = ref(null);
//
const websocketheart = () => {
//
if (timer2.value) {
clearInterval(timer2.value);
timer2.value = null;
}
timer2.value = setInterval(() => {
nowDateTime.value = formatDate(new Date(), "YYYY-MM-DD HH:mm:ss")
if (websock.value && websock.value.readyState === 1) {
//
// connectSocketInit()
}
if (stationID.value) {
getScData();
}
}, 1000);
};
onMounted(() => {
websocketheart()
// stationID.value = "1267633458481725442"
})
onUnmounted(() => {
clearInterval(timer2.value);
})
onHide(() => {
console.log('页面隐藏,清除定时器')
clearInterval(timer2.value);
timer2.value = null;
})
onShow(() => {
//
websocketheart()
})
const getScData = () => {
uni.request({
url: GyKrByzc.value + '?zhanc=' + stationID.value + '&jldLx=1',
method: 'GET',
success: (res) => {
console.log(res)
jlData.value = JSON.parse(res.data.result).JlData;
}
})
}
//
const formatNumber = (num) => {
let temp = 0;
try {
temp = parseFloat(num);
} catch (error) {
//TODO handle the exception
}
return temp.toFixed(4).replace(/\.?0+$/, '');
};
</script> </script>
<style> <style lang="scss" scoped>
.header-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10 10rpx;
border-bottom: 1rpx solid #eee;
margin-left: 10px;
margin-right: 10px;
}
.title {
font-weight: bold;
color: #333;
}
.titlejl {
font-size: 20rpx;
vertical-align: middle;
font-weight: bold;
color: #0055ff;
margin-bottom: 15px;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 16px;
padding: 16px;
}
.card {
background: #fff;
border-radius: 8px;
padding: 5px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.field-list {
margin-top: 10px;
display: flex;
flex-wrap: wrap;
/* 允许子元素换行 */
gap: 3px;
}
.field-item {
display: flex;
height: 30px;
justify-content: space-between;
align-items: center;
padding: 5px 5px;
background: #f8f9fa;
border-radius: 4px;
flex-basis: calc(50% - 10px);
/* 每个元素占据约一半宽度,减去间隙 */
box-sizing: border-box;
/* 包含内边距和边框 */
}
/* 当屏幕宽度较小时,每个元素占据整行 */
@media (max-width: 200px) {
.field-item {
flex-basis: 100%;
}
}
.field-label {
color: #666;
font-size: 10px;
flex: 1;
margin-right: 2px;
width: 80px;
font-weight: 500;
}
.field-labelssll {
color: #0000ff;
text-decoration: underline;
font-size: 10px;
flex: 1;
margin-right: 2px;
width: 80px;
font-weight: 500;
}
.field-value {
color: #1890ff;
font-weight: 500;
font-size: 12px;
text-align: right;
width: 40vw;
overflow: hidden;
text-overflow: ellipsis;
}
.field-dw {
color: #1890ff;
font-weight: 500;
font-size: 12px;
text-align: center;
width: 20vw;
overflow: hidden;
text-overflow: ellipsis;
}
.status-circle {
width: 70rpx;
height: 30rpx;
font-size: 12px;
vertical-align: middle;
}
.page-layout {
display: flex;
flex-direction: column;
height: 100vh;
}
.scroll-container {
flex: 1;
overflow-y: auto;
}
</style> </style>

View File

@ -14,18 +14,31 @@
<date-time-show></date-time-show> <date-time-show></date-time-show>
</view> </view>
<wd-card title="天然气实时数据"> <wd-card title="天然气实时数据">
天然气实时数据汇总计算结果用标签显示出各类天然气的实时数据需要工业库后台进行计算 天然气计量实时数据
<template #footer> <template #footer>
<wd-button size="small" @click="gotoTrqSssj" plain>查看详情</wd-button> <wd-button size="small" @click="gotoTrqSssj" plain>查看详情</wd-button>
</template> </template>
</wd-card> </wd-card>
<wd-card title="管道运行实时数据"> <wd-card title="工艺参数实时数据">
条管线的天然气实时数据汇总计算结果用标签显示出各类天然气的实时数据需要工业库后台进行计算 站场工艺参数实时数据
<template #footer> <template #footer>
<wd-button size="small" @click="gotoGdSssj" plain>查看详情</wd-button> <wd-button size="small" @click="gotoGycsSssj" plain>查看详情</wd-button>
</template> </template>
</wd-card> </wd-card>
<wd-card title="可燃气体报警实时数据">
各站场可燃气体报警仪实时数据
<template #footer>
<wd-button size="small" @click="gotoKrqtbjSssj" plain>查看详情</wd-button>
</template>
</wd-card>
<wd-card title="压缩机实时数据">
各站场压缩机运行参数实时数据
<template #footer>
<wd-button size="small" @click="gotoYsjSssj" plain>查看详情</wd-button>
</template>
</wd-card>
</view> </view>
</PageLayout> </PageLayout>
</template> </template>
@ -40,6 +53,30 @@
} }
function gotoGdSssj() { function gotoGdSssj() {
uni.navigateTo({
url: '/pages-production/shishishuju/gycsSssj'
})
}
function gotoGycsSssj() {
uni.navigateTo({
url: '/pages-production/shishishuju/gycsSssj'
})
}
function gotoKrqtbjSssj() {
uni.navigateTo({
url: '/pages-production/shishishuju/krqtSssj'
})
}
function gotoYsjSssj() {
uni.navigateTo({
url: '/pages-production/shishishuju/ysjSssj'
})
}
function gotoScSssj() {
uni.navigateTo({ uni.navigateTo({
url: '/pages-production/shishishuju/trqSssj' url: '/pages-production/shishishuju/trqSssj'
}) })

View File

@ -0,0 +1,336 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom',
navigationBarTitleText: '可燃气体浓度实时数据',
},
}
</route>
<template>
<PageLayout navTitle="可燃气体浓度实时数据" routeMethod="pushTab">
<!-- 标题行 -->
<wd-text :text="stationName ? stationName: ' '"
style="color: blue;font-size:18px;text-align: center;margin: 5px;"></wd-text>
<wd-cell :title="'时间:' + nowDateTime " center>
<wd-button custom-class="custom-value" size="small" plain clickable
@click="handleStop">{{caijiText}}</wd-button>
<wd-button custom-class="custom-value" size="small" plain clickable
@click="handleRightClick">选择站场</wd-button>
</wd-cell>
<scroll-view direction="vertical" class="scroll-container">
<view class="container">
<view>
<view class="field-item">
<text class="titlejl">安装位置</text>
<text class="field-value">参数数值</text>
<text class="field-dw">运行状态 </text>
</view>
</view>
<view v-for="(item, index) in jlData" :key="index" class="card">
<view>
<view class="field-item">
<text class="titlejl">{{ item.jldname }}:</text>
<text class="field-value">{{ formatNumber(item.krvalue) || '-' }}%</text>
<text class="field-dw">{{ item.krzt }} </text>
</view>
</view>
</view>
</view>
</scroll-view>
<wd-popup v-model="selectZc" position="bottom" custom-style="width:100%;height: 300px;" @close="handleClose">
<view style="font-size: 18px;text-align: center;color: blue;margin: 10px;">选择采输气站场</view>
<cxc-szcx-stationJl-select v-model="stationID" returnCodeOrID="id" @change="onChange">
</cxc-szcx-stationJl-select>
</wd-popup>
<wd-popup v-model="sssjFlag" position="bottom" custom-style="width:100%;height: 70vh;" @close="handleClose">
<sssj-chart :jldData="jldData"></sssj-chart>
</wd-popup>
<wd-popup v-model="lssjFlag" position="bottom" custom-style="width:100%;height: 70vh;" @close="handleClose">
<lssj-chart :jldData="jldData"></lssj-chart>
</wd-popup>
</PageLayout>
</template>
<script setup>
import {
queryJldZcList,
queryJldDataByZc
} from '@/api/production'
import {
ref,
onMounted,
computed,
nextTick,
watchEffect,
onUnmounted,
} from 'vue';
import {
onHide,
onShow
} from '@dcloudio/uni-app'
import {
formatDate
} from '@/utils/dateTime.ts';
import SssjChart from './chart/sssjChart'
import LssjChart from './chart/lssjChart'
const res = wx.getSystemInfoSync();
const statusHeight = res.statusBarHeight; //
const cusnavbarheight = (statusHeight + 30) + "px";
const selectZc = ref(false)
const lssjFlag = ref(false)
const sssjFlag = ref(false)
const nowDateTime = ref("")
const caijiText = ref("停止采集")
const stationList = ref([])
const stationID = ref("")
const stationName = ref(" ")
const jlData = ref([])
const jldData = ref({})
const GyKrByzc = ref('https://szcx.zyyt.sinopec.com/Gyk/sssj/GetGyKrByZc')
function openSssjChart(e) {
sssjFlag.value = true;
console.log(11, e)
jldData.value = e
console.log(selectZc.value)
}
function openlssjChart(e) {
lssjFlag.value = true;
jldData.value = e
console.log(selectZc.value)
}
function handleRightClick() {
selectZc.value = true;
console.log(selectZc.value)
}
function handleClose() {
console.log(selectZc.value)
}
function onChange(e, data) {
console.log(2, e, data.value);
stationID.value = e
stationName.value = data.value.title
getScData(); //
}
function handleStop() {
if (caijiText.value === "停止采集") {
console.log('清除定时器,停止采集')
caijiText.value = "开始采集"
clearInterval(timer2.value);
timer2.value = null;
} else {
console.log('开始采集,打开定时器')
caijiText.value = "停止采集"
websocketheart()
}
}
const websock = ref(null);
const timer2 = ref(null);
//
const websocketheart = () => {
//
if (timer2.value) {
clearInterval(timer2.value);
timer2.value = null;
}
timer2.value = setInterval(() => {
nowDateTime.value = formatDate(new Date(), "YYYY-MM-DD HH:mm:ss")
if (websock.value && websock.value.readyState === 1) {
//
// connectSocketInit()
}
if (stationID.value) {
getScData();
}
}, 1000);
};
onMounted(() => {
websocketheart()
// stationID.value = "1267633458481725442"
})
onUnmounted(() => {
clearInterval(timer2.value);
})
onHide(() => {
console.log('页面隐藏,清除定时器')
clearInterval(timer2.value);
timer2.value = null;
})
onShow(() => {
//
websocketheart()
})
const getScData = () => {
uni.request({
url: GyKrByzc.value + '?zhanc=' + stationID.value + '&jldLx=2',
method: 'GET',
success: (res) => {
console.log(res)
jlData.value = JSON.parse(res.data.result).JlData;
}
})
}
//
const formatNumber = (num) => {
let temp = 0;
try {
temp = parseFloat(num);
} catch (error) {
//TODO handle the exception
}
return temp.toFixed(8).replace(/\.?0+$/, '');
};
</script>
<style lang="scss" scoped>
.header-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10 10rpx;
border-bottom: 1rpx solid #eee;
margin-left: 10px;
margin-right: 10px;
}
.title {
font-weight: bold;
color: #333;
}
.titlejl {
font-size: 20rpx;
vertical-align: middle;
font-weight: bold;
color: #0055ff;
margin-bottom: 15px;
width: 40vw;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 16px;
padding: 16px;
}
.card {
background: #fff;
border-radius: 8px;
padding: 5px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.field-list {
margin-top: 10px;
display: flex;
flex-wrap: wrap;
/* 允许子元素换行 */
gap: 3px;
}
.field-item {
display: flex;
height: 30px;
justify-content: space-between;
align-items: center;
padding: 5px 5px;
background: #f8f9fa;
border-radius: 4px;
flex-basis: calc(50% - 10px);
/* 每个元素占据约一半宽度,减去间隙 */
box-sizing: border-box;
/* 包含内边距和边框 */
}
/* 当屏幕宽度较小时,每个元素占据整行 */
@media (max-width: 200px) {
.field-item {
flex-basis: 100%;
}
}
.field-label {
color: #666;
font-size: 10px;
flex: 1;
margin-right: 2px;
width: 80px;
font-weight: 500;
}
.field-labelssll {
color: #0000ff;
text-decoration: underline;
font-size: 10px;
flex: 1;
margin-right: 2px;
width: 80px;
font-weight: 500;
}
.field-value {
color: #1890ff;
font-weight: 500;
font-size: 12px;
text-align: right;
width: 40vw;
overflow: hidden;
text-overflow: ellipsis;
}
.field-dw {
color: #1890ff;
font-weight: 500;
font-size: 12px;
text-align: center;
width: 20vw;
overflow: hidden;
text-overflow: ellipsis;
}
.status-circle {
width: 70rpx;
height: 30rpx;
font-size: 12px;
vertical-align: middle;
}
.page-layout {
display: flex;
flex-direction: column;
height: 100vh;
}
.scroll-container {
flex: 1;
overflow-y: auto;
}
</style>

View File

@ -1,8 +1,465 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom',
navigationBarTitleText: '压缩机实时数据',
},
}
</route>
<template> <template>
</template> <PageLayout navTitle="压缩机实时数据" routeMethod="pushTab">
<!-- 标题行 -->
<wd-text :text="stationName ? stationName: ' '"
style="color: blue;font-size:18px;text-align: center;margin: 5px;"></wd-text>
<wd-cell :title="'时间:' + nowDateTime " center>
<wd-button custom-class="custom-value" size="small" plain clickable
@click="handleStop">{{caijiText}}</wd-button>
<wd-button custom-class="custom-value" size="small" plain clickable
@click="handleRightClick">选择站场</wd-button>
<script> </wd-cell>
<scroll-view direction="vertical" class="scroll-container">
<view class="container">
<view v-for="(item, index) in jlData" :key="index" class="card">
<view class="field-item">
<text class="titlejl">{{ item.jzname }}</text>
<view class="status-circle"
:style="{ backgroundColor: item.jzzt==='运行' ? '#4CAF50' : '#F44336' }">
{{item.jzzt}}
</view>
</view>
<view class="field-list">
<view v-for="(itempar, indexpar) in item.data" :key="index" class="card">
<view class="field-itemData">
<text class="titlejl">{{itempar.jldname}}</text>
<text class="field-value">{{ formatNumber(itempar.ysvalue) || '' }}</text>
<text class="field-dw">{{ (itempar.jlddw) || '' }}</text>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<wd-popup v-model="selectZc" position="bottom" custom-style="width:100%;height: 300px;" @close="handleClose">
<view style="font-size: 18px;text-align: center;color: blue;margin: 10px;">选择采输气站场</view>
<cxc-szcx-stationJl-select v-model="stationID" returnCodeOrID="id" @change="onChange">
</cxc-szcx-stationJl-select>
</wd-popup>
<wd-popup v-model="sssjFlag" position="bottom" custom-style="width:100%;height: 70vh;" @close="handleClose">
<sssj-chart :jldData="jldData"></sssj-chart>
</wd-popup>
<wd-popup v-model="lssjFlag" position="bottom" custom-style="width:100%;height: 70vh;" @close="handleClose">
<lssj-chart :jldData="jldData"></lssj-chart>
</wd-popup>
</PageLayout>
</template>
<script setup>
import {
queryJldZcList,
queryJldDataByZc
} from '@/api/production'
import {
ref,
onMounted,
computed,
nextTick,
watchEffect,
onUnmounted,
} from 'vue';
import {
onHide,
onShow
} from '@dcloudio/uni-app'
import {
formatDate
} from '@/utils/dateTime.ts';
import SssjChart from './chart/sssjChart'
import LssjChart from './chart/lssjChart'
const res = wx.getSystemInfoSync();
const statusHeight = res.statusBarHeight; //
const cusnavbarheight = (statusHeight + 30) + "px";
const selectZc = ref(false)
const lssjFlag = ref(false)
const sssjFlag = ref(false)
const nowDateTime = ref("")
const caijiText = ref("停止采集")
const stationList = ref([])
const stationID = ref("")
const stationName = ref(" ")
const jlData = ref([])
const jldData = ref({})
const sssjUrl = ref('wss://szcx.zyyt.sinopec.com/Gyk/websocket/')
const ysByzc = ref('https://szcx.zyyt.sinopec.com/Gyk/sssj/GetYsByZc')
function openSssjChart(e) {
sssjFlag.value = true;
console.log(11, e)
jldData.value = e
console.log(selectZc.value)
}
function openlssjChart(e) {
lssjFlag.value = true;
jldData.value = e
console.log(selectZc.value)
}
function handleRightClick() {
selectZc.value = true;
console.log(selectZc.value)
}
function handleClose() {
console.log(selectZc.value)
}
function onChange(e, data) {
console.log(2, e, data.value);
stationID.value = e
stationName.value = data.value.title
getScData(); //
}
function handleStop() {
if (caijiText.value === "停止采集") {
console.log('清除定时器,停止采集')
caijiText.value = "开始采集"
clearInterval(timer2.value);
timer2.value = null;
} else {
console.log('开始采集,打开定时器')
caijiText.value = "停止采集"
websocketheart()
}
}
const websock = ref(null);
const timer2 = ref(null);
//
const websocketheart = () => {
//
if (timer2.value) {
clearInterval(timer2.value);
timer2.value = null;
}
timer2.value = setInterval(() => {
nowDateTime.value = formatDate(new Date(), "YYYY-MM-DD HH:mm:ss")
if (websock.value && websock.value.readyState === 1) {
//
// connectSocketInit()
}
if (stationID.value) {
getScData();
}
}, 1000);
};
onMounted(() => {
websocketheart()
// stationID.value = "1267633458481725442"
})
onUnmounted(() => {
clearInterval(timer2.value);
})
onHide(() => {
console.log('页面隐藏,清除定时器')
clearInterval(timer2.value);
timer2.value = null;
})
onShow(() => {
//
websocketheart()
})
const getScData = () => {
uni.request({
url: ysByzc.value + '?zhanc=' + stationID.value,
method: 'GET',
success: (res) => {
console.log(1111, res)
jlData.value = processCompressorData(res.data.result);
console.log(jlData.value)
}
})
}
/**
* 完整的数据分类和整理方法
* @param {Array} data - 原始数据数组
* @param {Array} fields - 需要保留的字段数组
* @returns {Array} 分组整理后的数据
*/
function processCompressorData(data, fields = ['id', 'station_id', 'depart_id', 'zhan', 'gykbz', 'jlddw', 'ysvalue']) {
//
if (!Array.isArray(data)) {
console.error('数据必须是数组');
return [];
}
if (!Array.isArray(fields)) {
console.error('字段列表必须是数组');
return [];
}
const groupMap = new Map();
const validFields = new Set(fields);
//
validFields.add('jldname');
//
data.forEach((item, index) => {
try {
//
if (!item || typeof item !== 'object') {
console.warn(`跳过无效数据项 ${index}`);
return;
}
//
if (!item.jldname || typeof item.jldname !== 'string') {
console.warn(`跳过无jldname的数据项 ${index}`);
return;
}
const jldnameParts = item.jldname.split('*');
if (jldnameParts.length < 3) {
console.warn(`无效的jldname格式: ${item.jldname}`);
return;
}
const jzname = jldnameParts[1].trim();
const paramName = jldnameParts[2].trim();
if (!jzname) {
console.warn(`无法解析机组名称: ${item.jldname}`);
return;
}
//
if (!groupMap.has(jzname)) {
groupMap.set(jzname, {
jzname: jzname,
jzzt: '停止', //
data: []
});
}
const group = groupMap.get(jzname);
//
if (paramName.includes('发动机转速')) {
const speed = parseFloat(item.ysvalue) || 0;
if (speed > 0) {
group.jzzt = '运行';
} else {
group.jzzt = '停运';
}
}
//
const paramData = {};
validFields.forEach(field => {
if (item.hasOwnProperty(field)) {
// 使
if (field === 'jldname') {
paramData[field] = paramName;
} else {
paramData[field] = item[field];
}
}
});
//
group.data.push(paramData);
} catch (error) {
console.error(`处理数据项 ${index} 时出错:`, error);
}
});
//
const result = Array.from(groupMap.values());
//
result.sort((a, b) => a.jzname.localeCompare(b.jzname));
//
result.forEach(group => {
group.data.sort((a, b) => a.jldname.localeCompare(b.jldname));
});
return result;
}
//
const formatNumber = (num) => {
let temp = 0;
try {
temp = parseFloat(num);
} catch (error) {
//TODO handle the exception
}
return temp.toFixed(4).replace(/\.?0+$/, '');
};
</script> </script>
<style> <style lang="scss" scoped>
.header-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10 10rpx;
border-bottom: 1rpx solid #eee;
margin-left: 10px;
margin-right: 10px;
}
.title {
font-weight: bold;
color: #333;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 16px;
padding: 16px;
}
.card {
background: #fff;
border-radius: 8px;
padding: 5px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.field-list {
margin-top: 10px;
display: flex;
flex-wrap: wrap;
/* 允许子元素换行 */
gap: 3px;
}
.field-item {
display: flex;
height: 30px;
justify-content: space-between;
align-items: center;
padding: 5px 5px;
background: #f8f9fa;
border-radius: 4px;
flex-basis: calc(50% - 10px);
/* 每个元素占据约一半宽度,减去间隙 */
box-sizing: border-box;
/* 包含内边距和边框 */
}
/* 当屏幕宽度较小时,每个元素占据整行 */
@media (max-width: 200px) {
.field-item {
flex-basis: 100%;
}
}
.field-label {
color: #666;
font-size: 10px;
flex: 1;
margin-right: 2px;
width: 80px;
font-weight: 500;
}
.field-labelssll {
color: #0000ff;
text-decoration: underline;
font-size: 10px;
flex: 1;
margin-right: 2px;
width: 80px;
font-weight: 500;
}
.field-itemData {
display: flex;
width: 40vw;
height: 30px;
justify-content: space-between;
align-items: center;
padding: 5px 5px;
background: #f8f9fa;
border-radius: 4px;
flex-basis: calc(50% - 10px);
/* 每个元素占据约一半宽度,减去间隙 */
box-sizing: border-box;
/* 包含内边距和边框 */
}
.field-title {
font-size: 20rpx;
vertical-align: middle;
font-weight: bold;
color: #0055ff;
margin-bottom: 15px;
width: 40%;
}
.field-value {
color: #1890ff;
font-weight: 500;
font-size: 12px;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
width: 30%;
}
.field-dw {
color: #1890ff;
font-weight: 500;
font-size: 12px;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
width: 20%;
}
.status-circle {
width: 70rpx;
height: 30rpx;
font-size: 12px;
vertical-align: middle;
}
.page-layout {
display: flex;
flex-direction: column;
height: 100vh;
}
.scroll-container {
flex: 1;
overflow-y: auto;
}
</style> </style>

View File

@ -643,7 +643,12 @@
}, },
{ {
"path": "shishishuju/gycsSssj", "path": "shishishuju/gycsSssj",
"type": "page" "type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "站场工艺参数实时数据"
}
}, },
{ {
"path": "shishishuju/index", "path": "shishishuju/index",
@ -654,6 +659,15 @@
"navigationBarTitleText": "实时数据 " "navigationBarTitleText": "实时数据 "
} }
}, },
{
"path": "shishishuju/krqtSssj",
"type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "可燃气体浓度实时数据"
}
},
{ {
"path": "shishishuju/nyxhSssj", "path": "shishishuju/nyxhSssj",
"type": "page" "type": "page"
@ -669,7 +683,12 @@
}, },
{ {
"path": "shishishuju/ysjSssj", "path": "shishishuju/ysjSssj",
"type": "page" "type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "压缩机实时数据"
}
}, },
{ {
"path": "shishishuju/chart/lssjChart", "path": "shishishuju/chart/lssjChart",

View File

@ -79,6 +79,7 @@ interface NavigateToOptions {
"/pages-production/shishishuju/aqbjSssj" | "/pages-production/shishishuju/aqbjSssj" |
"/pages-production/shishishuju/gycsSssj" | "/pages-production/shishishuju/gycsSssj" |
"/pages-production/shishishuju/index" | "/pages-production/shishishuju/index" |
"/pages-production/shishishuju/krqtSssj" |
"/pages-production/shishishuju/nyxhSssj" | "/pages-production/shishishuju/nyxhSssj" |
"/pages-production/shishishuju/trqSssj" | "/pages-production/shishishuju/trqSssj" |
"/pages-production/shishishuju/ysjSssj" | "/pages-production/shishishuju/ysjSssj" |