From 5f1afc77e9b8bd6829419dec25141bf44e7e65df Mon Sep 17 00:00:00 2001
From: XaoLi717 <144221124+XaoLi717@users.noreply.github.com>
Date: Sat, 14 Sep 2024 10:04:37 +0800
Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=94=B6=E9=9B=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/home/datainfo/index.ts | 56 +++++
src/views/Home/Index.vue | 74 ++++--
src/views/Home/datainfo/DataInfoForm.vue | 238 +++++++++++++++++++
src/views/Home/datainfo/index.vue | 290 +++++++++++++++++++++++
4 files changed, 640 insertions(+), 18 deletions(-)
create mode 100644 src/api/home/datainfo/index.ts
create mode 100644 src/views/Home/datainfo/DataInfoForm.vue
create mode 100644 src/views/Home/datainfo/index.vue
diff --git a/src/api/home/datainfo/index.ts b/src/api/home/datainfo/index.ts
new file mode 100644
index 0000000..645b00a
--- /dev/null
+++ b/src/api/home/datainfo/index.ts
@@ -0,0 +1,56 @@
+import request from '@/config/axios'
+
+// 首页数据统计 VO
+export interface DataInfoVO {
+ infoYear: Date // 数据收集时间
+ infoCo2e: number // 碳排放总量
+ infoWater: number // 总用水量
+ infoCastoff: number // 废弃物总量
+ infoCoai: number // 能源使用总量
+ infoPollution: number // 污染物总量
+ infoEcom: number // 环保投入
+ infoStaff: number // 员工总数
+ infoTraining: number // 员工培训费用
+ infoRd: number // 研发费用
+ infoProbono: number // 公益投入金额
+ infoInsurance: number // 社会保险覆盖率
+ infoViolate: number // 违规经营次数
+ infoGuarantee: number // 对外担保金额
+ infoMoney: number // 现金分红总额
+ infoEnvironment: number // 环境评分
+ infoSociety: number // 社会评分
+ infoGovern: number // 治理评分
+}
+
+// 首页数据统计 API
+export const DataInfoApi = {
+ // 查询首页数据统计分页
+ getDataInfoPage: async (params: any) => {
+ return await request.get({ url: `/home/data-info/page`, params })
+ },
+
+ // 查询首页数据统计详情
+ getDataInfo: async (id: number) => {
+ return await request.get({ url: `/home/data-info/get?id=` + id })
+ },
+
+ // 新增首页数据统计
+ createDataInfo: async (data: DataInfoVO) => {
+ return await request.post({ url: `/home/data-info/create`, data })
+ },
+
+ // 修改首页数据统计
+ updateDataInfo: async (data: DataInfoVO) => {
+ return await request.put({ url: `/home/data-info/update`, data })
+ },
+
+ // 删除首页数据统计
+ deleteDataInfo: async (id: number) => {
+ return await request.delete({ url: `/home/data-info/delete?id=` + id })
+ },
+
+ // 导出首页数据统计 Excel
+ exportDataInfo: async (params) => {
+ return await request.download({ url: `/home/data-info/export-excel`, params })
+ },
+}
\ No newline at end of file
diff --git a/src/views/Home/Index.vue b/src/views/Home/Index.vue
index 0a5dea9..b43c9a6 100644
--- a/src/views/Home/Index.vue
+++ b/src/views/Home/Index.vue
@@ -124,22 +124,22 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
@@ -295,6 +295,7 @@ import { useUserStore } from '@/store/modules/user'
// import { useWatermark } from '@/hooks/web/useWatermark'
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
import { pieOptions, barOptions } from './echarts-data'
+import {DataInfoApi, DataInfoVO} from "@/api/home/datainfo";
defineOptions({ name: 'Home' })
@@ -303,8 +304,11 @@ const { t } = useI18n()
const userStore = useUserStore()
// const { setWatermark } = useWatermark()
const loading = ref(true)
+const list = ref([]) // 列表的数据
+const total = ref(0) // 列表的总页数
const avatar = userStore.getUser.avatar
const username = userStore.getUser.nickname
+const allData = ref({});
const pieOptionsData = reactive(pieOptions) as EChartsOption
// 获取统计数
let totalSate = reactive({
@@ -337,14 +341,43 @@ const pjList = [
{pjEtime: '2002-03-10',pjName: '优化产线',pjType: '环境',pjDept: '技术部',pjNumber: 778899},
{pjEtime: '2005-05-20',pjName: '保护环境',pjType: '社会',pjDept: '艺术部',pjNumber: 998877},
]
-const dataList = [
- {name: '碳排放',infoCo2e: 543672300,dAn: '吨', time: '2024-07-05',color: '#e6eae3'},
- {name: '用水量',infoCo2e: 543672300,dAn: '吨', time: '2024-07-05',color: '#ecf5ff'},
- {name: '环保投入',infoCo2e: 543672300,dAn: '万元', time: '2024-07-05',color: '#f0f9eb'},
- {name: '技能培训',infoCo2e: 543672300,dAn: '人', time: '2024-07-05',color: '#fef0f0'},
- {name: '污染物质',infoCo2e: 543672300,dAn: '吨', time: '2024-07-05',color: '#c0c4cc'},
- {name: '研发费用',infoCo2e: 543672300,dAn: '万元', time: '2024-07-05',color: '#fdf6ec'}
-]
+const dataList = computed(() => [
+ { name: '碳排放', infoCo2e: allData.value.infoCo2e, dAn: '吨', time: '2024-07-05', color: '#e6eae3' },
+ { name: '用水量', infoCo2e: allData.value.infoWater, dAn: '吨', time: '2024-07-05', color: '#ecf5ff' },
+ { name: '环保投入', infoCo2e: allData.value.infoEcom, dAn: '万元', time: '2024-07-05', color: '#f0f9eb' },
+ { name: '技能培训', infoCo2e: allData.value.infoTraining, dAn: '人', time: '2024-07-05', color: '#fef0f0' },
+ { name: '污染物质', infoCo2e: allData.value.infoPollution, dAn: '吨', time: '2024-07-05', color: '#c0c4cc' },
+ { name: '研发费用', infoCo2e: allData.value.infoRd, dAn: '万元', time: '2024-07-05', color: '#fdf6ec' }
+]);
+/** 查询列表 */
+const getList = async () => {
+ loading.value = true
+ try {
+ const data = await DataInfoApi.getDataInfoPage(queryParams)
+ allData.value=data.list[0]
+ // await getAllData()
+ list.value = data.list
+ total.value = data.total
+ } finally {
+ loading.value = false
+ }
+}
+const queryParams = reactive({
+ pageNo: 1,
+ pageSize: 1,
+ infoYear: undefined,
+ infoYear: [],
+ infoCo2e: undefined,
+ infoWater: undefined,
+ infoPollution: undefined,
+ infoEcom: undefined,
+ infoTraining: undefined,
+ infoRd: undefined,
+ infoEnvironment: undefined,
+ infoSociety: undefined,
+ infoGovern: undefined,
+ createTime: [],
+})
const getCount = async () => {
const data = {
project: 40,
@@ -540,6 +573,11 @@ const getAllApi = async () => {
}
getAllApi()
+
+/** 初始化 **/
+onMounted(() => {
+ getList()
+})