Bläddra i källkod

安全监控分站历史数据

bobo04052021@163.com 2 månader sedan
förälder
incheckning
1b08b66ea1

+ 33 - 56
src/views/vent/deviceManager/comment/HistoryTable.vue

@@ -55,9 +55,8 @@ const emit = defineEmits(['change']);
 const historyType = ref('');
 const historyType = ref('');
 const deviceKide = ref('');
 const deviceKide = ref('');
 const columns = ref([]);
 const columns = ref([]);
-const deviceList = ref([]);
+const deviceOptions = ref([]);
 const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({});
 const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({});
-// let deviceList = ref([]);
 const deviceTypeStr = ref('');
 const deviceTypeStr = ref('');
 loading.value = true;
 loading.value = true;
 
 
@@ -75,19 +74,6 @@ watch(
       // getForm();
       // getForm();
     }
     }
     dataSource.value = [];
     dataSource.value = [];
-    // const column = getTableHeaderColumns(newVal.includes('_history') ? newVal : newVal + '_history');
-    // if (column && column.length < 1) {
-    //   const arr = newVal.split('_');
-    //   console.log('历史记录列表表头------------>', arr[0] + '_monitor');
-    //   columns.value = getTableHeaderColumns(arr[0] + '_history');
-    //   if (columns.value.length < 1) {
-    //     if (historyType.value) {
-    //       columns.value = getTableHeaderColumns(historyType.value + '_history');
-    //     }
-    //   }
-    // } else {
-    //   columns.value = column;
-    // }
     await getDeviceList();
     await getDeviceList();
     nextTick(() => {
     nextTick(() => {
       getDataSource();
       getDataSource();
@@ -100,19 +86,6 @@ watch(
   }
   }
 );
 );
 
 
-// watch(historyType, (type) => {
-//   if (!type) return;
-//   // if (historyTable.value) getForm().resetFields()
-//   const column = getTableHeaderColumns(type.includes('_history') ? type : type + '_history');
-//   if (column && column.length < 1) {
-//     // const arr = type.split('_');
-//     // columns.value = getTableHeaderColumns(arr[0] + '_history');
-//   } else {
-//     // columns.value = column;
-//   }
-//   setColumns(columns.value);
-// });
-
 watch(
 watch(
   () => props.scroll.y,
   () => props.scroll.y,
   (newVal) => {
   (newVal) => {
@@ -125,7 +98,7 @@ watch(
 );
 );
 
 
 watch(
 watch(
-  () => props.deviceId,
+  () => props.id,
   async () => {
   async () => {
     await getForm().setFieldsValue({});
     await getForm().setFieldsValue({});
     await getDeviceList();
     await getDeviceList();
@@ -135,9 +108,19 @@ watch(
 async function getDeviceList() {
 async function getDeviceList() {
   let result;
   let result;
   const res = await getDeviceListApi({ column: 'createTime', pageNo: 1, pageSize: 10000 });
   const res = await getDeviceListApi({ column: 'createTime', pageNo: 1, pageSize: 10000 });
-  console.log(res, 'ssssssssssssssssssssss');
-  result = res.result;
-  deviceList.value = result;
+  result = res;
+  if (result) {
+    deviceOptions.value = [];
+    deviceOptions.value = result.map((item) => {
+      return {
+        label: item['strinstallpos'],
+        value: item['id'],
+        strinstallpos: item['strinstallpos'],
+      };
+      // return { label: item['strname'], value: item['id']}
+    });
+  }
+  deviceOptions.value.unshift({ label: '--请选择设备--', value: '', strinstallpos: '' });
 }
 }
 
 
 function resetFormParam() {
 function resetFormParam() {
@@ -152,7 +135,7 @@ function resetFormParam() {
     column: pagination['createTime'],
     column: pagination['createTime'],
     starttime_begin: formData['starttime_begin'],
     starttime_begin: formData['starttime_begin'],
     starttime_endtime: formData['starttime_endtime'],
     starttime_endtime: formData['starttime_endtime'],
-    nsubstationid: formData['gdeviceid'],
+    nsubstationid: formData['nsubstationid'],
     nwartype: 1001,
     nwartype: 1001,
   };
   };
   return params;
   return params;
@@ -163,14 +146,14 @@ async function getDataSource() {
   setLoading(true);
   setLoading(true);
   const params = await resetFormParam();
   const params = await resetFormParam();
   const result = await defHttp.get({ url: '/safety/ventanalyAlarmLog/list', params: params });
   const result = await defHttp.get({ url: '/safety/ventanalyAlarmLog/list', params: params });
-  setPagination({ total: Math.abs(result['datalist']['total']) || 0 });
-  if (result['datalist']['records'].length > 0) {
-    dataSource.value = result['datalist']['records'].map((item: any) => {
-      return Object.assign(item, item['readData']);
-    });
-  } else {
-    dataSource.value = [];
-  }
+  // if (result['datalist']['records'].length > 0) {
+  //   dataSource.value = result['datalist']['records'].map((item: any) => {
+  //     return Object.assign(item, item['readData']);
+  //   });
+  // } else {
+  //   dataSource.value = [];
+  // }
+  return result;
 
 
   setLoading(false);
   setLoading(false);
 }
 }
@@ -179,7 +162,7 @@ async function getDataSource() {
 const { tableContext } = useListPage({
 const { tableContext } = useListPage({
   tableProps: {
   tableProps: {
     // api: list,
     // api: list,
-    columns: props.historyColumns ? columns : (props.historyColumns as any[]),
+    columns: props.historyColumns ? props.historyColumns : (props.historyColumns as any[]),
     canResize: true,
     canResize: true,
     showTableSetting: false,
     showTableSetting: false,
     showActionColumn: false,
     showActionColumn: false,
@@ -239,16 +222,17 @@ const { tableContext } = useListPage({
                 label: '查询设备',
                 label: '查询设备',
                 field: 'nsubstationid',
                 field: 'nsubstationid',
                 component: 'Select',
                 component: 'Select',
-                defaultValue: props.id ? props.id : deviceList.value[0] ? deviceList.value[0]['strinstallpos'] : '',
-                required: true,
+                defaultValue: props.id ? props.id : deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
                 componentProps: {
                 componentProps: {
                   showSearch: true,
                   showSearch: true,
                   filterOption: (input: string, option: any) => {
                   filterOption: (input: string, option: any) => {
                     return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
                     return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
                   },
                   },
-                  options: deviceList,
+                  options: deviceOptions,
                   onChange: (e, option) => {
                   onChange: (e, option) => {
-                    if (option && (option['strinstallpos'] || option['id'])) historyType.value = option['strinstallpos'] || option['id'];
+                    if (option) {
+                      historyType.value = option.value; // 使用选项的value(即id)更新historyType
+                    }
                   },
                   },
                 },
                 },
                 colProps: {
                 colProps: {
@@ -276,7 +260,7 @@ const { tableContext } = useListPage({
     },
     },
     beforeFetch() {
     beforeFetch() {
       const newParams = { ...resetFormParam() };
       const newParams = { ...resetFormParam() };
-      debugger;
+      // debugger;
       return newParams;
       return newParams;
     },
     },
   },
   },
@@ -294,19 +278,12 @@ watchEffect(() => {
 
 
 onMounted(async () => {
 onMounted(async () => {
   await getDeviceList();
   await getDeviceList();
-  if (deviceList.value[0]) {
-    historyType.value = deviceList.value[0]['strinstallpos'] || deviceList.value[0]['id'];
+  if (deviceOptions.value[0]) {
+    historyType.value = deviceOptions.value[0]['strinstallpos'] || deviceOptions.value[0]['id'];
     nextTick(async () => {
     nextTick(async () => {
       await getDataSource();
       await getDataSource();
     });
     });
   }
   }
-  // watch([() => getPaginationRef()['current'], () => getPaginationRef()['pageSize']], async () => {
-  //   if (deviceList.value[0]) {
-  //     if (deviceList.value[0]) {
-  //       await getDataSource();
-  //     }
-  //   }
-  // });
 });
 });
 defineExpose({ setLoading });
 defineExpose({ setLoading });
 </script>
 </script>

+ 1 - 67
src/views/vent/deviceManager/substationTabel/index.vue

@@ -42,46 +42,6 @@
           </NormalTable>
           </NormalTable>
         </div>
         </div>
         <div class="history-content tab-item" v-if="activeKey == 'history'">
         <div class="history-content tab-item" v-if="activeKey == 'history'">
-          <!-- <a-form class="search-area" :model="formSearch" labelAlign="center" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
-            <a-row>
-              <a-col :span="4">
-                <a-form-item label="开始时间:">
-                  <a-date-picker
-                    show-time
-                    valueFormat="YYYY-MM-DD HH:mm:ss"
-                    placeholder="开始时间"
-                    size="small"
-                    v-model:value="formSearch.starttime_begin"
-                    style="width: 220px; color: #ffffff"
-                  />
-                </a-form-item>
-              </a-col>
-              <a-col :span="4">
-                <a-form-item label="结束时间:">
-                  <a-date-picker
-                    show-time
-                    valueFormat="YYYY-MM-DD HH:mm:ss"
-                    placeholder="结束时间"
-                    size="small"
-                    v-model:value="formSearch.starttime_endtime"
-                    style="width: 220px"
-                  />
-                </a-form-item>
-              </a-col>
-              <a-col :span="4">
-                <a-form-item label="查询设备:">
-                  <a-select v-model:value="formSearch.nsubstationid" style="width: 220px" size="small" placeholder="请选择...">
-                    <a-select-option v-for="item in deviceList" :key="item.deviceID">{{ item.strinstallpos }}</a-select-option>
-                  </a-select>
-                </a-form-item>
-              </a-col>
-              <a-col :span="2">
-                <a-button type="primary" style="margin-right: 10px" @click="getSearch">查询</a-button>
-                <a-button type="plain" @click="getReset">重置</a-button>
-              </a-col>
-            </a-row>
-          </a-form>
-          <a-table :columns="historyColumns" :pagination="false" size="small" maxWidth="340" :scroll="{ x: 'max-content', y: 140 }"> </a-table> -->
           <HistoryTable :scroll="scroll" :historyColumns="historyColumns" />
           <HistoryTable :scroll="scroll" :historyColumns="historyColumns" />
         </div>
         </div>
       </div>
       </div>
@@ -97,22 +57,13 @@ import HistoryTable from '../comment/HistoryTable.vue';
 import { historyColumns, columns, searchFormSchema, formSchema } from './substation.data';
 import { historyColumns, columns, searchFormSchema, formSchema } from './substation.data';
 import { list, getImportUrl, getExportUrl, deleteById, getHistory, batchDeleteById, saveOrUpdate, addDevice } from './substation.api';
 import { list, getImportUrl, getExportUrl, deleteById, getHistory, batchDeleteById, saveOrUpdate, addDevice } from './substation.api';
 import { message } from 'ant-design-vue';
 import { message } from 'ant-design-vue';
-import dayjs from 'dayjs';
+// import dayjs from 'dayjs';
 const normalTabel = ref();
 const normalTabel = ref();
 let timer = undefined;
 let timer = undefined;
 let activeKey = ref('device');
 let activeKey = ref('device');
-let formSearch = reactive({
-  pageNo: 1,
-  pageSize: 1000,
-  starttime_begin: dayjs().add(-1, 'day').format('YYYY-MM-DD HH:mm:ss'),
-  starttime_endtime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
-  nsubstationid: '',
-  nwartype: 1001,
-});
 const scroll = reactive({
 const scroll = reactive({
   y: 230,
   y: 230,
 });
 });
-let historyList = ref<any[]>([]);
 function reload() {
 function reload() {
   timer = setInterval(() => {
   timer = setInterval(() => {
     if (normalTabel.value) normalTabel.value.reload();
     if (normalTabel.value) normalTabel.value.reload();
@@ -136,23 +87,6 @@ function onChangeTab(tab) {
   } else {
   } else {
   }
   }
 }
 }
-async function getSearchList() {
-  formSearch.nsubstationid = formSearch.nsubstationid ? formSearch.nsubstationid : deviceList.value[0].deviceID;
-  let res = await getHistory({ ...formSearch });
-  // console.log(res,'000000=======')
-  let result = res.records;
-  historyList.value = result;
-}
-//查询历史数据
-function getSearch() {
-  getSearchList();
-}
-function getReset() {
-  formSearch.starttime_begin = dayjs().add(-1, 'day').format('YYYY-MM-DD HH:mm:ss');
-  formSearch.starttime_endtime = dayjs().format('YYYY-MM-DD HH:mm:ss');
-  formSearch.nsubstationid = deviceList.value[0].deviceID;
-  getSearchList();
-}
 
 
 onMounted(() => {
 onMounted(() => {
   reload();
   reload();

+ 37 - 1
src/views/vent/deviceManager/substationTabel/substation.data.ts

@@ -286,4 +286,40 @@ export const formSchema: FormSchema[] = [
   },
   },
 ];
 ];
 
 
-export const historyColumns: BasicColumn[] = [];
+export const historyColumns: BasicColumn[] = [
+  {
+    title: '名称',
+    dataIndex: 'strName',
+    key: 'strName',
+    width: 120,
+    align: 'center',
+  },
+  {
+    title: '安装位置',
+    dataIndex: 'strinstallpos',
+    key: 'strinstallpos',
+    width: 120,
+    align: 'center',
+  },
+  {
+    title: '分站IP地址',
+    dataIndex: 'strip',
+    key: 'strip',
+    width: 120,
+    align: 'center',
+  },
+  {
+    title: '开始报警时间',
+    dataIndex: 'starttime_begin',
+    key: 'starttime_begin',
+    width: 120,
+    align: 'center',
+  },
+  {
+    title: '报警状态',
+    dataIndex: 'status',
+    key: 'status',
+    width: 120,
+    align: 'center',
+  },
+];

+ 376 - 0
src/views/vent/safetyList/common/HistoryTable.vue

@@ -0,0 +1,376 @@
+<template>
+  <div class="history-table" v-if="loading">
+    <BasicTable ref="historyTable" @register="registerTable" :data-source="dataSource" :columns="historyColumns">
+      <template #form-submitBefore>
+        <a-button type="primary" preIcon="ant-design:search-outlined" @click="getDataSource">查询</a-button>
+        <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXlsFn"> 导出</a-button>
+      </template>
+    </BasicTable>
+  </div>
+</template>
+
+<script lang="ts" setup>
+//ts语法
+import { watchEffect, ref, watch, defineExpose, inject, nextTick, onMounted, computed } from 'vue';
+import { subStationList } from '../safetyList.api';
+import { historyColumns } from '../historyLsit.data';
+import { FormSchema } from '/@/components/Form/index';
+import { BasicTable } from '/@/components/Table';
+import { useListPage } from '/@/hooks/system/useListPage';
+import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
+import { useMethods } from '/@/hooks/system/useMethods';
+import { defHttp } from '/@/utils/http/axios';
+import dayjs from 'dayjs';
+import { getAutoScrollContainer } from '/@/utils/common/compUtils';
+
+const props = defineProps({
+  columnsType: {
+    type: String,
+  },
+  columns: {
+    type: Array,
+    // required: true,
+    default: () => [],
+  },
+  historyColumns: {
+    type: Array,
+    default: () => [],
+  },
+  id: {
+    type: String,
+  },
+  scroll: {
+    type: Object,
+    default: { y: 0 },
+  },
+  formSchemas: {
+    type: Array<FormSchema>,
+    default: () => [],
+  },
+});
+const postExportXlsUrl = '/safety/ventanalySubStation/export158StatusLog';
+//获取分站数据
+const getDeviceListApi = (params) => defHttp.get({ url: '/safety/ventanalySubStation/alllist', params });
+const historyTable = ref();
+const loading = ref(false);
+const dataSource = ref([]);
+
+const emit = defineEmits(['change']);
+
+const historyType = ref('');
+const linkStatus = ref('');
+const deviceKide = ref('');
+const columns = ref([]);
+const deviceOptions = ref([]);
+const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({});
+const deviceTypeStr = ref('');
+loading.value = true;
+
+watch(
+  () => {
+    return props.columnsType;
+  },
+  async (newVal) => {
+    debugger;
+    if (!newVal) return;
+    deviceKide.value = newVal;
+    if (historyTable.value) {
+      getForm().resetFields();
+      // getForm().updateSchema();
+      // getForm();
+    }
+    dataSource.value = [];
+    await getSubStationList();
+    nextTick(() => {
+      getDataSource();
+    });
+
+    if (historyTable.value) reload();
+  },
+  {
+    immediate: true,
+  }
+);
+
+watch(
+  () => props.scroll.y,
+  (newVal) => {
+    if (newVal) {
+      tableScroll.value = { y: newVal - 100 };
+    } else {
+      tableScroll.value = {};
+    }
+  }
+);
+
+watch(
+  () => props.id,
+  async () => {
+    await getForm().setFieldsValue({});
+    await getSubStationList();
+  }
+);
+
+//获取分站信息
+async function getSubStationList() {
+  let result;
+  let res = await subStationList({ strtype: 'modbus' });
+  result = res;
+  if (result) {
+    deviceOptions.value = [];
+    deviceOptions.value = result['records'].map((item) => {
+      return {
+        label: item['stationName'],
+        value: item['id'],
+        strinstallpos: item['stationName'],
+        status: item['status'],
+      };
+      // return { label: item['strname'], value: item['id']}
+    });
+  }
+  deviceOptions.value.unshift({ label: '--请选择分站--', value: '', stationName: '' });
+}
+
+function resetFormParam() {
+  const formData = getForm().getFieldsValue();
+  const pagination = getPaginationRef();
+  formData['pageNo'] = pagination['current'];
+  formData['pageSize'] = pagination['pageSize'];
+  const params = {
+    pageNo: pagination['current'],
+    pageSize: pagination['pageSize'],
+    createTime_begin: formData['starttime_begin'],
+    createTime_end: formData['starttime_end'],
+    stationId: formData['stationId'],
+    status: formData['status'],
+  };
+  return params;
+}
+
+async function getDataSource() {
+  dataSource.value = [];
+  setLoading(true);
+  const params = await resetFormParam();
+  const result = await defHttp.post({ url: '/safety/ventanalySubStation/get158StatusLog', params: params });
+  // if (result['datalist']['records'].length > 0) {
+  //   dataSource.value = result['datalist']['records'].map((item: any) => {
+  //     return Object.assign(item, item['readData']);
+  //   });
+  // } else {
+  dataSource.value = result['records'];
+  // }
+  // return result;
+
+  setLoading(false);
+}
+//导出
+// function onExportXlsFn() {
+//   // const params = resetFormParam();
+//   // // 判断时间间隔和查询时间区间,数据量下载大时进行提示
+//   // return onExportXlsPost(params);
+// }
+//导入导出方法
+function onExportXlsFn() {
+  const { handleExportXlsPost } = useMethods();
+  const params = resetFormParam();
+  handleExportXlsPost('历史数据', postExportXlsUrl, params);
+}
+
+// 列表页面公共参数、方法
+const { tableContext, onExportXlsPost } = useListPage({
+  tableProps: {
+    // api: list,
+    columns: props.historyColumns ? props.historyColumns : (props.historyColumns as any[]),
+    canResize: true,
+    showTableSetting: false,
+    showActionColumn: false,
+    bordered: false,
+    size: 'small',
+    scroll: tableScroll,
+    showIndexColumn: true,
+    tableLayout: 'auto',
+    formConfig: {
+      labelAlign: 'left',
+      showAdvancedButton: false,
+      showSubmitButton: false,
+      showResetButton: false,
+      baseColProps: {
+        xs: 24,
+        sm: 24,
+        md: 24,
+        lg: 9,
+        xl: 7,
+        xxl: 4,
+      },
+      schemas:
+        props.formSchemas.length > 0
+          ? props.formSchemas
+          : [
+              {
+                field: 'starttime_begin',
+                label: '开始时间',
+                component: 'DatePicker',
+                defaultValue: dayjs().startOf('date'),
+                required: true,
+                componentProps: {
+                  showTime: true,
+                  valueFormat: 'YYYY-MM-DD HH:mm:ss',
+                  getPopupContainer: getAutoScrollContainer,
+                },
+                colProps: {
+                  span: 4,
+                },
+              },
+              {
+                field: 'starttime_end',
+                label: '结束时间',
+                component: 'DatePicker',
+                defaultValue: dayjs(),
+                required: true,
+                componentProps: {
+                  showTime: true,
+                  valueFormat: 'YYYY-MM-DD HH:mm:ss',
+                  getPopupContainer: getAutoScrollContainer,
+                },
+                colProps: {
+                  span: 4,
+                },
+              },
+              {
+                label: '查询分站',
+                field: 'stationId',
+                component: 'Select',
+                defaultValue: props.id ? props.id : deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
+                componentProps: {
+                  showSearch: true,
+                  filterOption: (input: string, option: any) => {
+                    return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
+                  },
+                  options: deviceOptions,
+                  onChange: (e, option) => {
+                    if (option) {
+                      historyType.value = option.value; // 使用选项的value(即id)更新historyType
+                    }
+                  },
+                },
+                colProps: {
+                  span: 4,
+                },
+              },
+              {
+                label: '连接状态',
+                field: 'status',
+                component: 'Select',
+                componentProps: {
+                  options: [
+                    { label: '连接成功', value: 1 },
+                    { label: '连接失败', value: 0 },
+                  ],
+                  onChange: (e, option) => {
+                    if (option) {
+                      linkStatus.value = option.value; // 使用选项的value(即id)更新historyType
+                    }
+                  },
+                },
+                colProps: {
+                  span: 4,
+                },
+              },
+            ],
+    },
+    // fetchSetting: {
+    pagination: {
+      current: 1,
+      pageSize: 10,
+      pageSizeOptions: ['10', '30', '50', '100'],
+      showQuickJumper: false,
+    },
+
+    beforeFetch() {
+      const newParams = { ...resetFormParam() };
+      // debugger;
+      return newParams;
+    },
+  },
+  exportConfig: {
+    name: '历史列表',
+    url: postExportXlsUrl,
+  },
+});
+
+//注册table数据
+const [registerTable, { reload, setLoading, getForm, setColumns, getPaginationRef, setPagination }] = tableContext;
+
+watchEffect(() => {
+  if (historyTable.value && dataSource) {
+    const data = dataSource.value || [];
+    emit('change', data);
+  }
+});
+
+onMounted(async () => {
+  await getSubStationList();
+  console.log(deviceOptions.value[0], '数据');
+  if (deviceOptions.value[0]) {
+    historyType.value = deviceOptions.value[0]['stationName'] || deviceOptions.value[0]['id'];
+    linkStatus.value = deviceOptions.value[0]['status'];
+    nextTick(async () => {
+      await getDataSource();
+    });
+  }
+});
+defineExpose({ setLoading });
+</script>
+
+<style scoped lang="less">
+@import '/@/design/vent/color.less';
+
+:deep(.@{ventSpace}-table-body) {
+  height: auto !important;
+}
+:deep(.zxm-picker) {
+  height: 30px !important;
+}
+.history-table {
+  width: 100%;
+  :deep(.jeecg-basic-table-form-container) {
+    .@{ventSpace}-form {
+      padding: 0 !important;
+      border: none !important;
+      margin-bottom: 0 !important;
+      .@{ventSpace}-picker,
+      .@{ventSpace}-select-selector {
+        width: 100% !important;
+        height: 100%;
+        background: #00000017;
+        border: 1px solid #b7b7b7;
+        input,
+        .@{ventSpace}-select-selection-item,
+        .@{ventSpace}-picker-suffix {
+          color: #fff;
+        }
+        .@{ventSpace}-select-selection-placeholder {
+          color: #ffffffaa;
+        }
+      }
+    }
+    .@{ventSpace}-table-title {
+      min-height: 0 !important;
+    }
+  }
+  .pagination-box {
+    display: flex;
+    justify-content: flex-end;
+    align-items: center;
+    .page-num {
+      border: 1px solid #0090d8;
+      padding: 4px 8px;
+      margin-right: 5px;
+      color: #0090d8;
+    }
+    .btn {
+      margin-right: 10px;
+    }
+  }
+}
+</style>

+ 5 - 41
src/views/vent/safetyList/common/detail.vue

@@ -141,46 +141,7 @@
         </div>
         </div>
         <!-- 历史数据 -->
         <!-- 历史数据 -->
         <div class="history-content" v-if="activeKey == 'history'">
         <div class="history-content" v-if="activeKey == 'history'">
-          <a-form class="search-area" :model="formSearch" labelAlign="center" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
-            <a-row>
-              <a-col :span="4">
-                <a-form-item label="开始时间:">
-                  <a-date-picker
-                    show-time
-                    valueFormat="YYYY-MM-DD HH:mm:ss"
-                    placeholder="开始时间"
-                    size="small"
-                    v-model:value="formSearch.starttime_begin"
-                    style="width: 220px; color: #ffffff"
-                  />
-                </a-form-item>
-              </a-col>
-              <a-col :span="4">
-                <a-form-item label="结束时间:">
-                  <a-date-picker
-                    show-time
-                    valueFormat="YYYY-MM-DD HH:mm:ss"
-                    placeholder="结束时间"
-                    size="small"
-                    v-model:value="formSearch.starttime_endtime"
-                    style="width: 220px"
-                  />
-                </a-form-item>
-              </a-col>
-              <a-col :span="4">
-                <a-form-item label="查询设备:">
-                  <a-select v-model:value="formSearch.nsubstationid" style="width: 220px" size="small" placeholder="请选择...">
-                    <a-select-option v-for="item in deviceList" :key="item.deviceID">{{ item.strinstallpos }}</a-select-option>
-                  </a-select>
-                </a-form-item>
-              </a-col>
-              <a-col :span="2">
-                <a-button type="primary" style="margin-right: 10px" @click="getSearch">查询</a-button>
-                <a-button type="plain" @click="getReset">重置</a-button>
-              </a-col>
-            </a-row>
-          </a-form>
-          <a-table :columns="historyColumns" :pagination="false" size="small" maxWidth="340" :scroll="{ x: 'max-content', y: 140 }"> </a-table>
+          <HistoryTable :scroll="scroll" :historyColumns="historyColumns" />
         </div>
         </div>
         <!-- 监测详情 -->
         <!-- 监测详情 -->
         <div class="detail-content" v-if="activeKey == 'manageAuto'">
         <div class="detail-content" v-if="activeKey == 'manageAuto'">
@@ -352,6 +313,7 @@ import {
   set158StationRead,
   set158StationRead,
 } from '../safetyList.api';
 } from '../safetyList.api';
 import { historyColumns } from '../historyLsit.data';
 import { historyColumns } from '../historyLsit.data';
+import HistoryTable from './HistoryTable.vue';
 import customHeader from '/@/components/vent/customHeader.vue';
 import customHeader from '/@/components/vent/customHeader.vue';
 import dayjs from 'dayjs';
 import dayjs from 'dayjs';
 
 
@@ -452,7 +414,9 @@ let derictList = reactive<any[]>([
   { label: '反向', value: '1' },
   { label: '反向', value: '1' },
 ]);
 ]);
 let devStationId = ref('');
 let devStationId = ref('');
-
+const scroll = reactive({
+  y: 230,
+});
 //读取分站设备下拉选项数据
 //读取分站设备下拉选项数据
 let timer: null | NodeJS.Timeout = null;
 let timer: null | NodeJS.Timeout = null;
 function getMonitor(flag = false) {
 function getMonitor(flag = false) {

+ 20 - 46
src/views/vent/safetyList/historyLsit.data.ts

@@ -1,72 +1,46 @@
 import { BasicColumn } from '/@/components/Table';
 import { BasicColumn } from '/@/components/Table';
 
 
 export const historyColumns: BasicColumn[] = [
 export const historyColumns: BasicColumn[] = [
-  // {
-  //     title: '序号',
-  //     width: 60,
-  //     align: 'center',
-  //     customRender: ({ index }: { index: number }) => `${index + 1}`
-  // },
   {
   {
-    title: '安装位置',
-    dataIndex: 'strinstallpos',
-    key: 'strinstallpos',
+    title: '分站名称',
+    dataIndex: 'stationName',
+    key: 'stationName',
+    width: 120,
     align: 'center',
     align: 'center',
   },
   },
   {
   {
-    title: 'Ip地址',
-    dataIndex: 'stripC',
-    key: 'stripC',
-    width: 90,
-    align: 'center',
-  },
-  {
-    title: '监测值',
-    dataIndex: 'valueJc',
-    key: 'valueJc',
+    title: '分站id',
+    dataIndex: 'stationId',
+    key: 'stationId',
+    width: 120,
     align: 'center',
     align: 'center',
   },
   },
   {
   {
     title: '供电模式',
     title: '供电模式',
-    dataIndex: 'gdmsC',
-    key: 'gdmsC',
-    width: 90,
+    dataIndex: 'gdms',
+    key: 'gdms',
+    width: 120,
     align: 'center',
     align: 'center',
   },
   },
   {
   {
     title: '电池容量(%)',
     title: '电池容量(%)',
     dataIndex: 'dcrl',
     dataIndex: 'dcrl',
     key: 'dcrl',
     key: 'dcrl',
-    width: 90,
+    width: 120,
     align: 'center',
     align: 'center',
   },
   },
   {
   {
-    title: '启用状态',
-    dataIndex: 'linkIdC',
-    key: 'linkIdC',
-    width: 80,
+    title: '连接状态',
+    dataIndex: 'status',
+    key: 'status',
+    width: 120,
     align: 'center',
     align: 'center',
   },
   },
   {
   {
-    title: '通讯状态',
-    dataIndex: 'linkstatusC',
-    key: 'linkstatusC',
-    width: 80,
-    align: 'center',
-  },
-
-  // {
-  //     title: '时间',
-  //     dataIndex: 'updateTime',
-  //     key: 'updateTime',
-  //     width: 120,
-  //     align: 'center',
-  // },
-  {
-    title: '操作',
-    dataIndex: 'action',
-    width: 220,
+    title: '时间',
+    dataIndex: 'createTime',
+    key: 'createTime',
+    width: 120,
     align: 'center',
     align: 'center',
-    slots: { customRender: 'action' },
   },
   },
 ];
 ];