zhaohy 4 months ago
parent
commit
2eeab1c5a9
  1. 10
      hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts
  2. 3
      hx-ai-intelligent/src/router/carbonEmissionManage.ts
  3. 20
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
  4. 82
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  5. 612
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue
  6. 11
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue
  7. 9
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/config.ts
  8. 106
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue
  9. 13
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue
  10. 43
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue
  11. 14
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/index.vue
  12. 1
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/dialogStyle.less
  13. 24
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.less
  14. 14
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue
  15. 24
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.less
  16. 565
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue
  17. 1
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less
  18. 24
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/index.less
  19. 24
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue
  20. 5
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/lightPosition.ts
  21. 24
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.less
  22. 582
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue
  23. 7
      lib/util/xlsx-util.ts

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

@ -8,6 +8,8 @@ export enum carbonEmissionFactorLibrary {
getCarbonFactorTree = '/carbon-smart/api/carbon/emission/type/getCarbonFactorTree',
creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate',
delTreeNode = '/carbon-smart/api/carbon/emission/type/del',
move = '/carbon-smart/api/carbon/emission/type/move',
excel = '/carbon-smart/api/carbon/emission/factor/excel',
// 单位管理
dictionaryUnitManagement = '/carbon-smart/client/dict/dictionaryUnitManagement',
findOutermost = '/carbon-smart/client/dict/findOutermost',
@ -15,7 +17,7 @@ export enum carbonEmissionFactorLibrary {
updateDictionary = '/carbon-smart/client/dict/updateDictionary',
delDictionary = '/carbon-smart/client/dict/delDictionary',
}
// 碳排管理-碳排统计接口
// 碳排管理-能耗统计接口
export enum energyConsumption {
getDicList = '/carbon-smart/client/dict/list',
pageList = '/carbon-smart/api/carbon/stats/pageList',
@ -23,6 +25,7 @@ export enum energyConsumption {
creat = '/carbon-smart/api/carbon/stats/creat',
update = '/carbon-smart/api/carbon/stats/update',
del = '/carbon-smart/api/carbon/stats/del',
voucherDownloadList = '/carbon-smart/api/carbon/stats/voucherDownloadList',
}
// 碳排管理-碳排速算接口
export enum quickCalculation {
@ -55,6 +58,7 @@ export enum carbonInventoryCheck {
findUnitById = '/carbon-smart/api/carbon/inventory/findById',
getDetailsList = '/carbon-smart/api/carbon/inventory/details/getDetailsList',
updateTable = '/carbon-smart/api/carbon/inventory/details/update',
voucherDownloadList = '/carbon-smart/api/carbon/inventory/details/voucherDownloadList',
// 排放统计接口
emissionStatistic = '/carbon-smart/api/carbon/inventory/emissionStatistic',
// 碳排流向
@ -75,6 +79,8 @@ export enum uploadPic {
uploadfiles = '/carbon-smart/api/common/file/uploadfiles',
select = '/carbon-smart/api/common/file/select',
uploadfile = '/carbon-smart/api/common/file/uploadfile',
download = '/carbon-smart/api/common/file/download',
downloadZip = '/carbon-smart/api/common/file/downloadZip',
}
// 碳规划
export enum carbonPlanning {
@ -90,4 +96,6 @@ export enum carbonPlanning {
detailedStatisticalDataChart = '/carbon-smart/api/carbon/planning/detailedStatisticalDataChart',
batchOrUpdate = '/carbon-smart/api/carbon/planning/batchOrUpdate',
addNodes = '/carbon-smart/api/carbon/planning/addNodes',
benchmarkSetting = '/carbon-smart/api/carbon/planning/benchmarkSetting',
benchmarkSubmit = '/carbon-smart/api/carbon/planning/benchmarkSubmit',
}

3
hx-ai-intelligent/src/router/carbonEmissionManage.ts

@ -40,6 +40,9 @@ const equipment = {
meta: {
title: '碳排因子库',
keepAlive: false,
operates: [
{ title: '碳排因子库导入', code: 'carbonEmissionFactorLibraryImport' },
],
// backApi: [],
},
},

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

@ -290,11 +290,12 @@
getDictList();
visible.value = true;
formState.value.id = record.id;
fetch(uploadPic.select, { bizId: record.id, bizTpye: 1 }).then((res) => {
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
}));
});
@ -415,7 +416,9 @@
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) {
@ -424,9 +427,6 @@
});
fileList.value = newFileList;
};
const uploadQuery = ref({
bizTpye: 1,
});
const onSubmit = () => {
formRef.value
.validate()
@ -443,14 +443,20 @@
// uploadQuery.value.bizId = res.data.id;
const formData = ref(new FormData());
fileList.value.forEach((file) => {
formData.value.append('files', file.originFileObj);
if (file.type !== 'done') {
formData.value.append('files', file.originFileObj);
}
});
formData.value.append('bizTpye', 1);
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();
})
.catch((error) => {
@ -459,6 +465,7 @@
} else {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
getDetailList();
}
});
@ -479,6 +486,7 @@
//
const onClose = () => {
visible.value = false;
delIds.value = [];
formState.value = {};
fileList.value = [];
formRef.value.resetFields();

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

@ -62,9 +62,17 @@
<a-menu>
<a-menu-item @click="editTreeNodeData(data)">编辑</a-menu-item>
<a-menu-item @click="addTreeNodeData">新增子节点</a-menu-item>
<a-menu-item>上移</a-menu-item>
<a-menu-item>下移</a-menu-item>
<a-menu-item @click="deleteTreeNode">删除</a-menu-item>
<a-menu-item
v-if="!data.isFirst && data.emissionName !== '未分类'"
@click="moveNode(data, 'up')"
>上移</a-menu-item
>
<a-menu-item
v-if="!data.isEnd && data.emissionName !== '未分类'"
@click="moveNode(data, 'down')"
>下移</a-menu-item
>
<a-menu-item @click="deleteTreeNode(data)">删除</a-menu-item>
</a-menu>
</template>
</a-dropdown>
@ -228,6 +236,7 @@
TreeProps,
} from 'ant-design-vue/es/tree';
import { log } from 'node:console';
import { or } from '@vueuse/core';
defineOptions({ name: 'OrderListIndex' });
const orgId = ref('');
@ -253,7 +262,7 @@
const disabled = ref(false);
const treeNodeAdd = ref<boolean>(false);
const operationTree = ref<string>('新增');
const showOperation = ref(false);
// const showOperation = ref(false);
const opMap: any = ref({
type: 'add',
@ -442,8 +451,15 @@
editTreeNode.value.type = 'update';
addTreeNode.value = data.emissionName;
};
const moveNode = (data, type: opType) => {
const flag = type === 'up';
http.post(carbonEmissionFactorLibrary.move, { ...data, isUp: flag }).then(() => {
getOrgTree();
NsMessage.success('操作成功');
});
};
//
const deleteTreeNode = () => {
const deleteTreeNode = (data) => {
Modal.confirm({
title: '警告',
icon: createVNode(ExclamationCircleOutlined),
@ -452,10 +468,12 @@
okType: 'primary',
cancelText: '取消',
onOk() {
http.post(carbonEmissionFactorLibrary.delTreeNode, editTreeNode.value).then(() => {
getOrgTree();
NsMessage.success('操作成功');
});
http
.post(carbonEmissionFactorLibrary.delTreeNode, { orgId: orgId.value, id: data.id })
.then(() => {
getOrgTree();
NsMessage.success('操作成功');
});
},
onCancel() {
console.log('Cancel');
@ -511,7 +529,7 @@
const editTreeNode = ref({});
const onSelect = (selectedKeys: string[], info: any) => {
if (info.selected) {
showOperation.value = true;
// showOperation.value = true;
editTreeNode.value = {
id: info.selectedNodes[0].id,
level: info.selectedNodes[0].level,
@ -519,6 +537,8 @@
sortNumber: info.selectedNodes[0].sortNumber,
parentEmissionId: info.selectedNodes[0].parentEmissionId,
};
} else {
editTreeNode.value = {};
}
};
@ -573,6 +593,15 @@
opMap.value.fuc && opMap.value.fuc({ ...formData.value });
});
};
const doWnload = (url: any) => {
const a = document.createElement('a');
document.body.appendChild(a);
a.href = encodeURI(url);
//
// a.download = fileName.value;
//a
a.click();
};
const tableConfig = ref({
title: '数据库',
api: carbonEmissionFactorLibrary.getTableList,
@ -609,13 +638,29 @@
{
label: '导入',
type: 'primary',
name: 'userImport',
handle: () => {},
name: 'carbonEmissionFactorLibraryImport',
extra: {
api: carbonEmissionFactorLibrary.excel, //
params: {
orgId,
},
title: '设备信息', // title
templateName: 'whiteListUser', // 使
indexName: '设备id', //
message: [
{ label: '1、若必填项未填写,则不能进行导入操作' },
{ label: `2、当重复时,则更新数据。` },
{ label: '3、数据将从模版的第五行进行导入。' },
{ label: '4、文件导入勿超过5MB。' },
],
},
},
{
label: '导出',
type: 'primary',
name: 'userExports',
handle: () => {
doWnload('/hx-ai-intelligent/asset/file/whiteListUser.xlsx');
},
},
{
label: '批量删除',
@ -687,6 +732,7 @@
{
title: '参考文献',
dataIndex: 'bibliography',
ellipsis: true,
},
{
title: '引用数量',
@ -917,7 +963,7 @@
} else {
canSelect.value = false;
}
fetch(carbonEmissionFactorLibrary.findOutermost).then((res) => {
fetch(carbonEmissionFactorLibrary.findOutermost, { grp: 'MEASUREMENT_UNIT' }).then((res) => {
groupData.value = res.data;
});
addUnitTitle.value = '新增单位';
@ -992,10 +1038,18 @@
onOk() {
fetch(carbonEmissionFactorLibrary.delDictionary, formState.value).then((res) => {
message.success('操作成功!');
formState.value = {
grp: 'MEASUREMENT_UNIT',
grpDesc: '计量单位',
};
getUnitTree();
});
},
onCancel() {
formState.value = {
grp: 'MEASUREMENT_UNIT',
grpDesc: '计量单位',
};
console.log('Cancel');
},
});

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

@ -27,7 +27,11 @@
</div>
</template>
</a-table> -->
<ns-view-list-table v-bind="tableConfig" :model="data" ref="mainRef" :scroll="{ x: 1500,y:350 }">
<ns-view-list-table
v-bind="tableConfig"
:model="data"
ref="mainRef"
:scroll="{ x: 1500, y: 350 }">
<!-- <template #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'enableRules'">
<a-switch
@ -40,7 +44,7 @@
</template>
</template> -->
</ns-view-list-table>
<!-- <a-pagination
<!-- <a-pagination
:current="queryParams.pageNum"
:total="total"
:page-size="queryParams.pageSize"
@ -61,8 +65,7 @@
:model="formState"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
:wrapper-col="wrapperCol">
<a-form-item ref="name" label="能源种类" name="energyType">
<a-input v-model:value="formState.energyType" placeholder="请输入能源种类" />
</a-form-item>
@ -73,8 +76,7 @@
<a-tree-select
v-model:value="formState.collectionNode"
:tree-line="true"
:tree-data="treeData"
>
:tree-data="treeData">
</a-tree-select>
</a-form-item>
<a-form-item label="计算碳排" name="isComputeCarbon">
@ -91,51 +93,149 @@
</a-select>
</a-form-item>
<a-row>
<a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="1月" name="janFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.janFlag" :checked-value="1" :unCheckedValue="0" />
<a-col :span="24" style="display: flex; justify-content: space-around">
<a-form-item
label="1月"
name="janFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.janFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="2月" name="febFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.febFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="2月"
name="febFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.febFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="3月" name="marFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.marFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="3月"
name="marFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.marFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
</a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="4月" name="aprFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.aprFlag" :checked-value="1" :unCheckedValue="0" />
<a-col :span="24" style="display: flex; justify-content: space-around">
<a-form-item
label="4月"
name="aprFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.aprFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="5月" name="mayFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.mayFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="5月"
name="mayFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.mayFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="6月" name="junFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.junFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="6月"
name="junFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.junFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
</a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="7月" name="julFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.julFlag" :checked-value="1" :unCheckedValue="0" />
<a-col :span="24" style="display: flex; justify-content: space-around">
<a-form-item
label="7月"
name="julFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.julFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="8月" name="augFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.augFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="8月"
name="augFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.augFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="9月" name="sepFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.sepFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="9月"
name="sepFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.sepFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
</a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;">
<a-form-item label="10月" name="octFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.octFlag" :checked-value="1" :unCheckedValue="0" />
<a-col :span="24" style="display: flex; justify-content: space-around">
<a-form-item
label="10月"
name="octFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.octFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="11月" name="novFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.novFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="11月"
name="novFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.novFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
<a-form-item label="12月" name="decFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol">
<a-switch v-model:checked="formState.decFlag" :checked-value="1" :unCheckedValue="0" />
<a-form-item
label="12月"
name="decFlag"
:label-col="switchLabelCol"
:wrapper-col="switchWrapperCol">
<a-switch
v-model:checked="formState.decFlag"
:checked-value="1"
:unCheckedValue="0" />
</a-form-item>
</a-col>
</a-row>
<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>
@ -143,7 +243,7 @@
</template>
</a-drawer>
<!-- 上传凭证弹窗 -->
<a-modal :visible="openUpload" title="凭证上传" @ok="handleOk" @cancel="closeOpenUpload">
<!-- <a-modal :visible="openUpload" title="凭证上传" @ok="handleOk" @cancel="closeOpenUpload">
<a-upload-dragger
v-model:fileList="fileList"
name="file"
@ -161,19 +261,55 @@
<p>3.每次上传自动覆盖</p>
</p>
</a-upload-dragger>
</a-modal>
</a-modal> -->
<!-- 凭证下载 -->
<a-drawer
:visible="downLoadVisible"
title="凭证列表"
:width="500"
@close="onCloseDownLoad"
:footer-style="{ textAlign: 'right' }">
<div></div>
<a-table
:columns="downLoadColumns"
:data-source="downLoadData"
bordered
rowKey="id"
:rowSelection="{
selectedRowKeys: selectedRowKeysSet,
onChange: onSelectionChangeSet,
}"
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'action'">
<span>
<a @click="downLoad(record)">下载</a>
</span>
</template>
</template>
</a-table>
<template #footer>
<a-button style="margin-right: 8px" @click="onCloseDownLoad">取消</a-button>
<a-button type="primary" @click="onSubmitDownLoad">确定</a-button>
</template>
</a-drawer>
</div>
</template>
<script lang="ts" setup>
import { ref, toRaw,defineExpose } from 'vue';
import { ref, toRaw, defineExpose } from 'vue';
import type { Rule } from 'ant-design-vue/es/form';
import { Pagination,message,Modal } from 'ant-design-vue';
import type { TreeSelectProps,UploadChangeParam } from 'ant-design-vue';
import { Pagination, message, Modal } from 'ant-design-vue';
import { UploadOutlined } from '@ant-design/icons-vue';
import type { TreeSelectProps, UploadChangeParam, UploadProps } from 'ant-design-vue';
import { NsMessage } from '/nerv-lib/component';
import dayjs, { Dayjs } from 'dayjs';
import { http } from '/nerv-lib/util/http';
import { tableColumns } from '../config';
import { energyConsumption,carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary';
import {
energyConsumption,
carbonEmissionFactorLibrary,
uploadPic,
} from '/@/api/carbonEmissionFactorLibrary';
import { group } from '/@/api/deviceManage';
defineOptions({
energyType: 'EnergyConsumption', // name
@ -184,17 +320,17 @@
const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result;
const fetch = (api, params = { orgId } ) => {
const fetch = (api, params = { orgId }) => {
return http.post(api, params);
};
const selectYear = ref<Dayjs>(dayjs( new Date().getFullYear().toString()));
const total = ref<number>()
const selectYear = ref<Dayjs>(dayjs(new Date().getFullYear().toString()));
const total = ref<number>();
const queryParams = ref({
pageNum: 1,
pageSize: 10,
orgId: orgId.value,
year: selectYear.value.format('YYYY')
})
year: selectYear.value.format('YYYY'),
});
const isRequired = ref(false);
const visible = ref(false);
const openUpload = ref<boolean>(false);
@ -225,26 +361,26 @@
const switchWrapperCol = { span: 14 };
const formState = ref({
orgId: orgId.value,
})
});
// form
const rules: Record<string, Rule[]> = {
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
isComputeCarbon: [{ required: true, message: '请选择是否计算碳排', trigger: 'change' }],
unit: [{ required: true, message: '请选择计量单位', trigger: 'change' }]
unit: [{ required: true, message: '请选择计量单位', trigger: 'change' }],
};
//
const emissionTypeDic = ref()
const emissionTypeDic = ref();
//
const measurementUnit = ref([])
const measurementUnit = ref([]);
//
const treeData = ref<TreeSelectProps['treeData']>([]);
//
const changeYearData = () => {
queryParams.value.year = selectYear.value
getTableList()
}
queryParams.value.year = selectYear.value;
getTableList();
};
const mainRef = ref();
const year = selectYear.value.format('YYYY')
const year = selectYear.value.format('YYYY');
const tableConfig = ref({
title: '能耗统计',
api: energyConsumption.pageList,
@ -255,8 +391,8 @@
name: 'userAdd',
type: 'primary',
handle: () => {
getDictList()
visible.value = true
getDictList();
visible.value = true;
},
},
{
@ -273,20 +409,24 @@
{
label: '模板下载',
type: 'primary',
name: 'userExports',
},
// {
// label: '',
// type: 'primary',
// handle: () => {
// openUpload.value = true;
// },
// },
{
label: '上传凭证',
label: '凭证下载',
type: 'primary',
handle: () => {
openUpload.value = true;
fetch(energyConsumption.voucherDownloadList, { bizType: 3 }).then((res) => {
downLoadData.value = res.data;
});
downLoadVisible.value = true;
},
},
{
label: '凭证下载',
type: 'primary',
name: 'userExports',
},
],
columns: [
{
@ -370,25 +510,34 @@
label: '编辑',
name: 'userEdit',
handle: (record: any) => {
getDictList()
visible.value = true
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
if(res.data.emissionType){
res.data.emissionType = Number(res.data.emissionType)
getDictList();
visible.value = true;
fetch(energyConsumption.findById, { id: record.id }).then((res) => {
if (res.data.emissionType) {
res.data.emissionType = Number(res.data.emissionType);
}
if (res.data.unit) {
let selectDevice = ref([Number(res.data.unit)]);
findParentIds(measurementUnit.value, res.data.unit, selectDevice.value);
res.data.unit = selectDevice
res.data.unit = selectDevice;
}
formState.value = res.data
emissionType.value = res.data.emissionType
if(formState.value.isComputeCarbon===0){
isRequired.value = true
}else{
isRequired.value = false
formState.value = res.data;
emissionType.value = res.data.emissionType;
if (formState.value.isComputeCarbon === 0) {
isRequired.value = true;
} else {
isRequired.value = false;
}
});
fetch(uploadPic.select, { bizId: record.id, bizType: 3 }).then((res) => {
fileList.value = res.data.map((item) => ({
uid: item.id.toString(), // 使id
name: item.fileName, //
status: 'done', //
type: 'done',
url: item.filePath, // URLURL
}));
});
},
},
{
@ -419,7 +568,7 @@
},
rowKey: 'id',
});
defineExpose({
mainRef,
});
@ -437,27 +586,27 @@
}
//
const getTableList = () => {
fetch(energyConsumption.pageList , queryParams.value).then((res) => {
data.value = res.data.records
fetch(energyConsumption.pageList, queryParams.value).then((res) => {
data.value = res.data.records;
});
};
//
const onChange = (pageNumber: number,size: number) => {
const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size;
mainRef.value?.nsTableRef.reload();
};
//
const emissionType = ref()
const emissionType = ref();
const changeRadio = (e) => {
if(e.target.value === 0){
isRequired.value = true
if(emissionType.value){
formState.value.emissionType = emissionType.value
if (e.target.value === 0) {
isRequired.value = true;
if (emissionType.value) {
formState.value.emissionType = emissionType.value;
}
}else{
isRequired.value = false
formState.value.emissionType = ''
} else {
isRequired.value = false;
formState.value.emissionType = '';
}
};
//
@ -466,84 +615,144 @@
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
formState.value.year = selectYear.value.format('YYYY')
if(formState.value.unit){
formState.value.unit = formState.value.unit.join(',').split(',')[1]
formState.value.year = selectYear.value.format('YYYY');
if (formState.value.unit) {
formState.value.unit = formState.value.unit.join(',').split(',')[1];
}
if(formState.value.id){
fetch(energyConsumption.update , formState.value).then((res) => {
visible.value = false
formState.value = {
orgId: orgId.value,
}
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
});
}else{
fetch(energyConsumption.creat , formState.value).then((res) => {
if(res.data === '新增数据已存在'){
visible.value = false
NsMessage.warning(res.data);
}else{
visible.value = false
if (formState.value.id) {
fetch(energyConsumption.update, formState.value).then((res) => {
if (fileList.value.length !== 0) {
const formData = ref(new FormData());
fileList.value.forEach((file) => {
if (file.type !== 'done') {
formData.value.append('files', file.originFileObj);
}
});
formData.value.append('bizType', 3);
formData.value.append('bizId', formState.value.id);
delIds.value.forEach((item) => {
formData.value.append('deleteList', item);
});
fetch(uploadPic.uploadfiles, formData.value)
.then((res) => {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
mainRef.value?.nsTableRef.reload();
})
.catch((error) => {
console.log('error', error);
});
} else {
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
}
};
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
}
});
} else {
fetch(energyConsumption.creat, formState.value).then((res) => {
if (res.data === '新增数据已存在') {
visible.value = false;
delIds.value = [];
NsMessage.warning(res.data);
} else {
if (fileList.value.length !== 0) {
const formData = ref(new FormData());
fileList.value.forEach((file) => {
formData.value.append('files', file.originFileObj);
});
formData.value.append('bizType', 3);
formData.value.append('bizId', res.data);
fetch(uploadPic.uploadfiles, formData.value)
.then((res) => {
message.success('操作成功!');
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
mainRef.value?.nsTableRef.reload();
})
.catch((error) => {
console.log('error', error);
});
} else {
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
};
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
}
}
});
}
})
.catch(error => {
.catch((error) => {
console.log('error', error);
});
};
//
const getDictList = () => {
//
fetch(energyConsumption.getDicList , {grp: 'EMISSION_TYPE'}).then((res) => {
emissionTypeDic.value = res.data
fetch(energyConsumption.getDicList, { grp: 'EMISSION_TYPE' }).then((res) => {
emissionTypeDic.value = res.data;
});
//
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT'}).then((res) => {
measurementUnit.value = res.data
measurementUnit.value = measurementUnit.value.map(item => ({
value: item.id,
label: item.cnValue,
children: item.children ? item.children.map(child => ({
value: child.id,
label: child.cnValue
})) : []
}));
});
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT' }).then(
(res) => {
measurementUnit.value = res.data;
measurementUnit.value = measurementUnit.value.map((item) => ({
value: item.id,
label: item.cnValue,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.cnValue,
}))
: [],
}));
},
);
//
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => {
treeData.value = res.data
treeData.value = treeData.value.map(item => ({
value: item.id,
label: item.pointName,
children: item.children ? item.children.map(child => ({
value: child.id,
label: child.pointName
})) : []
}));
});
}
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE', orgId: orgId.value }).then(
(res) => {
treeData.value = res.data;
treeData.value = treeData.value.map((item) => ({
value: item.id,
label: item.pointName,
children: item.children
? item.children.map((child) => ({
value: child.id,
label: child.pointName,
}))
: [],
}));
},
);
};
//
const addNewData = () => {
getDictList()
visible.value = true
}
getDictList();
visible.value = true;
};
//
const editData = (record) =>{
getDictList()
visible.value = true
fetch(energyConsumption.findById , {id : record.id }).then((res) => {
if(res.data.unitName){
res.data.unitName = res.data.unitName.split(',')
const editData = (record) => {
getDictList();
visible.value = true;
fetch(energyConsumption.findById, { id: record.id }).then((res) => {
if (res.data.unitName) {
res.data.unitName = res.data.unitName.split(',');
}
formState.value = res.data
formState.value = res.data;
});
};
//
@ -555,7 +764,7 @@
okType: 'primary',
cancelText: '取消',
onOk() {
fetch(energyConsumption.del , {id : record.id }).then((res) => {
fetch(energyConsumption.del, { id: record.id }).then((res) => {
message.success('操作成功!');
mainRef.value?.nsTableRef.reload();
});
@ -564,13 +773,14 @@
console.log('Cancel');
},
});
}
};
//
const onClose = () => {
visible.value = false;
delIds.value = [];
formState.value = {
orgId: orgId.value,
}
};
formRef.value.resetFields();
};
//
@ -583,25 +793,113 @@
openUpload.value = false;
};
//
const fileList = ref([]);
const fileList = ref<UploadProps['fileList']>([]);
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
return false;
};
const handleChange = (info: UploadChangeParam) => {
const status = info.file.status;
if (status !== 'uploading') {
fileList.value = [...info.fileList];
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (status === 'done') {
if (info.file.status === 'done') {
message.success(`${info.file.name} 文件上传成功`);
} else if (status === 'error') {
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败`);
}
};
function handleDrop(e: DragEvent) {
console.log(e);
}
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 closeOpenUpload = () =>{
const closeOpenUpload = () => {
openUpload.value = false;
};
//
const downLoadVisible = ref(false);
const downLoadColumns = [
{
title: '序号',
customRender: (text: any) => {
return text.index + 1;
},
},
{
title: '能源类型',
dataIndex: 'bizName',
},
{
title: '文件名',
dataIndex: 'fileName',
ellipsis: true,
},
{
title: '操作',
key: 'action',
},
];
const downLoadData = ref([]);
const selectedRowKeysSet = ref([]);
const onSelectionChangeSet = (selectedKeys, selectedRows) => {
selectedRowKeysSet.value = selectedKeys;
};
const downLoad = (record) => {
const deleteId = ref(new FormData());
deleteId.value.append('id', record.id);
fetch(uploadPic.download, deleteId.value)
.then((res) => {
// URL blob
const url = window.URL.createObjectURL(new Blob([res.data]));
// <a>
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', record.fileName); //
document.body.appendChild(link);
link.click();
// URL
window.URL.revokeObjectURL(url);
})
.catch((error) => {
console.error('下载图片失败:', error);
});
};
const onSubmitDownLoad = () => {
const deleteIds = ref(new FormData());
selectedRowKeysSet.value.forEach((item) => {
deleteIds.value.append('ids', item);
});
fetch(uploadPic.downloadZip, deleteIds.value)
.then((res) => {
// URL blob
const url = window.URL.createObjectURL(new Blob([res.data]));
// <a>
const link = document.createElement('a');
link.href = url;
debugger
link.setAttribute('download', ''); //
document.body.appendChild(link);
link.click();
// URL
window.URL.revokeObjectURL(url);
})
.catch((error) => {
console.error('下载图片失败:', error);
});
};
const onCloseDownLoad = () => {
selectedRowKeysSet.value = []
downLoadVisible.value = false;
};
</script>
<style scoped lang="less">
:deep(.ant-table-title) {
@ -610,7 +908,7 @@
:deep(.ant-table-container) {
padding: 0px 16px;
}
.buttonGroup{
.buttonGroup {
margin-left: 1vw;
width: 30vw;
display: flex;
@ -622,4 +920,4 @@
td.column-money {
text-align: right !important;
}
</style>
</style>

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

@ -102,7 +102,7 @@
<a-row>
<a-col :span="12">
<a-form-item ref="name" label="关键词">
<ns-input v-model:value="selectData" />
<ns-input v-model:value="selectData" @change="keyChange" />
</a-form-item>
</a-col>
</a-row>
@ -281,7 +281,7 @@
type: 'primary',
handle: () => {
visible.value = true;
getNewTable();
// getNewTable();
},
},
],
@ -384,7 +384,7 @@
//
const addNewData = () => {
visible.value = true;
getNewTable();
// getNewTable();
};
//
const selectedRowKeys = ref([]);
@ -404,6 +404,11 @@
newTableData.value = res.data.records;
});
};
const selectData = ref();
const keyChange = () => {
queryData.value.emissionSources = selectData.value;
getNewTable();
};
//
const editData = (record) => {
selectedRowKeys.value = [record.factorId];

9
hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/config.ts

@ -8,13 +8,14 @@ export const voucherColumns = [
},
{
title: '日期',
dataIndex: 'age',
key: 'age',
dataIndex: 'updateTime',
key: 'updateTime',
ellipsis: true,
},
{
title: '文件名称',
dataIndex: 'address',
key: 'address 1',
dataIndex: 'fileName',
key: 'fileName',
ellipsis: true,
},
];

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

@ -275,6 +275,7 @@
<a-tree-select
v-model:value="editFormState.collectionNode"
:tree-line="true"
@select="selectNode"
:tree-data="collectingNodes">
</a-tree-select>
</a-form-item>
@ -290,6 +291,7 @@
<a-form-item ref="name" label="关键字" name="emissionFactors">
<a-input-search
v-model:value="editFormState.emissionFactors"
@search="searchKey"
placeholder="请输入关键字" />
</a-form-item>
</a-col>
@ -320,8 +322,9 @@
<a-upload
v-model:file-list="fileList"
name="file"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
:headers="headers"
accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf"
@remove="handleFileRemove"
:before-upload="beforeUpload"
@change="handleChange">
<a-button>
<upload-outlined></upload-outlined>
@ -353,6 +356,7 @@
energyConsumption,
carbonEmissionFactorLibrary,
carbonInventoryCheck,
uploadPic,
} from '/@/api/carbonEmissionFactorLibrary';
import { group } from '/@/api/deviceManage';
import { debug, log } from 'node:console';
@ -844,6 +848,9 @@
//
const openVoucher = ref(false);
const downLoadVoucher = () => {
fetch(carbonInventoryCheck.voucherDownloadList, { bizType: 2 }).then((res) => {
voucherData.value = res.data;
});
openVoucher.value = true;
};
const selectedRowKeys = ref([]);
@ -851,29 +858,7 @@
selectedRowKeys.value = selectedKeys;
};
const voucherData = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
tags: ['nice', 'developer'],
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 2 Lake Park, London No. 2 Lake Park',
tags: ['loser'],
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park, Sidney No. 1 Lake Park',
tags: ['cool', 'teacher'],
},
];
const voucherData = ref([]);
const onCloseVoucher = () => {
openVoucher.value = false;
};
@ -909,6 +894,15 @@
editFormState.value.collectionNode = record.carbonSource;
editFormState.value.factorId = record.factorId;
selectedRowKeysEdit.value = [record.factorId];
fetch(uploadPic.select, { bizId: record.id, bizType: 2 }).then((res) => {
fileList.value = res.data.map((item) => ({
uid: item.id.toString(), // 使id
name: item.fileName, //
status: 'done', //
type: 'done',
url: item.filePath, // URLURL
}));
});
editData.value = true;
};
const getNewTable = () => {
@ -917,6 +911,10 @@
total.value = res.data.total;
});
};
const searchKey = () => {
queryData.value.emissionSources = editFormState.value.emissionFactors;
getNewTable();
};
//
const canEdit = ref(false);
const automatic = ref(false);
@ -946,23 +944,37 @@
},
);
};
const selectNode = (value) => {
debugger;
};
//
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} file uploaded successfully`);
message.success(`${info.file.name} 文件上传成功`);
} else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`);
message.error(`${info.file.name} 文件上传失败`);
}
};
const fileList = ref([]);
const headers = {
authorization: 'authorization-text',
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 submitEditData = () => {
editFormRef.value
.validate()
@ -978,8 +990,33 @@
editFormState.value.collectionNode = editFormState.value.collectionNode.value;
}
fetch(carbonInventoryCheck.updateTable, editFormState.value).then((res) => {
editData.value = false;
getPFYTableList(getTableId.value);
if (fileList.value.length !== 0) {
const formData = ref(new FormData());
fileList.value.forEach((file) => {
if (file.type !== 'done') {
formData.value.append('files', file.originFileObj);
}
});
formData.value.append('bizType', 2);
formData.value.append('bizId', editFormState.value.id);
delIds.value.forEach((item) => {
formData.value.append('deleteList', item);
});
fetch(uploadPic.uploadfiles, formData.value)
.then((res) => {
message.success('操作成功!');
editData.value = false;
delIds.value = [];
getPFYTableList(getTableId.value);
})
.catch((error) => {
console.log('error', error);
});
} else {
editData.value = false;
delIds.value = [];
getPFYTableList(getTableId.value);
}
});
})
.catch((error) => {
@ -988,6 +1025,7 @@
};
const onCloseEditData = () => {
editData.value = false;
delIds.value = [];
editFormState.value = {
orgId: orgId.value,
};

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

@ -5,7 +5,12 @@
</div>
<!-- 填报页 -->
<div v-if="fillInPage" style="height: 100%">
<fillIn :reportId="reportId" :year="year" :startTime="startTime" :endTime="endTime" @change-data="updateData" />
<fillIn
:reportId="reportId"
:year="year"
:startTime="startTime"
:endTime="endTime"
@change-data="updateData" />
</div>
<!-- 新增报告弹窗 -->
<a-drawer
@ -33,7 +38,7 @@
<a-form-item label="报告周期" name="reportPeriod">
<a-select
v-model:value="formState.reportPeriod"
placeholder="请选择排放类型"
placeholder="请选择报告周期"
@change="selectChange">
<a-select-option value="1">年度</a-select-option>
<a-select-option value="2">月度</a-select-option>
@ -81,7 +86,9 @@
return year === Number(formState.value.reportYear) ? false : true;
}
};
const selectChange = (value) => {};
const selectChange = (value) => {
formState.value.reportScope = '';
};
// form
const rules: Record<string, Rule[]> = {
reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }],

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

@ -74,9 +74,7 @@
</div>
</div>
<div class="button" style="margin-bottom: 12px">
<a-button type="primary" :disabled="selectedRowKeys.length === 0" @click="editData">
批量设置
</a-button>
<a-button type="primary" @click="editData"> 批量设置 </a-button>
<a-button type="primary" style="margin-left: 6px" @click="setBasicData">
基准值设置
</a-button>
@ -137,20 +135,13 @@
:columns="drawerColumns"
:data-source="newTableData"
bordered
rowKey="id"
:rowKey="(record, index) => index"
:rowSelection="{
selectedRowKeys: selectedRowKeysSet,
onChange: onSelectionChangeSet,
type: 'radio',
}"
:pagination="false">
<template #bodyCell="{ column, text, record }">
<template v-if="column.key === 'action'">
<span>
<a @click="setBasic(record)">设为基准值</a>
</span>
</template>
</template>
</a-table>
<template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button>
@ -206,9 +197,11 @@
itemizeId: props.parentId,
type: props.type,
});
const ids = ref([]);
const getTableData = () => {
fetch(carbonPlanning.detailedStatisticalDataTable, queryParams.value).then((res) => {
data.value = res.data;
ids.value = data.value.map((item) => item.id);
});
};
getTableData();
@ -261,7 +254,7 @@
const wrapperCol = { span: 18 };
const editData = (record) => {
open.value = true;
if (record) {
if (record.isLastYear) {
formState.value.ids = [record.id];
if (record.lastYear === '是') {
formState.value.isLastYear = 1;
@ -285,6 +278,9 @@
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
if (formState.value.ids[0] === undefined) {
formState.value.ids = ids.value;
}
fetch(carbonPlanning.batchOrUpdate, formState.value).then((res) => {
open.value = false;
formState.value = {};
@ -301,27 +297,38 @@
};
const visible = ref(false);
const selectedRowKeysSet = ref([]);
const referenceQuery = ref();
const onSelectionChangeSet = (selectedKeys, selectedRows) => {
selectedRowKeysSet.value = selectedKeys;
referenceQuery.value = selectedRows[0].referenceValue;
};
const drawerColumns = [
{
title: '年份',
dataIndex: 'emissionSources',
dataIndex: 'year',
},
{
title: '用电量',
dataIndex: 'emissionFactors',
},
{
title: '操作',
key: 'action',
dataIndex: 'referenceValue',
},
];
const newTableData = ref([]);
const setBasicData = () => {
fetch(carbonPlanning.benchmarkSetting, { orgId: orgId.value }).then((res) => {
newTableData.value = res.data;
});
visible.value = true;
};
const onSubmit = () => {
fetch(carbonPlanning.benchmarkSubmit, {
ids: ids.value,
referenceValue: referenceQuery.value,
}).then((res) => {
visible.value = false;
selectedRowKeysSet.value = [];
getTableData();
});
};
const onClose = () => {
visible.value = false;
};

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

@ -48,7 +48,12 @@
</div>
</div>
<div class="totalContant" v-else>
<categoryDeatil @change-data="updateData" :parentId="parentId" :year="year" :type="type" :nodeName="nodeName" />
<categoryDeatil
@change-data="updateData"
:parentId="parentId"
:year="year"
:type="type"
:nodeName="nodeName" />
</div>
<!-- 新增节点 -->
<a-drawer :visible="visible" :width="500" @close="onClose" :footer-style="{ textAlign: 'right' }">
@ -159,7 +164,7 @@
};
const getMonthPillarData = () => {
fetch(carbonPlanning.electricityUsageBackThen, getPillarQuery.value).then((res) => {
xAxisData.value = res.data.year;
xAxisData.value = res.data.yearMonth;
referenceValue.value = res.data.referenceValue;
budget.value = res.data.budget;
actualUsage.value = res.data.actualUsage;
@ -286,6 +291,7 @@
type: props.tabId,
year: selectYearValue.value.format('YYYY'),
yearAndMonth: 'year',
yearMonth: selectMonthValue.value.format('YYYY-DD'),
});
const ballValue = ref();
const getBallData = () => {
@ -447,7 +453,7 @@
fetch(carbonPlanning.searchListByYear, yearQueryParams.value).then((res) => {
data.value = res.data;
res.data.forEach((item) => {
treeCheckedKeys.value.push((item.itemizeId).toString());
treeCheckedKeys.value.push(item.itemizeId.toString());
});
});
};
@ -460,7 +466,9 @@
});
const changeMonth = () => {
monthQueryParams.value.yearMonth = selectMonthValue.value;
getBallQuery.value.yearMonth = selectMonthValue.value;
getMonthData();
getBallData();
};
const getMonthData = () => {
fetch(carbonPlanning.searchListByMonth, monthQueryParams.value).then((res) => {

1
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/dialogStyle.less

@ -39,7 +39,6 @@
.journal {
padding: 1% 3%;
width: 100%;
height: 150px;
background-color: rgba(0, 0, 0);
border-radius: 12px;
border: 2px solid transparent;

24
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.less

@ -16,26 +16,30 @@
perspective-origin: 850px -160px;
// 左上角区域切换功能
.btn-box {
width: 120px;
width: 100px;
position: sticky;
top: 10px;
left: 10px;
top: 15px;
margin-left: 10px;
display: flex;
flex-direction: column;
gap: 8px;
.btn-item {
cursor: pointer;
width: 100%;
height: 40px;
height: 35px;
border-radius: 4px;
background: rgba(39, 120, 255, 1);
// background: rgba(39, 120, 255, 1);
background: rgb(7, 72, 116);
border: 1px solid rgba(51, 199, 255, 1);
box-shadow: 0px 10px 15px rgba(0, 54, 136, 0.3);
font-size: 18px;
font-size: 16px;
color: white;
}
.btnActive {
background: rgba(39, 120, 255, 1);
}
.btn-item:hover {
color: black;
color: white;
}
}
// 大区分区
@ -128,7 +132,10 @@
justify-content: center;
align-items: center;
cursor: pointer;
}
}
}
.drawer-item {
position: relative;
// 抽屉关闭按钮
.drawer-box-out {
width: 30px;
@ -145,5 +152,4 @@
align-items: center;
cursor: pointer;
}
}

14
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue

@ -7,7 +7,7 @@
v-for="(item, index) in floorData"
:key="index"
class="btn-item"
:style="{ color: item.dataCode == thisFloor ? 'black' : 'white' }"
:class="{ btnActive: item.dataCode == thisFloor }"
@click="changeFloor(item.childList, item.dataCode)"
>{{ item.name }}</button
>
@ -36,14 +36,6 @@
:visible="item.visible" />
</div>
</div>
<!-- 右侧抽屉的触发按钮 -->
<div class="drawer-box-in" v-if="!visible" @click="toggleDrawer">
<double-left-outlined class="drawer-icon" style="color: white" />
</div>
<!-- 左侧抽屉的关闭按钮 -->
<div class="drawer-box-out" v-if="visible" @click="toggleDrawer">
<double-right-outlined class="drawer-icon" style="color: white" />
</div>
<!-- 右侧抽屉 -->
<a-drawer
v-model:visible="visible"
@ -56,6 +48,10 @@
id="drawer"
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }">
<a-tabs v-model:activeKey="activeKey">
<div class="drawer-box-out" @click="toggleDrawer">
<double-left-outlined v-if="!visible" class="drawer-icon" style="color: white" />
<double-right-outlined v-else class="drawer-icon" style="color: white" />
</div>
<a-tab-pane key="1" tab="控制面板">
<tabs1
ref="tabs1Ref"

24
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.less

@ -392,12 +392,22 @@
.zmhlbtn {
position: relative;
}
// 禁用图标
.anticon-stop {
position: absolute;
right: 3px;
bottom: 3px;
overflow: hidden;
.btn-back {
position: absolute;
width: 50px;
height: 50px;
right: -25px;
bottom: -30px;
transform: rotate(45deg);
background: orange;
// 禁用图标
.anticon-stop {
transform: rotate(-45deg) scale(0.9);
position: absolute;
left: 3px;
top: 15px;
}
}
}
}

565
hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue

@ -1,243 +1,266 @@
<template>
<a-spin :spinning="isLoading">
<!-- 照明区域 -->
<div>
<div class="light-area">
<div class="light-area-tab"></div>
<span class="light-area-text">空调区域</span>
</div>
<!-- 照明区域按钮部分 -->
<div class="area">
<template v-if="!showAllButtonsArea">
<button
v-for="(button, index) in limitedButtons1"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button, index) in props.treeData"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</div>
<!-- 空调区域 -->
<div>
<div class="light-area">
<div class="light-area-tab"></div>
<span class="light-area-text">空调区域</span>
</div>
<!-- 空调分组部分 -->
<div>
<div class="circuit-area">
<div class="circuit-tab"></div>
<span class="circuit-text">空调分组</span>
<div class="btn2">
<!-- 空调区域按钮部分 -->
<div class="area">
<template v-if="!showAllButtonsArea">
<button
v-for="(button, index) in limitedButtons1"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button, index) in props.treeData"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</div>
</div>
<!-- 空调分组部分 -->
<div>
<div class="circuit-area">
<div class="circuit-tab"></div>
<span class="circuit-text">空调分组</span>
<div class="btn2">
<a-badge :offset="[-10, 2]" :count="lockList.length">
<button
class="openPlan"
:class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }"
@click="togglePlan2">
{{ isPlanEnabled2 ? '启用开关' : '禁用开关' }}
</button>
<a-switch
v-model:checked="selectAllCheckbox"
:disabled="singleSelection"
:class="{
'blue-background': selectAllCheckbox,
'grey-background': !selectAllCheckbox,
}"
@change="toggleAllSelection" />
<button class="allBtn">全选</button>
<button class="both" @click="selectAll">
{{ singleSelection ? '多选' : '单选' }}
</button>
</div>
</div>
<div class="btnArea">
<template v-if="!showAllButtons">
<button
v-for="(button, index) in limitedButtons2"
:key="index"
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" />
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtons = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button, index) in buttons2"
:key="index"
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" />
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtons = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</a-badge>
<a-switch
v-model:checked="selectAllCheckbox"
:disabled="singleSelection"
:class="{
'blue-background': selectAllCheckbox,
'grey-background': !selectAllCheckbox,
}"
@change="toggleAllSelection" />
<button class="allBtn">全选</button>
<button class="both" @click="selectAll">
{{ singleSelection ? '多选' : '单选' }}
</button>
</div>
</div>
<!-- 控制模式部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-area">
<div class="control-tab"></div>
<span class="control-text">控制模式</span>
</div>
<!-- 控制模式按钮部分 -->
<div class="control-mode-btn-area">
<div class="btnArea">
<template v-if="!showAllButtons">
<button
v-for="(button3, index) in thisButton2.childList"
v-for="(button, index) in limitedButtons2"
:key="index"
class="btn"
:class="{ selected: button3.selectAble }"
@click="selectButton3(button3)">
{{ button3.name }}
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }}
</button>
</div>
</div>
<!-- 控制场景部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-scene-area">
<div class="control-scene-tab"></div>
<span class="control-scene-text">启动模式</span>
<div v-if="!singleSelection" style="flex: 1; color: red; text-align: right"
>多选模式下会修改当前选中的所有回路</div
>
</div>
<!-- 控制场景按钮部分 -->
<div class="control-scene-btn-area">
<div style="margin-top: 10px">
<span @click="showAllButtons = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button4, index) in thisButton3.childList"
v-for="(button, index) in buttons2"
:key="index"
:class="{ btn: true, selected: button4.executeStatus.value != 0 }"
@click="selectButton4(button4)">
{{ button4.name }}
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }}
</button>
</div>
<div style="margin-top: 10px">
<span @click="showAllButtons = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</div>
<!-- 底部按钮区 -->
<div class="bottom">
<a-badge :offset="[-10, 2]" :count="changeList.length">
<a-popconfirm
title="刷新将会取消已作出的修改"
ok-text="确定"
cancel-text="取消"
@confirm="refresh(false)"
@cancel="changeCancel">
<button class="flushed">刷新</button>
</a-popconfirm>
</a-badge>
<a-spin :spinning="buttonLoading">
<button class="execute" @click="showModal">执行</button>
</a-spin>
</div>
<!-- 控制模式部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-area">
<div class="control-tab"></div>
<span class="control-text">控制模式</span>
</div>
<!-- 控制模式按钮部分 -->
<div class="control-mode-btn-area">
<button
v-for="(button3, index) in thisButton2.childList"
:key="index"
class="btn"
:class="{ selected: button3.selectAble }"
@click="selectButton3(button3)">
{{ button3.name }}
</button>
</div>
</div>
<!-- 控制场景部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-scene-area">
<div class="control-scene-tab"></div>
<span class="control-scene-text">启动模式</span>
<div v-if="!singleSelection" style="flex: 1; color: red; text-align: right"
>多选模式下会修改当前选中的所有回路</div
>
</div>
<!-- 控制场景按钮部分 -->
<div class="control-scene-btn-area">
<button
v-for="(button4, index) in thisButton3.childList"
:key="index"
:class="{ btn: true, selected: button4.executeStatus.value != 0 }"
@click="selectButton4(button4)">
{{ button4.name }}
</button>
</div>
</div>
<!-- 底部按钮区 -->
<div class="bottom">
<a-badge :offset="[-10, 2]" :count="changeList.length">
<a-popconfirm
title="刷新将会取消已作出的修改"
ok-text="确定"
cancel-text="取消"
@confirm="refresh(false)"
@cancel="changeCancel">
<button class="flushed">刷新</button>
</a-popconfirm>
</a-badge>
<button class="execute" @click="showModal">执行</button>
</div>
<!-- 点击执行时的弹出框 -->
<div class="out-dialog" v-if="executeVisible">
<div class="content">
<div>
<div class="div-operation"></div>
<span class="text-operation">变更内容 </span>
</div>
<div class="j-box" v-for="item in diffList" :key="item.id">
<div class="journal" style="margin-top: 20px">
<div class="imgText">
<div class="zjzm">
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp;
<span
class="title-text"
style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.regionName + ' > ' + item.deviceGroupName }}</span
>
<!-- 点击执行时的弹出框 -->
<div class="out-dialog" v-if="executeVisible">
<div class="content">
<div>
<div class="div-operation"></div>
<span class="text-operation">变更内容 </span>
</div>
<div class="j-box" v-for="item in diffList" :key="item.id">
<div class="journal" style="margin-top: 20px">
<div class="imgText">
<div class="zjzm">
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp;
<span
class="title-text"
style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.regionName + ' > ' + item.deviceGroupName }}</span
>
</div>
<a-popconfirm
title="此操作将会撤销修改"
ok-text="确定"
cancel-text="取消"
@confirm="delBtn(item)"
@cancel="changeCancel">
<button class="cxbtn">撤销</button>
</a-popconfirm>
</div>
<div class="btn-box">
<div class="btn-item">
<div class="left">控制模式</div>
<div class="right">
<span>手动</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span>
</div>
<a-popconfirm
title="此操作将会撤销修改"
ok-text="确定"
cancel-text="取消"
@confirm="delBtn(item)"
@cancel="changeCancel">
<button class="cxbtn">撤销</button>
</a-popconfirm>
</div>
<div class="btn-box">
<div class="btn-item">
<div class="left">控制模式</div>
<div class="right">
<span>手动</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span>
</div>
<div class="btn-item">
<div class="left"> 亮度 </div>
<div class="right">
<!-- 数字0也会被判为false故只判断undefined null -->
<span>{{
item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.brightness != undefined ? item.stateAfter.brightness : '--'
}}</span>
</div>
<div class="btn-item">
<div class="left"> 亮度 </div>
<div class="right">
<!-- 数字0也会被判为false故只判断undefined null -->
<span>{{
item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.brightness != undefined ? item.stateAfter.brightness : '--'
}}</span>
</div>
</div>
<div class="btn-item">
<div class="left"> 控制场景 </div>
<div class="right">
<span>{{
item?.stateBefore?.scene?.label ? item.stateBefore.scene.label : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.scene?.label ? item.stateAfter.scene.label : '--'
}}</span>
</div>
<div class="btn-item">
<div class="left"> 控制场景 </div>
<div class="right">
<span>{{
item?.stateBefore?.scene?.label ? item.stateBefore.scene.label : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.scene?.label ? item.stateAfter.scene.label : '--'
}}</span>
</div>
</div>
<div class="btn-item">
<div class="left"> 色温 </div>
<div class="right">
<span>{{
item?.stateBefore?.color != undefined ? item.stateBefore.color : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>
{{ item?.stateAfter?.color != undefined ? item.stateAfter.color : '--' }}
</span>
</div>
<div class="btn-item">
<div class="left"> 色温 </div>
<div class="right">
<span>{{
item?.stateBefore?.color != undefined ? item.stateBefore.color : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>
{{ item?.stateAfter?.color != undefined ? item.stateAfter.color : '--' }}
</span>
</div>
</div>
<div class="btn-item">
<div class="left"> 启用状态 </div>
<div class="right">
<span>{{
item?.stateBefore?.lockStatus != undefined
? item.stateBefore.lockStatus
? '禁用'
: '启用'
: '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>
{{
item?.stateAfter?.lockStatus != undefined
? item.stateAfter.lockStatus
? '禁用'
: '启用'
: '--'
}}
</span>
</div>
</div>
</div>
</div>
</div>
<div style="width: 100%; height: 60px"></div>
<div class="button-box">
<button class="cancel" @click="executeVisible = false">取消</button>
<a-popconfirm
title="此操作将提交以上修改内容"
ok-text="确定"
cancel-text="取消"
@confirm="submitChangeList"
@cancel="changeCancel">
<button class="execute">执行</button>
</a-popconfirm>
</div>
</div>
</a-spin>
<div style="width: 100%; height: 60px"></div>
<div class="button-box">
<button class="cancel" @click="executeVisible = false">取消</button>
<a-popconfirm
title="此操作将提交以上修改内容"
ok-text="确定"
cancel-text="取消"
@confirm="submitChangeList"
@cancel="changeCancel">
<button class="execute">执行</button>
</a-popconfirm>
</div>
</div>
</template>
<script setup lang="ts">
@ -304,48 +327,67 @@
emit('changeArea', button.id);
// -
resetMode();
// -
handleButton.value = '';
};
// 8
const limitedButtons1 = computed(() => props.treeData.slice(0, 8));
// ======================================================================
// id
const handleButton = ref('');
// /
const isPlanEnabled2 = ref(true);
const isPlanEnabled2 = ref(false);
//
const lockList = ref<any>([]);
// /
const togglePlan2 = () => {
//
if (handleButton.value == '') {
return message.info('请选择空调分组');
}
//
const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value);
let panel = +!btn.ctrlStatus;
isLoading.value = true;
http
.get(lightingManage.setDisable, {
deviceGroup: btn.dataCode,
panel,
projectId: state.projectId,
siteId: state.siteId,
})
.then((res) => {
if (res.msg === 'success') {
// - - - loading
isPlanEnabled2.value = !isPlanEnabled2.value;
btn.ctrlStatus = panel;
isLoading.value = false;
// 线
let valid = buttons2.value.filter((item: any) => {
return item.selected;
});
// 线
if (valid.length == 0) {
return message.info('请先选择线路');
// 线
} else {
//
isPlanEnabled2.value = !isPlanEnabled2.value;
//
let after = +isPlanEnabled2.value;
// 线
valid.forEach((item: any) => {
//
if (item.lockStatus == after) {
return;
}
//
const same = lockList.value.find((v: any) => {
return v.deviceGroup == item.dataCode;
});
//
if (same) {
//
if (same.before == after) {
lockList.value.forEach((v1: any, index: number) => {
if (same.deviceGroup == v1.deviceGroup) {
lockList.value.splice(index, 1);
}
});
// true false
}
//
} else {
isLoading.value = false;
lockList.value.push({
deviceGroup: item.dataCode,
deviceGroupName: item.name,
region: item.treePid,
regionName: '',
before: item.lockStatus,
lockStatus: after,
});
}
})
.catch(() => {
isLoading.value = false;
//
item.lockStatus = after;
});
}
};
//
@ -399,8 +441,6 @@
});
//
const changeLine = (button: any) => {
// ID/
handleButton.value = button.id;
// /
if (button.ctrlStatus) {
isPlanEnabled2.value = true;
@ -449,7 +489,7 @@
console.log(thisButton2, 'button');
};
//
//
const buttons2 = ref([]);
//
const showAllButtons = ref(false);
@ -612,9 +652,6 @@
// ======================================================================
const isLoading = ref(false);
// loading
const buttonLoading = ref(false);
//
const refresh = (reload = false) => {
//
@ -631,6 +668,12 @@
});
}
changeList.value = [];
if (!reload) {
lockList.value.forEach((item: any) => {
resetLockList(item);
});
}
lockList.value = [];
//
let data = props.treeData[0];
//
@ -640,6 +683,18 @@
// 线
resetMode();
};
// /
const resetLockList = (item: any) => {
props.treeData.find((v: any) => {
if (item.region == v.dataCode) {
v.childList.find((v1: any) => {
if (item.deviceGroup == v1.dataCode) {
v1.lockStatus = item.before;
}
});
}
});
};
//
const resetChangeList = (item: any) => {
props.treeData.find((v: any) => {
@ -675,11 +730,10 @@
if (!changeList.value.length) {
return message.info('未产生任何修改');
}
buttonLoading.value = true;
http
.post(airConditionControl.getChangeList, {
sceneList: changeList.value,
lockList: [],
lockList: lockList.value,
projectId: state.projectId,
siteId: state.siteId,
})
@ -690,11 +744,8 @@
} else {
message.warning('获取修改内容失败');
}
buttonLoading.value = false;
})
.catch(() => {
buttonLoading.value = false;
});
.catch(() => {});
};
//
const changeCancel = () => {};
@ -714,17 +765,19 @@
obj.scene = obj.stateAfter.scene.value;
obj.before = obj.stateBefore.scene.value;
resetChangeList(obj);
resetLockList(obj);
// changeList diffList ()
changeList.value = changeList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
lockList.value = lockList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
diffList.value = diffList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
console.log(changeList, 'changeList');
console.log(diffList, 'diffList');
//
if (changeList.value.length == 0) {
if (changeList.value.length == 0 && lockList.value.length == 0) {
executeVisible.value = false;
}
};
@ -733,7 +786,7 @@
http
.post(airConditionControl.submitChangeList, {
sceneList: changeList.value,
lockList: [],
lockList: lockList.value,
projectId: state.projectId,
siteId: state.siteId,
})

1
hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less

@ -39,7 +39,6 @@
.journal {
padding: 1% 3%;
width: 100%;
height: 150px;
background-color: rgba(0, 0, 0);
border-radius: 12px;
border: 2px solid transparent;

24
hx-ai-intelligent/src/view/equipmentControl/lightingManage/index.less

@ -16,26 +16,30 @@
perspective-origin: 850px -160px;
// 左上角区域切换功能
.btn-box {
width: 120px;
width: 100px;
position: sticky;
top: 10px;
left: 10px;
top: 15px;
margin-left: 10px;
display: flex;
flex-direction: column;
gap: 8px;
.btn-item {
cursor: pointer;
width: 100%;
height: 40px;
height: 35px;
border-radius: 4px;
background: rgba(39, 120, 255, 1);
// background: rgba(39, 120, 255, 1);
background: rgb(7, 72, 116);
border: 1px solid rgba(51, 199, 255, 1);
box-shadow: 0px 10px 15px rgba(0, 54, 136, 0.3);
font-size: 18px;
font-size: 16px;
color: white;
}
.btnActive {
background: rgba(39, 120, 255, 1);
}
.btn-item:hover {
color: black;
color: white;
}
}
// 大区分区
@ -128,7 +132,10 @@
justify-content: center;
align-items: center;
cursor: pointer;
}
}
}
.drawer-item {
position: relative;
// 抽屉关闭按钮
.drawer-box-out {
width: 30px;
@ -145,5 +152,4 @@
align-items: center;
cursor: pointer;
}
}

24
hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue

@ -7,7 +7,7 @@
v-for="(item, index) in floorData"
:key="index"
class="btn-item"
:style="{ color: item.dataCode == thisFloor ? 'black' : 'white' }"
:class="{ btnActive: item.dataCode == thisFloor }"
@click="changeFloor(item.childList, item.dataCode)"
>{{ item.name }}</button
>
@ -36,14 +36,6 @@
:visible="item.visible" />
</div>
</div>
<!-- 右侧抽屉的触发按钮 -->
<div class="drawer-box-in" v-if="!visible" @click="toggleDrawer">
<double-left-outlined class="drawer-icon" style="color: white" />
</div>
<!-- 左侧抽屉的关闭按钮 -->
<div class="drawer-box-out" v-if="visible" @click="toggleDrawer">
<double-right-outlined class="drawer-icon" style="color: white" />
</div>
<!-- 右侧抽屉 -->
<a-drawer
v-model:visible="visible"
@ -55,13 +47,17 @@
:closable="false"
id="drawer"
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }">
<div class="drawer-box-out" @click="toggleDrawer">
<double-left-outlined v-if="!visible" class="drawer-icon" style="color: white" />
<double-right-outlined v-else class="drawer-icon" style="color: white" />
</div>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板">
<tabs1
ref="tabs1Ref"
@changeArea="changeArea"
@reset="reset"
@reload="reload"
@changeArea="changeArea"
:treeData="treeData" />
</a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render>
@ -77,6 +73,7 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { lightPosition } from './lightPosition';
//
import light from './light.vue';
import tabs1 from './tabs1.vue';
@ -289,7 +286,12 @@
siteId: state.siteId,
})
.then((res) => {
console.log(res);
const data = res.data;
data.forEach((item: any, index: number) => {
item.styleText = lightPosition[index];
});
console.log(res.data);
// bulbs.value = data;
});
};

5
hx-ai-intelligent/src/view/equipmentControl/lightingManage/lightPosition.ts

@ -1,3 +1,6 @@
// 此文件只定义light(即俯视图小灯泡)的位置信息
// 与显示状态和分组信息无关
export const lightPosition = [];
export const lightPosition = [
{ left: '180px', bottom: '200px' },
{ left: '180px', bottom: '230px' },
];

24
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.less

@ -413,12 +413,22 @@
.zmhlbtn {
position: relative;
}
// 禁用图标
.anticon-stop {
position: absolute;
right: 3px;
bottom: 3px;
overflow: hidden;
.btn-back {
position: absolute;
width: 50px;
height: 50px;
right: -25px;
bottom: -30px;
transform: rotate(45deg);
background: orange;
// 禁用图标
.anticon-stop {
transform: rotate(-45deg) scale(0.9);
position: absolute;
left: 3px;
top: 15px;
}
}
}
}

582
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue

@ -1,243 +1,266 @@
<template>
<a-spin :spinning="isLoading">
<!-- 照明区域 -->
<div>
<div class="light-area">
<div class="light-area-tab"></div>
<span class="light-area-text"> 照明区域 </span>
</div>
<!-- 照明区域按钮部分 -->
<div class="area">
<template v-if="!showAllButtonsArea">
<button
v-for="(button, index) in limitedButtons1"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button, index) in props.treeData"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</div>
<!-- 照明区域 -->
<div>
<div class="light-area">
<div class="light-area-tab"></div>
<span class="light-area-text"> 照明区域 </span>
</div>
<!-- 照明回路部分 -->
<div>
<div class="circuit-area">
<div class="circuit-tab"></div>
<span class="circuit-text">照明回路</span>
<div class="btn2">
<!-- 照明区域按钮部分 -->
<div class="area">
<template v-if="!showAllButtonsArea">
<button
v-for="(button, index) in limitedButtons1"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button, index) in props.treeData"
:key="index"
:class="{ btn: true, selected: button.selected }"
@click="changeArea(button)">
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtonsArea = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</div>
</div>
<!-- 照明回路部分 -->
<div>
<div class="circuit-area">
<div class="circuit-tab"></div>
<span class="circuit-text">照明回路</span>
<div class="btn2">
<a-badge :offset="[-10, 2]" :count="lockList.length">
<button
class="openPlan"
:class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }"
@click="togglePlan2">
{{ isPlanEnabled2 ? '启用开关' : '禁用开关' }}
</button>
<a-switch
v-model:checked="selectAllCheckbox"
:disabled="singleSelection"
:class="{
'blue-background': selectAllCheckbox,
'grey-background': !selectAllCheckbox,
}"
@change="toggleAllSelection" />
<button class="allBtn">全选</button>
<button class="both" @click="selectAll">
{{ singleSelection ? '多选' : '单选' }}
</button>
</div>
</div>
<div class="btnArea">
<template v-if="!showAllButtons">
<button
v-for="(button, index) in limitedButtons2"
:key="index"
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" />
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtons = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button, index) in buttons2"
:key="index"
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" />
{{ button.name }}
</button>
<div style="margin-top: 10px">
<span @click="showAllButtons = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</a-badge>
<a-switch
v-model:checked="selectAllCheckbox"
:disabled="singleSelection"
:class="{
'blue-background': selectAllCheckbox,
'grey-background': !selectAllCheckbox,
}"
@change="toggleAllSelection" />
<button class="allBtn">全选</button>
<button class="both" @click="selectAll">
{{ singleSelection ? '多选' : '单选' }}
</button>
</div>
</div>
<!-- 控制模式部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-area">
<div class="control-tab"></div>
<span class="control-text"> 控制模式 </span>
</div>
<!-- 控制模式按钮部分 -->
<div class="control-mode-btn-area">
<div class="btnArea">
<template v-if="!showAllButtons">
<button
v-for="(button3, index) in thisButton2.childList"
v-for="(button, index) in limitedButtons2"
:key="index"
class="btn"
:class="{ selected: button3.selectAble }"
@click="selectButton3(button3)">
{{ button3.name }}
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }}
</button>
</div>
</div>
<!-- 控制场景部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-scene-area">
<div class="control-scene-tab"></div>
<span class="control-scene-text"> 控制场景 </span>
<div v-if="!singleSelection" style="flex: 1; color: red; text-align: right"
>多选模式下会修改当前选中的所有回路</div
>
</div>
<!-- 控制场景按钮部分 -->
<div class="control-scene-btn-area">
<div style="margin-top: 10px">
<span @click="showAllButtons = true" class="openzm"><down-outlined /> 展开</span>
</div>
</template>
<template v-else>
<button
v-for="(button4, index) in thisButton3.childList"
v-for="(button, index) in buttons2"
:key="index"
:class="{ btn: true, selected: button4.executeStatus.value != 0 }"
@click="selectButton4(button4)">
{{ button4.name }}
:class="{ btn: true, selected: button.selected }"
class="zmhlbtn"
@click="changeLine(button)">
<div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }}
</button>
</div>
<div style="margin-top: 10px">
<span @click="showAllButtons = false" class="openzm"><up-outlined /> 回缩</span>
</div>
</template>
</div>
<!-- 底部按钮区 -->
<div class="bottom">
<a-badge :offset="[-10, 2]" :count="changeList.length">
<a-popconfirm
title="刷新将会取消已作出的修改"
ok-text="确定"
cancel-text="取消"
@confirm="refresh(false)"
@cancel="changeCancel">
<button class="flushed">刷新</button>
</a-popconfirm>
</a-badge>
<a-spin :spinning="buttonLoading">
<button class="execute" @click="showModal">执行</button>
</a-spin>
</div>
<!-- 控制模式部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-area">
<div class="control-tab"></div>
<span class="control-text"> 控制模式 </span>
</div>
<!-- 控制模式按钮部分 -->
<div class="control-mode-btn-area">
<button
v-for="(button3, index) in thisButton2.childList"
:key="index"
class="btn"
:class="{ selected: button3.selectAble }"
@click="selectButton3(button3)">
{{ button3.name }}
</button>
</div>
</div>
<!-- 控制场景部分 -->
<div v-show="thisButton2.dataCode">
<div class="control-scene-area">
<div class="control-scene-tab"></div>
<span class="control-scene-text"> 控制场景 </span>
<div v-if="!singleSelection" style="flex: 1; color: red; text-align: right"
>多选模式下会修改当前选中的所有回路</div
>
</div>
<!-- 控制场景按钮部分 -->
<div class="control-scene-btn-area">
<button
v-for="(button4, index) in thisButton3.childList"
:key="index"
:class="{ btn: true, selected: button4.executeStatus.value != 0 }"
@click="selectButton4(button4)">
{{ button4.name }}
</button>
</div>
</div>
<!-- 底部按钮区 -->
<div class="bottom">
<a-badge :offset="[-10, 2]" :count="changeList.length">
<a-popconfirm
title="刷新将会取消已作出的修改"
ok-text="确定"
cancel-text="取消"
@confirm="refresh(false)"
@cancel="changeCancel">
<button class="flushed">刷新</button>
</a-popconfirm>
</a-badge>
<button class="execute" @click="showModal">执行</button>
</div>
<!-- 点击执行时的弹出框 -->
<div class="out-dialog" v-if="executeVisible">
<div class="content">
<div>
<div class="div-operation"></div>
<span class="text-operation">变更内容 </span>
</div>
<div class="j-box" v-for="(item, index) in diffList" :key="item.id">
<div class="journal" style="margin-top: 20px">
<div class="imgText">
<div class="zjzm">
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp;
<span
class="title-text"
style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.regionName + ' > ' + item.deviceGroupName }}</span
>
</div>
<a-popconfirm
title="此操作将会撤销修改"
ok-text="确定"
cancel-text="取消"
@confirm="delBtn(item)"
@cancel="changeCancel">
<button class="cxbtn">撤销</button>
</a-popconfirm>
<!-- 点击执行时的弹出框 -->
<div class="out-dialog" v-if="executeVisible">
<div class="content">
<div>
<div class="div-operation"></div>
<span class="text-operation">变更内容 </span>
</div>
<div class="j-box" v-for="item in diffList" :key="item.id">
<div class="journal" style="margin-top: 20px">
<div class="imgText">
<div class="zjzm">
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp;
<span
class="title-text"
style="font-size: 18px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.regionName + ' > ' + item.deviceGroupName }}</span
>
</div>
<a-popconfirm
title="此操作将会撤销修改"
ok-text="确定"
cancel-text="取消"
@confirm="delBtn(item)"
@cancel="changeCancel">
<button class="cxbtn">撤销</button>
</a-popconfirm>
</div>
<div class="btn-box">
<div class="btn-item">
<div class="left">控制模式</div>
<div class="right">
<span>手动</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span></div
>
</div>
<div class="btn-box">
<div class="btn-item">
<div class="left">控制模式</div>
<div class="right">
<span>手动</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span>
</div>
<div class="btn-item">
<div class="left"> 亮度 </div>
<div class="right">
<!-- 由于数字0也会被判为false故只判断undefined null -->
<span>{{
item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.brightness != undefined ? item.stateAfter.brightness : '--'
}}</span>
</div>
<div class="btn-item">
<div class="left"> 亮度 </div>
<div class="right">
<!-- 由于数字0也会被判为false故只判断undefined null -->
<span>{{
item?.stateBefore?.brightness != undefined ? item.stateBefore.brightness : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.brightness != undefined ? item.stateAfter.brightness : '--'
}}</span>
</div>
</div>
<div class="btn-item">
<div class="left"> 控制场景 </div>
<div class="right">
<span>{{
item?.stateBefore?.scene?.label ? item.stateBefore.scene.label : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.scene?.label ? item.stateAfter.scene.label : '--'
}}</span>
</div>
<div class="btn-item">
<div class="left"> 控制场景 </div>
<div class="right">
<span>{{
item?.stateBefore?.scene?.label ? item.stateBefore.scene.label : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>{{
item?.stateAfter?.scene?.label ? item.stateAfter.scene.label : '--'
}}</span>
</div>
</div>
<div class="btn-item">
<div class="left"> 色温 </div>
<div class="right">
<span>{{
item?.stateBefore?.color != undefined ? item.stateBefore.color : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>
{{ item?.stateAfter?.color != undefined ? item.stateAfter.color : '--' }}
</span>
</div>
<div class="btn-item">
<div class="left"> 色温 </div>
<div class="right">
<span>{{
item?.stateBefore?.color != undefined ? item.stateBefore.color : '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>
{{ item?.stateAfter?.color != undefined ? item.stateAfter.color : '--' }}
</span>
</div>
</div>
<div class="btn-item">
<div class="left"> 启用状态 </div>
<div class="right">
<span>{{
item?.stateBefore?.lockStatus != undefined
? item.stateBefore.lockStatus
? '禁用'
: '启用'
: '--'
}}</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>
{{
item?.stateAfter?.lockStatus != undefined
? item.stateAfter.lockStatus
? '禁用'
: '启用'
: '--'
}}
</span>
</div>
</div>
</div>
</div>
</div>
<div style="width: 100%; height: 60px"></div>
<div class="button-box">
<button class="cancel" @click="executeVisible = false">取消</button>
<a-popconfirm
title="此操作将提交以上修改内容"
ok-text="确定"
cancel-text="取消"
@confirm="submitChangeList"
@cancel="changeCancel">
<button class="execute">执行</button>
</a-popconfirm>
</div>
</div>
</a-spin>
<div style="width: 100%; height: 60px"></div>
<div class="button-box">
<button class="cancel" @click="executeVisible = false">取消</button>
<a-popconfirm
title="此操作将提交以上修改内容"
ok-text="确定"
cancel-text="取消"
@confirm="submitChangeList"
@cancel="changeCancel">
<button class="execute">执行</button>
</a-popconfirm>
</div>
</div>
</template>
<script setup lang="ts">
@ -303,48 +326,67 @@
emit('changeArea', button.id);
// -
resetMode();
// -
handleButton.value = '';
};
// 8
const limitedButtons1 = computed(() => props.treeData.slice(0, 8));
// ======================================================================
// id
const handleButton = ref('');
// /
const isPlanEnabled2 = ref(true);
const isPlanEnabled2 = ref(false);
//
const lockList = ref<any>([]);
// /
const togglePlan2 = () => {
//
if (handleButton.value == '') {
return message.info('请选择照明回路');
}
//
const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value);
let panel = +!btn.ctrlStatus;
isLoading.value = true;
http
.get(lightingManage.setDisable, {
deviceGroup: btn.dataCode,
panel,
projectId: state.projectId,
siteId: state.siteId,
})
.then((res) => {
if (res.msg === 'success') {
// - - - loading
isPlanEnabled2.value = !isPlanEnabled2.value;
btn.ctrlStatus = panel;
isLoading.value = false;
// 线
let valid = buttons2.value.filter((item: any) => {
return item.selected;
});
// 线
if (valid.length == 0) {
return message.info('请先选择线路');
// 线
} else {
//
isPlanEnabled2.value = !isPlanEnabled2.value;
//
let after = +isPlanEnabled2.value;
// 线
valid.forEach((item: any) => {
//
if (item.lockStatus == after) {
return;
}
//
const same = lockList.value.find((v: any) => {
return v.deviceGroup == item.dataCode;
});
//
if (same) {
//
if (same.before == after) {
lockList.value.forEach((v1: any, index: number) => {
if (same.deviceGroup == v1.deviceGroup) {
lockList.value.splice(index, 1);
}
});
// true false
}
//
} else {
isLoading.value = false;
lockList.value.push({
deviceGroup: item.dataCode,
deviceGroupName: item.name,
region: item.treePid,
regionName: '',
before: item.lockStatus,
lockStatus: after,
});
}
})
.catch(() => {
isLoading.value = false;
//
item.lockStatus = after;
});
}
};
//
@ -398,8 +440,6 @@
});
//
const changeLine = (button: any) => {
// ID/
handleButton.value = button.id;
// /
if (button.ctrlStatus) {
isPlanEnabled2.value = true;
@ -611,9 +651,6 @@
// ======================================================================
const isLoading = ref(false);
// loading
const buttonLoading = ref(false);
//
const refresh = (reload = false) => {
//
@ -630,6 +667,12 @@
});
}
changeList.value = [];
if (!reload) {
lockList.value.forEach((item: any) => {
resetLockList(item);
});
}
lockList.value = [];
//
let data = props.treeData[0];
//
@ -638,7 +681,19 @@
buttons2.value = data.childList;
resetMode();
};
//
// /
const resetLockList = (item: any) => {
props.treeData.find((v: any) => {
if (item.region == v.dataCode) {
v.childList.find((v1: any) => {
if (item.deviceGroup == v1.dataCode) {
v1.lockStatus = item.before;
}
});
}
});
};
// 线
const resetChangeList = (item: any) => {
props.treeData.find((v: any) => {
if (item.region == v.dataCode) {
@ -653,7 +708,7 @@
v3.executeStatus.value = 0;
}
if (!item.before) {
console.log(item, '没有这个选项');
console.log(item, '没有这个选项---');
v3.executeStatus.value = 0;
}
//
@ -670,14 +725,13 @@
};
//
const showModal = () => {
if (!changeList.value.length) {
if (!changeList.value.length && !lockList.value.length) {
return message.info('未产生任何修改');
}
buttonLoading.value = true;
http
.post(lightingManage.getChangeList, {
sceneList: changeList.value,
lockList: [],
lockList: lockList.value,
projectId: state.projectId,
siteId: state.siteId,
})
@ -688,11 +742,8 @@
} else {
message.warning('获取修改内容失败');
}
buttonLoading.value = false;
})
.catch(() => {
buttonLoading.value = false;
});
.catch(() => {});
};
//
const changeCancel = () => {};
@ -705,24 +756,26 @@
const changeList: any = ref([]);
//
const diffList = ref([]);
//
//
const delBtn = (obj: any) => {
console.log(obj, '当前选择的修改内容');
// treeData
obj.scene = obj.stateAfter.scene.value;
obj.before = obj.stateBefore.scene.value;
obj.scene = obj?.stateAfter?.scene?.value;
obj.before = obj?.stateBefore?.scene?.value;
resetChangeList(obj);
// changeList diffList ()
resetLockList(obj);
// changeList lockList diffList ()
changeList.value = changeList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
lockList.value = lockList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
diffList.value = diffList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
console.log(changeList, 'changeList');
console.log(diffList, 'diffList');
//
if (changeList.value.length == 0) {
if (changeList.value.length == 0 && lockList.value.length == 0) {
executeVisible.value = false;
}
};
@ -731,14 +784,15 @@
http
.post(lightingManage.submitChangeList, {
sceneList: changeList.value,
lockList: [],
lockList: lockList.value,
projectId: state.projectId,
siteId: state.siteId,
})
.then(() => {
emit('reload');
refresh(true);
});
})
.catch(() => {});
};
// ========================================================================

7
lib/util/xlsx-util.ts

@ -1,10 +1,9 @@
import { utils, write } from 'xlsx';
import { dateUtil } from '/nerv-lib/util/date-util';
import { NsMessage } from '/nerv-lib/component/message';
import axios from 'axios';
import { createVNode, h, render as vueRender } from 'vue';
import { Cookies } from '/nerv-lib/util/cookie';
import { NsXlsxImport } from '/nerv-lib/component/xlsx';
import { NsModal } from '/nerv-lib/component/modal';
@ -126,7 +125,9 @@ export const importFile = (
});
formData.append('file', event);
axios
.post(api, formData)
.post(api, formData, {
headers: { token: Cookies.get(`${import.meta.env.VITE_PUBLIC_PATH}-nervsid`) },
})
.then((res) => {
if (res) {
NsMessage.success('导入成功', 1, () => {

Loading…
Cancel
Save