Browse Source

Merge branch 'master' of http://182.92.126.35:3000/hrx/mky-vent-base

lxh 9 months ago
parent
commit
71dfb02b2e

+ 30 - 6
src/views/vent/comment/history/HistoryTable.vue

@@ -19,12 +19,34 @@
   // 用于服务场景类历史数据业务,这类数据通常由一条数据返回多个子设备的信息,例如:{ forcFan1Temp, forcFan2Temp };
   // 而此组件可以将这些数据分类,例如:表格只有 温度 一列,但可以根据所选的子设备展示不同的数据;
   // 综上所述,此组件在基础的历史数据组件上添加了子设备下拉框(由字典驱动),用户选择子设备后表头将动态调整以适配数据展示;
+  //
   // 使用方法如下:
   // 设有历史数据2条,[{ name, forcFan1Temp, forcFan2Temp }, { name, forcFan1Temp, forcFan2Temp }]。
-  // 1、配置设备字段(通常是综合管理-设备字段管理),加$的字段将允许动态展示数据。如 name-名称,$Temp-温度。
-  // 2、配置数据字典(通常是设置-数据字典),为上述设备的子设备添加编码。如 压风机1-forcFan1,压风机2-forcFan2。
-  // 3、配合前端开发人员开发,调用该组件并使用上面定好的device-code(设备字段)、dict-code(数据字典)。
-  // 4、测试结果,子设备选择 压风机1 时,表格会读取 name、forcFan1Temp 作展示。
+  //
+  // 1、配置设备字段(参考公司端综合设备管理-设备字段管理)
+  // 以压风机为例,设压风机设备的历史数据编码为forcFan_history。
+  // 那么字段code中加$的字段将允许动态展示数据,例子如下:
+  //  显示字段    字段code
+  //   温度        $Temp
+  //  安装位置      name
+  //
+  // 2、配置数据字典(参考系统管理-数据字典),为上述设备配置子设备
+  // 同以压风机为例,设压风机子设备字典编码为forcFan_dict,且已经新增到系统中。
+  // 则字典配置的例子如下:
+  //  名称    数据值
+  // 压风机1 forcFan1
+  // 压风机2 forcFan2
+  //
+  // 3、运维人员应配合前端开发人员,使用指定的编码配置内容。
+  // 同以压风机为例,需使用device-code(forcFan)、dict-code(forcFan_dict)。
+  //
+  // 4、其他内容说明
+  // 同以压风机为例,当子设备没有数据是,此时展示的数据是:
+  //  温度    安装位置
+  // 取Temp    取name
+  // 同以压风机为例,当子设备选择压风机1时,此时展示的数据是:
+  //      温度        安装位置
+  // 取forcFan1Temp    取name
   import { onMounted, ref, shallowRef } from 'vue';
   import { BasicColumn, PaginationProps, BasicTable } from '/@/components/Table';
   import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
@@ -43,10 +65,12 @@
       // schemas?: FormSchema[];
       /** 表格分页配置,可以覆写,参考BaiscTable */
       pagination?: PaginationProps;
-      /** 设备编码,该编码用于从字段/点表配置中读出默认表头,示例:forcFan */
+      /** 设备编码,该编码用于请求设备信息,示例:forcFan */
       deviceCode: string;
       /** 字典编码,该编码用于从字典配置中读出设备项,示例:forcFan_dict */
       dictCode: string;
+      /** 字段编码,该编码用于从设备字段配置中读取默认表头信息,示例:forcFan_history */
+      columnsCode: string;
       /** 表格配置,参考BaiscTable,该值会与默认的配置进行浅合并,这里提供的任何配置都是优先的 */
       // tableProps?: BasicTableProps;
       /** 查询表单配置,参考BaiscTable */
@@ -184,7 +208,7 @@
 
   onMounted(async () => {
     await fetchDevice();
-    initTable([deviceInfo.value.deviceType as string, props.deviceCode.concat('_history')], deviceOptions.value, dictOptions.value);
+    initTable([deviceInfo.value.deviceType as string, props.columnsCode], deviceOptions.value, dictOptions.value);
     search();
   });
 </script>

+ 2 - 1
src/views/vent/comment/history/history.data.ts

@@ -62,7 +62,8 @@ export const getDefaultSchemas: (dictCode: any[], deviceOptions: any[]) => FormS
     label: '子设备',
     field: 'deviceNum',
     component: 'Select',
-    required: true,
+    required: Boolean(dictOptions.length),
+    show: Boolean(dictOptions.length),
     defaultValue: dictOptions[0].value,
     componentProps: {
       options: dictOptions,

+ 4 - 2
src/views/vent/monitorManager/compressor/components/nitrogenHistory.vue

@@ -1,10 +1,12 @@
 <template>
   <div class="nitrogen-history">
-    <HistoryTable columns-type="nitrogen" device-type="nitrogen" :sys-id="deviceId" designScope="nitrogen_auto_history" :scroll="{ y: 650 }" />
+    <!-- <HistoryTable columns-type="nitrogen" device-type="nitrogen" :sys-id="deviceId" designScope="nitrogen_auto_history" :scroll="{ y: 650 }" /> -->
+    <HistoryTable device-code="nitrogen" dict-code="nitrogen_dict" columns-code="nitrogen_auto_history" />
   </div>
 </template>
 <script setup lang="ts">
-  import HistoryTable from '../../comment/HistoryTable.vue';
+  // import HistoryTable from '../../comment/HistoryTable.vue';
+  import HistoryTable from '/@/views/vent/comment/history/HistoryTable.vue';
   const props = defineProps({
     deviceType: {
       type: String,

+ 4 - 2
src/views/vent/monitorManager/nitrogen/components/nitrogenHistory.vue

@@ -1,10 +1,12 @@
 <template>
   <div class="nitrogen-history">
-    <HistoryTable columns-type="forcFan" device-type="forcFan" designScope="forcFan_history" :scroll="{ y: 650 }" />
+    <!-- <HistoryTable columns-type="forcFan" device-type="forcFan" designScope="forcFan_history" :scroll="{ y: 650 }" /> -->
+    <HistoryTable device-code="forcFan" dict-code="forcFan_dict" columns-code="forcFan_history" />
   </div>
 </template>
 <script setup lang="ts">
-  import HistoryTable from '../../comment/HistoryTable.vue';
+  // import HistoryTable from '../../comment/HistoryTable.vue';
+  import HistoryTable from '/@/views/vent/comment/history/HistoryTable.vue';
 </script>
 <style lang="less" scoped>
   .nitrogen-history {