diff --git a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts index c9b0f97..2fbfe1b 100644 --- a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts +++ b/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', } diff --git a/hx-ai-intelligent/src/router/carbonEmissionManage.ts b/hx-ai-intelligent/src/router/carbonEmissionManage.ts index 9adcfc0..b0034fa 100644 --- a/hx-ai-intelligent/src/router/carbonEmissionManage.ts +++ b/hx-ai-intelligent/src/router/carbonEmissionManage.ts @@ -40,6 +40,9 @@ const equipment = { meta: { title: '碳排因子库', keepAlive: false, + operates: [ + { title: '碳排因子库导入', code: 'carbonEmissionFactorLibraryImport' }, + ], // backApi: [], }, }, diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue index 1a63a0c..c99a2f6 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue +++ b/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, // 文件的URL,这里假设用示例的URL格式 })); }); @@ -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(); diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue index ba32d72..9be85b4 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue @@ -62,9 +62,17 @@ 编辑 新增子节点 - 上移 - 下移 - 删除 + 上移 + 下移 + 删除 @@ -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(false); const operationTree = ref('新增'); - 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'); }, }); diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue index 210669c..3b2bc53 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue @@ -27,7 +27,11 @@ --> - + - - + + + +
+ + + + +
\ No newline at end of file + diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue index f49bd40..a39353a 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/quickCalculation/index.vue @@ -102,7 +102,7 @@ - + @@ -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]; diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/config.ts b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/config.ts index f396774..3574b58 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/config.ts +++ b/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, }, ]; diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue index 151d401..c85cfb3 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/fillInPage/index.vue @@ -275,6 +275,7 @@ @@ -290,6 +291,7 @@ @@ -320,8 +322,9 @@ @@ -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, // 文件的URL,这里假设用示例的URL格式 + })); + }); 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([]); + 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, }; diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue index ef39680..a8e3dd6 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonInventoryCheck/index.vue @@ -5,7 +5,12 @@
- +
年度 月度 @@ -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 = { reportName: [{ required: true, message: '请输入报告名称', trigger: 'change' }], diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue index 234403e..05e7b7c 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonPlanning/category/categoryDeatil.vue @@ -74,9 +74,7 @@
- - 批量设置 - + 批量设置 基准值设置 @@ -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"> -