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. 18
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue
  4. 76
      hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue
  5. 576
      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. 102
      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. 22
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.less
  14. 14
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/index.vue
  15. 18
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.less
  16. 161
      hx-ai-intelligent/src/view/equipmentControl/airConditionControlSystem/tabs1.vue
  17. 1
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/dialogStyle.less
  18. 22
      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. 18
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.less
  22. 180
      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', getCarbonFactorTree = '/carbon-smart/api/carbon/emission/type/getCarbonFactorTree',
creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate', creat = '/carbon-smart/api/carbon/emission/type/creatOrUpdate',
delTreeNode = '/carbon-smart/api/carbon/emission/type/del', 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', dictionaryUnitManagement = '/carbon-smart/client/dict/dictionaryUnitManagement',
findOutermost = '/carbon-smart/client/dict/findOutermost', findOutermost = '/carbon-smart/client/dict/findOutermost',
@ -15,7 +17,7 @@ export enum carbonEmissionFactorLibrary {
updateDictionary = '/carbon-smart/client/dict/updateDictionary', updateDictionary = '/carbon-smart/client/dict/updateDictionary',
delDictionary = '/carbon-smart/client/dict/delDictionary', delDictionary = '/carbon-smart/client/dict/delDictionary',
} }
// 碳排管理-碳排统计接口 // 碳排管理-能耗统计接口
export enum energyConsumption { export enum energyConsumption {
getDicList = '/carbon-smart/client/dict/list', getDicList = '/carbon-smart/client/dict/list',
pageList = '/carbon-smart/api/carbon/stats/pageList', pageList = '/carbon-smart/api/carbon/stats/pageList',
@ -23,6 +25,7 @@ export enum energyConsumption {
creat = '/carbon-smart/api/carbon/stats/creat', creat = '/carbon-smart/api/carbon/stats/creat',
update = '/carbon-smart/api/carbon/stats/update', update = '/carbon-smart/api/carbon/stats/update',
del = '/carbon-smart/api/carbon/stats/del', del = '/carbon-smart/api/carbon/stats/del',
voucherDownloadList = '/carbon-smart/api/carbon/stats/voucherDownloadList',
} }
// 碳排管理-碳排速算接口 // 碳排管理-碳排速算接口
export enum quickCalculation { export enum quickCalculation {
@ -55,6 +58,7 @@ export enum carbonInventoryCheck {
findUnitById = '/carbon-smart/api/carbon/inventory/findById', findUnitById = '/carbon-smart/api/carbon/inventory/findById',
getDetailsList = '/carbon-smart/api/carbon/inventory/details/getDetailsList', getDetailsList = '/carbon-smart/api/carbon/inventory/details/getDetailsList',
updateTable = '/carbon-smart/api/carbon/inventory/details/update', updateTable = '/carbon-smart/api/carbon/inventory/details/update',
voucherDownloadList = '/carbon-smart/api/carbon/inventory/details/voucherDownloadList',
// 排放统计接口 // 排放统计接口
emissionStatistic = '/carbon-smart/api/carbon/inventory/emissionStatistic', emissionStatistic = '/carbon-smart/api/carbon/inventory/emissionStatistic',
// 碳排流向 // 碳排流向
@ -75,6 +79,8 @@ export enum uploadPic {
uploadfiles = '/carbon-smart/api/common/file/uploadfiles', uploadfiles = '/carbon-smart/api/common/file/uploadfiles',
select = '/carbon-smart/api/common/file/select', select = '/carbon-smart/api/common/file/select',
uploadfile = '/carbon-smart/api/common/file/uploadfile', uploadfile = '/carbon-smart/api/common/file/uploadfile',
download = '/carbon-smart/api/common/file/download',
downloadZip = '/carbon-smart/api/common/file/downloadZip',
} }
// 碳规划 // 碳规划
export enum carbonPlanning { export enum carbonPlanning {
@ -90,4 +96,6 @@ export enum carbonPlanning {
detailedStatisticalDataChart = '/carbon-smart/api/carbon/planning/detailedStatisticalDataChart', detailedStatisticalDataChart = '/carbon-smart/api/carbon/planning/detailedStatisticalDataChart',
batchOrUpdate = '/carbon-smart/api/carbon/planning/batchOrUpdate', batchOrUpdate = '/carbon-smart/api/carbon/planning/batchOrUpdate',
addNodes = '/carbon-smart/api/carbon/planning/addNodes', 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: { meta: {
title: '碳排因子库', title: '碳排因子库',
keepAlive: false, keepAlive: false,
operates: [
{ title: '碳排因子库导入', code: 'carbonEmissionFactorLibraryImport' },
],
// backApi: [], // backApi: [],
}, },
}, },

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

@ -290,11 +290,12 @@
getDictList(); getDictList();
visible.value = true; visible.value = true;
formState.value.id = record.id; 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) => ({ fileList.value = res.data.map((item) => ({
uid: item.id.toString(), // 使id uid: item.id.toString(), // 使id
name: item.fileName, // name: item.fileName, //
status: 'done', // status: 'done', //
type: 'done',
url: item.filePath, // URLURL url: item.filePath, // URLURL
})); }));
}); });
@ -415,7 +416,9 @@
message.error(`${info.file.name} 文件上传失败`); message.error(`${info.file.name} 文件上传失败`);
} }
}; };
const delIds = ref([]);
const handleFileRemove = (file) => { const handleFileRemove = (file) => {
delIds.value.push(file.uid);
const newFileList = []; const newFileList = [];
fileList.value.forEach((item) => { fileList.value.forEach((item) => {
if (item.uid !== file.uid) { if (item.uid !== file.uid) {
@ -424,9 +427,6 @@
}); });
fileList.value = newFileList; fileList.value = newFileList;
}; };
const uploadQuery = ref({
bizTpye: 1,
});
const onSubmit = () => { const onSubmit = () => {
formRef.value formRef.value
.validate() .validate()
@ -443,14 +443,20 @@
// uploadQuery.value.bizId = res.data.id; // uploadQuery.value.bizId = res.data.id;
const formData = ref(new FormData()); const formData = ref(new FormData());
fileList.value.forEach((file) => { fileList.value.forEach((file) => {
if (file.type !== 'done') {
formData.value.append('files', file.originFileObj); formData.value.append('files', file.originFileObj);
}
}); });
formData.value.append('bizTpye', 1); formData.value.append('bizType', 1);
formData.value.append('bizId', res.data.id); formData.value.append('bizId', res.data.id);
delIds.value.forEach((item) => {
formData.value.append('deleteList', item);
});
fetch(uploadPic.uploadfiles, formData.value) fetch(uploadPic.uploadfiles, formData.value)
.then((res) => { .then((res) => {
message.success('操作成功!'); message.success('操作成功!');
visible.value = false; visible.value = false;
delIds.value = [];
getDetailList(); getDetailList();
}) })
.catch((error) => { .catch((error) => {
@ -459,6 +465,7 @@
} else { } else {
message.success('操作成功!'); message.success('操作成功!');
visible.value = false; visible.value = false;
delIds.value = [];
getDetailList(); getDetailList();
} }
}); });
@ -479,6 +486,7 @@
// //
const onClose = () => { const onClose = () => {
visible.value = false; visible.value = false;
delIds.value = [];
formState.value = {}; formState.value = {};
fileList.value = []; fileList.value = [];
formRef.value.resetFields(); formRef.value.resetFields();

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

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

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

@ -27,7 +27,11 @@
</div> </div>
</template> </template>
</a-table> --> </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 #bodyCell="{ record, column }">
<template v-if="column.dataIndex === 'enableRules'"> <template v-if="column.dataIndex === 'enableRules'">
<a-switch <a-switch
@ -61,8 +65,7 @@
:model="formState" :model="formState"
:rules="rules" :rules="rules"
:label-col="labelCol" :label-col="labelCol"
:wrapper-col="wrapperCol" :wrapper-col="wrapperCol">
>
<a-form-item ref="name" label="能源种类" name="energyType"> <a-form-item ref="name" label="能源种类" name="energyType">
<a-input v-model:value="formState.energyType" placeholder="请输入能源种类" /> <a-input v-model:value="formState.energyType" placeholder="请输入能源种类" />
</a-form-item> </a-form-item>
@ -73,8 +76,7 @@
<a-tree-select <a-tree-select
v-model:value="formState.collectionNode" v-model:value="formState.collectionNode"
:tree-line="true" :tree-line="true"
:tree-data="treeData" :tree-data="treeData">
>
</a-tree-select> </a-tree-select>
</a-form-item> </a-form-item>
<a-form-item label="计算碳排" name="isComputeCarbon"> <a-form-item label="计算碳排" name="isComputeCarbon">
@ -91,51 +93,149 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-row> <a-row>
<a-col :span="24" style="display:flex;justify-content: space-around;"> <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-form-item
<a-switch v-model:checked="formState.janFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="2月" name="febFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.febFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="3月" name="marFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.marFlag" :checked-value="1" :unCheckedValue="0" /> 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-form-item>
</a-col> </a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;"> <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-form-item
<a-switch v-model:checked="formState.aprFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="5月" name="mayFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.mayFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="6月" name="junFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.junFlag" :checked-value="1" :unCheckedValue="0" /> 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-form-item>
</a-col> </a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;"> <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-form-item
<a-switch v-model:checked="formState.julFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="8月" name="augFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.augFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="9月" name="sepFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.sepFlag" :checked-value="1" :unCheckedValue="0" /> 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-form-item>
</a-col> </a-col>
<a-col :span="24" style="display:flex;justify-content: space-around;"> <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-form-item
<a-switch v-model:checked="formState.octFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="11月" name="novFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.novFlag" :checked-value="1" :unCheckedValue="0" /> 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>
<a-form-item label="12月" name="decFlag" :label-col="switchLabelCol" :wrapper-col="switchWrapperCol"> <a-form-item
<a-switch v-model:checked="formState.decFlag" :checked-value="1" :unCheckedValue="0" /> 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-form-item>
</a-col> </a-col>
</a-row> </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> </a-form>
<template #footer> <template #footer>
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> <a-button style="margin-right: 8px" @click="onClose">取消</a-button>
@ -143,7 +243,7 @@
</template> </template>
</a-drawer> </a-drawer>
<!-- 上传凭证弹窗 --> <!-- 上传凭证弹窗 -->
<a-modal :visible="openUpload" title="凭证上传" @ok="handleOk" @cancel="closeOpenUpload"> <!-- <a-modal :visible="openUpload" title="凭证上传" @ok="handleOk" @cancel="closeOpenUpload">
<a-upload-dragger <a-upload-dragger
v-model:fileList="fileList" v-model:fileList="fileList"
name="file" name="file"
@ -161,19 +261,55 @@
<p>3.每次上传自动覆盖</p> <p>3.每次上传自动覆盖</p>
</p> </p>
</a-upload-dragger> </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> </div>
</template> </template>
<script lang="ts" setup> <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 type { Rule } from 'ant-design-vue/es/form';
import { Pagination,message,Modal } from 'ant-design-vue'; import { Pagination, message, Modal } from 'ant-design-vue';
import type { TreeSelectProps,UploadChangeParam } 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 { NsMessage } from '/nerv-lib/component';
import dayjs, { Dayjs } from 'dayjs'; import dayjs, { Dayjs } from 'dayjs';
import { http } from '/nerv-lib/util/http'; import { http } from '/nerv-lib/util/http';
import { tableColumns } from '../config'; import { tableColumns } from '../config';
import { energyConsumption,carbonEmissionFactorLibrary } from '/@/api/carbonEmissionFactorLibrary'; import {
energyConsumption,
carbonEmissionFactorLibrary,
uploadPic,
} from '/@/api/carbonEmissionFactorLibrary';
import { group } from '/@/api/deviceManage'; import { group } from '/@/api/deviceManage';
defineOptions({ defineOptions({
energyType: 'EnergyConsumption', // name energyType: 'EnergyConsumption', // name
@ -184,17 +320,17 @@
const orgId = ref(''); const orgId = ref('');
const result = JSON.parse(sessionStorage.getItem('ORGID')!); const result = JSON.parse(sessionStorage.getItem('ORGID')!);
orgId.value = result; orgId.value = result;
const fetch = (api, params = { orgId } ) => { const fetch = (api, params = { orgId }) => {
return http.post(api, params); return http.post(api, params);
}; };
const selectYear = ref<Dayjs>(dayjs( new Date().getFullYear().toString())); const selectYear = ref<Dayjs>(dayjs(new Date().getFullYear().toString()));
const total = ref<number>() const total = ref<number>();
const queryParams = ref({ const queryParams = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orgId: orgId.value, orgId: orgId.value,
year: selectYear.value.format('YYYY') year: selectYear.value.format('YYYY'),
}) });
const isRequired = ref(false); const isRequired = ref(false);
const visible = ref(false); const visible = ref(false);
const openUpload = ref<boolean>(false); const openUpload = ref<boolean>(false);
@ -225,26 +361,26 @@
const switchWrapperCol = { span: 14 }; const switchWrapperCol = { span: 14 };
const formState = ref({ const formState = ref({
orgId: orgId.value, orgId: orgId.value,
}) });
// form // form
const rules: Record<string, Rule[]> = { const rules: Record<string, Rule[]> = {
energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }], energyType: [{ required: true, message: '请输入能源种类', trigger: 'change' }],
isComputeCarbon: [{ 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 treeData = ref<TreeSelectProps['treeData']>([]);
// //
const changeYearData = () => { const changeYearData = () => {
queryParams.value.year = selectYear.value queryParams.value.year = selectYear.value;
getTableList() getTableList();
} };
const mainRef = ref(); const mainRef = ref();
const year = selectYear.value.format('YYYY') const year = selectYear.value.format('YYYY');
const tableConfig = ref({ const tableConfig = ref({
title: '能耗统计', title: '能耗统计',
api: energyConsumption.pageList, api: energyConsumption.pageList,
@ -255,8 +391,8 @@
name: 'userAdd', name: 'userAdd',
type: 'primary', type: 'primary',
handle: () => { handle: () => {
getDictList() getDictList();
visible.value = true visible.value = true;
}, },
}, },
{ {
@ -273,20 +409,24 @@
{ {
label: '模板下载', label: '模板下载',
type: 'primary', type: 'primary',
name: 'userExports',
}, },
// {
// label: '',
// type: 'primary',
// handle: () => {
// openUpload.value = true;
// },
// },
{ {
label: '上传凭证', label: '凭证下载',
type: 'primary', type: 'primary',
handle: () => { handle: () => {
openUpload.value = true; fetch(energyConsumption.voucherDownloadList, { bizType: 3 }).then((res) => {
downLoadData.value = res.data;
});
downLoadVisible.value = true;
}, },
}, },
{
label: '凭证下载',
type: 'primary',
name: 'userExports',
},
], ],
columns: [ columns: [
{ {
@ -370,25 +510,34 @@
label: '编辑', label: '编辑',
name: 'userEdit', name: 'userEdit',
handle: (record: any) => { handle: (record: any) => {
getDictList() getDictList();
visible.value = true visible.value = true;
fetch(energyConsumption.findById , {id : record.id }).then((res) => { fetch(energyConsumption.findById, { id: record.id }).then((res) => {
if(res.data.emissionType){ if (res.data.emissionType) {
res.data.emissionType = Number(res.data.emissionType) res.data.emissionType = Number(res.data.emissionType);
} }
if (res.data.unit) { if (res.data.unit) {
let selectDevice = ref([Number(res.data.unit)]); let selectDevice = ref([Number(res.data.unit)]);
findParentIds(measurementUnit.value, res.data.unit, selectDevice.value); findParentIds(measurementUnit.value, res.data.unit, selectDevice.value);
res.data.unit = selectDevice res.data.unit = selectDevice;
} }
formState.value = res.data formState.value = res.data;
emissionType.value = res.data.emissionType emissionType.value = res.data.emissionType;
if(formState.value.isComputeCarbon===0){ if (formState.value.isComputeCarbon === 0) {
isRequired.value = true isRequired.value = true;
}else{ } else {
isRequired.value = false 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
}));
});
}, },
}, },
{ {
@ -437,27 +586,27 @@
} }
// //
const getTableList = () => { const getTableList = () => {
fetch(energyConsumption.pageList , queryParams.value).then((res) => { fetch(energyConsumption.pageList, queryParams.value).then((res) => {
data.value = res.data.records data.value = res.data.records;
}); });
}; };
// //
const onChange = (pageNumber: number,size: number) => { const onChange = (pageNumber: number, size: number) => {
queryParams.value.pageNum = pageNumber; queryParams.value.pageNum = pageNumber;
queryParams.value.pageSize = size; queryParams.value.pageSize = size;
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
}; };
// //
const emissionType = ref() const emissionType = ref();
const changeRadio = (e) => { const changeRadio = (e) => {
if(e.target.value === 0){ if (e.target.value === 0) {
isRequired.value = true isRequired.value = true;
if(emissionType.value){ if (emissionType.value) {
formState.value.emissionType = emissionType.value formState.value.emissionType = emissionType.value;
} }
}else{ } else {
isRequired.value = false isRequired.value = false;
formState.value.emissionType = '' formState.value.emissionType = '';
} }
}; };
// //
@ -466,84 +615,144 @@
.validate() .validate()
.then(() => { .then(() => {
console.log('values', formState, toRaw(formState)); console.log('values', formState, toRaw(formState));
formState.value.year = selectYear.value.format('YYYY') formState.value.year = selectYear.value.format('YYYY');
if(formState.value.unit){ if (formState.value.unit) {
formState.value.unit = formState.value.unit.join(',').split(',')[1] formState.value.unit = formState.value.unit.join(',').split(',')[1];
}
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);
} }
if(formState.value.id){ });
fetch(energyConsumption.update , formState.value).then((res) => { formData.value.append('bizType', 3);
visible.value = false 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 = { formState.value = {
orgId: orgId.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('操作成功!'); message.success('操作成功!');
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
}
}); });
}else{ } else {
fetch(energyConsumption.creat , formState.value).then((res) => { fetch(energyConsumption.creat, formState.value).then((res) => {
if(res.data === '新增数据已存在'){ if (res.data === '新增数据已存在') {
visible.value = false visible.value = false;
delIds.value = [];
NsMessage.warning(res.data); NsMessage.warning(res.data);
}else{ } else {
visible.value = false 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 = { formState.value = {
orgId: orgId.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('操作成功!'); message.success('操作成功!');
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
} }
}
}); });
} }
}) })
.catch(error => { .catch((error) => {
console.log('error', error); console.log('error', error);
}); });
}; };
// //
const getDictList = () => { const getDictList = () => {
// //
fetch(energyConsumption.getDicList , {grp: 'EMISSION_TYPE'}).then((res) => { fetch(energyConsumption.getDicList, { grp: 'EMISSION_TYPE' }).then((res) => {
emissionTypeDic.value = res.data emissionTypeDic.value = res.data;
}); });
// //
fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT'}).then((res) => { fetch(carbonEmissionFactorLibrary.dictionaryUnitManagement, { grp: 'MEASUREMENT_UNIT' }).then(
measurementUnit.value = res.data (res) => {
measurementUnit.value = measurementUnit.value.map(item => ({ measurementUnit.value = res.data;
measurementUnit.value = measurementUnit.value.map((item) => ({
value: item.id, value: item.id,
label: item.cnValue, label: item.cnValue,
children: item.children ? item.children.map(child => ({ children: item.children
? item.children.map((child) => ({
value: child.id, value: child.id,
label: child.cnValue label: child.cnValue,
})) : [] }))
: [],
})); }));
}); },
);
// //
fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE',orgId: orgId.value }).then((res) => { fetch(group.queryDeviceGroupTree, { energyType: 'ELECTRICITY_USAGE', orgId: orgId.value }).then(
treeData.value = res.data (res) => {
treeData.value = treeData.value.map(item => ({ treeData.value = res.data;
treeData.value = treeData.value.map((item) => ({
value: item.id, value: item.id,
label: item.pointName, label: item.pointName,
children: item.children ? item.children.map(child => ({ children: item.children
? item.children.map((child) => ({
value: child.id, value: child.id,
label: child.pointName label: child.pointName,
})) : [] }))
: [],
})); }));
}); },
} );
};
// //
const addNewData = () => { const addNewData = () => {
getDictList() getDictList();
visible.value = true visible.value = true;
} };
// //
const editData = (record) =>{ const editData = (record) => {
getDictList() getDictList();
visible.value = true visible.value = true;
fetch(energyConsumption.findById , {id : record.id }).then((res) => { fetch(energyConsumption.findById, { id: record.id }).then((res) => {
if(res.data.unitName){ if (res.data.unitName) {
res.data.unitName = res.data.unitName.split(',') res.data.unitName = res.data.unitName.split(',');
} }
formState.value = res.data formState.value = res.data;
}); });
}; };
// //
@ -555,7 +764,7 @@
okType: 'primary', okType: 'primary',
cancelText: '取消', cancelText: '取消',
onOk() { onOk() {
fetch(energyConsumption.del , {id : record.id }).then((res) => { fetch(energyConsumption.del, { id: record.id }).then((res) => {
message.success('操作成功!'); message.success('操作成功!');
mainRef.value?.nsTableRef.reload(); mainRef.value?.nsTableRef.reload();
}); });
@ -564,13 +773,14 @@
console.log('Cancel'); console.log('Cancel');
}, },
}); });
} };
// //
const onClose = () => { const onClose = () => {
visible.value = false; visible.value = false;
delIds.value = [];
formState.value = { formState.value = {
orgId: orgId.value, orgId: orgId.value,
} };
formRef.value.resetFields(); formRef.value.resetFields();
}; };
// //
@ -583,25 +793,113 @@
openUpload.value = false; openUpload.value = false;
}; };
// //
const fileList = ref([]); const fileList = ref<UploadProps['fileList']>([]);
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
return false;
};
const handleChange = (info: UploadChangeParam) => { const handleChange = (info: UploadChangeParam) => {
const status = info.file.status; fileList.value = [...info.fileList];
if (status !== 'uploading') { if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList); console.log(info.file, info.fileList);
} }
if (status === 'done') { if (info.file.status === 'done') {
message.success(`${info.file.name} 文件上传成功`); message.success(`${info.file.name} 文件上传成功`);
} else if (status === 'error') { } else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败`); message.error(`${info.file.name} 文件上传失败`);
} }
}; };
function handleDrop(e: DragEvent) { const delIds = ref([]);
console.log(e); 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; 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> </script>
<style scoped lang="less"> <style scoped lang="less">
:deep(.ant-table-title) { :deep(.ant-table-title) {
@ -610,7 +908,7 @@
:deep(.ant-table-container) { :deep(.ant-table-container) {
padding: 0px 16px; padding: 0px 16px;
} }
.buttonGroup{ .buttonGroup {
margin-left: 1vw; margin-left: 1vw;
width: 30vw; width: 30vw;
display: flex; display: flex;

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

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

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

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

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

@ -275,6 +275,7 @@
<a-tree-select <a-tree-select
v-model:value="editFormState.collectionNode" v-model:value="editFormState.collectionNode"
:tree-line="true" :tree-line="true"
@select="selectNode"
:tree-data="collectingNodes"> :tree-data="collectingNodes">
</a-tree-select> </a-tree-select>
</a-form-item> </a-form-item>
@ -290,6 +291,7 @@
<a-form-item ref="name" label="关键字" name="emissionFactors"> <a-form-item ref="name" label="关键字" name="emissionFactors">
<a-input-search <a-input-search
v-model:value="editFormState.emissionFactors" v-model:value="editFormState.emissionFactors"
@search="searchKey"
placeholder="请输入关键字" /> placeholder="请输入关键字" />
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -320,8 +322,9 @@
<a-upload <a-upload
v-model:file-list="fileList" v-model:file-list="fileList"
name="file" name="file"
action="https://www.mocky.io/v2/5cc8019d300000980a055e76" accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf"
:headers="headers" @remove="handleFileRemove"
:before-upload="beforeUpload"
@change="handleChange"> @change="handleChange">
<a-button> <a-button>
<upload-outlined></upload-outlined> <upload-outlined></upload-outlined>
@ -353,6 +356,7 @@
energyConsumption, energyConsumption,
carbonEmissionFactorLibrary, carbonEmissionFactorLibrary,
carbonInventoryCheck, carbonInventoryCheck,
uploadPic,
} from '/@/api/carbonEmissionFactorLibrary'; } from '/@/api/carbonEmissionFactorLibrary';
import { group } from '/@/api/deviceManage'; import { group } from '/@/api/deviceManage';
import { debug, log } from 'node:console'; import { debug, log } from 'node:console';
@ -844,6 +848,9 @@
// //
const openVoucher = ref(false); const openVoucher = ref(false);
const downLoadVoucher = () => { const downLoadVoucher = () => {
fetch(carbonInventoryCheck.voucherDownloadList, { bizType: 2 }).then((res) => {
voucherData.value = res.data;
});
openVoucher.value = true; openVoucher.value = true;
}; };
const selectedRowKeys = ref([]); const selectedRowKeys = ref([]);
@ -851,29 +858,7 @@
selectedRowKeys.value = selectedKeys; selectedRowKeys.value = selectedKeys;
}; };
const voucherData = [ const voucherData = ref([]);
{
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 onCloseVoucher = () => { const onCloseVoucher = () => {
openVoucher.value = false; openVoucher.value = false;
}; };
@ -909,6 +894,15 @@
editFormState.value.collectionNode = record.carbonSource; editFormState.value.collectionNode = record.carbonSource;
editFormState.value.factorId = record.factorId; editFormState.value.factorId = record.factorId;
selectedRowKeysEdit.value = [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; editData.value = true;
}; };
const getNewTable = () => { const getNewTable = () => {
@ -917,6 +911,10 @@
total.value = res.data.total; total.value = res.data.total;
}); });
}; };
const searchKey = () => {
queryData.value.emissionSources = editFormState.value.emissionFactors;
getNewTable();
};
// //
const canEdit = ref(false); const canEdit = ref(false);
const automatic = 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) => { const handleChange = (info: UploadChangeParam) => {
fileList.value = [...info.fileList];
if (info.file.status !== 'uploading') { if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList); console.log(info.file, info.fileList);
} }
if (info.file.status === 'done') { if (info.file.status === 'done') {
message.success(`${info.file.name} file uploaded successfully`); message.success(`${info.file.name} 文件上传成功`);
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
message.error(`${info.file.name} file upload failed.`); message.error(`${info.file.name} 文件上传失败`);
} }
}; };
const delIds = ref([]);
const fileList = ref([]); const handleFileRemove = (file) => {
const headers = { delIds.value.push(file.uid);
authorization: 'authorization-text', const newFileList = [];
fileList.value.forEach((item) => {
if (item.uid !== file.uid) {
newFileList.push(item);
}
});
fileList.value = newFileList;
}; };
// // ;
const submitEditData = () => { const submitEditData = () => {
editFormRef.value editFormRef.value
.validate() .validate()
@ -978,8 +990,33 @@
editFormState.value.collectionNode = editFormState.value.collectionNode.value; editFormState.value.collectionNode = editFormState.value.collectionNode.value;
} }
fetch(carbonInventoryCheck.updateTable, editFormState.value).then((res) => { fetch(carbonInventoryCheck.updateTable, editFormState.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', 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; editData.value = false;
delIds.value = [];
getPFYTableList(getTableId.value); getPFYTableList(getTableId.value);
}
}); });
}) })
.catch((error) => { .catch((error) => {
@ -988,6 +1025,7 @@
}; };
const onCloseEditData = () => { const onCloseEditData = () => {
editData.value = false; editData.value = false;
delIds.value = [];
editFormState.value = { editFormState.value = {
orgId: orgId.value, orgId: orgId.value,
}; };

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

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

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

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

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

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

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

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

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

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

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

@ -7,7 +7,7 @@
v-for="(item, index) in floorData" v-for="(item, index) in floorData"
:key="index" :key="index"
class="btn-item" class="btn-item"
:style="{ color: item.dataCode == thisFloor ? 'black' : 'white' }" :class="{ btnActive: item.dataCode == thisFloor }"
@click="changeFloor(item.childList, item.dataCode)" @click="changeFloor(item.childList, item.dataCode)"
>{{ item.name }}</button >{{ item.name }}</button
> >
@ -36,14 +36,6 @@
:visible="item.visible" /> :visible="item.visible" />
</div> </div>
</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 <a-drawer
v-model:visible="visible" v-model:visible="visible"
@ -56,6 +48,10 @@
id="drawer" id="drawer"
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }"> :maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }">
<a-tabs v-model:activeKey="activeKey"> <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="控制面板"> <a-tab-pane key="1" tab="控制面板">
<tabs1 <tabs1
ref="tabs1Ref" ref="tabs1Ref"

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

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

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

@ -1,12 +1,11 @@
<template> <template>
<a-spin :spinning="isLoading"> <!-- 空调区域 -->
<!-- 照明区域 -->
<div> <div>
<div class="light-area"> <div class="light-area">
<div class="light-area-tab"></div> <div class="light-area-tab"></div>
<span class="light-area-text">空调区域</span> <span class="light-area-text">空调区域</span>
</div> </div>
<!-- 照明区域按钮部分 --> <!-- 空调区域按钮部分 -->
<div class="area"> <div class="area">
<template v-if="!showAllButtonsArea"> <template v-if="!showAllButtonsArea">
<button <button
@ -40,12 +39,14 @@
<div class="circuit-tab"></div> <div class="circuit-tab"></div>
<span class="circuit-text">空调分组</span> <span class="circuit-text">空调分组</span>
<div class="btn2"> <div class="btn2">
<a-badge :offset="[-10, 2]" :count="lockList.length">
<button <button
class="openPlan" class="openPlan"
:class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }" :class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }"
@click="togglePlan2"> @click="togglePlan2">
{{ isPlanEnabled2 ? '启用开关' : '禁用开关' }} {{ isPlanEnabled2 ? '启用开关' : '禁用开关' }}
</button> </button>
</a-badge>
<a-switch <a-switch
v-model:checked="selectAllCheckbox" v-model:checked="selectAllCheckbox"
:disabled="singleSelection" :disabled="singleSelection"
@ -68,7 +69,9 @@
:class="{ btn: true, selected: button.selected }" :class="{ btn: true, selected: button.selected }"
class="zmhlbtn" class="zmhlbtn"
@click="changeLine(button)"> @click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" /> <div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }} {{ button.name }}
</button> </button>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
@ -82,7 +85,9 @@
:class="{ btn: true, selected: button.selected }" :class="{ btn: true, selected: button.selected }"
class="zmhlbtn" class="zmhlbtn"
@click="changeLine(button)"> @click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" /> <div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }} {{ button.name }}
</button> </button>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
@ -141,10 +146,7 @@
<button class="flushed">刷新</button> <button class="flushed">刷新</button>
</a-popconfirm> </a-popconfirm>
</a-badge> </a-badge>
<a-spin :spinning="buttonLoading">
<button class="execute" @click="showModal">执行</button> <button class="execute" @click="showModal">执行</button>
</a-spin>
</div> </div>
<!-- 点击执行时的弹出框 --> <!-- 点击执行时的弹出框 -->
@ -220,6 +222,28 @@
</span> </span>
</div> </div>
</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>
</div> </div>
@ -237,7 +261,6 @@
</a-popconfirm> </a-popconfirm>
</div> </div>
</div> </div>
</a-spin>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -304,48 +327,67 @@
emit('changeArea', button.id); emit('changeArea', button.id);
// - // -
resetMode(); resetMode();
// -
handleButton.value = '';
}; };
// 8 // 8
const limitedButtons1 = computed(() => props.treeData.slice(0, 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 = () => { const togglePlan2 = () => {
// // 线
if (handleButton.value == '') { let valid = buttons2.value.filter((item: any) => {
return message.info('请选择空调分组'); return item.selected;
} });
// // 线
const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value); if (valid.length == 0) {
let panel = +!btn.ctrlStatus; return message.info('请先选择线路');
isLoading.value = true; // 线
http } else {
.get(lightingManage.setDisable, { //
deviceGroup: btn.dataCode,
panel,
projectId: state.projectId,
siteId: state.siteId,
})
.then((res) => {
if (res.msg === 'success') {
// - - - loading
isPlanEnabled2.value = !isPlanEnabled2.value; isPlanEnabled2.value = !isPlanEnabled2.value;
btn.ctrlStatus = panel; //
isLoading.value = false; 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 { } else {
isLoading.value = false; lockList.value.push({
deviceGroup: item.dataCode,
deviceGroupName: item.name,
region: item.treePid,
regionName: '',
before: item.lockStatus,
lockStatus: after,
});
} }
}) //
.catch(() => { item.lockStatus = after;
isLoading.value = false;
}); });
}
}; };
// //
@ -399,8 +441,6 @@
}); });
// //
const changeLine = (button: any) => { const changeLine = (button: any) => {
// ID/
handleButton.value = button.id;
// / // /
if (button.ctrlStatus) { if (button.ctrlStatus) {
isPlanEnabled2.value = true; isPlanEnabled2.value = true;
@ -449,7 +489,7 @@
console.log(thisButton2, 'button'); console.log(thisButton2, 'button');
}; };
// //
const buttons2 = ref([]); const buttons2 = ref([]);
// //
const showAllButtons = ref(false); const showAllButtons = ref(false);
@ -612,9 +652,6 @@
// ====================================================================== // ======================================================================
const isLoading = ref(false);
// loading
const buttonLoading = ref(false);
// //
const refresh = (reload = false) => { const refresh = (reload = false) => {
// //
@ -631,6 +668,12 @@
}); });
} }
changeList.value = []; changeList.value = [];
if (!reload) {
lockList.value.forEach((item: any) => {
resetLockList(item);
});
}
lockList.value = [];
// //
let data = props.treeData[0]; let data = props.treeData[0];
// //
@ -640,6 +683,18 @@
// 线 // 线
resetMode(); 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) => { const resetChangeList = (item: any) => {
props.treeData.find((v: any) => { props.treeData.find((v: any) => {
@ -675,11 +730,10 @@
if (!changeList.value.length) { if (!changeList.value.length) {
return message.info('未产生任何修改'); return message.info('未产生任何修改');
} }
buttonLoading.value = true;
http http
.post(airConditionControl.getChangeList, { .post(airConditionControl.getChangeList, {
sceneList: changeList.value, sceneList: changeList.value,
lockList: [], lockList: lockList.value,
projectId: state.projectId, projectId: state.projectId,
siteId: state.siteId, siteId: state.siteId,
}) })
@ -690,11 +744,8 @@
} else { } else {
message.warning('获取修改内容失败'); message.warning('获取修改内容失败');
} }
buttonLoading.value = false;
}) })
.catch(() => { .catch(() => {});
buttonLoading.value = false;
});
}; };
// //
const changeCancel = () => {}; const changeCancel = () => {};
@ -714,17 +765,19 @@
obj.scene = obj.stateAfter.scene.value; obj.scene = obj.stateAfter.scene.value;
obj.before = obj.stateBefore.scene.value; obj.before = obj.stateBefore.scene.value;
resetChangeList(obj); resetChangeList(obj);
resetLockList(obj);
// changeList diffList () // changeList diffList ()
changeList.value = changeList.value.filter((item: any) => { changeList.value = changeList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup; return item.deviceGroup !== obj.deviceGroup;
}); });
lockList.value = lockList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
diffList.value = diffList.value.filter((item: any) => { diffList.value = diffList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup; 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; executeVisible.value = false;
} }
}; };
@ -733,7 +786,7 @@
http http
.post(airConditionControl.submitChangeList, { .post(airConditionControl.submitChangeList, {
sceneList: changeList.value, sceneList: changeList.value,
lockList: [], lockList: lockList.value,
projectId: state.projectId, projectId: state.projectId,
siteId: state.siteId, siteId: state.siteId,
}) })

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

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

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

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

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

@ -7,7 +7,7 @@
v-for="(item, index) in floorData" v-for="(item, index) in floorData"
:key="index" :key="index"
class="btn-item" class="btn-item"
:style="{ color: item.dataCode == thisFloor ? 'black' : 'white' }" :class="{ btnActive: item.dataCode == thisFloor }"
@click="changeFloor(item.childList, item.dataCode)" @click="changeFloor(item.childList, item.dataCode)"
>{{ item.name }}</button >{{ item.name }}</button
> >
@ -36,14 +36,6 @@
:visible="item.visible" /> :visible="item.visible" />
</div> </div>
</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 <a-drawer
v-model:visible="visible" v-model:visible="visible"
@ -55,13 +47,17 @@
:closable="false" :closable="false"
id="drawer" id="drawer"
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }"> :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-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板"> <a-tab-pane key="1" tab="控制面板">
<tabs1 <tabs1
ref="tabs1Ref" ref="tabs1Ref"
@changeArea="changeArea"
@reset="reset" @reset="reset"
@reload="reload" @reload="reload"
@changeArea="changeArea"
:treeData="treeData" /> :treeData="treeData" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render> <a-tab-pane key="2" tab="计划列表" force-render>
@ -77,6 +73,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { lightPosition } from './lightPosition';
// //
import light from './light.vue'; import light from './light.vue';
import tabs1 from './tabs1.vue'; import tabs1 from './tabs1.vue';
@ -289,7 +286,12 @@
siteId: state.siteId, siteId: state.siteId,
}) })
.then((res) => { .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(即俯视图小灯泡)的位置信息 // 此文件只定义light(即俯视图小灯泡)的位置信息
// 与显示状态和分组信息无关 // 与显示状态和分组信息无关
export const lightPosition = []; export const lightPosition = [
{ left: '180px', bottom: '200px' },
{ left: '180px', bottom: '230px' },
];

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

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

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

@ -1,5 +1,4 @@
<template> <template>
<a-spin :spinning="isLoading">
<!-- 照明区域 --> <!-- 照明区域 -->
<div> <div>
<div class="light-area"> <div class="light-area">
@ -40,12 +39,14 @@
<div class="circuit-tab"></div> <div class="circuit-tab"></div>
<span class="circuit-text">照明回路</span> <span class="circuit-text">照明回路</span>
<div class="btn2"> <div class="btn2">
<a-badge :offset="[-10, 2]" :count="lockList.length">
<button <button
class="openPlan" class="openPlan"
:class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }" :class="{ enabled2: isPlanEnabled2, disabled2: !isPlanEnabled2 }"
@click="togglePlan2"> @click="togglePlan2">
{{ isPlanEnabled2 ? '启用开关' : '禁用开关' }} {{ isPlanEnabled2 ? '启用开关' : '禁用开关' }}
</button> </button>
</a-badge>
<a-switch <a-switch
v-model:checked="selectAllCheckbox" v-model:checked="selectAllCheckbox"
:disabled="singleSelection" :disabled="singleSelection"
@ -68,7 +69,9 @@
:class="{ btn: true, selected: button.selected }" :class="{ btn: true, selected: button.selected }"
class="zmhlbtn" class="zmhlbtn"
@click="changeLine(button)"> @click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" /> <div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }} {{ button.name }}
</button> </button>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
@ -82,7 +85,9 @@
:class="{ btn: true, selected: button.selected }" :class="{ btn: true, selected: button.selected }"
class="zmhlbtn" class="zmhlbtn"
@click="changeLine(button)"> @click="changeLine(button)">
<stop-outlined v-if="button.ctrlStatus" /> <div v-if="button.lockStatus" class="btn-back">
<stop-outlined />
</div>
{{ button.name }} {{ button.name }}
</button> </button>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
@ -141,10 +146,7 @@
<button class="flushed">刷新</button> <button class="flushed">刷新</button>
</a-popconfirm> </a-popconfirm>
</a-badge> </a-badge>
<a-spin :spinning="buttonLoading">
<button class="execute" @click="showModal">执行</button> <button class="execute" @click="showModal">执行</button>
</a-spin>
</div> </div>
<!-- 点击执行时的弹出框 --> <!-- 点击执行时的弹出框 -->
@ -154,14 +156,14 @@
<div class="div-operation"></div> <div class="div-operation"></div>
<span class="text-operation">变更内容 </span> <span class="text-operation">变更内容 </span>
</div> </div>
<div class="j-box" v-for="(item, index) in diffList" :key="item.id"> <div class="j-box" v-for="item in diffList" :key="item.id">
<div class="journal" style="margin-top: 20px"> <div class="journal" style="margin-top: 20px">
<div class="imgText"> <div class="imgText">
<div class="zjzm"> <div class="zjzm">
<img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp; <img class="title-img" src="/asset/image//bulbLogo/21961.png" alt="" />&nbsp;
<span <span
class="title-text" class="title-text"
style="font-size: 20px; font-weight: 500; color: rgba(255, 255, 255, 1)" style="font-size: 18px; font-weight: 500; color: rgba(255, 255, 255, 1)"
>{{ item.regionName + ' > ' + item.deviceGroupName }}</span >{{ item.regionName + ' > ' + item.deviceGroupName }}</span
> >
</div> </div>
@ -180,8 +182,8 @@
<div class="right"> <div class="right">
<span>手动</span> <span>手动</span>
<img src="/asset/image/bulbLogo/22406.png" alt="" /> <img src="/asset/image/bulbLogo/22406.png" alt="" />
<span>自动</span> <span>自动</span></div
</div> >
</div> </div>
<div class="btn-item"> <div class="btn-item">
<div class="left"> 亮度 </div> <div class="left"> 亮度 </div>
@ -220,6 +222,28 @@
</span> </span>
</div> </div>
</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>
</div> </div>
@ -237,7 +261,6 @@
</a-popconfirm> </a-popconfirm>
</div> </div>
</div> </div>
</a-spin>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -303,48 +326,67 @@
emit('changeArea', button.id); emit('changeArea', button.id);
// - // -
resetMode(); resetMode();
// -
handleButton.value = '';
}; };
// 8 // 8
const limitedButtons1 = computed(() => props.treeData.slice(0, 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 = () => { const togglePlan2 = () => {
// // 线
if (handleButton.value == '') { let valid = buttons2.value.filter((item: any) => {
return message.info('请选择照明回路'); return item.selected;
} });
// // 线
const btn: any = buttons2.value.find((button: any) => button.id === handleButton.value); if (valid.length == 0) {
let panel = +!btn.ctrlStatus; return message.info('请先选择线路');
isLoading.value = true; // 线
http } else {
.get(lightingManage.setDisable, { //
deviceGroup: btn.dataCode,
panel,
projectId: state.projectId,
siteId: state.siteId,
})
.then((res) => {
if (res.msg === 'success') {
// - - - loading
isPlanEnabled2.value = !isPlanEnabled2.value; isPlanEnabled2.value = !isPlanEnabled2.value;
btn.ctrlStatus = panel; //
isLoading.value = false; 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 { } else {
isLoading.value = false; lockList.value.push({
deviceGroup: item.dataCode,
deviceGroupName: item.name,
region: item.treePid,
regionName: '',
before: item.lockStatus,
lockStatus: after,
});
} }
}) //
.catch(() => { item.lockStatus = after;
isLoading.value = false;
}); });
}
}; };
// //
@ -398,8 +440,6 @@
}); });
// //
const changeLine = (button: any) => { const changeLine = (button: any) => {
// ID/
handleButton.value = button.id;
// / // /
if (button.ctrlStatus) { if (button.ctrlStatus) {
isPlanEnabled2.value = true; isPlanEnabled2.value = true;
@ -611,9 +651,6 @@
// ====================================================================== // ======================================================================
const isLoading = ref(false);
// loading
const buttonLoading = ref(false);
// //
const refresh = (reload = false) => { const refresh = (reload = false) => {
// //
@ -630,6 +667,12 @@
}); });
} }
changeList.value = []; changeList.value = [];
if (!reload) {
lockList.value.forEach((item: any) => {
resetLockList(item);
});
}
lockList.value = [];
// //
let data = props.treeData[0]; let data = props.treeData[0];
// //
@ -638,7 +681,19 @@
buttons2.value = data.childList; buttons2.value = data.childList;
resetMode(); 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) => { const resetChangeList = (item: any) => {
props.treeData.find((v: any) => { props.treeData.find((v: any) => {
if (item.region == v.dataCode) { if (item.region == v.dataCode) {
@ -653,7 +708,7 @@
v3.executeStatus.value = 0; v3.executeStatus.value = 0;
} }
if (!item.before) { if (!item.before) {
console.log(item, '没有这个选项'); console.log(item, '没有这个选项---');
v3.executeStatus.value = 0; v3.executeStatus.value = 0;
} }
// //
@ -670,14 +725,13 @@
}; };
// //
const showModal = () => { const showModal = () => {
if (!changeList.value.length) { if (!changeList.value.length && !lockList.value.length) {
return message.info('未产生任何修改'); return message.info('未产生任何修改');
} }
buttonLoading.value = true;
http http
.post(lightingManage.getChangeList, { .post(lightingManage.getChangeList, {
sceneList: changeList.value, sceneList: changeList.value,
lockList: [], lockList: lockList.value,
projectId: state.projectId, projectId: state.projectId,
siteId: state.siteId, siteId: state.siteId,
}) })
@ -688,11 +742,8 @@
} else { } else {
message.warning('获取修改内容失败'); message.warning('获取修改内容失败');
} }
buttonLoading.value = false;
}) })
.catch(() => { .catch(() => {});
buttonLoading.value = false;
});
}; };
// //
const changeCancel = () => {}; const changeCancel = () => {};
@ -705,24 +756,26 @@
const changeList: any = ref([]); const changeList: any = ref([]);
// //
const diffList = ref([]); const diffList = ref([]);
// //
const delBtn = (obj: any) => { const delBtn = (obj: any) => {
console.log(obj, '当前选择的修改内容'); console.log(obj, '当前选择的修改内容');
// treeData // treeData
obj.scene = obj.stateAfter.scene.value; obj.scene = obj?.stateAfter?.scene?.value;
obj.before = obj.stateBefore.scene.value; obj.before = obj?.stateBefore?.scene?.value;
resetChangeList(obj); resetChangeList(obj);
// changeList diffList () resetLockList(obj);
// changeList lockList diffList ()
changeList.value = changeList.value.filter((item: any) => { changeList.value = changeList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup; return item.deviceGroup !== obj.deviceGroup;
}); });
lockList.value = lockList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup;
});
diffList.value = diffList.value.filter((item: any) => { diffList.value = diffList.value.filter((item: any) => {
return item.deviceGroup !== obj.deviceGroup; 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; executeVisible.value = false;
} }
}; };
@ -731,14 +784,15 @@
http http
.post(lightingManage.submitChangeList, { .post(lightingManage.submitChangeList, {
sceneList: changeList.value, sceneList: changeList.value,
lockList: [], lockList: lockList.value,
projectId: state.projectId, projectId: state.projectId,
siteId: state.siteId, siteId: state.siteId,
}) })
.then(() => { .then(() => {
emit('reload'); emit('reload');
refresh(true); refresh(true);
}); })
.catch(() => {});
}; };
// ======================================================================== // ========================================================================

7
lib/util/xlsx-util.ts

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

Loading…
Cancel
Save