Ver código fonte

[Feat 0000]修改塔山火灾页面数据配置项及调整双下拉框组件逻辑

wangkeyi 13 horas atrás
pai
commit
2b8d9ef600

+ 29 - 10
src/views/vent/home/configurable/components/preset/selectorDualChart.vue

@@ -68,8 +68,8 @@
   const visible2 = ref(false);
   const selectedValue1 = ref('');
   const selectedValue2 = ref('');
-  const selectedLabel1 = ref('请选择');
-  const selectedLabel2 = ref('请选择');
+  const selectedLabel1 = ref('');
+  const selectedLabel2 = ref('');
 
   // 从配置中获取选择器配置
   const { chartConfig, selectorConfig1, selectorConfig2 } = props.config.config;
@@ -78,6 +78,7 @@
   const options1 = ref<any[]>([]);
   const options2 = ref<any[]>([]);
   const rawChartData = ref([]); // 存储原始数据,用于过滤
+
   // 处理图标渲染
   const getIcon = (iconName: string) => {
     const iconMap: Record<string, any> = {
@@ -89,9 +90,29 @@
     };
     return iconMap[iconName] || SwapOutlined;
   };
+
+  // 设置默认选中项
+  const setDefaultSelections = () => {
+    // 设置第一个下拉框默认选中第一项
+    if (options1.value.length > 0) {
+      const firstOption1 = options1.value[0];
+      selectedValue1.value = firstOption1.value;
+      selectedLabel1.value = firstOption1.label;
+    }
+
+    // 设置第二个下拉框默认选中第一项
+    if (options2.value.length > 0) {
+      const firstOption2 = options2.value[0];
+      selectedValue2.value = firstOption2.value;
+      selectedLabel2.value = firstOption2.label;
+    }
+  };
+
   // 组件挂载时初始化一次
   onMounted(() => {
     initData();
+    // 设置默认选中项
+    setDefaultSelections();
   });
 
   // 初始化数据
@@ -131,22 +152,20 @@
     // 如果没有原始数据,直接返回空
     if (!rawChartData.value.length) return [];
 
-    // 过滤逻辑:如果选择了值则过滤,未选择则不过滤对应条件
+    // 过滤逻辑:使用选中的值过滤
     return rawChartData.value.filter((item: any) => {
-      const matchFirst = selectedValue1.value ? item.deviceType === selectedValue1.value : true;
-
-      const matchSecond = selectedValue2.value ? item.deviceId === selectedValue2.value : true;
-
+      const matchFirst = item.deviceType === selectedValue1.value;
+      const matchSecond = item.deviceId === selectedValue2.value;
       return matchFirst && matchSecond;
     });
   });
+
   // 监听数据变化,重新初始化
   watch(
     () => props.data,
-    (newData) => {
-      initData();
+    () => {
       nextTick(() => {
-        console.log(chartData.value, '更新后的chartData');
+        initData();
       });
     },
     { immediate: true }

+ 2 - 2
src/views/vent/home/configurable/configurable.api.ts

@@ -8,7 +8,7 @@ enum Api {
   getDisHome = '/monitor/disaster/getDisHome',
   getBDDustData = '/monitor/disaster/getDisDustHome',
   getBDFireData = '/monitor/disaster/getDisFireHome',
-  getDeviceSys = '/ventanaly-device/monitor/system',
+  getDeviceSys = '/ventanaly-device/monitor/getSysFireHomeInfo',
   getAlarmRecord = '/ventanaly-device/safety/ventanalyAlarmLog/sysLinkDevAlarmLog',
 }
 
@@ -216,7 +216,7 @@ export const getBDFireData = (params) => {
     return res;
   });
 };
