tsg-app/pages/sjc/index.vue

181 lines
4.8 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>
<view style="margin-top: 70px; padding: 10px">
<SlTable :tableData="slData" v-if="name == '渗流监测'"></SlTable>
<ZwyTable
:tableData="zwyData"
v-else-if="name == '主坝位移监测'"
></ZwyTable>
<ZwyTable
:tableData="zwyData"
v-else-if="name == '溢洪道位移监测'"
></ZwyTable>
<ZwyTable
:tableData="zwyData"
v-else-if="name == '副坝位移监测'"
></ZwyTable>
<ZsyTable
:tableData="zsyData"
v-else-if="name == '主坝渗压监测'"
></ZsyTable>
<ZsyTable
:tableData="sdData"
v-else-if="name == '灌溉发电洞渗压监测'"
></ZsyTable>
<ZsyTable
:tableData="fbData"
v-else-if="name == '副坝渗压监测'"
></ZsyTable>
<ZwyTable
:tableData="zwyData"
v-else-if="name == '灌溉发电洞变形监测'"
></ZwyTable>
</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";
2024-11-21 17:53:13 +08:00
export default {
2025-04-18 13:53:13 +08:00
components: {
SlTable,
ZwyTable,
ZsyTable,
},
data() {
return {
slData: [], //渗流监测
zwyData: [], //主坝位移监测
zsyData: [], //主坝渗压监测
sdData: [], //发电洞渗压监测
fbData: [], //副坝渗压监测
name: "",
};
},
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(
"/gunshiApp/tsg/osmoticPressR/list/value?type=2"
);
if (data.code == 200) {
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-04-18 13:53:13 +08:00
async getZwyData() {
try {
const { data } = await uni.$http.get(
"/gunshiApp/tsg/osmoticShiftR/list/value"
);
if (data.code == 200) {
let resData = [];
if (this.name == "主坝位移监测") {
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(
"/gunshiApp/tsg/osmoticPressR/list/value?type=1"
);
if (data.code == 200) {
const zb = data.data.filter(
(item) => item?.profileName?.split("+")[0] == "ZB0"
);
const fb = data.data.filter(
(item) => item?.profileName?.split("+")[0] == "FB0"
);
const sd = data.data.filter(
(item) => item?.profileName?.split("+")[0] == "SD0"
);
this.zsyData = zb;
this.fbData = fb;
this.sdData = sd;
}
} 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();
},
onLoad(options) {
this.name = options.name;
},
};
2024-11-21 17:53:13 +08:00
</script>
<style lang="scss" scoped>
</style>