<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="zsyData" v-else-if="name == '灌溉发电洞渗压监测'"></ZsyTable>
          <ZwyTable :tableData="zwyData" v-else-if="name == '灌溉发电洞变型监测'"></ZwyTable>
      </view>
	</view>
</template>
<script>
import SlTable from "./slTable.vue"
import ZwyTable from "./zwyTable.vue"
import ZsyTable from "./zsyTable.vue"
export default {
    components:{
        SlTable,
        ZwyTable,
        ZsyTable
    },
    data() {
        return {
            slData:[], //渗流监测
            zwyData:[],//主坝位移监测
            zsyData:[],//主坝渗压监测
            name:'',
        }
    },
    methods: {
        async getSlData(){
            try {
              const {data} =  await uni.$http.get('/gunshiApp/ykz/osmoticPressR/list/value?type=2')
              if(data.code == 200){
                this.slData = data.data;
              }
            } catch (error) {
                uni.$showMsg();
            }
        },
        async getZwyData(){
            try {
              const {data} =  await uni.$http.get('/gunshiApp/ykz/osmoticShiftR/list/value')
              if(data.code == 200){
                this.zwyData = data.data;
              }
            } catch (error) {
                uni.$showMsg();
            }
        },
        async getzsyData(){
            try {
              const {data} =  await uni.$http.get('/gunshiApp/ykz/osmoticPressR/list/value?type=1')
              if(data.code == 200){
                this.zsyData = data.data;
              }
            } catch (error) {
                uni.$showMsg();
            }
        },
    },
    mounted() {
        this.getSlData();
        this.getZwyData();
        this.getzsyData();
    },
    onLoad(options) {
      this.name=options.name
    }
}
</script>
<style lang="scss" scoped>
    
</style>