hsz-app/pages/sjc/index.vue

178 lines
4.4 KiB
Vue
Raw Normal View History

2024-11-21 17:53:13 +08:00
<template>
2025-04-18 13:53:13 +08:00
<view class="container">
<u-navbar
:title="name"
:autoBack="true"
:titleStyle="{
fontSize: '18px',
}"
:height="44"
:safeAreaInsetTop="true"
leftIconSize="20"
leftIconColor="rgb(153, 153, 153)"
>
</u-navbar>
2025-12-18 17:53:20 +08:00
<view style="margin-top: 80px; padding: 10px">
2025-04-18 13:53:13 +08:00
<SlTable :tableData="slData" v-if="name == '渗流监测'"></SlTable>
<ZwyTable
:tableData="zwyData"
2025-12-18 17:53:20 +08:00
v-else-if="name == '位移监测'"
2025-04-18 13:53:13 +08:00
></ZwyTable>
2025-12-18 17:53:20 +08:00
2025-04-18 13:53:13 +08:00
<ZsyTable
:tableData="zsyData"
2025-12-18 17:53:20 +08:00
v-else-if="name == '渗压监测'"
2025-04-18 13:53:13 +08:00
></ZsyTable>
2025-12-18 17:53:20 +08:00
2025-09-28 17:47:19 +08:00
<ByTable
:tableData="byData"
v-else-if="name == '白蚁监测'"
></ByTable>
2025-04-18 13:53:13 +08:00
</view>
</view>
2024-11-21 17:53:13 +08:00
</template>
<script>
2025-04-18 13:53:13 +08:00
import SlTable from "./slTable.vue";
import ZwyTable from "./zwyTable.vue";
import ZsyTable from "./zsyTable.vue";
2025-09-28 17:47:19 +08:00
import ByTable from "./byTable.vue";
2024-11-21 17:53:13 +08:00
export default {
2025-04-18 13:53:13 +08:00
components: {
SlTable,
ZwyTable,
ZsyTable,
2025-09-28 17:47:19 +08:00
ByTable
2025-04-18 13:53:13 +08:00
},
data() {
return {
slData: [], //渗流监测
zwyData: [], //主坝位移监测
zsyData: [], //主坝渗压监测
sdData: [], //发电洞渗压监测
fbData: [], //副坝渗压监测
2025-09-28 17:47:19 +08:00
byData:[],
2025-04-18 13:53:13 +08:00
name: "",
2025-09-28 17:47:19 +08:00
deviceId:""
2025-04-18 13:53:13 +08:00
};
},
methods: {
filterStationsByCode(array, config) {
const { prefix, start, end, digitLength = 1 } = config;
console.log("array",array);
return array.filter((item) => {
if (!item.stationCode) return false;
const code = item.stationCode;
if (!code.startsWith(prefix)) return false;
const numStr = code.substring(prefix.length);
const num = parseInt(numStr);
// 检查数字部分的长度是否符合要求
if (digitLength > 1 && numStr.length !== digitLength) return false;
return num >= start && num <= end;
});
2024-11-21 17:53:13 +08:00
},
2025-04-18 13:53:13 +08:00
async getSlData() {
try {
const { data } = await uni.$http.get(
2025-12-18 17:53:20 +08:00
"/gunshiApp/hsz/osmoticPressR/list/value?type=2"
2025-04-18 13:53:13 +08:00
);
if (data.code == 200) {
2025-12-18 17:53:20 +08:00
console.log("data.data",data.data);
2025-04-18 13:53:13 +08:00
this.slData = data.data;
2024-11-21 17:53:13 +08:00
}
2025-04-18 13:53:13 +08:00
} catch (error) {
uni.$showMsg();
}
2024-11-21 17:53:13 +08:00
},
2025-09-28 17:47:19 +08:00
async getByData() {
try {
const { data } = await uni.$http.get(
2025-12-18 17:53:20 +08:00
`/gunshiApp/hsz/termite/survey/listNewData?deviceId=${this.deviceId}`
2025-09-28 17:47:19 +08:00
);
if (data.code == 200) {
this.byData = data.data;
}
} catch (error) {
uni.$showMsg();
}
},
2025-04-18 13:53:13 +08:00
async getZwyData() {
try {
const { data } = await uni.$http.get(
2025-12-18 17:53:20 +08:00
"/gunshiApp/hsz/osmoticShiftR/list/value"
2025-04-18 13:53:13 +08:00
);
if (data.code == 200) {
let resData = [];
2025-12-18 17:53:20 +08:00
if (this.name == "位移监测") {
2025-04-18 13:53:13 +08:00
resData = this.filterStationsByCode(data.data, {
prefix: "WY-",
start: 1,
end: 27,
digitLength: 2,
});
}else if(this.name == "溢洪道位移监测"){
const wy = this.filterStationsByCode(data.data, {
prefix: "WY-",
start: 28,
end: 31,
digitLength: 2,
});
const zy = this.filterStationsByCode(data.data, {
prefix: "ZY-",
start: 5,
end: 36,
digitLength: 2,
});
resData = [...wy,...zy]
}else if(this.name == "副坝位移监测"){
resData = this.filterStationsByCode(data.data, {
prefix: "ZY-",
start: 1,
end: 4,
digitLength: 2,
});
}else{
resData = data.data.filter(item => item.stationCode == 'WY-32')
}
2025-09-23 17:01:20 +08:00
// this.zwyData = resData;
this.zwyData = data.data;
2025-04-18 13:53:13 +08:00
}
} catch (error) {
uni.$showMsg();
}
2024-11-21 17:53:13 +08:00
},
2025-04-18 13:53:13 +08:00
async getzsyData() {
try {
const { data } = await uni.$http.get(
2025-12-18 17:53:20 +08:00
"/gunshiApp/hsz/osmoticPressR/list/value?type=1"
2025-04-18 13:53:13 +08:00
);
if (data.code == 200) {
2025-12-18 17:53:20 +08:00
this.zsyData = data.data;
2025-04-18 13:53:13 +08:00
}
} catch (error) {
uni.$showMsg();
}
2024-11-21 17:53:13 +08:00
},
2025-04-18 13:53:13 +08:00
},
mounted() {
this.getSlData();
this.getZwyData();
this.getzsyData();
2025-09-28 17:47:19 +08:00
this.getByData();
2025-04-18 13:53:13 +08:00
},
onLoad(options) {
this.name = options.name;
2025-09-28 17:47:19 +08:00
this.deviceId = options.deviceId || '';
2025-04-18 13:53:13 +08:00
},
};
2024-11-21 17:53:13 +08:00
</script>
<style lang="scss" scoped>
</style>