-// ceshi
+// 塔山火灾预警页面获取数据接口
 export const getDeviceSys = (params) => {
   const key = `${Api.getDeviceSys}?${JSON.stringify(params)}`;
   if (!cache.has(key)) {

+ 46 - 132
src/views/vent/home/configurable/configurable.data.tashan.ts

@@ -154,16 +154,16 @@ export const testConfigTSFire: Config[] = [
   },
   // 3. 光纤测温系统(左下)
   {
-    deviceType: 'pdArray',
+    deviceType: 'deviceInfo',
     moduleName: '光纤测温系统',
     pageType: 'ts_fire',
     moduleData: {
       header: {
         show: true,
-        readFrom: '',
+        readFrom: 'fiber.datalist',
         selector: {
           show: true,
-          value: '${systemname}',
+          value: '${strinstallpos}',
         },
         slot: {
           show: false,
@@ -187,14 +187,15 @@ export const testConfigTSFire: Config[] = [
       chart: [
         {
           type: 'line_smooth',
-          readFrom: 'deviceInfo.fiber.datalist',
-          legend: { show: false },
+          readFrom: 'readData.fibreTemperature',
+          parser: 'json',
+          legend: { show: true },
           xAxis: [{ show: true }],
           yAxis: [{ show: true, name: '温度(℃)', position: 'left' }],
           series: [
             {
               label: '${strinstallpos}',
-              readFrom: 'readData.fibreTemperature',
+              readFrom: '',
               xprop: 'pos',
               yprop: 'value',
             },
@@ -254,6 +255,7 @@ export const testConfigTSFire: Config[] = [
       table: [
         {
           type: 'A',
+          parser: 'json',
           readFrom: 'sysInfo.coalSpoCha',
           columns: [
             {
@@ -506,7 +508,7 @@ export const testConfigTSFire: Config[] = [
       preset: [
         {
           readFrom: '',
-          selectorConfig1: {
+          selectorConfig2: {
             options: [
               {
                 value: 'o2',
@@ -518,7 +520,7 @@ export const testConfigTSFire: Config[] = [
               },
             ],
           },
-          selectorConfig2: {
+          selectorConfig1: {
             options: [
               {
                 value: '1',
@@ -552,8 +554,8 @@ export const testConfigTSFire: Config[] = [
         mockChart: [
           {
             label: '工作面1氧气',
-            deviceType: 'o2',
-            deviceId: '1',
+            deviceId: 'o2',
+            deviceType: '1',
             seriesData: [
               { pos: '0', value: 21 },
               { pos: '10', value: 21 },
@@ -569,8 +571,8 @@ export const testConfigTSFire: Config[] = [
           },
           {
             label: '工作面1一氧化碳',
-            deviceType: 'co',
-            deviceId: '1',
+            deviceId: 'co',
+            deviceType: '1',
             seriesData: [
               { pos: '0', value: 11 },
               { pos: '10', value: 11 },
@@ -586,8 +588,8 @@ export const testConfigTSFire: Config[] = [
           },
           {
             label: '工作面2氧气',
-            deviceType: 'o2',
-            deviceId: '2',
+            deviceId: 'o2',
+            deviceType: '2',
             seriesData: [
               { pos: '0', value: 25 },
               { pos: '10', value: 25 },
@@ -603,8 +605,8 @@ export const testConfigTSFire: Config[] = [
           },
           {
             label: '工作面2一氧化碳',
-            deviceType: 'co',
-            deviceId: '2',
+            deviceId: 'co',
+            deviceType: '2',
             seriesData: [
               { pos: '0', value: 15 },
               { pos: '10', value: 15 },
@@ -666,51 +668,23 @@ export const testConfigTSFire: Config[] = [
       table: [
         {
           type: 'A',
-          readFrom: 'mockTable',
+          readFrom: 'deviceInfo.bundletube.enterWind',
           columns: [
-            { name: '序号', prop: 'serialVal' },
-            { name: '监测点', prop: 'MonitorPoint' },
-            { name: '报警等级', prop: 'warnLevel' },
-            { name: '类型', prop: 'warnType' },
-            { name: '值', prop: 'nowVal' },
+            { name: '监测点', prop: 'strinstallpos' },
+            { name: '温度', prop: 'readData.temperature' },
+            { name: 'ch2', prop: 'readData.ch2val' },
+            { name: 'ch', prop: 'readData.chval' },
+            { name: 'co2', prop: 'readData.co2val' },
+            { name: 'co', prop: 'readData.coval' },
+            { name: 'gas', prop: 'readData.gasval' },
+            { name: 'o2', prop: 'readData.o2val' },
+            { name: '报警等级', prop: 'syswarnLevel_str' },
           ],
         },
       ],
       list: [],
       complex_list: [],
       preset: [],
-      mock: {
-        mockTable: [
-          {
-            serialVal: '1',
-            MonitorPoint: '130608工作面采空区1',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '2',
-            MonitorPoint: '130608工作面采空区1',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '3',
-            MonitorPoint: '130608工作面采空区1',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '4',
-            MonitorPoint: '130608工作面采空区1',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-        ],
-      },
     },
     showStyle: {
       size: 'width:980px;height:270px;',
@@ -718,10 +692,10 @@ export const testConfigTSFire: Config[] = [
       position: 'bottom:8px;left:470px',
     },
   },
-  // 8. 风侧设备监测(中下2)
+  // 8. 风侧设备监测(中下2)
   {
     deviceType: 'RealtimeMonitor',
-    moduleName: '风侧设备监测',
+    moduleName: '风侧设备监测',
     pageType: 'ts_fire',
     moduleData: {
       header: {
@@ -757,51 +731,23 @@ export const testConfigTSFire: Config[] = [
       table: [
         {
           type: 'A',
-          readFrom: 'mockTable',
+          readFrom: 'deviceInfo.bundletube.returnWind',
           columns: [
-            { name: '序号', prop: 'serialVal' },
-            { name: '监测点', prop: 'MonitorPoint' },
-            { name: '报警等级', prop: 'warnLevel' },
-            { name: '类型', prop: 'warnType' },
-            { name: '值', prop: 'nowVal' },
+            { name: '监测点', prop: 'strinstallpos' },
+            { name: '温度', prop: 'readData.temperature' },
+            { name: 'ch2', prop: 'readData.ch2val' },
+            { name: 'ch', prop: 'readData.chval' },
+            { name: 'co2', prop: 'readData.co2val' },
+            { name: 'co', prop: 'readData.coval' },
+            { name: 'gas', prop: 'readData.gasval' },
+            { name: 'o2', prop: 'readData.o2val' },
+            { name: '报警等级', prop: 'syswarnLevel_str' },
           ],
         },
       ],
       list: [],
       complex_list: [],
       preset: [],
-      mock: {
-        mockTable: [
-          {
-            serialVal: '1',
-            MonitorPoint: '130608工作面采空区2',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '2',
-            MonitorPoint: '130608工作面采空区2',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '3',
-            MonitorPoint: '130608工作面采空区2',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '4',
-            MonitorPoint: '130608工作面采空区2',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-        ],
-      },
     },
     showStyle: {
       size: 'width:980px;height:270px;',
@@ -848,51 +794,19 @@ export const testConfigTSFire: Config[] = [
       table: [
         {
           type: 'A',
-          readFrom: 'mockTable',
+          readFrom: 'alarmLog',
           columns: [
-            { name: '序号', prop: 'serialVal' },
-            { name: '监测点', prop: 'MonitorPoint' },
-            { name: '报警等级', prop: 'warnLevel' },
-            { name: '类型', prop: 'warnType' },
-            { name: '值', prop: 'nowVal' },
+            { name: '设备名称', prop: 'devicename' },
+            { name: '预警描述', prop: 'devicekind_dictText' },
+            { name: '预警值名称', prop: 'valuename' },
+            { name: '报警等级', prop: 'nwartype_dictText' },
+            { name: '值', prop: 'val' },
           ],
         },
       ],
       list: [],
       complex_list: [],
       preset: [],
-      mock: {
-        mockTable: [
-          {
-            serialVal: '1',
-            MonitorPoint: '130608工作面采空区3',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '2',
-            MonitorPoint: '130608工作面采空区3',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '3',
-            MonitorPoint: '130608工作面采空区3',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-          {
-            serialVal: '4',
-            MonitorPoint: '130608工作面采空区3',
-            warnLevel: '低风险',
-            warnType: '乙烷',
-            nowVal: '0ppm',
-          },
-        ],
-      },
     },
     showStyle: {
       size: 'width:980px;height:270px;',

+ 22 - 13
src/views/vent/home/configurable/fireTS.vue

@@ -96,11 +96,11 @@
     yjjbLevelStr: '-',
   });
   onMounted(() => {
+    let alarmLogData = [];
     fetchConfigs('ts_fire').then(() => {
       configs.value = testConfigTSFire;
       getDeviceSys({
         devicetype: 'sys',
-        systemID: '1955807282207465474',
         type: 'all',
       }).then((res) => {
         const processedRes = handleData(res);
@@ -110,7 +110,8 @@
           pageNo: '1',
           pageSize: '10',
         }).then((res) => {
-          processedRes.alarmLog = res.records || [];
+          alarmLogData = res.records || [];
+          processedRes.alarmLog = alarmLogData;
           updateData(processedRes);
         });
       });
@@ -118,10 +119,10 @@
     interval = setInterval(() => {
       getDeviceSys({
         devicetype: 'sys',
-        systemID: '1955807282207465474',
         type: 'all',
       }).then((res) => {
         const processedRes = handleData(res);
+        processedRes.alarmLog = alarmLogData;
         updateData(processedRes);
       });
     }, 2000);
@@ -130,17 +131,25 @@
   const handleData = (res: any) => {
     const processedData = { ...res };
     fireSgWarnInfo.value = res?.fireSgWarnInfo || {};
-
-    if (res.sysInfo.coalSpoCha && typeof res.sysInfo.coalSpoCha === 'string') {
-      processedData.sysInfo.coalSpoCha = JSON.parse(`${res.sysInfo.coalSpoCha}` || '[]');
-    }
-    if (res.deviceInfo.fiber) {
-      // Example: process each item in datalist if needed
-      processedData.deviceInfo.fiber.datalist.forEach((item) => {
-        item.readData.fibreTemperature = JSON.parse(`${item.readData.fibreTemperature}` || '[]');
-      });
-      console.log(processedData.deviceInfo.fiber, '11111111111111111111111');
+    // 处理束管数据,分类进风、回风
+    if (processedData.deviceInfo?.bundletube) {
+      const { datalist = [] } = processedData.deviceInfo.bundletube;
+      processedData.deviceInfo.bundletube = {
+        ...processedData.deviceInfo.bundletube,
+        enterWind: datalist.filter((item) => item.strRemark === 'enterWind'),
+        returnWind: datalist.filter((item) => item.strRemark === 'returnWind'),
+      };
     }
+    // 处理开采煤层自燃发火特性
+    // if (processedData.sysInfo.coalSpoCha && typeof processedData.sysInfo.coalSpoCha === 'string') {
+    //   processedData.sysInfo.coalSpoCha = JSON.parse(res.sysInfo.coalSpoCha || '[]');
+    // }
+    // 处理光纤测温数据
+    // if (processedData.deviceInfo?.fiber?.datalist) {
+    //   processedData.deviceInfo.fiber.datalist.forEach((item) => {
+    //     item.readData.fibreTemperature = JSON.parse(item.readData.fibreTemperature || '[]');
+    //   });
+    // }
     return processedData;
   };
 

+ 1 - 1
src/views/vent/home/configurable/hooks/helper.ts

@@ -40,7 +40,7 @@ export function getRawProp(formatter: string): string {
 // 获取模块所依赖的数据的方法
 export function getData(raw, readFrom, parser?) {
   const result = readFrom ? get(raw, readFrom) : raw;
-
+  if (!result) return result;
   switch (parser) {
     case 'json':
       return JSON.parse(result);