xuziqiang 2 months ago
parent
commit
bf4a3fd581
  1. 13
      hx-ai-intelligent/src/api/monitor.ts
  2. 47
      hx-ai-intelligent/src/view/monitor/deviceMonitor/graph/index.vue
  3. 1
      hx-ai-intelligent/src/view/monitor/deviceMonitor/index.vue
  4. 2
      hx-ai-intelligent/src/view/monitor/deviceMonitor/page.vue
  5. 86
      hx-ai-intelligent/src/view/monitor/deviceMonitor/table/index.vue
  6. 452
      hx-ai-intelligent/src/view/monitor/deviceMonitor/tree/index.vue
  7. 36
      hx-ai-intelligent/src/view/monitor/environmentMonitor/averageData/config.ts
  8. 250
      hx-ai-intelligent/src/view/monitor/environmentMonitor/averageData/index.vue
  9. 20
      hx-ai-intelligent/src/view/monitor/environmentMonitor/historyData/config.ts
  10. 243
      hx-ai-intelligent/src/view/monitor/environmentMonitor/historyData/index.vue
  11. 6
      hx-ai-intelligent/src/view/monitor/environmentMonitor/index.vue

13
hx-ai-intelligent/src/api/monitor.ts

@ -0,0 +1,13 @@
export enum deviceMonitor {
// getTableList = '/carbon/emission/factor/queryCarbonFactorPage',
// addNewData = '/carbon/emission/factor/creatOrUpdate',
// editUser = '/carbon-smart/api/user/edit',
// frozen = '/carbon-smart/api/user/frozen',
// resetPwd = '/carbon-smart/api/user/resetPwd',
// del = '/carbon-smart/api/user/del',
// batchDel = '/carbon-smart/api/user/batchDel',
// getCarbonFactorTree = '/carbon/emission/type/getCarbonFactorTree',
// queryDeptTree = '/carbon-smart/api/user/queryDeptTree',
// queryUserPerList = '/carbon-smart/api/user/queryUserPerList',
getDeviceGraph = '/carbon-smart/api/monitor/getDeviceGraph',
}

47
hx-ai-intelligent/src/view/monitor/deviceMonitor/graph/index.vue

