lxh 2 weeks ago
parent
commit
7aad7dd300

+ 2 - 2
.env.development

@@ -30,6 +30,6 @@ VITE_GLOB_API_URL_PREFIX=
 #微前端qiankun应用,命名必须以VITE_APP_SUB_开头,jeecg-app-1为子应用的项目名称,也是子应用的路由父路径
 #VITE_APP_SUB_APP = [["micro-need-air", "//10.10.150.72:8099/"], ["micro-vent-3dModal", "//localhost:8091/"], ["micro-fire-front", "//localhost:8090/"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.88:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
-VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.154:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
-# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"], ["micro-need-air", "//182.92.126.35:8099/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
+# VITE_APP_SUB_APP = [["micro-vent-3dModal", "//192.168.183.154:8091/", "micro-vent-3dModal"], ["micro-need-air", "//192.168.183.88:8093/", "micro-need-air"], ["micro-fire-front", "//localhost:8097/", "fire-Micro"]]
+VITE_APP_SUB_APP = [["micro-vent-3dModal", "//182.92.126.35:8091/", "micro-vent-3dModal"], ["micro-need-air", "//182.92.126.35:8099/", "micro-need-air"], ["micro-fire-front", "//182.92.126.35:8097/", "fire-Micro"]]
 # VITE_APP_SUB_APP = [["micro-vent-3dModal", "//localhost:8091/"], ["micro-need-air", "//localhost:8099/"], ["micro-fire-front", "//localhost:8090/"]]

+ 98 - 0
src/views/vent/gas/gasReportInspect/gasReportInspect.data.ts

@@ -139,6 +139,104 @@ export const columnSgt: BasicColumn[] = [
         align: 'center',
     },  
 ];
