From bc9f9097d1da4d431fdfe670d77521fd705baf53 Mon Sep 17 00:00:00 2001
From: suerwei <18810552194@163.com>
Date: 星期二, 28 五月 2024 17:07:40 +0800
Subject: [PATCH] 首页,详情页,统计出入库

---
 javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/TubLogController.java            |    6 
 javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/ITubLogService.java                 |    2 
 javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/impl/TubLogServiceImpl.java         |    4 
 javaweb-plus/javaweb-admin/src/main/java/com/javaweb/web/controller/system/SysIndexController.java |    2 
 javaweb-plus/javaweb-admin/src/main/resources/templates/index.html                                 |    2 
 javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/info.html                        |  129 ++++++++++++++++++++++++-
 javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml                            |   18 +++
 javaweb-plus/javaweb-admin/src/main/resources/templates/main.html                                  |   89 ++++++++++++++---
 javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/mapper/TubLogMapper.java                    |    2 
 9 files changed, 222 insertions(+), 32 deletions(-)

diff --git a/javaweb-plus/javaweb-admin/src/main/java/com/javaweb/web/controller/system/SysIndexController.java b/javaweb-plus/javaweb-admin/src/main/java/com/javaweb/web/controller/system/SysIndexController.java
index 865861d..8dcf4a5 100644
--- a/javaweb-plus/javaweb-admin/src/main/java/com/javaweb/web/controller/system/SysIndexController.java
+++ b/javaweb-plus/javaweb-admin/src/main/java/com/javaweb/web/controller/system/SysIndexController.java
@@ -252,7 +252,7 @@
     @GetMapping("/system/tubLogData")
     public AjaxResult tubLogData() {
         AjaxResult ajaxResult = new AjaxResult();
-        List<TubLog> tubLogs = tubLogMapper.countTubLogDate();
+        List<TubLog> tubLogs = tubLogMapper.countTubLogDate(null);
         ajaxResult.put("tubLogs",tubLogs);
         return  ajaxResult;
     }
diff --git a/javaweb-plus/javaweb-admin/src/main/resources/templates/index.html b/javaweb-plus/javaweb-admin/src/main/resources/templates/index.html
index 6b0a52d..f5fbced 100644
--- a/javaweb-plus/javaweb-admin/src/main/resources/templates/index.html
+++ b/javaweb-plus/javaweb-admin/src/main/resources/templates/index.html
@@ -231,7 +231,7 @@
                     th:src="@{/system/main}" frameborder="0" seamless></iframe>
         </div>
         <div class="footer">
-            <div class="pull-right">Copyright 漏 2022.宸ョ▼鍕樺療鍦拌川淇℃伅鏌ヨ鏈嶅姟骞冲彴 All Rights Reserved. Powered by. 浜琁CP澶�</div>
+            <div class="pull-right">Copyright 漏 2024.閽绘帰宸ョ▼淇℃伅鍖栫郴缁� All Rights Reserved. Powered by. 浜琁CP澶�</div>
         </div>
     </div>
     <!--鍙充晶閮ㄥ垎缁撴潫-->
diff --git a/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html b/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
index 2ab0029..ff5859c 100644
--- a/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
+++ b/javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
@@ -263,26 +263,29 @@
 					<div style="height: 200px;width: 100%;">
 						<h3>鏉愭枡缁熻</h3>
 						<el-col :span="10" style="height: 200px;">
-							<template>
-								<el-table :data="tubLogs" border size="small" style="width: 100%"
-										  :header-cell-style="{color: '#4D4D4D',background: '#F7931E',fontWeight: '400'}"
-										  :row-class-name="tableRowClassName">
-<!--									<el-table-column prop="code" label="搴忓彿"></el-table-column>-->
-									<el-table-column prop="tubName" label="鍚嶇О"></el-table-column>
-									<el-table-column prop="inboundNumber" label="鍏ュ簱鏁伴噺"></el-table-column>
-									<el-table-column prop="outboundNumber" label="鍑哄簱鏁伴噺"></el-table-column>
-									<el-table-column prop="unit" label="鍗曚綅"></el-table-column>
+							<div style="margin-top: 15px">
+								<template>
+									<el-table :data="tubLogs" border size="small" style="width: 100%"
+											  :header-cell-style="{color: '#4D4D4D',background: '#F7931E',fontWeight: '400'}"
+											  :row-class-name="tableRowClassName">
+										<!--									<el-table-column prop="code" label="搴忓彿"></el-table-column>-->
+										<el-table-column prop="tubName" label="鍚嶇О"></el-table-column>
+										<el-table-column prop="inboundNumber" label="鍏ュ簱鏁伴噺"></el-table-column>
+										<el-table-column prop="outboundNumber" label="鍑哄簱鏁伴噺"></el-table-column>
+										<el-table-column prop="unit" label="鍗曚綅"></el-table-column>
 
