Pārlūkot izejas kodu

[Mod 0000] 钻孔数据重新对接

hongrunxia 1 nedēļu atpakaļ
vecāks
revīzija
c538ba7c78

+ 1 - 1
src/utils/ventutil.ts

@@ -275,5 +275,5 @@ export function deviceCameraInit(cameraAddrs, player: HTMLElement, webRtcServerL
  */
 export const get: typeof _.get = (o, p, defaultValue = '-') => {
   const d = _.get(o, p, defaultValue);
-  return !d ? defaultValue : d;
+  return d == undefined ? defaultValue : d;
 };

+ 19 - 19
src/views/vent/gas/gasAssessment/gasAssessment.data.ts

@@ -169,7 +169,7 @@ export const gasMonitor = [
   {
     title: '原始瓦斯含量',
     code: 'originalGasContent',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '工作面瓦斯储量',
@@ -196,7 +196,7 @@ export const gasUnitBase = [
   {
     title: '瓦斯储量',
     code: 'T2',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '钻孔施工长度',
@@ -206,7 +206,7 @@ export const gasUnitBase = [
   {
     title: '单元瓦斯含量',
     code: 'gasC',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '单元原始瓦斯压力',
@@ -228,17 +228,17 @@ export const gasUnitMonitor = [
   {
     title: '瓦斯总储量',
     code: 'T0',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '抽采达标量',
     code: 'T1',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '累计抽采纯量',
     code: 'T2',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '当前抽采率',
@@ -375,15 +375,15 @@ export const gasParamData = [
 
 export const currentGasMonitor = [
   {
-    title: '原始瓦斯含量 (m³/t)',
+    title: '原始瓦斯含量 (m³)',
     code: 'gasOriginalMass',
   },
   {
-    title: '残余瓦斯含量 (m³/t)',
+    title: '残余瓦斯含量 (m³)',
     code: 'gasRemnantMass',
   },
   {
-    title: '残存瓦斯含量 (m³/t)',
+    title: '残存瓦斯含量 (m³)',
     code: 'gasSurviveMass',
   },
   {
@@ -649,7 +649,7 @@ export const gasUnitHlOption: ModuleDataChart = {
   readFrom: '',
   legend: { show: false },
   xAxis: [{ show: true }],
-  yAxis: [{ show: true, name: '混量(m³/t)', position: 'left' }],
+  yAxis: [{ show: true, name: '混量(m³)', position: 'left' }],
   series: [{ readFrom: 'history', xprop: 'time', yprop: 'val', label: '单元瓦斯混量' }],
 };
 
@@ -689,7 +689,7 @@ export const gasUnitClOption: ModuleDataChart = {
   readFrom: '',
   legend: { show: false },
   xAxis: [{ show: true }],
-  yAxis: [{ show: true, name: '纯量(m³/t)', position: 'left' }],
+  yAxis: [{ show: true, name: '纯量(m³)', position: 'left' }],
   series: [{ readFrom: 'history', xprop: 'time', yprop: 'val', label: '单元瓦斯纯量', color: '#FAC858' }],
 };
 
@@ -727,9 +727,9 @@ export const mockGasUnitClData = {
 export const gasUnitOption = [
   {
     legend: '瓦斯浓度',
-    seriesName: '(m³/t)',
+    seriesName: '(m³)',
     ymax: 10000,
-    yname: 'm³/t',
+    yname: 'm³',
     linetype: 'line',
     yaxispos: 'left',
     color: '#37BCF2',
@@ -1307,12 +1307,12 @@ export const unitBaseInfo = [
   {
     title: '煤炭储量',
     code: 'T1',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '瓦斯储量',
     code: 'T2',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '钻孔施工长度',
@@ -1322,7 +1322,7 @@ export const unitBaseInfo = [
   {
     title: '单元瓦斯含量',
     code: 'gasC',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '单元原始瓦斯压力',
@@ -1345,17 +1345,17 @@ export const unitMonitor = [
   {
     title: '瓦斯总储量',
     code: 'T0',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '抽采达标量',
     code: 'T1',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '累计抽采纯量',
     code: 'T2',
-    unit: 'm³/t',
+    unit: 'm³',
   },
   {
     title: '当前抽采率',

+ 52 - 26
src/views/vent/gas/gasZk/index.vue

@@ -12,18 +12,25 @@
         </a-spin>
       </div>
       <div class="right-box">
+        <div class="status">
+          <div class="icon"></div>
+          <div class="status-content">
+            <span class="conten">{{ get(resData, 'curStatus') }}</span>
+            <span>钻杆状态</span>
+          </div>
+        </div>
         <div class="count">
           <div class="icon"></div>
           <div class="count-content">
-            <span class="conten">{{ usedCount }}</span>
+            <span class="conten">{{ get(resData, 'usedCount') }}</span>
             <span>钻孔计数</span>
           </div>
         </div>
-        <div class="status">
+        <div class="count">
           <div class="icon"></div>
-          <div class="status-content">
-            <span class="conten">{{ curStatus }}</span>
-            <span>钻杆状态</span>
+          <div class="count-content">
+            <span class="conten">{{ get(resData, 'usedPercent') ? Number(get(resData, 'usedPercent')).toFixed(2) + '%' : '-' }}</span>
+            <span>钻孔剩余</span>
           </div>
         </div>
       </div>
@@ -37,15 +44,16 @@
   import customHeader from '/@/components/vent/customHeader.vue';
   import { useGlobSetting } from '/@/hooks/setting';
   import Player, { I18N } from 'xgplayer';
-  import ZH from 'xgplayer/es/lang/zh-cn';
   import Mp4Plugin from 'xgplayer-mp4';
+  import { get } from '@/utils/ventutil';
 
   const globSetting = useGlobSetting();
   const baseApiUrl = globSetting.domainUrl;
   const videoPlayTime = ref(0); //视频开始播放时间
-  const curStatus = ref(''); //当前状态
-  const usedCount = ref(''); //钻孔计数
-  const videoUrl = ref('');
+  // const curStatus = ref(''); //当前状态
+  // const usedCount = ref(''); //钻孔计数
+  // const videoUrl = ref('');
+  const resData = ref({});
   const video = ref();
   const loadding = ref(true);
   let timer: IntervalHandle; //定时器
@@ -59,9 +67,10 @@
         const res = await getGasZkStatus({
           playTime: videoPlayTime.value,
         });
+        resData.value = res;
         // 更新数据
-        usedCount.value = res.usedCount;
-        curStatus.value = res.curStatus;
+        // usedCount.value = res.usedCount;
+        // curStatus.value = res.curStatus;
         startPolling();
       } catch (error) {
         console.error('请求失败,停止轮询', error);
@@ -91,7 +100,7 @@
       autoplay: true,
       loop: true,
       // fluid: false,
-      isLive: true,
+      isLive: false,
       playsinline: false,
       screenShot: false,
       // closeVideoClick: true,
@@ -99,9 +108,6 @@
       // closePauseVideoFocus: true,
       // closePlayVideoFocus: true,
       // topBarAutoHide: false,
-      customConfig: {
-        isClickPlayBack: false,
-      },
       controls: false,
       // ignores: ['time', 'start', 'definition', 'error', 'fullscreen', 'i18n', 'loading', 'mobile', 'pc', 'play', 'poster', 'progress', 'replay', 'volume', 'loading', 'pc', 'fullscreen', 'error', 'definition'],
       mp4plugin: {
@@ -109,22 +115,42 @@
         // minBufferLength: 10,
       },
     });
-    player.on('play', async () => {
+
+    player.on('complete', async () => {
+      player.play();
       try {
-        loadding.value = false;
-        videoPlayTime.value = await getVideoPlayTime();
-        // 第一次请求
-        const res = await getGasZkStatus({
-          playTime: videoPlayTime.value,
-        });
-        usedCount.value = res.usedCount;
-        curStatus.value = res.curStatus;
-        // 启动轮询
-        startPolling();
+        if (loadding.value) {
+          loadding.value = false;
+          videoPlayTime.value = await getVideoPlayTime();
+          // 第一次请求
+          const res = await getGasZkStatus({
+            playTime: videoPlayTime.value,
+          });
+          resData.value = res;
+          // 启动轮询
+          startPolling();
+        }
       } catch (error) {
         console.error('初始化失败', error);
       }
     });
+    // player.on('play', async () => {
+    //   try {
+    //     if (loadding.value) {
+    //       loadding.value = false;
+    //       videoPlayTime.value = await getVideoPlayTime();
+    //       // 第一次请求
+    //       const res = await getGasZkStatus({
+    //         playTime: videoPlayTime.value,
+    //       });
+    //       resData.value = res;
+    //       // 启动轮询
+    //       startPolling();
+    //     }
+    //   } catch (error) {
+    //     console.error('初始化失败', error);
+    //   }
+    // });
   };
 
   onMounted(async () => {