+//寸草塔二矿
+export const columnCctr: BasicColumn[] = [
+    {
+        title: '序号',
+        width: 60,
+        align: 'center',
+        customRender: ({ index }: { index: number }) => `${index + 1}`
+    },
+    {
+        title: '监测地点',
+        dataIndex: 'jcdd',
+        key: 'jcdd',
+        width:260,
+        align: 'center',
+    }, 
+    {
+        title: 'CH₄(%)',
+        dataIndex: 'ch4',
+        key: 'ch4',
+        align: 'center',
+    },
+    {
+        title: 'CO₂(%)',
+        dataIndex: 'co2',
+        key: 'co2',
+        align: 'center',
+    },
+    {
+        title: 'CO(ppm)',
+        dataIndex: 'co',
+        key: 'co',
+        align: 'center',
+    },
+    {
+        title: 'O₂(%)',
+        dataIndex: 'o2',
+        key: 'o2',
+        align: 'center',
+    },
+    {
+        title: 'T(°C)',
+        dataIndex: 't',
+        key: 't',
+        align: 'center',
+    },
+];
+//榆家梁
+export const columnYjl: BasicColumn[] = [
+    {
+        title: '序号',
+        width: 60,
+        align: 'center',
+        customRender: ({ index }: { index: number }) => `${index + 1}`
+    },
+    {
+        title: '监测地点',
+        dataIndex: 'jcdd',
+        key: 'jcdd',
+        width:260,
+        align: 'center',
+    }, 
+    {
+        title: 'CH₄(%)',
+        dataIndex: 'ch4',
+        key: 'ch4',
+        align: 'center',
+    },
+    {
+        title: 'CO₂(%)',
+        dataIndex: 'co2',
+        key: 'co2',
+        align: 'center',
+    },
+    {
+        title: 'CO(ppm)',
+        dataIndex: 'co',
+        key: 'co',
+        align: 'center',
+    },
+    {
+        title: 'O₂(%)',
+        dataIndex: 'o2',
+        key: 'o2',
+        align: 'center',
+    },
+    {
+        title: 'T(°C)',
+        dataIndex: 't',
+        key: 't',
+        align: 'center',
+    },
+    {
+        title: '检查人',
+        dataIndex: 'checkPerson',
+        key: 'checkPerson',
+        align: 'center',
+    },  
+];
 //补连塔
 export const columnBlt: BasicColumn[] = [
     {

+ 2 - 2
src/views/vent/gas/gasReportInspect/index-time.vue

@@ -36,7 +36,7 @@ import { ref, nextTick, reactive, onMounted } from 'vue';
 import fileSystem from './comment/common/cameraTree.vue';
 import { SvgIcon } from '/@/components/Icon';
 import treeIcon from './comment/common/Icon/treeIcon.vue';
-import { columnsType,columnBlt,columnBd,columnSgt} from './gasReportInspect.data';
+import { columnsType,columnBlt,columnBd,columnSgt,columnCctr,columnYjl} from './gasReportInspect.data';
 import { queryReportData } from './gasReportInspect.api';
 import { useGlobSetting } from '/@/hooks/setting';
 
@@ -51,7 +51,7 @@ let selected = reactive<any>({
     title: '',
     isFolder: false,
 });
-let columns=glob.sysOrgCode=='sdmtjtbltmk' ? columnBlt : glob.sysOrgCode=='sdmtjtbdmk' ? columnBd :  glob.sysOrgCode=='sdmtjtsgtmk' ? columnSgt :  columnsType
+let columns=glob.sysOrgCode=='sdmtjtbltmk' ? columnBlt : glob.sysOrgCode=='sdmtjtbdmk' ? columnBd :  glob.sysOrgCode=='sdmtjtsgtmk' ? columnSgt : glob.sysOrgCode=='sdmtjtcctrk' ? columnCctr : glob.sysOrgCode=='sdmtjtyjlmk' ? columnYjl : columnsType
 let tableData = ref<any[]>([])
 let handlerToggle = (param) => {
     gasType.value = param

+ 17 - 1
src/views/vent/monitorManager/alarmMonitor/common.api.ts

@@ -3,7 +3,9 @@ import { defHttp } from '/@/utils/http/axios';
 enum Api {
   sysTypeWarnList = '/safety/ventanalyAlarmLog/sysTypeWarn',
   sysWarn = '/safety/ventanalyAlarmLog/sysWarn',
-  getDevice = '/monitor/device',
+  getDevice = '/monitor/device',//实时数据
+  listdays='/safety/ventanalyMonitorData/listdays',//历史数据
+  bjlist='/safety/ventanalyAlarmLog/list'//报警历史数据
 }
 
 /**
@@ -23,3 +25,17 @@ export const sysWarn = (params) => defHttp.post({ url: Api.sysWarn, params });
  * @param params
  */
 export const getDevice = (params) => defHttp.post({ url: Api.getDevice, params });
+
+/**
+ * 历史数据
+ * @param params
+ */
+export const listdays = (params) => defHttp.get({ url: Api.listdays, params }, { joinParamsToUrl: true });
+
+/**
+ * 报警历史数据
+ * @param params
+ */
+export const bjlist = (params) => defHttp.get({ url: Api.bjlist, params }, { joinParamsToUrl: true });
+
+

+ 1 - 0
src/views/vent/monitorManager/alarmMonitor/common.data.ts

@@ -37,6 +37,7 @@ export function getMonitorComponent() {
       typeMenuListGas = [{ name: '预警监测' }, { name: '预警指标' }, { name: '瓦斯参数' }];
       return typeMenuListGas;
     default:
+      // typeMenuListGas = [{ name: '预警监测' },{ name: '管道故障诊断' }, { name: '预警指标' }];
       typeMenuListGas = [{ name: '预警监测' }, { name: '预警指标' }];
       return typeMenuListGas;
   }

+ 307 - 0
src/views/vent/monitorManager/alarmMonitor/common/faultDiagnose.vue

@@ -0,0 +1,307 @@
+<template>
+    <div class="faultDiagnose">
+        <div class="top-box">
+            <div class="nav" v-for="(item, index) in topList" :key="index">
+                <div class="pic" v-if="item.imgSrc">
+                    <img :src="imgUrl" alt="" />
+                     <SvgIcon class="icon-style" :name="item.icon" style=" position: absolute;left: 50%;top:50%;transform: translate(-50%,-50%); width: 60px; height: 38px" />
+                </div>
+                <div class="content" v-if="item.label && item.value">
+                    <span>{{ item.label }}</span>
+                    <span>{{ item.value }}</span>
+                </div>
+                <!-- <div class="text" v-if="item.text">{{ item.text }}</div> -->
+                <!-- <div class="percent" v-if="item.list.length != 0">
+                    <div class="title">{{ item.label }}</div>
+                    <div class="value">
+                        <div class="content-box" v-for="(items, ind) in item.list" :key="ind">
+                            <span style="color: #b3b8cc">{{ `${items.label} :` }}</span>
+                            <span style="color: var(--vent-table-action-link); margin-left: 10px">{{ `${items.value}%`
+                                }}</span>
+                        </div>
+                    </div>
+                </div> -->
+            </div>
+        </div>
+        <div class="bot-box">
+            <div class="left-area-box">
+                <div class="title-t">
+                    <div class="text-t">历史数据图表</div>
+                </div>
+                <a-form :model="formState" layout="inline" :label-col="{ style: { width: '80px' } }"
+                    :wrapper-col="{ span: 8 }">
+                    <a-form-item label="开始时间:">
+                        <a-date-picker v-model:value="formState.ttime_begin" style="width:220px" show-time
+                            valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" />
+                    </a-form-item>
+                    <a-form-item label="结束时间:">
+                        <a-date-picker v-model:value="formState.ttime_end" style="width:220px" show-time
+                            valueFormat="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" />
+                    </a-form-item>
+                    <a-form-item label="">
+                        <a-button type="primary" @click="getSearchHis">查询</a-button>
+                    </a-form-item>
+                </a-form>
+                <div class="echart-area-box"></div>
+            </div>
+            <div class="right-area-box">
+                <div class="title-t">
+                    <div class="text-t">瓦斯抽采泵信息</div>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script setup lang="ts">
+import { ref, reactive, watch } from 'vue';
+import dayjs from 'dayjs';
+import imgUrl from '/@/assets/images/fire/pie.png';
+import { SvgIcon } from '/@/components/Icon';
+let props = defineProps({
+    timeData: {
+        type: String,
+        default: ''
+    },
+    //顶部区域数据
+    topData:{
+        type:Array,
+        default:()=>{
+            return  []
+        }
+    }
+})
+
+let formState = reactive({
+    ttime_begin: '',
+    ttime_end: ''
+})
+let $emit = defineEmits(['getSearchHis'])
+const topList = ref<any[]>()
+
+
+const getSearchHis = () => {
+    console.log(formState, '000===')
+    $emit('getSearchHis', formState)
+}
+
+watch(() => props.timeData, (newV, oldV) => {
+    console.log(newV, 'time---')
+    if (newV) {
+        let index = newV.indexOf(' ')
+        let specificTime = dayjs(`${newV.substring(0, index)}T${newV.substring(index + 1)}`)
+        console.log(specificTime, 'specificTime')
+        formState.ttime_begin = specificTime.subtract(30, 'minute').format('YYYY-MM-DD HH:mm:ss')
+        console.log('前半个小时:', formState.ttime_begin);
+        formState.ttime_end = specificTime.add(30, 'minute').format('YYYY-MM-DD HH:mm:ss')
+        console.log('后半个小时:', formState.ttime_end);
+    }
+}, {
+    immediate: true
+})
+watch(()=>props.topData,(newT,oldT)=>{
+if(newT){
+    topList.value=newT
+}
+},{
+    immediate:true
+})
+</script>
+
+<style lang="less" scoped>
+@import '/@/design/theme.less';
+
+@{theme-deepblue} {
+    .faultDiagnose {
+        --image-bj1: url('/@/assets/images/themify/deepblue/fire/bj1.png');
+    --image-max: url('/@/assets/images/themify/deepblue/fire/max.svg');
+    --image-min: url('/@/assets/images/themify/deepblue/fire/min.svg');
+    --image-pj: url('/@/assets/images/themify/deepblue/fire/pj.svg');
+    --image-bj1: url('/@/assets/images/themify/deepblue/fire/bj1.png');
+    --image-14174: url('/@/assets/images/themify/deepblue/fire/14174.png');
+    --image-contetn: url('/@/assets/images/themify/deepblue/fire/contetn.png');
+    }
+}
+
+.faultDiagnose {
+    --image-bj1: url('/@/assets/images/fire/bj1.png');
+  --image-max: url('/@/assets/images/fire/max.svg');
+  --image-min: url('/@/assets/images/fire/min.svg');
+  --image-pj: url('/@/assets/images/fire/pj.svg');
+  --image-bj1: url('/@/assets/images/fire/bj1.png');
+  --image-14174: url('/@/assets/images/fire/14174.png');
+  --image-contetn: url('/@/assets/images/fire/contetn.png');
+  --border-image-2: linear-gradient(to bottom, transparent, #024688, transparent);
+    width: 100%;
+    height: 100%;
+
+    .top-box {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        height: 120px;
+        margin-bottom: 10px;
+        padding: 10px;
+        background: var(--image-bj1) no-repeat center;
+        background-size: 100% 100%;
+        box-sizing: border-box;
+
+        .nav {
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            flex: 1;
+                height: 100%;
+                border-right: 2px solid;
+                border-image: var(--border-image-2) 1 1 1;
+            // &:nth-child(1) {
+            //     flex: 1;
+            //     height: 100%;
+            //     border-right: 2px solid;
+            //     border-image: var(--border-image-2) 1 1 1;
+            // }
+
+            // &:nth-child(2) {
+            //     flex: 1;
+            //     height: 100%;
+            //     border-right: 2px solid;
+            //     border-image: var(--border-image-2) 1 1 1;
+            // }
+
+            // &:nth-child(3) {
+            //     flex: 1;
+            //     height: 100%;
+            //     border-right: 2px solid;
+            //     border-image: var(--border-image-2) 1 1 1;
+            // }
+
+            // &:nth-child(4) {
+            //     flex: 0.6;
+            //     color: #b3b8cc;
+            //     font-size: 16px;
+            //     height: 100%;
+            //     border-right: 2px solid;
+            //     border-image: var(--border-image-2) 1 1 1;
+            // }
+
+            // &:nth-child(5) {
+            //     flex: 1.4;
+            //     height: 100%;
+
+    
+            // }
+
+            .pic {
+                position:relative;
+                width: 30%;
+                height: 82%;
+
+                img {
+                    width: 100%;
+                    height: 100%;
+                }
+            }
+
+            .content {
+                height: 82%;
+                margin-left: 15px;
+                color: #fff;
+                display: flex;
+                flex-direction: column;
+                justify-content: space-around;
+
+                span {
+                    font-size: 14px;
+
+                    &:nth-child(1) {
+                        padding: 5px 0px;
+                        color: #b3b8cc;
+                    }
+
+                    &:nth-child(2) {
+                        font-family: 'douyuFont';
+                        font-size: 16px;
+                        color: var(--vent-table-action-link);
+                    }
+                }
+            }
+        }
+
+        // .nav:nth-child(1) .pic {
+        //     background: var(--image-max) no-repeat center;
+        //     background-size: 50% 50%;
+        // }
+
+        // .nav:nth-child(2) .pic {
+        //     background: var(--image-min) no-repeat center;
+        //     background-size: 50% 50%;
+        // }
+
+        // .nav:nth-child(3) .pic {
+        //     background: var(--image-pj) no-repeat center;
+        //     background-size: 50% 50%;
+        // }
+    }
+
+    .title-t {
+        height: 30px;
+        margin-bottom: 10px;
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+
+        .text-t {
+            font-family: 'douyuFont';
+            font-size: 14px;
+            color: #fff;
+        }
+    }
+
+    .bot-box {
+        display: flex;
+        justify-content: space-between;
+        height: calc(100% - 130px);
+
+        .left-area-box {
+            width: calc(50% - 5px);
+            height: 100%;
+            padding: 10px;
+            background: var(--image-bj1) no-repeat center;
+            background-size: 100% 100%;
+            box-sizing: border-box;
+
+            .echart-area-box {
+                height: calc(100% - 75px)
+            }
+        }
+
+        .right-area-box {
+            width: calc(50% - 5px);
+            height: 100%;
+            padding: 10px;
+            background: var(--image-bj1) no-repeat center;
+            background-size: 100% 100%;
+            box-sizing: border-box;
+        }
+    }
+
+}
+
+::v-deep .zxm-form-item-label>label {
+    color: #ccc
+}
+
+:deep(.zxm-picker-input > input) {
+    color: #fff;
+}
+
+:deep(.zxm-picker) {
+    border: 1px solid #3ad8ff77 !important;
+    background-color: #ffffff00 !important;
+    color: #fff !important;
+}
+
+:deep(.zxm-picker-suffix) {
+    color: #fff;
+}
+</style>

+ 30 - 53
src/views/vent/monitorManager/alarmMonitor/warn/fireWarn.vue

@@ -105,6 +105,7 @@ async function getMenuList() {
           detail: el.detail
         });
       });
+      getDetailList(menuList[activeIndex1.value].detail)
     } else if (activeIndex.value == 1 && menuList1.external && menuList1.external.length > 0) {
       menuList1.external.forEach((el: any) => {
         menuList.push({
@@ -116,8 +117,20 @@ async function getMenuList() {
           detail: el.detail
         });
       });
+      strType.value = menuList[activeIndex1.value].strtype;
+      getDetailList(menuList[activeIndex1.value].detail)
+    }else {
+      menuList1.info.forEach((el) => {
+        menuList.push({
+          name: el.sysname,
+          // warn: '正常',
+          deviceID: el.sysid,
+          strtype: '',
+        });
+      }); 
+      tableLists.value = menuList1.info[activeIndex1.value].list;
     }
-    getDetailList(menuList[activeIndex1.value].detail)
+   
   }
 }
 //获取右侧详情弹窗数据