@ -17,6 +17,7 @@
tableList: any[]; tableList: any[];
tableColumns: any[]; tableColumns: any[];
graphList: any[]; graphList: any[];
XData: any[];
} }
const pageData = inject<PageData>('pageData'); const pageData = inject<PageData>('pageData');
@ -37,32 +38,40 @@
const draw = () => { const draw = () => {
data.value = pageData.graphList; data.value = pageData.graphList;
let XData = pageData.XData;
if (chartInstance) { if (chartInstance) {
chartInstance.dispose(); chartInstance.dispose();
} }
chartInstance = echarts.init(graphChart.value); chartInstance = echarts.init(graphChart.value);
var seriesList = []; var seriesList = [];
var date = []; // var date = [];
var legendList: string | any[] = []; var legendList: string | any[] = [];
for (let i = 0; i < data.value.length; i++) { for (let i = 0; i < data.value.length; i++) {
date.push(data.value[i].date); seriesList.push({
name: data.value[i].deviceName,
data: data.value[i].data,
type: 'line',
smooth: true,
});
legendList.push(data.value[i].deviceName);
// date.push(data.value[i].date);
for (let j = 0; j < data.value[i].data.length; j++) { // for (let j = 0; j < data.value[i].data.length; j++) {
if (seriesList.length < j + 1) { // if (seriesList.length < j + 1) {
seriesList.push({ // seriesList.push({
name: data.value[i].data[j].name, // name: data.value[i].data[j].name,
data: [data.value[i].data[j].value], // data: [data.value[i].data[j].value],
type: 'line', // type: 'line',
smooth: true, // smooth: true,
}); // });
} else { // } else {
seriesList[j].data.push(data.value[i].data[j].value); // seriesList[j].data.push(data.value[i].data[j].value);
} // }
if (legendList.length == 0 || legendList.length < j + 1) { // if (legendList.length == 0 || legendList.length < j + 1) {
legendList.push(data.value[i].data[j].name); // legendList.push(data.value[i].data[j].name);
} // }
} // }
} }
const option = { const option = {
legend: { legend: {
@ -76,7 +85,7 @@
const date = params[0].name; const date = params[0].name;
const values = params const values = params
.map((param: any) => { .map((param: any) => {
const unit = data.value.find((d) => d.date === date)?.unit || ''; const unit = data.value.find((d) => d.date === date)?.devicePositionUnit || '';
return `<tr> return `<tr>
<td>${param.marker}${param.seriesName}</td> <td>${param.marker}${param.seriesName}</td>
<td style="text-align: right;">${param.value} ${unit}</td> <td style="text-align: right;">${param.value} ${unit}</td>
@ -88,7 +97,7 @@
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: date, data: XData,
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',

1
hx-ai-intelligent/src/view/monitor/deviceMonitor/index.vue

@ -12,6 +12,7 @@
tableList: [], tableList: [],
tableColumns: [], tableColumns: [],
graphList: [], graphList: [],
XData: [],
}); });
// 使 provide // 使 provide

2
hx-ai-intelligent/src/view/monitor/deviceMonitor/page.vue

@ -16,7 +16,7 @@
</div> </div>
</div> </div>
<graph ref="graphRef" v-if="isGraph" /> <graph ref="graphRef" v-if="isGraph" />
<environment-table ref="tableRef" v-else /> <environment-table ref="tableRef" style="width: 100%" v-else />
</div> </div>
</a-col> </a-col>
</a-row> </a-row>

86
hx-ai-intelligent/src/view/monitor/deviceMonitor/table/index.vue

@ -1,5 +1,10 @@
<template> <template>
<a-table :columns="columns" :data-source="data" bordered /> <a-table
:columns="columns"
:data-source="data"
bordered
style="width: 100%"
:scroll="{ x: 2000 }" />
</template> </template>
<script lang="ts"> <script lang="ts">
@ -7,14 +12,14 @@
import type { TableColumnType } from 'ant-design-vue'; import type { TableColumnType } from 'ant-design-vue';
import { inject } from 'vue'; import { inject } from 'vue';
// let data: any[] = [];
export default defineComponent({ export default defineComponent({
name: 'EnvironmentTable', name: 'EnvironmentTable',
setup() { setup() {
let data = ref<any[]>([]); let data = ref<any[]>([]);
let columns = ref<TableColumnType[]>([]); let columns = ref<TableColumnType[]>([]);
let index = ref(0);
interface PageData { interface PageData {
tableList: any[]; tableList: any[];
tableColumns: any[]; tableColumns: any[];
@ -29,13 +34,14 @@
watch( watch(
() => pageData as PageData, () => pageData as PageData,
(_newValue, _oldValue) => { (_newValue, _oldValue) => {
data.value = pageData.tableList; // data.value = pageData.tableList;
let columnA: any[] = [...column]; // let columnA: any[] = [...column];
columnA.push(...pageData.tableColumns); // columnA.push(...pageData.tableColumns);
columns.value = columnA; // columns.value = columnA;
// pageData.graphList; // // pageData.graphList;
// // //
init();
}, },
{ deep: true }, { deep: true },
); );
@ -62,7 +68,13 @@
const column: TableColumnType[] = [ const column: TableColumnType[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'key', customRender: ({ record, index }) => {
//
if (index == 0 || data.value[index - 1].deviceName == record.deviceName) {
return index + 1;
}
return index;
},
customCell: (record, rowIndex) => { customCell: (record, rowIndex) => {
if (rowIndex == undefined) { if (rowIndex == undefined) {
return { return {
@ -70,8 +82,8 @@
colSpan: 0, colSpan: 0,
}; };
} }
const rowSpan = getRowSpan('name', record, data.value); const rowSpan = getRowSpan('deviceName', record, data.value);
if (rowIndex != 0 && data.value[rowIndex - 1].key == record.key) { if (rowIndex != 0 && data.value[rowIndex - 1].deviceName == record.deviceName) {
return { return {
rowSpan: 0, rowSpan: 0,
colSpan: 0, colSpan: 0,
@ -82,9 +94,16 @@
}; };
}, },
}, },
// {
// title: '',
// customRender: (text: any) => {
// index.value += 1;
// return index.value;
// },
// },
{ {
title: '设备名称', title: '设备名称',
dataIndex: 'name', dataIndex: 'deviceName',
customCell: (record, rowIndex) => { customCell: (record, rowIndex) => {
if (rowIndex == undefined) { if (rowIndex == undefined) {
return { return {
@ -92,8 +111,8 @@
colSpan: 0, colSpan: 0,
}; };
} }
const rowSpan = getRowSpan('name', record, data.value); const rowSpan = getRowSpan('deviceName', record, data.value);
if (rowIndex != 0 && data.value[rowIndex - 1].name == record.name) { if (rowIndex != 0 && data.value[rowIndex - 1].deviceName == record.deviceName) {
return { return {
rowSpan: 0, rowSpan: 0,
colSpan: 0, colSpan: 0,
@ -106,7 +125,7 @@
}, },
{ {
title: '设备点位', title: '设备点位',
dataIndex: 'position', dataIndex: 'devicePositionName',
customCell: (record, rowIndex) => { customCell: (record, rowIndex) => {
if (rowIndex == undefined) { if (rowIndex == undefined) {
return { return {
@ -114,11 +133,11 @@
colSpan: 0, colSpan: 0,
}; };
} }
const rowSpan = getRowSpan('position', record, data.value, ['name']); const rowSpan = getRowSpan('devicePositionName', record, data.value, ['deviceName']);
if ( if (
rowIndex != 0 && rowIndex != 0 &&
data.value[rowIndex - 1].name == record.name && data.value[rowIndex - 1].deviceName == record.deviceName &&
data.value[rowIndex - 1].position == record.position data.value[rowIndex - 1].devicePositionName == record.devicePositionName
) { ) {
return { return {
rowSpan: 0, rowSpan: 0,
@ -132,7 +151,7 @@
}, },
{ {
title: '计量单位', title: '计量单位',
dataIndex: 'unit', dataIndex: 'devicePositionUnit',
customCell: (record, rowIndex) => { customCell: (record, rowIndex) => {
if (rowIndex == undefined) { if (rowIndex == undefined) {
return { return {
@ -140,12 +159,15 @@
colSpan: 0, colSpan: 0,
}; };
} }
const rowSpan = getRowSpan('unit', record, data.value, ['name', 'position']); const rowSpan = getRowSpan('devicePositionUnit', record, data.value, [
'deviceName',
'devicePositionName',
]);
if ( if (
rowIndex != 0 && rowIndex != 0 &&
data.value[rowIndex - 1].name == record.name && data.value[rowIndex - 1].deviceName == record.deviceName &&
data.value[rowIndex - 1].position == record.position && data.value[rowIndex - 1].devicePositionName == record.devicePositionName &&
data.value[rowIndex - 1].unit == record.unit data.value[rowIndex - 1].devicePositionUnit == record.devicePositionUnit
) { ) {
return { return {
rowSpan: 0, rowSpan: 0,
@ -157,14 +179,26 @@
}; };
}, },
}, },
{
title: '日期',
dataIndex: 'time',
},
]; ];
onMounted(() => { const init = () => {
index.value = 0;
data.value = pageData.tableList; data.value = pageData.tableList;
let columnA: any[] = [...column]; let columnA: any[] = [...column];
columnA.push(...pageData.tableColumns); let columnB: any[] = [];
pageData.tableColumns.forEach((item) => {
columnB.push({ title: item, dataIndex: item });
});
columnA.push(...columnB);
columns.value = columnA; columns.value = columnA;
};
onMounted(() => {
init();
}); });
return { return {
data, data,

452
hx-ai-intelligent/src/view/monitor/deviceMonitor/tree/index.vue

@ -46,9 +46,6 @@
<a-button type="primary" style="width: 100%; margin-bottom: 10px" @click="getSelect"> <a-button type="primary" style="width: 100%; margin-bottom: 10px" @click="getSelect">
查询 查询
</a-button> </a-button>
<a-button type="primary" style="width: 100%; margin-bottom: 10px" @click="getSelect11">
模拟不同数据查询
</a-button>
</div> </div>
</div> </div>
</template> </template>
@ -60,6 +57,7 @@
import { inject } from 'vue'; import { inject } from 'vue';
import { http } from '/nerv-lib/util'; import { http } from '/nerv-lib/util';
import { device } from '/@/api/deviceManage'; import { device } from '/@/api/deviceManage';
import { deviceMonitor } from '/@/api/monitor';
export default defineComponent({ export default defineComponent({
// eslint-disable-next-line vue/multi-word-component-names // eslint-disable-next-line vue/multi-word-component-names
@ -163,6 +161,7 @@
tableList: any[]; tableList: any[];
tableColumns: any[]; tableColumns: any[];
graphList: any[]; graphList: any[];
XData: any[];
} }
const pageData = inject<PageData>('pageData'); const pageData = inject<PageData>('pageData');
if (!pageData) { if (!pageData) {
@ -170,278 +169,180 @@
} }
// pageData // pageData
const getSelect = () => { const getSelect = () => {
pageData.tableList = [ http
{ .post(deviceMonitor.getDeviceGraph, {
key: '1', deviceIds: ['HLlmTZp8-0601-0001', 'HLlmTZp-0804-0001'],
name: 'AC_002(暖通电表)', devicePointCode: 'ua',
position: 'A 相电压', devicePointId: 32,
unit: 'V', endDate: '2024-07-02',
date: '2023-12-01', startDate: '2024-07-01',
'1:00': '3626', timeRate: '2',
}, })
{ .then((res) => {
key: '1', pageData.tableList = res.data.tableList;
name: 'AC_002(暖通电表)', pageData.tableColumns = res.data.tableHeaderList;
position: 'A 相电压',
unit: 'V', pageData.graphList = res.data.graphData;
date: '2023-12-01', pageData.XData = res.data.XData;
'1:00': '3626', });
}, // pageData.tableList = [
{ // {
key: '2', // key: '1',
name: 'AC_003(照明电表)', // name: 'AC_002',
position: 'A 相电压', // position: 'A ',
unit: 'V', // unit: 'V',
date: '2023-12-01', // date: '2023-12-01',
'1:00': '3626', // '1:00': '3626',
}, // },
{ // {
key: '2', // key: '1',
name: 'AC_003(照明电表)', // name: 'AC_002',
position: 'A 相电压', // position: 'A ',
unit: 'V', // unit: 'V',
date: '2023-12-01', // date: '2023-12-01',
'1:00': '3626', // '1:00': '3626',
}, // },
{ // {
key: '3', // key: '2',
name: 'AC_004(给排水电表)', // name: 'AC_003',
position: 'A 相电压', // position: 'A ',
unit: 'V', // unit: 'V',
date: '2023-12-01', // date: '2023-12-01',
'1:00': '3626', // '1:00': '3626',
}, // },
]; // {
pageData.tableColumns = [ // key: '2',
{ // name: 'AC_003',
title: '日期', // position: 'A ',
dataIndex: 'date', // unit: 'V',
}, // date: '2023-12-01',
{ // '1:00': '3626',
title: '1:00', // },
dataIndex: '1:00', // {
}, // key: '3',
]; // name: 'AC_004',
pageData.graphList = [ // position: 'A ',
{ // unit: 'V',
date: '2023-12-01 0:00', // date: '2023-12-01',
unit: 'V', // '1:00': '3626',
data: [ // },
{ // ];
name: 'AC_002(暖通电表)', // pageData.tableColumns = [
value: '21', // {
}, // title: '00:00',
{ // dataIndex: '00:00',
name: 'AC_003(照明电表)', // },
value: '36', // ];
}, // pageData.graphList = [
{ // {
name: 'AC_004(给排水电表)', // date: '2023-12-01 0:00',
value: '5', // unit: 'V',
}, // data: [
], // {
}, // name: 'AC_002',
{ // value: '21',
date: '2023-12-02 0:00', // },
unit: 'V', // {
data: [ // name: 'AC_003',
{ // value: '36',
name: 'AC_002(暖通电表)', // },
value: '26', // {
}, // name: 'AC_004',
{ // value: '5',
name: 'AC_003(照明电表)', // },
value: '25', // ],
}, // },
{ // {
name: 'AC_004(给排水电表)', // date: '2023-12-02 0:00',
value: '47', // unit: 'V',
}, // data: [
], // {
}, // name: 'AC_002',
{ // value: '26',
date: '2023-12-03 0:00', // },
unit: 'V', // {
data: [ // name: 'AC_003',
{ // value: '25',
name: 'AC_002(暖通电表)', // },
value: '18', // {
}, // name: 'AC_004',
{ // value: '47',
name: 'AC_003(照明电表)', // },
value: '22', // ],
}, // },
{ // {
name: 'AC_004(给排水电表)', // date: '2023-12-03 0:00',
value: '26', // unit: 'V',
}, // data: [
], // {
}, // name: 'AC_002',
{ // value: '18',
date: '2023-12-04 0:00', // },
unit: 'V', // {
data: [ // name: 'AC_003',
{ // value: '22',
name: 'AC_002(暖通电表)', // },
value: '40', // {
}, // name: 'AC_004',
{ // value: '26',
name: 'AC_003(照明电表)', // },
value: '15', // ],
}, // },
{ // {
name: 'AC_004(给排水电表)', // date: '2023-12-04 0:00',
value: '12', // unit: 'V',
}, // data: [
], // {
}, // name: 'AC_002',
{ // value: '40',
date: '2023-12-05 0:00', // },
unit: 'V', // {
data: [ // name: 'AC_003',
{ // value: '15',
name: 'AC_002(暖通电表)', // },
value: '15', // {
}, // name: 'AC_004',
{ // value: '12',
name: 'AC_003(照明电表)', // },
value: '18', // ],
}, // },
{ // {
name: 'AC_004(给排水电表)', // date: '2023-12-05 0:00',
value: '15', // unit: 'V',
}, // data: [
], // {
}, // name: 'AC_002',
{ // value: '15',
date: '2023-12-06 0:00', // },
unit: 'V', // {
data: [ // name: 'AC_003',
{ // value: '18',
name: 'AC_002(暖通电表)', // },
value: '15', // {
}, // name: 'AC_004',
{ // value: '15',
name: 'AC_003(照明电表)', // },
value: '18', // ],
}, // },
{ // {
name: 'AC_004(给排水电表)', // date: '2023-12-06 0:00',
value: '15', // unit: 'V',
}, // data: [
], // {
}, // name: 'AC_002',
]; // value: '15',
}; // },
// // {
const getSelect11 = () => { // name: 'AC_003',
pageData.tableList = [ // value: '18',
{ // },
key: '1', // {
name: 'AC_002(暖通电表)', // name: 'AC_004',
position: 'A 相电压', // value: '15',
unit: 'V', // },
date: '2023-12-01', // ],
'1:00': '3626', // },
'2:00': '2222', // ];
},
{
key: '1',
name: 'AC_002(暖通电表)',
position: 'A 相电压',
unit: 'V',
date: '2023-12-01',
'1:00': '3626',
'2:00': '2222',
},
{
key: '2',
name: 'AC_003(照明电表)',
position: 'A 相电压',
unit: 'V',
date: '2023-12-01',
'1:00': '3626',
'2:00': '2222',
},
{
key: '2',
name: 'AC_003(照明电表)',
position: 'A 相电压',
unit: 'V',
date: '2023-12-01',
'1:00': '3626',
'2:00': '2222',
},
{
key: '3',
name: 'AC_004(给排水电表)',
position: 'A 相电压',
unit: 'V',
date: '2023-12-01',
'1:00': '3626',
'2:00': '2222',
},
];
pageData.tableColumns = [
{
title: '日期',
dataIndex: 'date',
},
{
title: '1:00',
dataIndex: '1:00',
},
{
title: '2:00',
dataIndex: '2:00',
},
];
pageData.graphList = [
{
date: '2023-12-01 0:00',
unit: 'V',
data: [
{
name: 'AC_002(暖通电表)',
value: '21',
},
{
name: 'AC_003(照明电表)',
value: '36',
},
{
name: 'AC_004(给排水电表)',
value: '5',
},
{
name: 'AC_005(1111111)',
value: '14',
},
],
},
{
date: '2023-12-02 0:00',
unit: 'V',
data: [
{
name: 'AC_002(暖通电表)',
value: '26',
},
{
name: 'AC_003(照明电表)',
value: '25',
},
{
name: 'AC_004(给排水电表)',
value: '47',
},
{
name: 'AC_005(1111111)',
value: '28',
},
],
},
];
}; };
type RangeValue = [Dayjs, Dayjs]; type RangeValue = [Dayjs, Dayjs];
@ -493,7 +394,6 @@
dateRange, dateRange,
getDianWeiList, getDianWeiList,
getSelect, getSelect,
getSelect11,
disabledDate, disabledDate,
onCalendarChange, onCalendarChange,
onOpenChange, onOpenChange,

36
hx-ai-intelligent/src/view/monitor/environmentMonitor/averageData/config.ts

@ -0,0 +1,36 @@
export const tableColumns = [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '时间',
dataIndex: 'areaName',
},
{
title: '温度(℃)',
dataIndex: 'point',
},
{
title: '湿度(%)',
dataIndex: 'date',
},
{
title: 'CO2浓度(ppm)',
dataIndex: 'areaName',
},
{
title: 'PM2.5(μg/m³)',
dataIndex: 'point',
},
{
title: 'TVOC(mg/m³)',
dataIndex: 'date',
},
{
title: 'TVOC(mg/m³)',
dataIndex: '光照度(lux)',
},
];

250
hx-ai-intelligent/src/view/monitor/environmentMonitor/averageData/index.vue

@ -0,0 +1,250 @@
<!-- eslint-disable vue/v-on-event-hyphenation -->
<template>
<div>
<a-table :columns="tableColumns" :data-source="data" bordered :pagination="false">
<template #title>
<div
style="display: flex; align-items: center; justify-content: space-between; width: 100%">
<div style="display: flex; align-items: center; width: 85%">
<div style="width: 10%">数据报表</div>
<a-select
v-model:value="frequencyValue"
placeholder="请选择频率"
style="width: 17%; margin-left: 10px"
:options="frequencyOptions" />
<!-- <a-date-picker style="width: 13%; margin-left: 10px" v-model:value="timeValue" /> -->
<a-range-picker
:value="hackValue || dateRange"
:disabled-date="disabledDate"
@change="onChangeDate"
@openChange="onOpenChange"
@calendarChange="onCalendarChange"
style="width: 17%; margin-left: 10px"
:placeholder="['请选择日期', '请选择日期']" />
<a-button type="primary" style="margin-left: 10px" @click="getSelect"> 查询 </a-button>
</div>
<a-button type="primary"> 导出 </a-button>
</div>
</template>
</a-table>
<a-pagination
:current="queryParams.pageNum"
:total="total"
:page-size="queryParams.pageSize"
style="display: flex; justify-content: center; margin-top: 16px"
:show-size-changer="true"
:show-quick-jumper="true"
@change="onChange" />
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue';
// import { http } from '/nerv-lib/util/http';
import { Pagination, SelectProps, TreeSelectProps, TableColumnType } from 'ant-design-vue';
import { tableColumns } from './config';
import type { Dayjs } from 'dayjs';
// import { energyConsumption } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({
energyType: 'AverageData', // name
components: {
'a-pagination': Pagination,
},
});
const typeList = ref();
//
const frequencyValue = ref<string | undefined>();
// list
const frequencyOptions = ref<SelectProps['options']>([]);
const treeData2 = ref<TreeSelectProps['treeData']>([]);
const data = ref([]);
// let tableColumns = ref<TableColumnType[]>([]);
const total = ref<number>();
const queryParams = ref({
pageNum: 1,
pageSize: 10,
});
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
type RangeValue = [Dayjs, Dayjs];
const dates = ref<RangeValue>();
const hackValue = ref<RangeValue>();
const dateRange = ref<[Dayjs, Dayjs] | undefined>();
const onChangeDate = (val: RangeValue) => {
dateRange.value = val;
};
const onOpenChange = (open: boolean) => {
if (open) {
dates.value = [] as any;
hackValue.value = [] as any;
} else {
hackValue.value = undefined;
}
};
const disabledDate = (current: Dayjs) => {
if (!dates.value || (dates.value as any).length === 0) {
return false;
}
const tooLate = dates.value[0] && current.diff(dates.value[0], 'days') > 2;
const tooEarly = dates.value[1] && dates.value[1].diff(current, 'days') > 2;
return tooEarly || tooLate;
};
const onCalendarChange = (val: RangeValue) => {
dates.value = val;
};
//
const getTableList = () => {
// fetch(energyConsumption.pageList, queryParams.value).then((res) => {
// data.value = res.data.records;
// total.value = res.data.total;
// });
};
onMounted(() => {
frequencyOptions.value = [
{
value: '1',
label: '30分钟',
},
{
value: '2',
label: '小时',
},
{
value: '3',
label: '天',
},
{
value: '4',
label: '月',
},
{
value: '5',
label: '年',
},
];
typeList.value = [
{
id: 1,
value: '温度',
},
{
id: 2,
value: 'CO2浓度',
},
{
id: 3,
value: 'PM2.5',
},
{
id: 4,
value: '光照度',
},
{
id: 5,
value: 'TVOC',
},
{
id: 6,
value: '湿度',
},
];
treeData2.value = [
{
label: '办公区',
value: '0-0',
children: [
{
label: '办公一区',
value: '0-0-0',
},
{
label: '办公二区',
value: '0-0-1',
},
{
label: '办公三区',
value: '0-0-2',
},
{
label: '办公四区',
value: '0-0-3',
},
],
},
{
label: '站厅',
value: '0-1',
children: [
{
label: '站厅一区',
value: '0-1-0',
// disabled: true,
},
{
label: '站厅二区',
value: '0-1-1',
},
{
label: '站厅三区',
value: '0-1-2',
},
{
label: '站厅四区',
value: '0-1-3',
},
],
},
];
// let tableColumnsB = [
// {
// title: '1:00',
// dataIndex: '1:00',
// },
// {
// title: '2:00',
// dataIndex: '2:00',
// },
// {
// title: '3:00',
// dataIndex: '3:00',
// },
// {
// title: '4:00',
// dataIndex: '4:00',
// },
// ];
// let columnA: any[] = [...tableColumnsA];
// columnA.push(...tableColumnsB);
// tableColumns.value = columnA;
});
getTableList();
//
const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size;
getTableList();
};
</script>
<style scoped lang="less">
::v-deep .ant-table-title {
display: flex;
}
::v-deep .ant-table-container {
padding: 0px 16px;
}
</style>
<style scoped>
th.column-money,
td.column-money {
text-align: right !important;
}
</style>

20
hx-ai-intelligent/src/view/monitor/environmentMonitor/historyData/config.ts

@ -0,0 +1,20 @@
export const tableColumns = [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '区域名称',
dataIndex: 'areaName',
},
{
title: '点位',
dataIndex: 'point',
},
{
title: '日期',
dataIndex: 'date',
},
];

243
hx-ai-intelligent/src/view/monitor/environmentMonitor/historyData/index.vue

@ -0,0 +1,243 @@
<!-- eslint-disable vue/multi-word-component-names -->
<template>
<div>
<a-table
:columns="tableColumns"
:data-source="data"
bordered
:pagination="false"
:scroll="{ x: 100 }">
<template #title>
<div
style="display: flex; align-items: center; justify-content: space-between; width: 100%">
<div style="display: flex; align-items: center; width: 85%">
<div style="width: 10%">数据报表</div>
<a-select
v-model:value="typeValue"
placeholder="请选择环境参数"
style="width: 15%"
:options="typeList" />
<a-tree-select
v-model:value="quyuvalue"
style="width: 15%; margin-left: 10px"
:tree-data="treeData2"
tree-checkable
allow-clear
placeholder="请选择区域"
tree-node-filter-prop="label"
:maxTagCount="1" />
<a-select
v-model:value="frequencyValue"
placeholder="请选择采集频率"
style="width: 15%; margin-left: 10px"
:options="frequencyOptions" />
<a-date-picker style="width: 15%; margin-left: 10px" v-model:value="timeValue" />
<a-button type="primary" style="margin-left: 10px" @click="getSelect"> 查询 </a-button>
</div>
<a-button type="primary"> 导出 </a-button>
</div>
</template>
</a-table>
<a-pagination
:current="queryParams.pageNum"
:total="total"
:page-size="queryParams.pageSize"
style="display: flex; justify-content: center; margin-top: 16px"
:show-size-changer="true"
:show-quick-jumper="true"
@change="onChange" />
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted, defineOptions } from 'vue';
// import { http } from '/nerv-lib/util/http';
import { Pagination, SelectProps, TreeSelectProps, TableColumnType } from 'ant-design-vue';
import { tableColumns as tableColumnsA } from './config';
import type { Dayjs } from 'dayjs';
// import { energyConsumption } from '/@/api/carbonEmissionFactorLibrary';
defineOptions({
energyType: 'HistoryData', // name
components: {
'a-pagination': Pagination,
},
});
const typeList = ref();
const typeValue = ref();
const quyuvalue = ref<string[]>([]);
//
const frequencyValue = ref<string | undefined>();
// list
const frequencyOptions = ref<SelectProps['options']>([]);
const treeData2 = ref<TreeSelectProps['treeData']>([]);
const data = ref([]);
const timeValue = ref<Dayjs>();
let tableColumns = ref<TableColumnType[]>([]);
const total = ref<number>();
const queryParams = ref({
pageNum: 1,
pageSize: 10,
});
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
// const fetch = (api, params = { orgId }) => {
// return http.post(api, params);
// };
//
// const changeYearData = () => {
// queryParams.value.year = selectYear.value.format('YYYY');
// getTableList();
// };
//
const getTableList = () => {
// fetch(energyConsumption.pageList, queryParams.value).then((res) => {
// data.value = res.data.records;
// total.value = res.data.total;
// });
};
onMounted(() => {
frequencyOptions.value = [
{
value: '1',
label: '5分钟',
},
{
value: '2',
label: '10分钟',
},
{
value: '3',
label: '30分钟',
},
{
value: '4',
label: '1小时',
},
{
value: '5',
label: '天',
},
];
typeList.value = [
{
id: 1,
value: '温度',
},
{
id: 2,
value: 'CO2浓度',
},
{
id: 3,
value: 'PM2.5',
},
{
id: 4,
value: '光照度',
},
{
id: 5,
value: 'TVOC',
},
{
id: 6,
value: '湿度',
},
];
treeData2.value = [
{
label: '办公区',
value: '0-0',
children: [
{
label: '办公一区',
value: '0-0-0',
},
{
label: '办公二区',
value: '0-0-1',
},
{
label: '办公三区',
value: '0-0-2',
},
{
label: '办公四区',
value: '0-0-3',
},
],
},
{
label: '站厅',
value: '0-1',
children: [
{
label: '站厅一区',
value: '0-1-0',
// disabled: true,
},
{
label: '站厅二区',
value: '0-1-1',
},
{
label: '站厅三区',
value: '0-1-2',
},
{
label: '站厅四区',
value: '0-1-3',
},
],
},
];
let tableColumnsB = [
{
title: '1:00',
dataIndex: '1:00',
},
{
title: '2:00',
dataIndex: '2:00',
},
{
title: '3:00',
dataIndex: '3:00',
},
{
title: '4:00',
dataIndex: '4:00',
},
];
let columnA: any[] = [...tableColumnsA];
columnA.push(...tableColumnsB);
tableColumns.value = columnA;
});
getTableList();
//
const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size;
getTableList();
};
</script>
<style scoped lang="less">
::v-deep .ant-table-title {
display: flex;
}
::v-deep .ant-table-container {
padding: 0px 16px;
}
</style>
<style scoped>
th.column-money,
td.column-money {
text-align: right !important;
}
</style>

6
hx-ai-intelligent/src/view/monitor/environmentMonitor/index.vue

@ -4,14 +4,16 @@
<a-tab-pane key="2" tab="历史数据" force-render>Content of Tab Pane 2</a-tab-pane> <a-tab-pane key="2" tab="历史数据" force-render>Content of Tab Pane 2</a-tab-pane>
<a-tab-pane key="3" tab="平均数据">Content of Tab Pane 3</a-tab-pane> <a-tab-pane key="3" tab="平均数据">Content of Tab Pane 3</a-tab-pane>
</a-tabs> </a-tabs>
<!-- <ns-view-list-table v-bind="tableConfig" v-if="activeKey == '1'" /> -->
<aggregate-data ref="aggregateDataRef" v-if="activeKey == '1'" style="height: 85%" /> <aggregate-data ref="aggregateDataRef" v-if="activeKey == '1'" style="height: 85%" />
<history-data v-if="activeKey == '2'" />
<average-data v-if="activeKey == '3'" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { tableConfig } from './config';
import aggregateData from './aggregateData/index.vue'; import aggregateData from './aggregateData/index.vue';
import historyData from './historyData/index.vue';
import averageData from './averageData/index.vue';
const aggregateDataRef = ref(); const aggregateDataRef = ref();

Loading…
Cancel
Save