204 lines
5.4 KiB
Vue
204 lines
5.4 KiB
Vue
<template>
|
|
<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>
|
|
<ByTable
|
|
:tableData="byData"
|
|
v-else-if="name == '白蚁监测'"
|
|
></ByTable>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import SlTable from "./slTable.vue";
|
|
import ZwyTable from "./zwyTable.vue";
|
|
import ZsyTable from "./zsyTable.vue";
|
|
import ByTable from "./byTable.vue";
|
|
export default {
|
|
components: {
|
|
SlTable,
|
|
ZwyTable,
|
|
ZsyTable,
|
|
ByTable
|
|
},
|
|
data() {
|
|
return {
|
|
slData: [], //渗流监测
|
|
zwyData: [], //主坝位移监测
|
|
zsyData: [], //主坝渗压监测
|
|
sdData: [], //发电洞渗压监测
|
|
fbData: [], //副坝渗压监测
|
|
byData:[],
|
|
name: "",
|
|
deviceId:""
|
|
};
|
|
},
|
|
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;
|
|
});
|
|
},
|
|
async getSlData() {
|
|
try {
|
|
const { data } = await uni.$http.get(
|
|
"/gunshiApp/tsg/osmoticPressR/list/value?type=2"
|
|
);
|
|
if (data.code == 200) {
|
|
this.slData = data.data;
|
|
}
|
|
} catch (error) {
|
|
uni.$showMsg();
|
|
}
|
|
},
|
|
|
|
async getByData() {
|
|
try {
|
|
const { data } = await uni.$http.get(
|
|
`/gunshiApp/tsg/termite/survey/listNewData?deviceId=${this.deviceId}`
|
|
);
|
|
if (data.code == 200) {
|
|
this.byData = data.data;
|
|
}
|
|
} catch (error) {
|
|
uni.$showMsg();
|
|
}
|
|
},
|
|
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')
|
|
}
|
|
// this.zwyData = resData;
|
|
this.zwyData = data.data;
|
|
}
|
|
} catch (error) {
|
|
uni.$showMsg();
|
|
}
|
|
},
|
|
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();
|
|
}
|
|
},
|
|
},
|
|
mounted() {
|
|
this.getSlData();
|
|
this.getZwyData();
|
|
this.getzsyData();
|
|
this.getByData();
|
|
},
|
|
onLoad(options) {
|
|
this.name = options.name;
|
|
this.deviceId = options.deviceId || '';
|
|
},
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
</style> |