@@ -138,97 +151,61 @@ function fireMenuToggle(ind) {
     case 0:
       loading.value = true;
       setTimeout(() => {
+         clearTimeout(timer);
         activeIndex1.value = 0;
-        menuList.length = 0;
-        getClearList();
-        clearTimeout(timer);
         currentLoad.value = '';
-        menuList1.internal.forEach((el) => {
-          menuList.push({
-            name: el.systemname,
-            warn: el.warnDes,
-            type: 'on',
-            deviceID: el.id,
-            strtype: el.strtype,
-          });
-        });
-        getMonitor(true);
+        getClearList();
+       getMonitor(true);  
         loading.value = false;
       }, 1000);
       break;
     case 1:
       loading.value = true;
       setTimeout(() => {
+          clearTimeout(timer);
         activeIndex1.value = 0;
-        menuList.length = 0;
-        clearTimeout(timer);
-        getClearList();
         currentLoad.value = '';
-        if (menuList1.external.length != 0) {
-          menuList1.external.forEach((el) => {
-            menuList.push({
-              name: el.systemname,
-              warn: el.warnDes,
-              type: 'out',
-              deviceID: el.id,
-              strtype: el.strtype,
-            });
-          });
-          getMonitor(true);
-          strType.value = menuList[activeIndex1.value].strtype;
-        } else {
-          menuList.length = 0;
-          clearTimeout(timer);
-          currentLoad.value = '';
-        }
+        getClearList();
+           getMonitor(true);
         loading.value = false;
       }, 1000);
       break;
     case 2:
-      clearTimeout(timer);
-      menuList.length = 0;
+    loading.value = true;
+      setTimeout(() => {
+        clearTimeout(timer);
       activeIndex1.value = 0;
-      menuList1.info.forEach((el) => {
-        menuList.push({
-          name: el.sysname,
-          // warn: '正常',
-          deviceID: el.sysid,
-          strtype: '',
-        });
-      });
+      currentLoad.value = '';
       loadZb();
+      getMonitor(true);
+        loading.value = false;
+      }, 1000);
+
       break;
   }
 }
 //加载预警指标组件
 function loadZb() {
-  loading.value = true;
-  setTimeout(() => {
-    tableLists.value = menuList1.info[0].list;
     const { sysOrgCode } = useGlobSetting();
     switch (sysOrgCode) {
       case 'sdmtjtbdmk': // 宝德
         currentLoad.value = 'warnFireBd';
-        loading.value = false;
         return currentLoad.value;
       case 'sdmtjtbetmk': // 布尔台
         currentLoad.value = 'warnFireBrt';
-        loading.value = false;
         return currentLoad.value;
       default:
         currentLoad.value = 'warnFireBrt';
-        loading.value = false;
         return currentLoad.value;
     }
-  }, 1000);
 }
 //菜单选项切换
 function cardClick(ind, item) {
   if (activeIndex.value != 2) {
     loading.value = true;
     setTimeout(() => {
-      activeIndex1.value = ind;
       clearTimeout(timer);
+      activeIndex1.value = ind;
       getClearList();
       strType.value = item.strtype;
       currentLoad.value = '';
@@ -240,7 +217,7 @@ function cardClick(ind, item) {
     setTimeout(() => {
       clearTimeout(timer);
       activeIndex1.value = ind;
-      tableLists.value = menuList1.info[ind].list;
+      getMonitor(true);
       loading.value = false;
     }, 1000);
   }

+ 141 - 27
src/views/vent/monitorManager/alarmMonitor/warn/gasWarn.vue

@@ -7,9 +7,9 @@
     </a-button>
     <div class="alarm-menu">
       <div class="type-btn">
-        <div :class="activeIndex == index ? 'btn1' : 'btn'"
-          :style="{ width: sysOrgCode == 'sdmtjtdltmk' ? '50%' : '33.33%' }" v-for="(item, index) in typeMenuListGas"
-          :key="index" @click="btnClick(index)">
+      
+        <div :class="activeIndex == index ? 'btn1' : 'btn'" v-for="(item, index) in typeMenuListGas" :key="index"
+          @click="btnClick(index)">
           {{ item.name }}
         </div>
       </div>
@@ -41,22 +41,22 @@
                     'box-value4': items.val == 104 && items.name == '报警状态',
                     'box-value5': (items.val == 201 || item.val == 1001) && items.name == '报警状态',
                   }">{{
-                      items.val == 0 && items.name == '报警状态'
-                        ? '正常'
-                        : items.val == 101 && items.name == '报警状态'
-                          ? '较低风险'
-                          : items.val == 102 && items.name == '报警状态'
-                            ? '低风险'
-                            : items.val == 103 && items.name == '报警状态'
-                              ? '中风险'
-                              : items.val == 104 && items.name == '报警状态'
-                                ? '高风险'
-                                : items.val == 201 && items.name == '报警状态'
-                                  ? '报警'
-                                  : items.val == 1001 && items.name == '报警状态'
-                                    ? '网络断开'
-                                    : items.val
-                    }}</span>
+                    items.val == 0 && items.name == '报警状态'
+                      ? '正常'
+                      : items.val == 101 && items.name == '报警状态'
+                        ? '较低风险'
+                        : items.val == 102 && items.name == '报警状态'
+                          ? '低风险'
+                          : items.val == 103 && items.name == '报警状态'
+                            ? '中风险'
+                            : items.val == 104 && items.name == '报警状态'
+                              ? '高风险'
+                              : items.val == 201 && items.name == '报警状态'
+                                ? '报警'
+                                : items.val == 1001 && items.name == '报警状态'
+                                  ? '网络断开'
+                                  : items.val
+                  }}</span>
                 </div>
               </div>
             </div>