-								</el-table>
-							</template>
+									</el-table>
+								</template>
+							</div>
 						</el-col>
 						<el-col :span="14" style="height: 200px;">
+							<div id="column-chart" style="height: 180px; width: 100%;"></div>
 						</el-col>
 					</div>
 				</el-card>
 
 				<el-card class="box-card" style="margin-top: 20px;">
-					<div id="map_div" style="width: 100%;height: 550px;"></div>
+					<div id="map_div" style="width: 100%;height: 550px;margin-top: -5px"></div>
 				</el-card>
 
 			</el-col>
@@ -370,13 +373,71 @@
 	}
 
 	function tubLogs() {
+		const chart = echarts.init(document.getElementById("column-chart"));
+		const option = {
+			tooltip: {
+				trigger: 'axis',
+				axisPointer: {
+					type: 'shadow'
+				}
+			},
+			legend: {},
+			grid: {
+				left: '3%',
+				right: '4%',
+				bottom: '3%',
+				containLabel: true
+			},
+			xAxis: [
+				{
+					type: 'category',
+					data: []
+				}
+			],
+			yAxis: [
+				{
+					type: 'value'
+				}
+			],
+			series: [
+				{
+					name: '鍑哄簱',
+					type: 'bar',
+					emphasis: {
+						focus: 'series'
+					},
+					data: []
+				},
+				{
+					name: '鍏ュ簱',
+					type: 'bar',
+					stack: 'Ad',
+					emphasis: {
+						focus: 'series'
+					},
+					data: []
+				},
+
+			]
+		};
+
 		let url = ctx + "/system/tubLogData";
 		$.ajaxSettings.async = false;
 		$.get(url,{},function(res){
 			vm.tubLogs = res.tubLogs;
+
+			res.tubLogs.forEach(function(value, index, array) {
+				const tubName = value.tubName;
+				const inboundNumber = value.inboundNumber;
+				const outboundNumber = value.outboundNumber;
+				const unit = value.unit;
+				option.xAxis[0].data[index] = tubName;
+				option.series[0].data[index] = outboundNumber;
+				option.series[1].data[index] = inboundNumber;
+			});
+			chart.setOption(option, true);
 		})
 		$.ajaxSettings.async = false;
-		console.log(vm.tubLogs);
 	}
 
 	//棣栭〉绗竴琛屼釜鏁扮粺璁�
@@ -397,8 +458,6 @@
 			vm.stationProcessData = res.projectData;
 		})
 		$.ajaxSettings.async = false;
-		console.log(vm.stationProcessData);
-
 	}
 	var vm = new Vue({
 		el: "#app",
diff --git a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/TubLogController.java b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/TubLogController.java
index 2ae93e6..6695b35 100644
--- a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/TubLogController.java
+++ b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/controller/TubLogController.java
@@ -141,10 +141,10 @@
     /**
      * 缁熻
      */
-    @GetMapping("/countTubLogDate")
+    @GetMapping("/countTubLogDate/{projectId}")
     @ResponseBody
-    public AjaxResult countTubLogDate() {
-        return tubLogService.countTubLogDate();
+    public AjaxResult countTubLogDate(@PathVariable("projectId") String projectId) {
+        return tubLogService.countTubLogDate(projectId);
     }
 
 }
diff --git a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/mapper/TubLogMapper.java b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/mapper/TubLogMapper.java
index 2aa702e..8f33224 100644
--- a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/mapper/TubLogMapper.java
+++ b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/mapper/TubLogMapper.java
@@ -70,5 +70,5 @@
     /**
      * 缁熻
      */
-    List<TubLog> countTubLogDate();
+    List<TubLog> countTubLogDate(@Param("projectId") String projectId);
 }
diff --git a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/ITubLogService.java b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/ITubLogService.java
index 3a51560..dd8a9ef 100644
--- a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/ITubLogService.java
+++ b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/ITubLogService.java
@@ -76,5 +76,5 @@
     /**
      * 缁熻
      */
-    AjaxResult countTubLogDate();
+    AjaxResult countTubLogDate(String projectId);
 }
