From 7435b78aa64bb9fdfdc8e89787a0b88ef54ac8ef Mon Sep 17 00:00:00 2001
From: 李宇 <986321569@qq.com>
Date: 星期五, 29 一月 2021 16:20:13 +0800
Subject: [PATCH] 修改危废页面

---
 src/main/webapp/WEB-INF/spring-menu.xml                                       |   22 ++++++++---
 src/main/webapp/sys_hazardous_waste.xhtml                                     |   18 ++++-----
 src/main/java/com/nanometer/smartlab/api/ApiAction.java                       |    2 
 src/main/java/com/nanometer/smartlab/controller/HazardousWasteController.java |   31 ++++++++++++---
 4 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/src/main/java/com/nanometer/smartlab/api/ApiAction.java b/src/main/java/com/nanometer/smartlab/api/ApiAction.java
index 895fbec..d00c8b5 100644
--- a/src/main/java/com/nanometer/smartlab/api/ApiAction.java
+++ b/src/main/java/com/nanometer/smartlab/api/ApiAction.java
@@ -1569,7 +1569,7 @@
                 hazardousWaste.setMedical(new BigDecimal(0));
             }
             hazardousWaste.setUpdator(hazardousWaste.getCreator());
-            hazardousWaste.setUpdatetime(new Date());
+//            hazardousWaste.setUpdatetime(new Date());
             hazardousWasteService.insertInfo(hazardousWaste);
             return ResponseModel.getOkInstence("添加成功");
         }catch (Exception e){
diff --git a/src/main/java/com/nanometer/smartlab/controller/HazardousWasteController.java b/src/main/java/com/nanometer/smartlab/controller/HazardousWasteController.java
index 97b4c20..a6cea3a 100644
--- a/src/main/java/com/nanometer/smartlab/controller/HazardousWasteController.java
+++ b/src/main/java/com/nanometer/smartlab/controller/HazardousWasteController.java
@@ -2,8 +2,11 @@
 
 
 import com.nanometer.smartlab.entity.HazardousWaste;
+import com.nanometer.smartlab.entity.dto.HazardousWasteUser;
+import com.nanometer.smartlab.entity.enumtype.Waster;
 import com.nanometer.smartlab.service.HazardousWasteService;
 import com.nanometer.smartlab.util.FacesUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.primefaces.model.LazyDataModel;
 import org.primefaces.model.SortOrder;
@@ -46,11 +49,19 @@
 
                     List<HazardousWaste> list = null;
                     try {
-                        int pageCount = hazardousWasteService.countAll(startTime,endTime,status,applyPerson,project,department,tid);
-
-                        this.setRowCount(pageCount);
-                        if (pageCount > 0)
-                            list = hazardousWasteService.selectAll(startTime,endTime,status,applyPerson,project,department,tid,first, pageSize);
+                        if (getUser().getWaster() != null){
+                            if (getUser().getWaster().equals(Waster.MANAGE)){
+                                int pageCount = hazardousWasteService.countAll(startTime,endTime,status,applyPerson,project,department,tid);
+                                this.setRowCount(pageCount);
+                                if (pageCount > 0)
+                                    list = hazardousWasteService.selectAll(startTime,endTime,status,applyPerson,project,department,tid,first, pageSize);
+                            }else if (StringUtils.isNotBlank(getUser().getProject())){
+                                int pageCount = hazardousWasteService.countAll(startTime,endTime,status,applyPerson,getUser().getProject(),department,tid);
+                                this.setRowCount(pageCount);
+                                if (pageCount > 0)
+                                    list = hazardousWasteService.selectAll(startTime,endTime,status,applyPerson,getUser().getProject(),department,tid,first, pageSize);
+                            }
+                        }
                         //查询更换模式
                         if (isSearch) {
                             isSearch = false;
@@ -203,7 +214,15 @@
 
 
     public void export2Excel() {
-        List<Map> list = hazardousWasteService.exportList(startTime,endTime,status,applyPerson,project,department,tid);
+        List<Map> list = new ArrayList<>();
+        if (getUser().getWaster() != null){
+            if (getUser().getWaster().equals(Waster.MANAGE)){
+                list = hazardousWasteService.exportList(startTime,endTime,status,applyPerson,project,department,tid);
+            }else if (StringUtils.isNotBlank(getUser().getProject())){
+                list = hazardousWasteService.exportList(startTime,endTime,status,applyPerson,getUser().getProject(),department,tid);
+            }
+        }
+
         try{
             hazardousWasteService.export2Excel(list);
         }catch (Exception e){
diff --git a/src/main/webapp/WEB-INF/spring-menu.xml b/src/main/webapp/WEB-INF/spring-menu.xml
index 186064f..ed59289 100644
--- a/src/main/webapp/WEB-INF/spring-menu.xml
+++ b/src/main/webapp/WEB-INF/spring-menu.xml
@@ -172,6 +172,22 @@
 
         <bean class="com.nanometer.smartlab.model.MenuModel">
             <property name="id" value="base_info_mng"></property>
+            <property name="title" value="危废处理"></property>
+            <property name="icon" value="icon_sidebar1"></property>
+            <property name="subMenu">
+                <list value-type="com.nanometer.smartlab.model.MenuModel">
+                    <bean class="com.nanometer.smartlab.model.MenuModel">
+                        <property name="id" value="sys_hazardous_waste"></property>
+                        <property name="title" value="危废处理信息"></property>
+                        <property name="page" value="sys_hazardous_waste"></property>
+                        <property name="privilegeCode" value="sys_hazardous_waste"></property>
+                    </bean>
+                </list>
+            </property>
+        </bean>
+
+        <bean class="com.nanometer.smartlab.model.MenuModel">
+            <property name="id" value="base_info_mng"></property>
             <property name="title" value="基本信息管理"></property>
             <property name="icon" value="icon_sidebar3"></property>
             <property name="subMenu">
@@ -231,12 +247,6 @@
                         <property name="title" value="编码替换字典"></property>
                         <property name="page" value="sys_encode_replace_dict"></property>
                         <property name="privilegeCode" value="sys_encode_replace_dict"></property>
-                    </bean>
-                    <bean class="com.nanometer.smartlab.model.MenuModel">
-                        <property name="id" value="sys_hazardous_waste"></property>
-                        <property name="title" value="危废处理信息"></property>
-                        <property name="page" value="sys_hazardous_waste"></property>
-                        <property name="privilegeCode" value="sys_hazardous_waste"></property>
                     </bean>
                 </list>
             </property>
diff --git a/src/main/webapp/sys_hazardous_waste.xhtml b/src/main/webapp/sys_hazardous_waste.xhtml
index c3ec6f4..b078069 100644
--- a/src/main/webapp/sys_hazardous_waste.xhtml
+++ b/src/main/webapp/sys_hazardous_waste.xhtml
@@ -15,9 +15,7 @@
         <p:tab title="危废处理信息">
             <h:form id="hazardousWasteForm">
                 <p:panel styleClass="center-header">
-                    <p:outputLabel styleClass="title" value="危废处理信息"/>
-
-                    <p:panelGrid styleClass="filter" columns="9">
+                    <p:panelGrid styleClass="filter" columns="20" style="white-space: nowrap">
                         <p:outputLabel value="开始时间:"/>
                         <p:calendar value="#{hazardousWasteController.startTime}"
                                     converter="timestampConvert"
@@ -36,9 +34,7 @@
 
                         <p:outputLabel value="确认者:"/>
                         <p:inputText value="#{hazardousWasteController.applyPerson}"/>
-                    </p:panelGrid>
 
-                    <p:panelGrid styleClass="filter" columns="8">
                         <p:outputLabel value="单号:"/>
                         <p:inputText value="#{hazardousWasteController.tid}"/>
                         <p:outputLabel value="课题组"></p:outputLabel>
@@ -57,6 +53,7 @@
 
                         <p:commandLink styleClass="search" process="@form" update="@form" actionListener="#{hazardousWasteController.modelChange}"/>
                     </p:panelGrid>
+
                 </p:panel>
                 <p:panel styleClass="center-body">
                     <p:panelGrid columns="5" styleClass="btn">
@@ -102,10 +99,14 @@
                         <p:column headerText="确认者">
                             <h:outputText value="#{row.applyPerson}"/>
                         </p:column>
+                        <p:column headerText="确认时间">
+                            <h:outputText value="#{row.updatetime}">
+                                <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" locale="zh_CN"></f:convertDateTime>
+                            </h:outputText>
+                        </p:column>
                         <p:column headerText="课题组">
                             <h:outputText value="#{row.project}"/>
                         </p:column>
-
                         <p:column headerText="部门">
                             <h:outputText value="#{row.department}"/>
                         </p:column>
@@ -120,10 +121,9 @@
 
                         <p:column headerText="创建时间">
                             <h:outputText value="#{row.createTime}">
-                                <f:convertDateTime pattern="yyyy-MM-dd" locale="zh_CN"></f:convertDateTime>
+                                <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" locale="zh_CN"></f:convertDateTime>
                             </h:outputText>
                         </p:column>
-
                     </p:dataTable>
                 </p:panel>
             </h:form>
@@ -131,8 +131,6 @@
         <p:tab title="统计分析">
             <h:form id="hazardousWasteAnalysisForm">
                 <p:panel styleClass="center-header">
-                    <p:outputLabel styleClass="title" value="危废处理信息"/>
-
                     <p:panelGrid styleClass="filter" columns="15">
                         <p:outputLabel value="开始时间:"/>
                         <p:calendar value="#{hazardousWasteController.startTime}"

--
Gitblit v1.9.2