@@ -73,25 +73,29 @@
       <div style="width: 100%; height: 100%" v-else-if="isShow == 'wscs'">
         <gasParamter />
       </div>
+      <div style="width: 100%; height: 100%" v-else-if="isShow == 'gzzd'">
+       <faultDiagnose :timeData="gzTime" :topData="topData" @getSearchHis="getlistdaysData1"></faultDiagnose>
+      </div>
     </div>
   </div>
 </template>
 
 <script setup lang="ts">
 import { ref, reactive, onMounted, onUnmounted } from 'vue';
-import { sysTypeWarnList, sysWarn } from '../common.api';
+import { sysTypeWarnList, sysWarn,getDevice,listdays,bjlist } from '../common.api';
 import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
 import { useRouter } from 'vue-router';
 import CustomHeader from '/@/components/vent/customHeader.vue';
 import warnTargetGas from '../common/warnTargetGas.vue';
 import gasParamter from '../common/gasParamter.vue';
+import faultDiagnose from '../common/faultDiagnose.vue'
 import { getMonitorComponent } from '../common.data';
 import { usePermission } from '/@/hooks/web/usePermission';
 import { useGlobSetting } from '/@/hooks/setting';
 import MeasurePoint from '../common/measurePoint.vue';
+import dayjs from 'dayjs';
 
 let typeMenuListGas = getMonitorComponent();