diff --git a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/impl/TubLogServiceImpl.java b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/impl/TubLogServiceImpl.java
index 9d153f2..f7de5ef 100644
--- a/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/impl/TubLogServiceImpl.java
+++ b/javaweb-plus/javaweb-cms/src/main/java/com/javaweb/geo/service/impl/TubLogServiceImpl.java
@@ -111,8 +111,8 @@
      * 缁熻
      */
     @Override
-    public AjaxResult countTubLogDate() {
-        List<TubLog> list = tubLogMapper.countTubLogDate();
+    public AjaxResult countTubLogDate(String projectId) {
+        List<TubLog> list = tubLogMapper.countTubLogDate(projectId);
         return AjaxResult.success("鏌ヨ鎴愬姛锛�",list);
     }
 
diff --git a/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml b/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml
index 7410116..650f94b 100644
--- a/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml
+++ b/javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml
@@ -52,7 +52,7 @@
         SELECT MAX(id) FROM js_tub_log where project_id = #{projectId}
     </select>
 
-    <select id="countTubLogDate" resultMap="TubLogResult">
+    <select id="countTubLogDate2" resultMap="TubLogResult">
         SELECT
             a.tub_name,
             b.inbound_number,
@@ -63,6 +63,22 @@
             LEFT JOIN ( SELECT tub_name, SUM( number ) AS inbound_number, unit FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name
     </select>
 
+    <select id="countTubLogDate" resultMap="TubLogResult">
+       SELECT
+            a.project_id,
+            a.tub_name,
+            b.inbound_number,
+            a.outbound_number,
+            a.unit
+        FROM
+            ( SELECT project_id, tub_name, SUM( number ) AS outbound_number, unit FROM js_tub_log WHERE outbound_date IS NOT NULL GROUP BY tub_name ) a
+            LEFT JOIN ( SELECT project_id, tub_name, SUM( number ) AS inbound_number, unit FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name
+            AND a.project_id = b.project_id
+        <where>
+            <if test="projectId != null and projectId != ''"> and a.project_id = #{projectId}</if>
+        </where>
+    </select>
+
     <insert id="insertTubLog" parameterType="TubLog" useGeneratedKeys="true" keyProperty="id">
         insert into js_tub_log
         <trim prefix="(" suffix=")" suffixOverrides=",">
diff --git a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/info.html b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/info.html
index 180fb5e..67711b1 100644
--- a/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/info.html
+++ b/javaweb-plus/javaweb-cms/src/main/resources/templates/geo/project/info.html
@@ -157,11 +157,49 @@
         </el-row>
         <el-row style="height: 200px;">
             <el-col :span="24">
-                <el-card class="box-card  card-green" style="height: 320px;margin-top: 20px">
-                    <div slot="header" class="clearfix">
-                        <span>鏉愭枡淇℃伅</span>
-                    </div>
+
+                <el-card class="box-card  card-green"  style="height: 320px;margin-top: 20px">
+                        <div slot="header" class="clearfix">
+                            <span>鏉愭枡缁熻</span>
+                        </div>
+                        <el-col :span="10" style="height: 320px;">
+                            <template>
+                                <el-table :data="tubLogs" border size="small" style="width: 100%"
+                                          :header-cell-style="{color: '#4D4D4D',background: '#F7931E',fontWeight: '400'}"
+                                          :row-class-name="tableRowClassName">
+                                    <el-table-column prop="tubName" label="鍚嶇О"></el-table-column>
+                                    <el-table-column prop="inboundNumber" label="鍏ュ簱鏁伴噺"></el-table-column>
+                                    <el-table-column prop="outboundNumber" label="鍑哄簱鏁伴噺"></el-table-column>
+                                    <el-table-column prop="unit" label="鍗曚綅"></el-table-column>
+                                </el-table>
+                            </template>
+                        </el-col>
+                        <el-col :span="14" style="height: 320px;">
+                            <div id="column-chart" style="height: 250px; width: 100%;"></div>
+                        </el-col>
                 </el-card>
+<!--                <el-card class="box-card  card-green" style="height: 320px;margin-top: 20px">-->
+<!--                    <div slot="header" class="clearfix">-->
+<!--                        <span>鏉愭枡淇℃伅</span>-->
+<!--                    </div>-->
+<!--                    <div>-->
+<!--                        <template>-->
+<!--                            <el-table :data="tubLogs" border size="small" style="width: 100%"-->
+<!--                                      :header-cell-style="{color: '#4D4D4D',background: '#F7931E',fontWeight: '400'}"-->
+<!--                                      :row-class-name="tableRowClassName">-->
+<!--                                &lt;!&ndash;									<el-table-column prop="code" label="搴忓彿"></el-table-column>&ndash;&gt;-->
+<!--                                <el-table-column prop="tubName" label="鍚嶇О"></el-table-column>-->
+<!--                                <el-table-column prop="inboundNumber" label="鍏ュ簱鏁伴噺"></el-table-column>-->
+<!--                                <el-table-column prop="outboundNumber" label="鍑哄簱鏁伴噺"></el-table-column>-->
+<!--                                <el-table-column prop="unit" label="鍗曚綅"></el-table-column>-->
+
+<!--                            </el-table>-->
+<!--                        </template>-->
+<!--                    </div>-->
+<!--                </el-card>-->
+
+
+
             </el-col>
 
         </el-row>
@@ -169,12 +207,14 @@
 
 
     <th:block th:include="include :: footer" />
+    <script th:src="@{/ajax/libs/report/echarts/echarts-all.js}"></script>
 
    <script th:inline="javascript">
         var project =[[${project}]];
         var projectId=[[${projectId}]];
         var statusDatas = [[${@dict.getType('hole_status')}]];
         var prefix = ctx + "geo/hole";
+        var prefix2 = ctx + "geo/TubLog";
 
         $(function() {
             var url = prefix + "/holelist?projectId=" + projectId;
@@ -183,10 +223,77 @@
                 vm.holeData = res.data;
             });
             vm.project = project;
-
-            console.log(vm.project);
-            console.log(vm.holeData);
+            tubLogs();
         });
+
+        function tubLogs() {
+            const chart = echarts.init(document.getElementById("column-chart"));
+            const option = {
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'shadow'
+                    }
+                },
+                legend: {},
+                grid: {
+                    left: '3%',
+                    right: '4%',
+                    bottom: '3%',
+                    containLabel: true
+                },
+                xAxis: [
+                    {
+                        type: 'category',
+                        data: []
+                    }
+                ],
+                yAxis: [
+                    {
+                        type: 'value'
+                    }
+                ],
+                series: [
+                    {
+                        name: '鍑哄簱',
+                        type: 'bar',
+                        emphasis: {
+                            focus: 'series'
+                        },
+                        data: []
+                    },
+                    {
+                        name: '鍏ュ簱',
+                        type: 'bar',
+                        stack: 'Ad',
+                        emphasis: {
+                            focus: 'series'
+                        },
+                        data: []
+                    },
+
+                ]
+            };
+
+            let url = prefix2 + "/countTubLogDate/" + projectId;
+            $.ajaxSettings.async = false;
+            $.get(url,{},function(res){
+                vm.tubLogs = res.data;
+
+                res.data.forEach(function(value, index, array) {
+                    const tubName = value.tubName;
+                    const inboundNumber = value.inboundNumber;
+                    const outboundNumber = value.outboundNumber;
+                    const unit = value.unit;
+                    option.xAxis[0].data[index] = tubName;
+                    option.series[0].data[index] = outboundNumber;
+                    option.series[1].data[index] = inboundNumber;
+                });
+                chart.setOption(option, true);
+
+            })
+            $.ajaxSettings.async = false;
+        }
 
         var vm = new Vue({
             el: "#app",
@@ -194,9 +301,17 @@
                 return {
                     project: "",
                     holeData: [],
+                    tubLogs:[],
                 };
             },
             methods: {
+                tableRowClassName({ row, rowIndex }) {
+                    if (rowIndex % 2 == 0) {
+                        return "";
+                    } else {
+                        return "warning-row";
+                    }
+                },
             }
         });
 

--
Gitblit v1.9.1