diff --git a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts index 2f9c803..df67ea8 100644 --- a/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts +++ b/hx-ai-intelligent/src/api/carbonEmissionFactorLibrary.ts @@ -49,6 +49,7 @@ export enum carbonInventoryCheck { createOrUpdate = '/carbon-smart/api/carbon/report/createOrUpdate', findById = '/carbon-smart/api/carbon/report/findById', delete = '/carbon-smart/api/carbon/report/delete', + downloadZip = '/carbon-smart/api/carbon/report/downloadZip', // 填报页面接口 // 最左侧碳盘查报告树 getCategoryTree = '/carbon-smart/api/carbon/inventory/contact/getCategoryTree', @@ -77,6 +78,8 @@ export enum carbonAssets { createOrUpdate = '/carbon-smart/api/carbon/trade/details/createOrUpdate', delete = '/carbon-smart/api/carbon/trade/details/delete', quotaStatistics = '/carbon-smart/api/carbon/trade/details/quotaStatistics', + import = '/carbon-smart/api/carbon/trade/details/import', + export = '/carbon-smart/api/carbon/trade/details/export', } // 上传图片接口 export enum uploadPic { diff --git a/hx-ai-intelligent/src/api/monitor.ts b/hx-ai-intelligent/src/api/monitor.ts index 7681b71..e4076b1 100644 --- a/hx-ai-intelligent/src/api/monitor.ts +++ b/hx-ai-intelligent/src/api/monitor.ts @@ -1,7 +1,7 @@ // 设备监测 export enum deviceMonitor { getDeviceGraph = '/carbon-smart/api/monitor/getDeviceGraph', - getDevicePointToMonitor = '/carbon-smart//api/monitor/getDevicePointToMonitor', + getDevicePointToMonitor = '/carbon-smart/api/monitor/getDevicePointToMonitor', } // 能耗监测 diff --git a/hx-ai-intelligent/src/icon/xianshiqi.svg b/hx-ai-intelligent/src/icon/xianshiqi.svg new file mode 100644 index 0000000..64cd691 --- /dev/null +++ b/hx-ai-intelligent/src/icon/xianshiqi.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/hx-ai-intelligent/src/icon/xiazai.svg b/hx-ai-intelligent/src/icon/xiazai.svg index 738f4a4..f77ac5b 100644 --- a/hx-ai-intelligent/src/icon/xiazai.svg +++ b/hx-ai-intelligent/src/icon/xiazai.svg @@ -1 +1,10 @@ - \ No newline at end of file + + + + + + + + + + diff --git a/hx-ai-intelligent/src/icon/zongheshuju.svg b/hx-ai-intelligent/src/icon/zongheshuju.svg new file mode 100644 index 0000000..abf6ff9 --- /dev/null +++ b/hx-ai-intelligent/src/icon/zongheshuju.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + 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 c99a2f6..2509768 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonAssets/carbonAssetsDetail/index.vue @@ -51,10 +51,17 @@
交易明细
-
+
新增 - 导入 - 导出 + + 导入 + + 导出 { - return http.post(api, params); + const fetch = (api, params = { orgId }, config) => { + return http.post(api, params, config); }; // 详情部分变量 const selectedRowKeys = ref([]); @@ -400,6 +407,52 @@ visible.value = true; getDictList(); }; + const importFileList = ref([]); + const importFile = (options: UploadRequestOption) => { + const { file, onSuccess, onError } = options; + const formData = ref(new FormData()); + formData.value.append('file', file as any); + formData.value.append('orgId', orgId.value); + formData.value.append('year', queryParams.value.year); + fetch(carbonAssets.import, formData.value) + .then((res) => { + message.success('操作成功!'); + getDetailList(); + }) + .catch((error) => { + console.log('error', error); + }); + }; + const exportFile = () => { + const exportQuery = ref({ + orgId: orgId.value, + pageNum: 1, + pageSize: 999, + year: queryParams.value.year, + ids: selectedRowKeys.value, + }); + const config = { + responseType: 'blob', + }; + fetch(carbonAssets.export, exportQuery.value, config) + .then((res) => { + // 创建一个 URL 对象,指向图片数据的 blob + const url = window.URL.createObjectURL(new Blob([res])); + // 创建一个 标签,用于触发下载 + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', 'carbonTradeDetails.xlsx'); // 设置下载的文件名 + document.body.appendChild(link); + link.click(); + + // 清理 URL 对象 + window.URL.revokeObjectURL(url); + selectedRowKeys.value = [] + }) + .catch((error) => { + console.error('下载失败:', error); + }); + }; // 上传附件 const fileList = ref([]); const beforeUpload: UploadProps['beforeUpload'] = (file) => { diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue index f2f6914..c310738 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionFactorLibrary/index.vue @@ -429,7 +429,7 @@ }; // 点击数据点的复选框 const checkedIds = ref([]); - const emissionType = ref(); + const emissionList = ref([]); const checkTreeNode = (checkedKeys, info) => { checkedTreeNodeKeys.value = checkedKeys; checkedIds.value = []; @@ -437,7 +437,7 @@ checkedIds.value.push(item.id); }); sessionStorage.setItem('checkedTreeNode', checkedIds.value); - emissionType.value = checkedIds.value.join(','); + emissionList.value = checkedIds.value; mainRef.value?.nsTableRef.reload(); }; // 点击新增树节点 @@ -522,7 +522,7 @@ getDefaultIds(items.children); } }); - emissionType.value = defaultIds.value.join(','); + emissionList.value = defaultIds.value.join(','); checkedIds.value = defaultIds.value; sessionStorage.setItem('checkedTreeNode', checkedIds.value); }; @@ -609,7 +609,7 @@ api: carbonEmissionFactorLibrary.getTableList, params: { orgId, - emissionType, + emissionList, }, headerActions: [ { @@ -661,10 +661,12 @@ label: '导出', type: 'primary', handle: () => { + // console.log( mainRef.value.nsTableRef.tableState.selectedRowKeys) const exportQuery = { orgId: orgId.value, pageNum: 1, pageSize: 999, + ids: mainRef.value.nsTableRef.tableState.selectedRowKeys, }; const config = { responseType: 'blob', @@ -682,6 +684,7 @@ // 清理 URL 对象 window.URL.revokeObjectURL(url); + mainRef.value.nsTableRef.tableState.selectedRowKeys = []; }) .catch((error) => { console.error('下载失败:', error); diff --git a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index copy.vue b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index copy.vue deleted file mode 100644 index 715b3e8..0000000 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index copy.vue +++ /dev/null @@ -1,952 +0,0 @@ - - - - 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 fe3cb14..0038a2c 100644 --- a/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue +++ b/hx-ai-intelligent/src/view/carbonEmissionManage/carbonEmissionStatistics/energyConsumption/index.vue @@ -210,22 +210,33 @@ -
凭证上传
+
+
凭证上传
+
- + - 上传 + 上传凭证 -
+
1.仅支持pdf格式文件或文件夹 2.文件名命名规则为【能源种类_年份】 + 3.每次上传自动覆盖