-const { sysOrgCode } = useGlobSetting();
 const { hasPermission } = usePermission();
 const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
 //当前左侧激活菜单的索引
@@ -107,13 +111,28 @@ let router = useRouter();
 //监测/指标激活索引
 let activeIndex = ref(0);
 let isShow = ref('yjjc');
-
+let historySearch = reactive({
+    ttime_begin: dayjs().format('YYYY-MM-DD HH:mm:ss'),
+    ttime_end: dayjs().format('YYYY-MM-DD HH:mm:ss')
+})
+//故障诊断开始时间
+let gzTime=ref('')
+//故障诊断顶部区域数据
+let topData=ref<any[]>([])
 // https获取监测数据
 let timer: null | NodeJS.Timeout = null;
 function getMonitor(flag?) {
   timer = setTimeout(
     async () => {
-      await getMenuList()
+      const { sysOrgCode } = useGlobSetting();
+      if (sysOrgCode == 'sdmtjtbetmk') {
+        await getMenuList()
+      } else if(sysOrgCode != 'sdmtjtbetmk' && activeIndex.value==1) {
+       await getBjlist()
+      }else {
+        await getMenuList()
+      }
+     
       if (timer) {
         timer = null;
       }
@@ -203,6 +222,93 @@ async function getMenuList() {
     getDetailList(menuList[activeIndex1.value].detail);
   }
 }
+//寸草塔二矿左侧菜单
+async function getBjlist(){
+  let res=await bjlist({devicetype: 'gasmonitor*',pageNo:1,pageSize:100,isok:'0',})
+  console.log(res,'寸草塔二矿左侧菜单')
+  if (res && res.records.length!=0) {
+    menuList.length = 0;
+    res.records.forEach((el) => {
+      menuList.push({
+        name: el.devicename,
+        warn: '故障',
+        deviceID: el.deviceid,
+        time:el.starttime
+        // strtype: el.strtype,
+        // detail: el.detail
+      });
+    });
+    gzTime.value=menuList[activeIndex1.value].time
+    //获取实时数据-报警历史
+    getDeviceList(menuList[activeIndex1.value].deviceID)
+    //获取历史数据
+    getlistdaysData(menuList[activeIndex1.value].deviceID,historySearch)
+  }
+}
+
+//获取实时数据-寸草塔二矿-报警历史
+async function getDeviceList(param){
+  let res=await getDevice({ids:param,devicetype: "gasmonitor"})
+  if(res && res.msgTxt.length!=0){
+    let data=res.msgTxt[0].datalist[0]
+    topData.value=[
+    {
+        id: 0,
+        label: '瓦斯浓度(%)',
+        imgSrc: true,
+        icon:'link',
+        value: data.readData.gasC || '--',
+      
+    },
+    {
+        id: 1,
+        label: '二氧化碳浓度(%)',
+        imgSrc: true,
+        icon:'co2val',
+        value: data.readData.co2val || '--',
+        
+    },
+    {
+        id: 2,
+        label: '瓦斯抽采混量',
+        imgSrc: true,
+        icon:'link',
+        value: data.readData.gasMixMass || '--',
+     
+    },
+    {
+        id: 3,
+        label: '报警状态',
+        imgSrc: true,
+        icon:'alarm-warning',
+        value: data.warnLevel=='101' ? '低风险' : data.warnLevel=='102' ? '一般风险' : data.warnLevel=='103' ? '较大风险' : data.warnLevel=='104' ? '重大风险' : data.warnLevel=='201' ? '报警' : data.warnLevel=='10000' ? '数据超限' : data.warnLevel=='1001'? '网络中断' : '正常',
+     
+    },
+    {
+        id: 4,
+        label: '通信状态',
+        imgSrc: true,
+        icon:'link',
+        value: data.netStatus=='0' ? '断开' : '连接',
+    },
+]
+
+  }
+  console.log(res,'寸草塔二矿实时数据-报警历史')
+
+}
+//获取历史数据-寸草塔二矿
+async function getlistdaysData(Ids,param){
+  let res=await listdays({strtype: 'gasmonitor_normal',gdeviceid:Ids,...param})
+  console.log(res,'获取历史数据-寸草塔二矿')
+}
+async function getlistdaysData1(param){
+  console.log(param,'param---')
+  historySearch.ttime_begin=param.ttime_begin
+  historySearch.ttime_end=param.ttime_end
+  let res=await listdays({strtype: 'gasmonitor_normal',gdeviceid:menuList[activeIndex1.value].deviceID,...historySearch})
+  console.log(res,'获取历史数据-寸草塔二矿')
+}
 
 //监测/预警指标选项切换
 function btnClick(ind) {
@@ -213,12 +319,19 @@ function btnClick(ind) {
       activeIndex1.value = 0;
       isShow.value = 'yjjc';
       break;
+    // case 1:
+    //   const { sysOrgCode } = useGlobSetting();
+    //   if (sysOrgCode == 'sdmtjtbetmk') {
+    //     activeIndex1.value = 0;
+    //     isShow.value = 'yjzb';
+    //   } else {
+    //     activeIndex1.value = 0;
+    //     isShow.value = 'gzzd';
+    //     getMonitor(true);
+    //   }
+    //   break;
     case 1:
       activeIndex1.value = 0;
-      isShow.value = 'yjzb';
-      break;
-    case 2:
-      activeIndex1.value = 0;
       isShow.value = 'wscs';
       break;
   }
@@ -228,6 +341,7 @@ function btnClick(ind) {
 function cardClick(ind, item) {
   clearTimeout(timer);
   activeIndex1.value = ind;
+  gzTime.value=item.time
   chartListWs.length = 0;
   getMonitor(true);
 }