zhaohy 3 months ago
parent
commit
cac9355b04
  1. 10
      hx-ai-intelligent/src/api/index.ts
  2. 2
      hx-ai-intelligent/src/api/planManage.ts
  3. 13
      hx-ai-intelligent/src/api/waterSystem.ts
  4. 220
      hx-ai-intelligent/src/util/Export2Excel.js
  5. 39
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
  6. 642
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index1.vue
  7. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue
  8. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts
  9. 56
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  10. 106
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts
  11. 47
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  12. 63
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  13. 1632
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue
  14. 37
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
  15. 39
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
  16. 3
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue
  17. 120
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue
  18. 133
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue
  19. 2
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue
  20. 4
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue
  21. 4
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue
  22. 4
      hx-ai-intelligent/src/view/equipmentControl/ventilationSystem/components/fanPlant.vue
  23. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/alarm1.png
  24. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/alarm2.png
  25. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/back.gif
  26. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/back.png
  27. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/device1.png
  28. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/device2.png
  29. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/edit.png
  30. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/type1off.png
  31. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/type2off.png
  32. BIN
      hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/type3off.png
  33. 83
      hx-ai-intelligent/src/view/equipmentManage/group/config.ts
  34. 47
      hx-ai-intelligent/src/view/equipmentManage/group/editCarbonEquipment.vue
  35. 18
      hx-ai-intelligent/src/view/equipmentManage/group/index.vue
  36. 18
      hx-ai-intelligent/src/view/monitor/energyMonitor/tree/index.vue
  37. 63
      hx-ai-intelligent/src/view/monitor/environmentMonitor/historyData/index.vue
  38. 19
      hx-ai-intelligent/src/view/monitor/environmentMonitor/index.vue

10
hx-ai-intelligent/src/api/index.ts

