123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <template>
- <view>
- <!-- navbar -->
- <p-i-s-navbar></p-i-s-navbar>
-
- <view style="margin-bottom: 200rpx;">
- <!-- 模拟量 -->
- <view v-if="active == 1">
- <p-i-s-content-1 :simulation="simulation" :simulationList="simulationList"></p-i-s-content-1>
- </view>
- <!-- 开关量 -->
- <view v-if="active == 2">
- <p-i-s-content-2 :sluice="sluice" :sluiceList="sluiceList"></p-i-s-content-2>
- </view>
- </view>
-
- <!-- tabbar -->
- <view class="tabbar">
- <view class="list_item">
- <view class="item" :class="active === 1 ? 'active':''" @click="click_item(1)">
- <view class="item_icon icon_one"></view>
- <view class="item_name">
- 模拟量
- </view>
- </view>
- <view class="item" :class="active === 2 ? 'active':''" @click="click_item(2)">
- <view class="item_icon icon_two"></view>
- <view class="item_name">
- 开关量
- </view>
- </view>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- active:1,
-
- // 模拟量
- // 监测统计
- simulation:[],
- simulationList:[],
- // simulationList_img:[],
-
-
- // 开关量
- sluice:[],
- sluiceList:[],
- };
- },
- onLoad() {
- // 模拟量
- this.getSimulation()
- this.getSimulationList()
-
-
- // 开关量
- this.getSluice()
- this.getSluiceList()
-
- },
- methods:{
- click_item(item){
- this.active = item
-
- },
- // 模拟量
- // 监测统计
- async getSimulation(){
- const res = await this.$myRequest({
- method:"POST",
- url: '/safety/total',
- header: {
- 'Content-Type': 'application/json',
- },
- data:{
- type:"simulation"
- }
- })
-
- console.log(res.data.data)
- this.simulation = res.data.data
-
- },
- // 统计项
- async getSimulationList(){
- console.log()
- const res = await this.$myRequest({
- method:"POST",
- url: '/safety/simulation/total',
- header: {
- 'Content-Type': 'application/json',
- 'Authorization':uni.getStorageSync('Authorization'),
- },
- })
-
- console.log(res.data.data)
- this.simulationList = res.data.data
-
-
- // this.originArr = this.simulationList
- // // 新数组,用来装数据
- // var newArr = [];
- // //通过map方法将原始数组中的每一项循环
- // this.originArr.map(function(item,index){
- // //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
- // var sevm = {};
- // //给每一项中的参数初始化并赋值
- // sevm = item.typeCode;
- // //将项放进新的数组
- // newArr[index] = sevm
- // })
- },
-
- // 开关量
- async getSluice(){
- const res = await this.$myRequest({
- method:"POST",
- url: '/safety/total',
- header: {
- 'Content-Type': 'application/json',
- },
- data:{
- type:"sluice"
- }
- })
-
- console.log(res.data.data)
- this.sluice = res.data.data
-
- },
- // 统计项
- async getSluiceList(){
- console.log()
- const res = await this.$myRequest({
- method:"POST",
- url: '/safety/sluice/total',
- header: {
- 'Content-Type': 'application/json',
- 'Authorization':uni.getStorageSync('Authorization'),
- },
- })
-
- console.log(res.data.data)
- this.sluiceList = res.data.data
-
- },
-
- }
- }
- </script>
- <style lang="scss">
-
- .tabbar{
- z-index: 999;
- background-color: #fff;
- position: fixed;
- bottom: 0;
- width: 750rpx;
- .list_item{
- width: 100%;
- border-top: 2rpx solid #f3f3f3;
- box-sizing: border-box;
- padding: 12rpx 0;
-
- .item{
- float: left;
- width: 50%;
- .item_icon{
- margin: 0 auto;
- width: 45rpx;
- height: 45rpx;
-
- background-size: cover;
- background-repeat: no-repeat;
- }
- .icon_one{
- background-image: url(icon/ss1.png);
- }
- .icon_two{
- background-image: url(icon/work.png);
- }
- .item_name{
- text-align: center;
- font-size: 25rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #929292;
- line-height: 40rpx;
- }
- }
- .active{
- .icon_one{
- background-image: url(icon/ss2.png);
- }
- .icon_two{
- background-image: url(icon/work_active.png);
- }
- .item_name{
- color: #3498DB;
- }
- }
- }
- }
- </style>
|