@ -60,3 +60,13 @@ export const getEnum = async ({
const res = await http.get(api, params);
return Promise.resolve(res);
};
/**
* ( enumType)
*/
export const getEnumEnergy = async ({
api = `${BASE_URL}/operation/enum/getEnumEnergy`,
params = {},
}: dictHttpConfig) => {
const res = await http.get(api, params);
return Promise.resolve(res);
};

2
hx-ai-intelligent/src/api/planManage.ts

@ -2,7 +2,7 @@ const prefix = '/carbon-smart/api';
// 照明系统及相关接口
export enum planManage {
/**
* @param deviceType (1,2,3,4,5,6,7)
* @param deviceType (1,2,3,4,5,6)
*/
// 获得未激活的计划
getTransData = prefix + '/deviceCtrlPlan/getDeActivatedPlanList',

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

@ -0,0 +1,13 @@
// 前缀
const prefix = '/carbon-smart/api';
// 通风系统相关接口
export enum waterSys {
// 获得污水池状态
getPool1 = prefix + '/waterSysCtrl/getSewagePoolState',
// 获得阀门状态
getValve = prefix + '/waterSysCtrl/getValveState',
// 获得集水池状态
getPool2 = prefix + '/waterSysCtrl/getCollectPoolState',
// 获得水泵状态
getPump = prefix + '/waterSysCtrl/getPumpState',
}

220
hx-ai-intelligent/src/util/Export2Excel.js

@ -0,0 +1,220 @@
/* eslint-disable */
import { saveAs } from 'file-saver'
import XLSX from 'xlsx'
function generateArray(table) {
var out = [];
var rows = table.querySelectorAll('tr');
var ranges = [];
for (var R = 0; R < rows.length; ++R) {
var outRow = [];
var row = rows[R];
var columns = row.querySelectorAll('td');
for (var C = 0; C < columns.length; ++C) {
var cell = columns[C];
var colspan = cell.getAttribute('colspan');
var rowspan = cell.getAttribute('rowspan');
var cellValue = cell.innerText;
if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
//Skip ranges
ranges.forEach(function (range) {
if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
}
});
//Handle Row Span
if (rowspan || colspan) {
rowspan = rowspan || 1;
colspan = colspan || 1;
ranges.push({
s: {
r: R,
c: outRow.length
},
e: {
r: R + rowspan - 1,
c: outRow.length + colspan - 1
}
});
};
//Handle Value
outRow.push(cellValue !== "" ? cellValue : null);
//Handle Colspan
if (colspan)
for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
}
out.push(outRow);
}
return [out, ranges];
};
function datenum(v, date1904) {
if (date1904) v += 1462;
var epoch = Date.parse(v);
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}
function sheet_from_array_of_arrays(data, opts) {
var ws = {};
var range = {
s: {
c: 10000000,
r: 10000000
},
e: {
c: 0,
r: 0
}
};
for (var R = 0; R != data.length; ++R) {
for (var C = 0; C != data[R].length; ++C) {
if (range.s.r > R) range.s.r = R;
if (range.s.c > C) range.s.c = C;
if (range.e.r < R) range.e.r = R;
if (range.e.c < C) range.e.c = C;
var cell = {
v: data[R][C]
};
if (cell.v == null) continue;
var cell_ref = XLSX.utils.encode_cell({
c: C,
r: R
});
if (typeof cell.v === 'number') cell.t = 'n';
else if (typeof cell.v === 'boolean') cell.t = 'b';
else if (cell.v instanceof Date) {
cell.t = 'n';
cell.z = XLSX.SSF._table[14];
cell.v = datenum(cell.v);
} else cell.t = 's';
ws[cell_ref] = cell;
}
}
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
return ws;
}
function Workbook() {
if (!(this instanceof Workbook)) return new Workbook();
this.SheetNames = [];
this.Sheets = {};
}
function s2ab(s) {
var buf = new ArrayBuffer(s.length);
var view = new Uint8Array(buf);
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
return buf;
}
export function export_table_to_excel(id) {
var theTable = document.getElementById(id);
var oo = generateArray(theTable);
var ranges = oo[1];
/* original data */
var data = oo[0];
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
/* add ranges to worksheet */
// ws['!cols'] = ['apple', 'banan'];
ws['!merges'] = ranges;
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: 'xlsx',
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), "test.xlsx")
}
export function export_json_to_excel({
multiHeader = [],
header,
data,
filename,
merges = [],
autoWidth = true,
bookType = 'xlsx'
} = {}) {
/* original data */
filename = filename || 'excel-list'
data = [...data]
data.unshift(header);
for (let i = multiHeader.length - 1; i > -1; i--) {
data.unshift(multiHeader[i])
}
var ws_name = "SheetJS";
var wb = new Workbook(),
ws = sheet_from_array_of_arrays(data);
if (merges.length > 0) {
if (!ws['!merges']) ws['!merges'] = [];
merges.forEach(item => {
ws['!merges'].push(XLSX.utils.decode_range(item))
})
}
if (autoWidth) {
/*设置worksheet每列的最大宽度*/
const colWidth = data.map(row => row.map(val => {
/*先判断是否为null/undefined*/
if (val == null) {
return {
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
return {
'wch': val.toString().length * 2
};
} else {
return {
'wch': val.toString().length
};
}
}))
/*以第一行为初始值*/
let result = colWidth[0];
for (let i = 1; i < colWidth.length; i++) {
for (let j = 0; j < colWidth[i].length; j++) {
if (result[j]['wch'] < colWidth[i][j]['wch']) {
result[j]['wch'] = colWidth[i][j]['wch'];
}
}
}
ws['!cols'] = result;
}
/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
var wbout = XLSX.write(wb, {
bookType: bookType,
bookSST: false,
type: 'binary'
});
saveAs(new Blob([s2ab(wbout)], {
type: "application/octet-stream"
}), `${filename}.${bookType}`);
}

39
hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue

@ -36,6 +36,7 @@
style="width: 200px"
v-model:value="queryParams.year"
placeholder="请选择账期"
:allowClear="false"
picker="year"
valueFormat="YYYY" />
</a-form-item>
@ -60,15 +61,15 @@
<div class="ns-form-title">
<div class="title">配额统计</div>
<div class="operation" style="display: flex; justify-content: flex-end; width: 63%">
<a-button type="primary" v-if="parentId === 1" @click="getTotalTable(1)"
>全国配额</a-button
>
<a-button type="primary" v-if="parentId === 2" @click="getTotalTable(2)"
>地方配额</a-button
>
<a-button type="primary" v-if="parentId === 3" @click="getTotalTable(3)"
>CCER配额</a-button
>
<a-button type="primary" v-if="queryParams.accountType === 1" @click="getTotalTable(1)">
全国配额
</a-button>
<a-button type="primary" v-if="queryParams.accountType === 2" @click="getTotalTable(2)">
地方配额
</a-button>
<a-button type="primary" v-if="queryParams.accountType === 3" @click="getTotalTable(3)">
CCER配额
</a-button>
</div>
</div>
<a-table :columns="totalColumns" :data-source="totalData" bordered :pagination="false">
@ -205,6 +206,7 @@
year.value = queryParams.value.year;
transactionType.value = queryParams.value.transactionType;
accountType.value = queryParams.value.accountType;
getTotalTable(queryParams.value.accountType);
mainRef.value?.nsTableRef.reload();
// getDetailList();
};
@ -299,11 +301,11 @@
}));
});
formState.value = JSON.parse(JSON.stringify(record));
if (formState.value.expenditure === 0) {
formState.value.transactionQuantity = formState.value.income;
} else {
formState.value.transactionQuantity = formState.value.expenditure;
}
// if (formState.value.expenditure === 0) {
// formState.value.transactionQuantity = formState.value.income;
// } else {
// formState.value.transactionQuantity = formState.value.expenditure;
// }
setTimeout(() => {
let selectDevice = ref([Number(formState.value.transactionType)]);
findParentIds(options.value, formState.value.transactionType, selectDevice.value);
@ -427,7 +429,7 @@
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'carbonTradeDetails.xlsx'); //
link.setAttribute('download', '碳资产导出.xlsx'); //
document.body.appendChild(link);
link.click();
@ -523,11 +525,6 @@
}));
});
formState.value = JSON.parse(JSON.stringify(record));
if (formState.value.expenditure === 0) {
formState.value.transactionQuantity = formState.value.income;
} else {
formState.value.transactionQuantity = formState.value.expenditure;
}
setTimeout(() => {
let selectDevice = ref([Number(formState.value.transactionType)]);
findParentIds(options.value, formState.value.transactionType, selectDevice.value);
@ -702,6 +699,7 @@
.then((res) => {
message.success('操作成功!');
visible.value = false;
formState.value = {};
delIds.value = [];
// getDetailList();
mainRef.value?.nsTableRef.reload();
@ -714,6 +712,7 @@
message.success('操作成功!');
visible.value = false;
delIds.value = [];
formState.value = {};
// getDetailList();
mainRef.value?.nsTableRef.reload();
}

642
hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index1.vue

@ -1,642 +0,0 @@
<template>
<div class="search">
<a-card style="border-radius: 12px">
<div class="ns-form-title">
<div class="title">查询</div>
<div class="operation">
<a-button type="primary" @click="changeParentData"> 返回 </a-button>
</div>
</div>
<a-form layout="inline">
<a-form-item>
<a-select
v-model:value="queryParams.accountType"
style="width: 200px"
placeholder="请输入账户类型">
<a-select-option :value="1">全国账户</a-select-option>
<a-select-option :value="2">地方账户</a-select-option>
<a-select-option :value="3">CCER</a-select-option>
</a-select>
</a-form-item>
<a-form-item>
<a-cascader
v-model:value="queryParams.transactionType"
multiple
style="width: 200px"
:options="options"
placeholder="请选择交易类型"
suffix-icon="Shopping Around">
<template #tagRender="data">
<a-tag :key="data.value" color="blue">{{ data.label }}</a-tag>
</template>
</a-cascader>
</a-form-item>
<a-form-item>
<a-date-picker
style="width: 200px"
v-model:value="queryParams.year"
placeholder="请选择账期"
picker="year"
valueFormat="YYYY" />
</a-form-item>
<a-form-item>
<a-button type="primary" @click="searchTableList">查询</a-button>
<a-button html-type="submit" style="margin-left: 6px" @click="reset">重置</a-button>
</a-form-item>
</a-form>
</a-card>
</div>
<div style="display: flex; margin-top: 20px; height: calc(84% - 20px)">
<div class="detailTable">
<div class="ns-form-title">
<div class="title">交易明细</div>
<div class="operation" style="display: flex">
<a-button type="primary" @click="addDetail">新增</a-button>
<a-upload
v-model:file-list="importFileList"
name="file"
accept=".xlsx"
:showUploadList="false"
:custom-request="importFile">
<a-button type="primary" style="margin-left: 6px">导入</a-button>
</a-upload>
<a-button type="primary" style="margin-left: 6px" @click="exportFile">导出</a-button>
<a-button
type="primary"
style="margin-left: 6px"
:disabled="selectedRowKeys.length === 0"
@click="deleteMore"
>批量删除</a-button
>
</div>
</div>
<a-table
:columns="columns"
:data-source="data"
rowKey="id"
@change="onChange"
:rowSelection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectionChange,
}"
:scroll="{ x: 1500, y: 400 }"
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.dataIndex === 'accountType'">
<span v-if="record.accountType">{{ record.accountType.label }}</span>
</template>
<template v-if="column.key === 'action'">
<span>
<a @click="editData(record)">编辑</a>
<a-divider type="vertical" />
<a @click="delData(record)">删除</a>
</span>
</template>
</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>
<div class="total">
<div class="ns-form-title">
<div class="title">配额统计</div>
<div class="operation" style="display: flex; justify-content: space-around; width: 63%">
<a-button type="primary" @click="getTotalTable(1)">全国配额</a-button>
<a-button type="primary" @click="getTotalTable(2)">地方配额</a-button>
<a-button type="primary" @click="getTotalTable(3)">CCER配额</a-button>
</div>
</div>
<a-table :columns="totalColumns" :data-source="totalData" bordered :pagination="false">
<template #bodyCell="{ column, text }">
<template v-if="column.dataIndex === 'name'">
<a>{{ text }}</a>
</template>
</template>
</a-table>
</div>
</div>
<!-- 新增报告弹窗 -->
<a-drawer
:width="500"
:visible="visible"
:body-style="{ paddingBottom: '80px' }"
:footer-style="{ textAlign: 'right' }"
destroyOnClose
@close="onClose">
<div class="ns-form-title" style="display: flex">
<div class="title">{{ text }}</div>
</div>
<a-form
ref="formRef"
:model="formState"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol">
<a-form-item ref="name" label="账户类型" name="accountType">
<a-select v-model:value="formState.accountType" placeholder="请输入账户类型">
<a-select-option value="1">全国账户</a-select-option>
<a-select-option value="2">地方账户</a-select-option>
<a-select-option value="3">CCER</a-select-option>
</a-select>
</a-form-item>
<a-form-item ref="name" label="交易类型" name="transactionType">
<a-cascader
v-model:value="formState.transactionType"
:options="options"
placeholder="请选择交易类型" />
</a-form-item>
<a-form-item ref="name" label="交易日期" name="transactionDate">
<a-date-picker v-model:value="formState.transactionDate" valueFormat="YYYY-MM-DD" />
</a-form-item>
<a-form-item ref="name" label="交易数量" name="transactionQuantity">
<a-input v-model:value="formState.transactionQuantity" placeholder="请输入交易数量" />
</a-form-item>
<a-form-item ref="name" label="发生金额" name="amountIncurred">
<a-input v-model:value="formState.amountIncurred" placeholder="请输入发生金额" />
</a-form-item>
<a-form-item ref="name" label="交易对象" name="tradingPartner">
<a-input v-model:value="formState.tradingPartner" placeholder="请输入交易对象" />
</a-form-item>
<a-form-item ref="name" label="交易凭证">
<a-upload
:file-list="fileList"
name="file"
accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf"
@remove="handleFileRemove"
:before-upload="beforeUpload"
@change="handleChange">
<a-button>
<upload-outlined></upload-outlined>
上传
</a-button>
</a-upload>
</a-form-item>
</a-form>
<template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
<a-button type="primary" @click="onSubmit">确定</a-button>
</template>
</a-drawer>
</template>
<script lang="ts" setup>
import { ref, defineEmits, toRaw } from 'vue';
import { http } from '/nerv-lib/util/http';
import { UploadOutlined } from '@ant-design/icons-vue';
import type { UploadChangeParam, UploadProps } from 'ant-design-vue';
import { Pagination, Modal, message } from 'ant-design-vue';
import {
carbonAssets,
carbonEmissionFactorLibrary,
uploadPic,
} from '/@/api/carbonEmissionFactorLibrary';
import { log } from 'console';
defineOptions({
energyType: 'carbonAssets', // name
components: {
'a-pagination': Pagination,
},
});
// id
const props = defineProps({
parentId: {
type: Number,
},
});
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId }, config) => {
return http.post(api, params, config);
};
//
const selectedRowKeys = ref([]);
const onSelectionChange = (selectedKeys, selectedRows) => {
selectedRowKeys.value = selectedKeys;
};
const total = ref<number>();
const thisYear = ref(new Date().getFullYear().toString());
const queryParams = ref({
pageNum: 1,
pageSize: 10,
orgId: orgId.value,
accountType: props.parentId,
year: thisYear.value,
});
const searchTableList = () => {
getDetailList();
};
//
const getDetailList = () => {
fetch(carbonAssets.carbonDetailsList, queryParams.value).then((res) => {
data.value = res.data.records;
total.value = res.data.total;
});
};
getDetailList();
const columns = [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '资产类别',
dataIndex: 'accountType',
},
{
title: '交易方式',
dataIndex: 'transactionTypeName',
},
{
title: '交易日期',
dataIndex: 'transactionDate',
sorter: (a, b) => a.transactionDate - b.transactionDate,
},
{
title: '本期收入(tCO2)',
dataIndex: 'income',
sorter: (a, b) => a.income - b.income,
},
{
title: '本期支出(tCO2)',
dataIndex: 'expenditure',
sorter: (a, b) => a.expenditure - b.expenditure,
},
{
title: '发生金额(¥)',
dataIndex: 'amountIncurredValue',
},
{
title: '交易对象',
dataIndex: 'tradingPartner',
},
{
title: '更新人',
dataIndex: 'updateUser',
},
{
title: '更新时间',
dataIndex: 'updateTime',
},
{
title: '操作',
key: 'action',
width: 130,
},
];
const data = ref([]);
const reset = () => {
queryParams.value = {
pageNum: 1,
pageSize: 10,
orgId: orgId.value,
year: new Date().getFullYear(),
};
getDetailList();
};
const editData = (record) => {
getDictList();
text.value = '编辑';
visible.value = true;
formState.value.id = record.id;
fetch(uploadPic.select, { bizId: record.id, bizType: 1 }).then((res) => {
fileList.value = res.data.map((item) => ({
uid: item.id.toString(), // 使id
name: item.fileName, //
status: 'done', //
type: 'done',
url: item.filePath, // URLURL
}));
});
formState.value = JSON.parse(JSON.stringify(record));
if (formState.value.expenditure === 0) {
formState.value.transactionQuantity = formState.value.income;
} else {
formState.value.transactionQuantity = formState.value.expenditure;
}
setTimeout(() => {
let selectDevice = ref([Number(formState.value.transactionType)]);
findParentIds(options.value, formState.value.transactionType, selectDevice.value);
formState.value.transactionType = selectDevice;
formState.value.transactionType = formState.value.transactionType;
}, 500);
};
// id
function findParentIds(tree: any, targetId: number, result: any) {
for (let item of tree) {
if (item.children && item.children.length > 0) {
if (item.children.some((child: any) => child.value === targetId)) {
result.unshift(item.value); // id
findParentIds(tree, item.value, result); // id
break; // 退
}
}
}
}
const delData = (record) => {
const id = [record.id];
Modal.confirm({
title: '警告',
content: '确定要删除吗?',
okText: '确定',
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(carbonAssets.delete, { ids: id }).then((res) => {
message.success('操作成功!');
getDetailList();
});
},
onCancel() {
console.log('Cancel');
},
});
};
const deleteMore = () => {
Modal.confirm({
title: '警告',
content: '确定要删除吗?',
okText: '确定',
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(carbonAssets.delete, { ids: selectedRowKeys.value }).then((res) => {
message.success('操作成功!');
getDetailList();
});
},
onCancel() {
console.log('Cancel');
},
});
};
//
const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size;
getDetailList();
};
//
const visible = ref(false);
const text = ref('新增');
const formState = ref({
orgId: orgId.value,
});
const formRef = ref();
const labelCol = { span: 5 };
const wrapperCol = { span: 19 };
const options = ref([]);
//
const getDictList = () => {
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'TRANSACTION_TYPE' }).then(
(res) => {
options.value = res.data;
options.value = options.value.map((item) => ({
value: item.id,
label: item.cnValue,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.cnValue,
}))
: [],
}));
},
);
};
getDictList();
//
const addDetail = () => {
text.value = '新增';
visible.value = true;
getDictList();
};
const importFileList = ref<UploadProps['fileList']>([]);
const importFile = (options: UploadRequestOption) => {
const { file, onSuccess, onError } = options;
const formData = ref(new FormData());
formData.value.append('file', file as any);
formData.value.append('orgId', orgId.value);
formData.value.append('year', queryParams.value.year);
fetch(carbonAssets.import, formData.value)
.then((res) => {
message.success('操作成功!');
getDetailList();
})
.catch((error) => {
console.log('error', error);
});
};
const exportFile = () => {
const exportQuery = ref({
orgId: orgId.value,
pageNum: 1,
pageSize: 999,
year: queryParams.value.year,
ids: selectedRowKeys.value,
});
const config = {
responseType: 'blob',
};
fetch(carbonAssets.export, exportQuery.value, config)
.then((res) => {
// URL blob
const url = window.URL.createObjectURL(new Blob([res]));
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'carbonTradeDetails.xlsx'); //
document.body.appendChild(link);
link.click();
// URL
window.URL.revokeObjectURL(url);
selectedRowKeys.value = [];
})
.catch((error) => {
console.error('下载失败:', error);
});
};
//
const fileList = ref<UploadProps['fileList']>([]);
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
return false;
};
const handleChange = (info: UploadChangeParam) => {
fileList.value = [...info.fileList];
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(`${info.file.name} 文件上传成功`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败`);
}
};
const delIds = ref([]);
const handleFileRemove = (file) => {
delIds.value.push(file.uid);
const newFileList = [];
fileList.value.forEach((item) => {
if (item.uid !== file.uid) {
newFileList.push(item);
}
});
fileList.value = newFileList;
};
const onSubmit = () => {
formRef.value
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
if (formState.value.transactionType) {
formState.value.transactionType = formState.value.transactionType.join(',').split(',')[1];
}
if (formState.value.accountType.value) {
formState.value.accountType = formState.value.accountType.value;
}
fetch(carbonAssets.createOrUpdate, formState.value).then((res) => {
if (res.data.id && fileList.value.length !== 0) {
// uploadQuery.value.bizId = res.data.id;
const formData = ref(new FormData());
fileList.value.forEach((file) => {
if (file.type !== 'done') {
formData.value.append('files', file.originFileObj);
}
});
formData.value.append('bizType', 1);
formData.value.append('bizId', res.data.id);
delIds.value.forEach((item) => {
formData.value.append('deleteList', item);
});
fetch(uploadPic.uploadfiles, formData.value)
.then((res) => {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
getDetailList();
getTotalTable();
})
.catch((error) => {
console.log('error', error);
});
} else {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
getDetailList();
}
});
})
.catch((error) => {
console.log('error', error);
});
};
// form
const rules: Record<string, Rule[]> = {
accountType: [{ required: true, message: '请输入账户类型', trigger: 'change' }],
transactionType: [{ required: true, message: '请选择交易类型', trigger: 'change' }],
transactionDate: [{ required: true, message: '请选择交易日期', trigger: 'change' }],
transactionQuantity: [{ required: true, message: '请输入交易数量', trigger: 'change' }],
amountIncurred: [{ required: true, message: '请输入发生金额', trigger: 'change' }],
tradingPartner: [{ required: true, message: '请输入交易对象', trigger: 'change' }],
};
//
const onClose = () => {
visible.value = false;
delIds.value = [];
formState.value = {};
fileList.value = [];
formRef.value.resetFields();
};
//
const getTotalTable = (type) => {
if (type) {
queryParams.value.accountType = type;
}
fetch(carbonAssets.quotaStatistics, queryParams.value).then((res) => {
totalData.value = res.data;
});
};
getTotalTable();
const totalColumns = [
{
title: '统计类型',
dataIndex: 'statisticType',
},
{
title: '小计',
dataIndex: 'subtotal',
},
{
title: '合计',
dataIndex: 'amountTo',
},
];
const totalData = ref([]);
//
const emit = defineEmits(['change-data']);
const changeParentData = () => {
emit('change-data', true);
};
</script>
<style lang="less" scoped>
.ns-form-title {
font-weight: bold;
user-select: text;
padding-bottom: 10px;
display: flex;
justify-content: space-between;
}
.title {
text-align: left;
height: 32px;
line-height: 32px;
font-weight: bold;
user-select: text;
position: relative;
padding-left: 9px;
}
.title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 13px;
width: 3px;
border-radius: 1px;
background-color: #2778ff;
}
:deep(.ant-card-body) {
padding: 16px;
}
.search {
height: 16%;
}
.detailTable {
width: 65%;
margin-right: 20px;
height: 100%;
background: white;
border-radius: 12px;
padding: 16px;
}
.total {
width: calc(35% - 20px);
height: 100%;
background: white;
border-radius: 12px;
padding: 16px;
}
</style>

2
hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/index.vue

@ -129,7 +129,7 @@
</div>
<div class="title">
<img width="24" height="24" src="../../../../src/icon/carbonAssetsTitle-3.svg" />
<span>全国碳账户余额</span>
<span>CCER账户余额</span>
</div>
<div class="bottom">
<div class="calculation BLCard">

2
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/config.ts

@ -167,7 +167,7 @@ export const formConfig = (disabled) => {
label: '已引用数',
field: 'numberOfReferences',
component: 'NsInput',
show:disabled,
show: disabled,
componentProps: {
defaultValue: '',
disabled: true,

56
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue

@ -299,13 +299,7 @@
const x = 3;
const y = 2;
const z = 1;
const genData: TreeProps['treeData'] = [
{
emissionName: '全部',
key: '0-0',
children: [],
},
];
const genData: TreeProps['treeData'] = [];
const checkedTreeNodeKeys = ref<string[]>();
const selectedKeys = ref<string[]>();
@ -532,7 +526,7 @@
const getOrgTree = () => {
fetch(carbonEmissionFactorLibrary.getCarbonFactorTree, getClassificationTree.value).then(
(res) => {
gData.value[0].children = res.data;
gData.value = res.data;
//
// const selectedNodes = [];
// checkedTreeNodeKeys.value.forEach(key => {
@ -564,10 +558,12 @@
const onSelectKeys = ref([]);
const onSelect = (selectedKey: string[], info: any) => {
if (selectedKey.length === 1) {
selectedKeys.value = selectedKey;
if (info.selectedNodes[0].emissionName === '全部') {
onSelectKeys.value = [];
} else {
onSelectKeys.value = [info.selectedNodes[0].id];
}
if (info.selected) {
// showOperation.value = true;
selectedKeys.value = selectedKey;
editTreeNode.value = {
id: info.selectedNodes[0].id,
level: info.selectedNodes[0].level,
@ -575,15 +571,18 @@
sortNumber: info.selectedNodes[0].sortNumber,
parentEmissionId: info.selectedNodes[0].parentEmissionId,
};
onSelectKeys.value = [info.selectedNodes[0].id];
emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
mainRef.value?.nsTableRef.reload();
} else {
editTreeNode.value = {};
onSelectKeys.value = [];
emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
mainRef.value?.nsTableRef.reload();
}
// if (info.selected) {
// // showOperation.value = true;
// } else {
// editTreeNode.value = {};
// onSelectKeys.value = [];
// emissionList.value = [...onSelectKeys.value, ...checkedIds.value];
// mainRef.value?.nsTableRef.reload();
// }
};
const onSearch = () => {
@ -705,12 +704,17 @@
label: '导出',
type: 'primary',
handle: () => {
// console.log( mainRef.value.nsTableRef.tableState.selectedRowKeys)
// console.log(mainRef.value.nsTableRef.formParamsRef)
const exportQuery = {
orgId: orgId.value,
pageNum: 1,
pageSize: 999,
ids: mainRef.value.nsTableRef.tableState.selectedRowKeys,
bibliography:mainRef.value.nsTableRef.formParamsRef.bibliography,
emissionGas:mainRef.value.nsTableRef.formParamsRef.emissionGas,
carbonDatabase:mainRef.value.nsTableRef.formParamsRef.carbonDatabase,
emissionProcess:mainRef.value.nsTableRef.formParamsRef.emissionProcess,
emissionSources:mainRef.value.nsTableRef.formParamsRef.emissionSources,
};
const config = {
responseType: 'blob',
@ -722,7 +726,7 @@
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'carbonFactor.xlsx'); //
link.setAttribute('download', '碳排因子库导出.xlsx'); //
document.body.appendChild(link);
link.click();
@ -1242,8 +1246,10 @@
flex-direction: column;
border-radius: 12px;
overflow: auto;
align-items: center;
:deep(.ant-tree) {
height: 90%;
width: 90%;
overflow: auto;
}
}
@ -1257,12 +1263,12 @@
}
}
}
:deep(
.ant-form-item-label
> label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before
) {
display: none !important;
}
// :deep(
// .ant-form-item-label
// > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before
// ) {
// display: none !important;
// }
:deep(.ant-form-item-label) {
z-index: 20;
text-align: right;

106
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/config.ts

@ -1,3 +1,5 @@
import { quickCalculation, carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
import { ref } from 'vue';
// 能耗统计表表头
export const tableColumns = [
{
@ -144,3 +146,107 @@ export const drawerColumns = [
dataIndex: 'dataSources',
},
];
export const setFactorConfig = (orgId) => {
return ref({
api: carbonEmissionFactorLibrary.getTableList,
params: { orgId, pageNum: 1, pageSize: 9999, emissionList: [0] },
treeConfig: {
header: {
icon: 'deviceType',
title: '排放分类',
},
params: { orgId},
dynamicParams: { emissionList: 'id[]' },
defaultExpandAll: true,
// checkable:true,
api: carbonEmissionFactorLibrary.getCarbonFactorTree,
fieldNames: { title: 'emissionName', key: 'id' },
formConfig: {
schemas: [
{
field: 'deviceType',
label: '设备名称',
component: 'NsInput',
autoSubmit: true,
componentProps: {
placeholder: '请输入关键字',
},
},
],
},
},
rowSelection: { type: 'radio' },
columns: [
{
title: '序号',
textNumber: 2,
dataIndex: 'address',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '名称',
dataIndex: 'emissionSources',
textNumber: 3,
},
{
title: '排放因子',
dataIndex: 'emissionFactors',
textNumber: 4,
textEllipsis: true,
},
{
title: '排放因子单位',
dataIndex: 'emissionFactorUnits',
width: 100,
textEllipsis: true,
},
{
title: '排放环节',
dataIndex: 'emissionProcess',
textWidth: 88,
textEllipsis: true,
},
{
title: '数据来源',
dataIndex: 'dataSources',
textNumber: 5,
textEllipsis: true,
},
],
formConfig: {
schemas: [
{
field: 'emissionSources',
label: '排放源',
component: 'NsInput',
componentProps: {
placeholder: '请输入排放源',
maxLength: 20,
},
},
{
field: 'emissionProcess',
label: '排放环节',
component: 'NsSelectApi',
componentProps: {
placeholder: '请选择排放环节',
api: carbonEmissionFactorLibrary.gasAndDatabase,
resultField: 'data',
params: {
orgId: orgId.value,
type: 'emissionProcess',
},
immediate: true,
labelField: 'label',
valueField: 'value',
},
},
],
params: {},
},
// pagination: { pageSizeOptions: false },
rowKey: 'id',
});
};

47
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue

@ -57,7 +57,7 @@
<a-radio :value="1"></a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="排放类型" name="emissionType" :required="isRequired">
<a-form-item label="排放类型" name="emissionType" :required="isRequired" v-if="isRequired">
<a-select
v-model:value="formState.emissionType"
placeholder="请选择排放类型"
@ -330,7 +330,7 @@
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'carbonStats.xlsx'); //
link.setAttribute('download', '能耗统计导出.xlsx'); //
document.body.appendChild(link);
link.click();
@ -342,13 +342,13 @@
});
},
},
{
label: '模板下载',
type: 'primary',
handle: () => {
doWnload('/hx-ai-intelligent/asset/file/energyConsumption.xlsx');
},
},
// {
// label: '',
// type: 'primary',
// handle: () => {
// doWnload('/hx-ai-intelligent/asset/file/energyConsumption.xlsx');
// },
// },
// {
// label: '',
// type: 'primary',
@ -782,23 +782,17 @@
//
fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => {
treeData.value = res.data;
treeData.value = treeData.value.map((item) => ({
treeData.value = transformData(treeData.value);
});
};
//
const transformData = (data: any[]) => {
return data.map((item) => ({
title: item.pointName,
value: item.id,
label: item.pointName,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.pointName,
children: child.children
? child.children.map((childs) => ({
value: childs.id,
label: childs.pointName,
}))
: [],
}))
: [],
key: item.id,
children: item.children ? transformData(item.children) : [],
}));
});
};
//
const emissionType = ref();
@ -819,7 +813,9 @@
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
formState.value.year = selectYear.value.format('YYYY');
formState.value.year = mainRef.value.nsTableRef.formParamsRef.year
? mainRef.value.nsTableRef.formParamsRef.year
: selectYear.value.format('YYYY');
if (formState.value.unit) {
formState.value.unit = formState.value.unit.join(',').split(',')[1];
}
@ -973,6 +969,7 @@
formState.value = {
orgId: orgId.value,
};
fileList.value = [];
formRef.value.resetFields();
};
//

63
hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue

@ -40,40 +40,11 @@
</div>
</div>
<div class="right">
<!-- <a-table
:columns="columns"
:data-source="tableData"
bordered
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'action'">
<span>
<a @click="editData(record)">编辑</a>
<a-divider type="vertical" />
<a @click="delData(record)">删除</a>
</span>
</template>
</template>
<template #title>
<div class="ns-table-title"><span>排放因子库</span></div>
<div class="buttonGroup">
<a-button type="primary" @click="addNewData">新增</a-button>
</div>
</template>
</a-table> -->
<ns-view-list-table
v-bind="tableConfig"
:model="tableData"
ref="mainRef"
:scroll="{ x: 1000 }" />
<!-- <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" /> -->
<!-- 新增/编辑 -->
<a-drawer
:width="500"
@ -93,20 +64,20 @@
:wrapper-col="wrapperCol">
<a-row>
<a-col :span="24">
<a-form-item ref="name" label="日期范围" name="dateRange">
<a-form-item ref="name" label="适用日期" name="dateRange">
<a-range-picker
v-model:value="formState.dateRange"
picker="month"
valueFormat="YYYY-MM" />
</a-form-item>
</a-col>
<a-col :span="24">
<!-- <a-col :span="24">
<a-form-item ref="name" label="排放因子" name="emissionFactors">
<ns-input v-model:value="formState.emissionFactors" disabled />
</a-form-item>
</a-col>
</a-col> -->
</a-row>
<span
<!-- <span
key=""
style="font-size: 16px; font-weight: 700; color: rgba(51, 51, 51, 1); text-align: left">
因子列表
@ -117,8 +88,11 @@
<ns-input style="margin-top: 5px" v-model:value="selectData" @change="keyChange" />
</a-form-item>
</a-col>
</a-row>
</a-row> -->
</a-form>
<a-button type="primary" style="margin-bottom: 10px" @click="selectFactor"
>选择因子</a-button
>
<a-table
:columns="drawerColumns"
:data-source="newTableData"
@ -142,6 +116,15 @@
</template>
</a-drawer>
</div>
<!-- 选择因子 -->
<a-modal
v-model:visible="openVisible"
width="60%"
title="选择因子"
@ok="onSubmit"
@cancel="onClose">
<ns-view-list-table v-bind="config" ref="setFactorRef" style="height: 500px" />
</a-modal>
</div>
</template>
@ -156,6 +139,7 @@
carbonEmissionFactorLibrary,
} from '/@/api/carbonEmissionFactorLibrary';
import { or } from '@vueuse/core';
import { setFactorConfig } from '../config';
defineOptions({
energyType: 'quickCalculation', // name
components: {
@ -499,6 +483,11 @@
},
});
};
const openVisible = ref(false);
const config = setFactorConfig(orgId.value);
const selectFactor = () => {
openVisible.value = true;
};
//
const onClose = () => {
visible.value = false;
@ -611,6 +600,12 @@
:deep(.ant-table-container) {
padding: unset;
}
:deep(.ant-modal-header) {
border-bottom: 10px solid #f0f0f0 !important;
}
:deep(.ant-modal-footer) {
border-top: 10px solid #f0f0f0 !important;
}
</style>
<style scoped>
th.column-money,

1632
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index copy.vue

File diff suppressed because it is too large

37
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue

@ -308,6 +308,7 @@
<div class="ns-form-title-edit">
<div class="title">编辑</div>
</div>
<a-spin :spinning="spinning">
<a-form
ref="editFormRef"
:model="editFormState"
@ -382,6 +383,7 @@
</a-col>
</a-row>
</a-form>
</a-spin>
<div class="ns-form-title-edit" style="display: flex">
<div class="titleEdit">因子列表</div>
</div>
@ -1121,19 +1123,21 @@
//
fetch(group.queryDeviceGroupTree, { energyType: value, orgId: orgId.value }).then((res) => {
collectingNodes.value = res.data;
collectingNodes.value = collectingNodes.value.map((item) => ({
collectingNodes.value = collectingNodes.value = transformData(collectingNodes.value);
});
};
//
const transformData = (data: any[]) => {
return data.map((item) => ({
title: item.pointName,
value: item.id,
label: item.pointName,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.pointName,
}))
: [],
key: item.id,
children: item.children ? transformData(item.children) : [],
}));
});
};
const spinning = ref(false);
const selectNode = (value) => {
spinning.value = true;
const getConsumeData = ref({
acquisitionDate: acquisitionDate.value,
collectionNode: value,
@ -1142,6 +1146,7 @@
});
fetch(carbonInventoryCheck.nodeCancellationConsumption, getConsumeData.value).then((res) => {
editFormState.value.consumption = res.data;
spinning.value = false;
});
};
//
@ -1696,6 +1701,13 @@
background: #c9e4ff;
}
}
:deep(.ant-empty) {
height: 80%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
}
.right {
flex: 1;
@ -1811,4 +1823,11 @@
display: flex;
justify-content: right;
}
:deep(.ant-empty) {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
</style>

39
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue

@ -39,7 +39,11 @@
placeholder="请输入报告名称" />
</a-form-item>
<a-form-item ref="name" label="报告年度" name="reportYear">
<a-date-picker v-model:value="formState.reportYear" picker="year" valueFormat="YYYY" />
<a-date-picker
v-model:value="formState.reportYear"
@openChange="openChange"
picker="year"
valueFormat="YYYY" />
</a-form-item>
<a-form-item ref="name" label="适用标准" name="genericStandard">
<a-input
@ -60,6 +64,7 @@
<a-form-item ref="name" label="报告范围" name="reportScope">
<a-range-picker
v-model:value="formState.reportScope"
:defaultPickerValue="defaultPickerValue"
picker="month"
:disabledDate="disabledDate"
valueFormat="YYYY-MM" />
@ -78,6 +83,8 @@
import { http } from '/nerv-lib/util/http';
import { carbonInventoryCheck } from '/@/api/carbonEmissionFactorLibrary';
import fillIn from './fillInPage/index.vue';
import { message } from 'ant-design-vue';
import dayjs, { Dayjs } from 'dayjs';
defineOptions({ name: 'CarbonInventoryCheck' });
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
@ -104,6 +111,17 @@
const selectChange = (value) => {
formState.value.reportScope = '';
};
const defaultPickerValue = ref([
dayjs('2020'), //
dayjs('2020'), //
]);
const openChange = (status) => {
if (status === false) {
if (formState.value.reportYear) {
defaultPickerValue.value = [dayjs('2022'), dayjs('2022')];
}
}
};
// form
const rules: Record<string, Rule[]> = {
reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }],
@ -241,6 +259,9 @@
};
fetch(carbonInventoryCheck.downloadZip, deleteId.value, config)
.then((res) => {
if (res.type === 'application/json') {
handlerResponseError(res);
} else {
// URL blob
const url = window.URL.createObjectURL(new Blob([res]));
// <a>
@ -252,6 +273,7 @@
// URL
window.URL.revokeObjectURL(url);
}
})
.catch((error) => {
console.error('下载图片失败:', error);
@ -295,6 +317,21 @@
},
rowKey: 'id',
});
const handlerResponseError = (data) => {
const fileReader = new FileReader();
fileReader.onload = function () {
try {
const jsonData = JSON.parse(fileReader.result); //
console.log('后台返回的信息', jsonData.data);
message.warning(jsonData.data);
// dosomething
} catch (err) {
//
console.log('success...');
}
};
fileReader.readAsText(data);
};
//
const updateData = (newDataOne, newDataTwo) => {
isMainPage.value = newDataOne;

3
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/all/index.vue

@ -360,6 +360,9 @@
background: #f2f2f2 !important;
color: black !important;
}
:deep(.ant-picker) {
border-radius: unset;
}
.month {
width: 50%;
display: flex;

120
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue

@ -96,28 +96,32 @@
</span>
</template>
</template>
<!-- <template #summary>
<template #summary>
<a-table-summary-row>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell>合计</a-table-summary-cell>
<a-table-summary-cell :colSpan="2">合计</a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text type="danger">{{ 111 }}</a-typography-text>
<a-typography-text>{{ totalLastYearActualUsage + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>{{ 222 }}</a-typography-text>
<a-typography-text>{{ totalActualUsage + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>{{ 222 }}</a-typography-text>
<a-typography-text>{{ totalReferenceValue + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>-</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>-</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
<a-table-summary-cell>
<a-typography-text>{{ 222 }}</a-typography-text>
<a-typography-text>{{ totalBudget + unit }}</a-typography-text>
</a-table-summary-cell>
<a-table-summary-cell></a-table-summary-cell>
</a-table-summary-row>
</template> -->
</template>
</a-table>
</a-card>
</div>
@ -135,16 +139,16 @@
v-model:value="formState.conversionRate"
:maxlength="15"
@keydown="handleKeyDown"
suffix="%"
:disabled="disabled" />
<span class="unit">%</span>
</a-form-item>
<a-form-item label="预算值" :required="true">
<a-input-number
v-model:value="formState.budget"
:maxlength="15"
@keydown="handleKeyDown"
suffix="kWh"
:disabled="!disabled" />
<span class="unit">kWh</span>
</a-form-item>
</a-form>
</a-modal>
@ -247,6 +251,7 @@
QuestionCircleOutlined,
} from '@ant-design/icons-vue';
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
import { getEnumEnergy } from '/@/api';
import * as echarts from 'echarts';
import { any, string } from 'vue-types';
import type { Dayjs } from 'dayjs';
@ -265,8 +270,10 @@
nodeName: {
type: string,
},
resourceType: {
type: string,
},
});
console.log(props, 'xxy');
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
@ -291,11 +298,29 @@
itemizeId: props.parentId,
type: props.type,
});
console.log(props.type, '6666');
const ids = ref([]);
const lastActualUsageList = ref([]);
//
const unit = ref();
const totalActualUsage = ref();
const totalBudget = ref();
const totalLastYearActualUsage = ref();
const totalReferenceValue = ref();
const getTableData = () => {
fetch(carbonPlanning.detailedStatisticalDataTable, queryParams.value).then((res) => {
data.value = res.data;
fetch(carbonPlanning.detailedStatisticalDataTable, queryParams.value).then(async (res) => {
let resUnit = await getEnumEnergy({ params: { code: props.resourceType } });
unit.value = resUnit.data.unit;
data.value = res.data.list;
totalActualUsage.value = res.data.actualUsage;
totalBudget.value = res.data.budget;
totalLastYearActualUsage.value = res.data.lastYearActualUsage;
totalReferenceValue.value = res.data.referenceValue;
if (data.value.length > 0) {
ids.value = data.value.map((item) => item.id);
lastActualUsageList.value = data.value.map((item) => item.lastYearActualUsage);
formState.value.lastYearList = lastActualUsageList.value;
}
});
};
getTableData();
@ -313,14 +338,17 @@
{
title: Number(props.year) - 1 + '年实际用量',
dataIndex: 'lastYearActualUsage',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: props.year + '年实际用量',
dataIndex: 'actualUsage',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '基准值',
dataIndex: 'referenceValue',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '是否按去年折算',
@ -329,10 +357,12 @@
{
title: '折算率',
dataIndex: 'conversionRate',
customRender: ({ text }: { text: number }) => `${text}%`, //
},
{
title: '2024年预算',
dataIndex: 'budget',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '操作',
@ -346,10 +376,10 @@
const formRef = ref();
const formState = ref({});
const labelCol = { span: 6 };
const wrapperCol = { span: 18 };
const wrapperCol = { span: 17 };
const editData = (record) => {
open.value = true;
if (record.isLastYear) {
if (record.isLastYear !== undefined) {
formState.value.ids = [record.id];
if (record.lastYear === '是') {
formState.value.isLastYear = 1;
@ -357,6 +387,7 @@
formState.value.isLastYear = 0;
}
formState.value.conversionRate = record.conversionRate;
formState.value.lastYearList = [record.lastYearActualUsage];
formState.value.budget = record.budget;
}
};
@ -593,7 +624,7 @@
'基准值',
],
top: '0',
left: '0',
right: '0',
textStyle: {
color: '#666',
fontSize: 12,
@ -650,6 +681,30 @@
],
series: [
{
name: props.year + '年预算',
type: 'line',
// smooth: true, // 线
symbol: 'emptyCircle', //
itemStyle: {
normal: {
color: 'rgba(255, 188, 70, 1)',
},
},
data: budgetList.value,
},
{
name: '基准值',
type: 'line',
// smooth: true, // 线
symbol: 'emptyCircle', //
itemStyle: {
normal: {
color: 'rgba(195, 142, 255, 1)',
},
},
data: referenceValueList.value,
},
{
name: Number(props.year) - 1 + '年实际用量',
type: 'bar',
barWidth: 18,
@ -707,28 +762,6 @@
},
data: actualUsageList.value,
},
{
name: props.year + '年预算',
type: 'line',
smooth: true, // 线
symbol: 'none', //
lineStyle: {
color: 'rgba(255, 188, 70, 1)',
width: 2,
},
data: budgetList.value,
},
{
name: '基准值',
type: 'line',
smooth: true, // 线
symbol: 'none', //
lineStyle: {
color: 'rgba(195, 142, 255, 1)',
width: 2,
},
data: referenceValueList.value,
},
],
};
chartInstance = echarts.init(chartRef.value);
@ -827,8 +860,8 @@
background: #f7f9ff;
padding: 12px;
border-radius: 12px;
background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(222, 255, 246, 1) 100%);
border: 1px solid rgba(18, 174, 132, 1);
background: linear-gradient(180deg, #ffffff 0%, #defff663 100%);
border: 1px solid #12ae8424;
.quantity {
font-size: 12px;
font-weight: 400;
@ -900,6 +933,11 @@
) {
display: none !important;
}
.unit {
position: absolute;
right: 10px;
top: 5px;
}
</style>
<style scoped>
.editable-row-operations a {

133
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue

@ -69,7 +69,8 @@
:parentId="parentId"
:year="year"
:type="type"
:nodeName="nodeName" />
:nodeName="nodeName"
:resourceType="resourceType" />
</div>
<!-- 新增节点 -->
<a-drawer :visible="visible" :width="500" @close="onClose" :footer-style="{ textAlign: 'right' }">
@ -81,6 +82,7 @@
:selectedKeys="selectedKeys"
:checkedKeys="treeCheckedKeys"
:tree-data="treeData"
:checkStrictly="true"
:show-line="{ showLeafIcon: false }"
v-if="treeData && treeData.length > 0"
class="draggable-tree"
@ -110,6 +112,7 @@
import categoryDeatil from './categoryDeatil.vue';
import { group } from '/@/api/deviceManage';
import { carbonPlanning } from '/@/api/carbonEmissionFactorLibrary';
import { getEnumEnergy } from '/@/api';
import type { TreeProps } from 'ant-design-vue';
import 'echarts-liquidfill';
defineOptions({
@ -124,8 +127,6 @@
type: String,
},
});
console.log(props, 'xxy');
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
@ -155,6 +156,9 @@
selectedTime.value = false;
getMonthData();
getBallQuery.value.yearAndMonth = 'month';
getBallQuery.value.itemizeIds = [];
getBallQuery.value.itemizeId = '';
getPillarQuery.value.itemizeId = '';
// getMonthPillarData();
};
const changeToYear = () => {
@ -167,6 +171,9 @@
selectedTime.value = true;
getYearData();
getBallQuery.value.yearAndMonth = 'year';
getBallQuery.value.itemizeIds = [];
getBallQuery.value.itemizeId = '';
getPillarQuery.value.itemizeId = '';
// getYearPillarData();
};
// echarts
@ -299,8 +306,8 @@
symbolSize: [14, 4],
symbolMargin: 0.5,
symbolPosition: 'start',
z: -20,
data: actualUsage.value,
barGap: '5%',
label: {
normal: {
show: false,
@ -320,8 +327,8 @@
symbolSize: [14, 4],
symbolMargin: 0.5,
symbolPosition: 'start',
z: -20,
data: budget.value,
barGap: '5%',
label: {
normal: {
show: false,
@ -339,7 +346,8 @@
color: '#f4664a',
width: 2,
},
data: referenceValue.value,
// data: referenceValue.value,
data: [600],
},
],
};
@ -386,7 +394,7 @@
textStyle: {
color: !selectedTime.value ? 'rgba(68, 197, 253,1)' : 'rgba(12, 168, 126, 1)',
insideColor: '#12786f',
fontSize: 40,
fontSize: Number(ballData) > 1000 ? 20 : 40,
},
formatter: (params) => {
// return `${(params.value * 100).toFixed(2)}%`;
@ -431,7 +439,7 @@
const selectedKeys = ref<string[]>([]);
const treeCheckedKeys = ref<string[]>([]);
const checkTreeNode = (checkedKeys, info) => {
treeCheckedKeys.value = checkedKeys;
treeCheckedKeys.value = checkedKeys.checked;
addTreeNode.value.itemizeIds = treeCheckedKeys.value;
};
const formatTreeData = (treeData) => {
@ -450,7 +458,9 @@
year: selectYearValue.value.format('YYYY'),
});
const onSubmit = () => {
fetch(carbonPlanning.addNodes, addTreeNode.value).then((res) => {
fetch(carbonPlanning.addNodes, addTreeNode.value).then(async (res) => {
let resUnit = await getEnumEnergy({ params: { code: props.energyType } });
unit.value = resUnit.data.unit;
data.value = res.data;
visible.value = false;
changeToYear();
@ -459,49 +469,6 @@
const onClose = () => {
visible.value = false;
};
//
const columns = ref([
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '分项名称',
dataIndex: 'itemizeName',
},
{
title: '年份',
dataIndex: 'year',
},
{
title: '实际用量',
dataIndex: 'actualUsage',
},
{
title: '预算量',
dataIndex: 'budget',
},
{
title: '基准值',
dataIndex: 'referenceValue',
},
{
title: '节能量',
dataIndex: 'energyConservation',
},
{
title: '预算达成率',
dataIndex: 'budgetAchievement',
},
{
title: '操作',
key: 'action',
},
]);
const data = ref([]);
//
const yearQueryParams = ref({
orgId: orgId.value,
@ -515,8 +482,13 @@
addTreeNode.value.year = selectYearValue.value;
getYearData();
};
//
const unit = ref();
const getYearData = () => {
fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then((res) => {
treeCheckedKeys.value = [];
fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then(async (res) => {
let resUnit = await getEnumEnergy({ params: { code: props.energyType } });
unit.value = resUnit.data.unit;
data.value = res.data;
res.data.forEach((item) => {
treeCheckedKeys.value.push(item.itemizeId.toString());
@ -540,7 +512,9 @@
getMonthData();
};
const getMonthData = () => {
fetch(carbonPlanning.searchListByMonth, monthQueryParams.value).then((res) => {
fetch(carbonPlanning.searchListByMonth, monthQueryParams.value).then(async (res) => {
let resUnit = await getEnumEnergy({ params: { code: props.energyType } });
unit.value = resUnit.data.unit;
data.value = res.data;
getMonthPillarData();
});
@ -553,17 +527,68 @@
const year = ref(selectYearValue.value.format('YYYY'));
const type = ref();
const nodeName = ref();
const resourceType = ref();
const detailData = (record) => {
electricTotal.value = false;
parentId.value = record.itemizeId;
type.value = props.tabId;
nodeName.value = record.itemizeName;
resourceType.value = props.energyType;
};
//
const columns = ref([
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '分项名称',
dataIndex: 'itemizeName',
},
{
title: '年份',
dataIndex: 'year',
},
{
title: '实际用量',
dataIndex: 'actualUsage',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '预算量',
dataIndex: 'budget',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '基准值',
dataIndex: 'referenceValue',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '节能量',
dataIndex: 'energyConservation',
customRender: ({ text }: { text: number }) => `${text ? text + unit.value : 0 + unit.value}`, //
},
{
title: '预算达成率',
dataIndex: 'budgetAchievement',
},
{
title: '操作',
key: 'action',
},
]);
const data = ref([]);
const customRow = (record) => {
return {
//
onClick: (event) => {
getPillarQuery.value.itemizeIds = [record.itemizeId];
getPillarQuery.value.itemizeId = record.itemizeId;
getBallQuery.value.itemizeIds = [record.itemizeId];
getBallQuery.value.itemizeId = record.itemizeId;
if (selectedTime.value) {
getYearPillarData();

2
hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/index.vue

@ -70,7 +70,7 @@
});
} else if (key === '4') {
tabId.value = 6;
energyType.value = 'gongshuiliang';
energyType.value = 'GAS_USAGE';
nextTick(() => {
if (provideWaterRef.value) {
provideWaterRef.value.electricTotal = true;

4
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs2.vue

@ -161,7 +161,7 @@
.get(planManage.getTableData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
// (1,2,3,4,5,6)
ctrlType: 2,
})
.then((res) => {
@ -235,7 +235,7 @@
.get(planManage.getTransData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
// (1,2,3,4,5,6)
ctrlType: 2,
})
.then((res) => {

4
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue

@ -162,7 +162,7 @@
.get(planManage.getTableData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
// (1,2,3,4,5,6)
ctrlType: 1,
})
.then((res) => {
@ -236,7 +236,7 @@
.get(planManage.getTransData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
// (1,2,3,4,5,6)
ctrlType: 1,
})
.then((res) => {

4
hx-ai-intelligent/src/view/equipmentControl/ventilationSystem/components/fanPlant.vue

@ -176,7 +176,7 @@
.get(planManage.getTableData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
// (1,2,3,4,5,6)
ctrlType: props.type,
})
.then((res) => {
@ -249,7 +249,7 @@
.get(planManage.getTransData, {
projectId: state.projectId,
siteId: state.siteId,
// (1,2,3,4,5,6,7)
// (1,2,3,4,5,6)
ctrlType: props.type,
})
.then((res) => {

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/alarm1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/alarm2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/back.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/back.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/device1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/device2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/edit.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/type1off.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/type2off.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
hx-ai-intelligent/src/view/equipmentControl/waterSystem/images/type3off.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

83
hx-ai-intelligent/src/view/equipmentManage/group/config.ts

@ -48,16 +48,17 @@ const tableCarbonKeyMap = [
// textEllipsis: true,
textNumber: 5,
},
{
title: '设备名称',
title: '设备id',
dataIndex: 'deviceInfoCode',
textNumber: 10,
dataIndex: 'deviceName',
// textEllipsis: true,
},
{
title: '设备id',
dataIndex: 'deviceInfoCode',
title: '设备编号',
textNumber: 10,
dataIndex: 'deviceName',
// textEllipsis: true,
},
{
textNumber: 5,
@ -77,14 +78,22 @@ const tableCarbonKeyMap = [
{
title: '分组名称',
textNumber: 10,
dataIndex: 'deviceNameType',
dataIndex: 'pointName',
},
{
textNumber: 5,
title: '设备状态',
dataIndex: 'status',
customRender: ({ value }) => {
return value === '0' ? '启用' : '停用';
if (value) {
if (value === '0') {
return '启用';
} else if (value === '1') {
return '停用';
}
} else {
return '';
}
},
},
];
@ -219,7 +228,7 @@ export const editCalTreeConfig = (orgId) => ({
],
},
});
export const treeConfig = (orgId) => {
export const treeConfig = (orgId, editCarbonEquipmentRef, tableRef) => {
return {
defaultExpandAll: true,
header: {
@ -233,6 +242,8 @@ export const treeConfig = (orgId) => {
return [{ pointName: '全部', id: 'all', selectable: false, children: data }];
},
formConfig: {
callList: true, // 刷新列表
// defaultSelection: true, //树默认选择第一个
schemas: [
{
field: 'energyType',
@ -248,6 +259,12 @@ export const treeConfig = (orgId) => {
valueField: 'dicKey',
placeholder: '请选择能耗种类',
autoSelectFirst: true,
onSelect: async (cur, record) => {
editCarbonEquipmentRef.value.changeEnergyType(cur);
tableRef.value?.nsTableRef.clearCheck();
tableRef.value?.nsTableRef.reload();
// value.value = cur;
},
},
},
{
@ -402,12 +419,12 @@ export const tableConfigCal = (
label: '编辑',
name: 'GroupPointEdit',
type: 'primary',
handle: (a, b) => {
if (isCarbon) {
handle: async (a, b) => {
// if (isCarbon) {
editCarbonEquipmentRef.value.toggle();
} else {
el.value.toggle();
}
// } else {
// el.value.toggle();
// }
},
},
{
@ -457,7 +474,7 @@ export const tableConfigCal = (
return data.list.length === 0;
},
extra: {
xlsxMap: tableKeyMap,
xlsxMap: isCarbon ? tableCarbonKeyMap : tableCalKeyMap,
xlsxName: '分组信息YYYY-MM-DD',
},
},
@ -656,7 +673,7 @@ export const tableConfigCal = (
};
};
export const editCarbonEquipmentConfig = (orgId) => {
export const editCarbonEquipmentConfig = (orgId, props) => {
return ref({
title: '设备信息',
api: device.queryDevicePage,
@ -674,22 +691,6 @@ export const editCarbonEquipmentConfig = (orgId) => {
formConfig: {
schemas: [
{
field: 'energyType',
label: '',
component: 'NsSelectApi',
autoSubmit: true,
componentProps: {
api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }),
// params: { dicKey: 'ENERGY_TYPE' },
immediate: true,
// resultField: 'data.ENERGY_TYPE',
labelField: 'cnValue',
valueField: 'dicKey',
placeholder: '请选择能耗种类',
autoSelectFirst: true,
},
},
{
field: 'deviceType',
label: '设备名称',
component: 'NsInput',
@ -743,6 +744,26 @@ export const editCarbonEquipmentConfig = (orgId) => {
formConfig: {
schemas: [
{
field: 'energyType',
label: '',
component: 'NsSelectApi',
// autoSubmit: true,
defaultValue: props.params.energyType,
componentProps: {
api: () => dict({ params: { dicKey: 'ENERGY_TYPE' } }),
// params: { dicKey: 'ENERGY_TYPE' },
immediate: true,
// resultField: 'data.ENERGY_TYPE',
labelField: 'cnValue',
valueField: 'dicKey',
placeholder: '请选择能耗种类',
// autoSelectFirst: true,
},
dynamicDisabled: (data: any) => {
return props.params.energyType !== 'CARBON_EMISSIONS';
},
},
{
field: 'areas',
label: '设备区域',
component: 'NsCascader',

47
hx-ai-intelligent/src/view/equipmentManage/group/editCarbonEquipment.vue

@ -28,6 +28,7 @@
<a-select
placeholder="请选择"
style="width: 200px"
v-model:value="linkOrgId"
:options="linkList"
:field-names="{ label: 'orgName', value: 'orgId' }"
@change="handleChange" />
@ -44,33 +45,46 @@
import { http } from '/nerv-lib/util';
import { group, device } from '/@/api/deviceManage';
const orgId = ref('');
const key = ref(Date.now());
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const linkOrgId = ref('');
// const selectOrgId = ref(orgId.value);
const props = defineProps({ params: Object });
const linkList = JSON.parse(sessionStorage.getItem('LINKLIST')!);
let config = editCarbonEquipmentConfig(orgId.value);
linkOrgId.value = linkList[0].orgId;
let config = editCarbonEquipmentConfig(orgId.value, props);
const visible = ref(false);
const carbonEquipment = ref();
// defineOptions({
// name: 'LedgerIndex', // name
// });
const changeEnergyType = (val) => {
props.params.energyType = val;
config = editCarbonEquipmentConfig(linkOrgId.value, props);
key.value = Date.now();
};
const handleChange = (value: string) => {
// selectOrgId.value = value;
config = editCarbonEquipmentConfig(value);
debugger;
config = editCarbonEquipmentConfig(value, props);
key.value = Date.now();
// carbonEquipment.value?.nsTableRef.reload();
// carbonEquipment.value?.nsTableRef.treeReload();
};
const props = defineProps({ params: Object });
const emit = defineEmits(['sure']);
const toggle = () => {
const toggle = (val) => {
if (val) {
config = editCarbonEquipmentConfig(linkOrgId.value, props);
key.value = Date.now();
}
visible.value = !visible.value;
// clearData();
// visible.value && getData(currentId.value);
@ -93,14 +107,35 @@
deviceInfoCode: selectedRowKeys[i],
});
}
if (props.params.energyType && props.params.energyType == 'CARBON_EMISSIONS') {
http.post(group.addCarbonDevice, params).then(() => {
emit('sure');
NsMessage.success('操作成功');
toggle();
toggle(null);
});
} else if (props.params.energyType && props.params.energyType != 'CARBON_EMISSIONS') {
// if (!currentId.value) {
// NsMessage.warn('');
// return;
// }
http
.post(group.saveComputeList, {
energyType: props.params.energyType,
orgId: props.params?.orgId,
hxDeviceGroupId: props.params?.hxDeviceGroupId,
saveOrgId: linkOrgId.value,
saveDeviceInfoCodes: selectedRowKeys,
})
.then(() => {
emit('sure');
NsMessage.success('操作成功');
toggle(null);
});
}
};
defineExpose({
toggle,
changeEnergyType,
});
</script>
<style lang="less" scoped>

18
hx-ai-intelligent/src/view/equipmentManage/group/index.vue

@ -54,7 +54,7 @@
v-show="!defaultType && isCarbon"
class="table"
v-bind="configCarbon"
ref="tableCalRef" />
ref="tableCalRef2" />
</div>
</template>
<script lang="ts" setup>
@ -80,6 +80,7 @@
const modalFormRef = ref();
const tableRef = ref();
const tableCalRef = ref();
const tableCalRef2 = ref();
const editDrawerRef = ref();
const editDrawerCalRef = ref();
const editGroupRef = ref();
@ -89,7 +90,7 @@
const treeRef = ref();
const defaultType = ref(true);
const isCarbon = ref(true);
const isCarbon = ref(false);
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
const defaultParams = ref({
orgId: result,
@ -119,7 +120,7 @@
setFactorRef,
);
const tConfig = treeConfig(result);
const tConfig = treeConfig(result, editCarbonEquipmentRef, tableRef);
const nsModalFormConfig = ref({
api: group.creatOrUpdate,
data: {},
@ -219,6 +220,7 @@
//
tableRef.value?.nsTableRef.clearCheck();
tableCalRef.value?.nsTableRef.clearCheck();
tableCalRef2.value?.nsTableRef.clearCheck();
const {
node: { pointType, id, energyType },
} = record;
@ -226,20 +228,24 @@
defaultParams.value.id = id;
defaultParams.value.hxDeviceGroupId = id;
defaultType.value = pointType === 'GROUPING_NODE';
defaultType.value
? tableRef.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
if (energyType == 'CARBON_EMISSIONS') {
isCarbon.value = true;
} else {
isCarbon.value = false;
}
defaultType.value
? tableRef.value?.nsTableRef.reload()
: isCarbon.value
? tableCalRef2.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
};
const handleOk = () => {
defaultType.value
? tableRef.value?.nsTableRef.reload()
: isCarbon.value
? tableCalRef2.value?.nsTableRef.reload()
: tableCalRef.value?.nsTableRef.reload();
};
</script>

18
hx-ai-intelligent/src/view/monitor/energyMonitor/tree/index.vue

@ -340,12 +340,26 @@
//
const today = new Date();
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0'); // getMonth() 0-11
const day = String(today.getDate()).padStart(2, '0');
const month = Number(String(today.getMonth() + 1).padStart(2, '0')); // getMonth() 0-11
const day = Number(String(today.getDate()).padStart(2, '0'));
if (dateTypeValue.value == 'month') {
startTime = year + '-' + month + '-01';
//
const date = new Date(year, month, 1);
//
// date.setDate(date.getDate() - 1);
endTime = date.toISOString().split('T')[0];
// endTime = endDate.value + '-01';
} else if (dateTypeValue.value == 'year') {
startTime = year + '-01-01';
endTime = year + '-12-31';
} else {
startTime = year + '-' + month + '-' + day;
endTime = year + '-' + month + '-' + day;
}
}
//
http

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

@ -59,7 +59,10 @@
查询
</a-button>
</div>
<a-button type="primary" style="position: absolute; right: 40px; top: -45px">
<a-button
type="primary"
style="position: absolute; right: 40px; top: -45px"
@click="exportExcel()">
导出
</a-button>
</div>
@ -84,6 +87,9 @@
</div>
</template>
<script lang="ts" setup>
import XLSX from 'xlsx';
// import Export2Excel from '/@/util/Export2Excel.js';
import { ref, onMounted, defineOptions } from 'vue';
// import { http } from '/nerv-lib/util/http';
import { Pagination, SelectProps, TreeSelectProps, TableColumnType } from 'ant-design-vue';
@ -346,6 +352,61 @@
}
});
};
// excel
/**
* @前期准备 npm install -S xlsx file-saver Export2Excel.js
*/
const exportExcel = () => {
import('/@/util/Export2Excel.js').then((excel) => {
//
let tHeader = [];
let filterVal = [];
for (let i = 0; i < tableColumns.value.length; i++) {
if (tableColumns.value[i].dataIndex) {
tHeader.push(tableColumns.value[i].title);
filterVal.push(tableColumns.value[i].dataIndex);
}
}
// const tHeader = [
// 'ID',
// '',
// 'ID',
// '',
// '',
// '',
// '',
// '',
// ];
// //
// const filterVal = [
// 'id',
// 'name',
// 'videoId',
// 'videoTitle',
// 'release',
// 'videoType',
// 'playVolume',
// 'updateTime',
// ];
//
const list = data.value;
const datas = formatJson(filterVal, list);
excel.export_json_to_excel({
header: tHeader, //
data: datas, //
filename: '表格导出测试', // excel
});
});
};
/**
* 格式化表格数据
* @filterVal 格式头
* @jsonData 用来格式化的表格数据
*/
const formatJson = (filterVal: any, jsonData: any) => {
return jsonData.map((v: any) => filterVal.map((j: any) => v[j]));
};
onMounted(async () => {
//
let frequency = await getEnum({ params: { enumType: 'TimeFlagEnum' } });

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

@ -65,6 +65,13 @@
:unCheckedValue="0"
@change="(checked) => updateShowed(record)" />
</template>
<template
v-if="column.dataIndex === 'device1Area' || column.dataIndex === 'device2Area'">
<a-tooltip v-if="text.length > 15" :title="text">
{{ text.slice(0, 15) }}...
</a-tooltip>
<span v-else>{{ text }}</span>
</template>
</template>
<template #title>
<div
@ -171,7 +178,7 @@
const typeList = ref();
const quyuvalue = ref<string[]>([]);
const useFlag = ref<Number>();
const useFlag = ref<Number | null>();
const useFlagList = ref();
useFlagList.value = [
{
@ -218,6 +225,7 @@
//
const resetting = () => {
quyuvalue.value = [];
useFlag.value = null;
areaName.value = '';
};
//
@ -296,6 +304,8 @@
// quyuvalue.value = [treeData2.value[0].childList[0].id];
// }
});
queryDeviceInfoListPage();
};
onMounted(async () => {
//
@ -360,6 +370,13 @@
{
title: '设备一级区域',
dataIndex: 'device1Area',
// width: 300,
// ellipsis: true,
// textNumber: 15,
// textEllipsis: true,
// ellipsis: {
// showTitle: false, // false tooltip
// },
},
{
title: '设备二级区域',

Loading…
Cancel
Save