Browse Source

输变电项目材料库功能开发

user5 3 years ago
parent
commit
39cf3dfd19

+ 26 - 0
src/main/java/com/jeeplus/modules/pojectMaterialsWarehouse/service/ProjectMaterialCollectService.java

@@ -65,6 +65,32 @@ public class ProjectMaterialCollectService extends CrudService<ProjectMaterialCo
     }
     }
 
 
     /**
     /**
+     * 新增数据(单条)
+     * @param info
+     */
+    @Transactional(readOnly = false)
+    public String singleSave(ProjectMaterialCollectInfo info){
+        //根据项目id查询项目信息
+        if(StringUtils.isNotBlank(info.getMaterialName())
+                && StringUtils.isNotBlank(info.getMaterialName())
+                && StringUtils.isNotBlank(info.getSpecifications())
+                && StringUtils.isNotBlank(info.getUnit())
+                && StringUtils.isNotBlank(info.getUserTheParts())
+                && StringUtils.isNotBlank(info.getExcludingTax())){
+            if(StringUtils.isBlank(info.getId())){
+                info.preInsert();
+                dao.insert(info);
+            }else{
+                info.preUpdate();
+                dao.update(info);
+            }
+        }else {
+            return "输变电项目材料文件数据填写不正确";
+        }
+        return "保存成功!";
+    }
+
+    /**
      * 批量新增数据信息
      * 批量新增数据信息
      * @param materialCollectList
      * @param materialCollectList
      * @return
      * @return

+ 54 - 0
src/main/java/com/jeeplus/modules/pojectMaterialsWarehouse/web/PojectMaterialsWarehouseController.java

@@ -139,12 +139,33 @@ public class PojectMaterialsWarehouseController extends BaseController {
         return "modules/pojectMaterialsWarehouse/projectMaterialCollectInfoView";
         return "modules/pojectMaterialsWarehouse/projectMaterialCollectInfoView";
     }
     }
 
 
+    /**
+     * 跳转导入上传页面
+     * @param workMaterialCollectType
+     * @param model
+     * @return
+     */
     @RequestMapping(value = "form")
     @RequestMapping(value = "form")
     public String form(WorkMaterialCollectType workMaterialCollectType, Model model) {
     public String form(WorkMaterialCollectType workMaterialCollectType, Model model) {
         model.addAttribute("workMaterialCollectType", workMaterialCollectType);
         model.addAttribute("workMaterialCollectType", workMaterialCollectType);
         return "modules/pojectMaterialsWarehouse/projectMaterialsWarehouseForm";
         return "modules/pojectMaterialsWarehouse/projectMaterialsWarehouseForm";
     }
     }
 
 
+    /**
+     * 跳转单条数据添加页面
+     * @param projectMaterialCollectInfo
+     * @param model
+     * @return
+     */
+    @RequestMapping(value = "singleForm")
+    public String singleForm(ProjectMaterialCollectInfo projectMaterialCollectInfo, Model model) {
+        if(StringUtils.isNotBlank(projectMaterialCollectInfo.getId())){
+            projectMaterialCollectInfo = projectMaterialCollectService.get(projectMaterialCollectInfo.getId());
+        }
+        model.addAttribute("projectMaterialCollectInfo", projectMaterialCollectInfo);
+        return "modules/pojectMaterialsWarehouse/projectMaterialCollectForm";
+    }
+
 
 
     @RequestMapping(value = "save",method= RequestMethod.POST)
     @RequestMapping(value = "save",method= RequestMethod.POST)
     @ResponseBody
     @ResponseBody
@@ -185,6 +206,39 @@ public class PojectMaterialsWarehouseController extends BaseController {
         return map;
         return map;
     }
     }
 
 
+    @RequestMapping(value = "singleSave",method= RequestMethod.POST)
+    @ResponseBody
+    public Object singleSave(ProjectMaterialCollectInfo projectMaterialCollectInfo, RedirectAttributes redirectAttributes) {
+        Map<String,Object> map = new HashMap<>();
+        map.put("success",false);
+        try {
+            if(StringUtils.isBlank(projectMaterialCollectInfo.getProjectId())){
+                map.put("str","没有找到关联项目信息");
+                return map;
+            }
+            if(StringUtils.isBlank(projectMaterialCollectInfo.getProjectType())){
+                map.put("str","工程类型未选择");
+                return map;
+            }
+            if(StringUtils.isBlank(projectMaterialCollectInfo.getProjectPart())){
+                map.put("str","工程部位未选择");
+                return map;
+            }
+            if(null == projectMaterialCollectInfo.getStartDate() || null == projectMaterialCollectInfo.getEndDate()){
+                map.put("str","工程日期未填写");
+                return map;
+            }
+            String saveResult = projectMaterialCollectService.singleSave(projectMaterialCollectInfo);
+            map.put("str",saveResult);
+            map.put("success",true);
+        } catch (Exception e) {
+            addMessage(redirectAttributes, "保存输变电项目材料信息失败!失败信息:"+e.getMessage());
+            map.put("str","保存输变电项目材料信息失败");
+            map.put("success",false);
+        }
+        return map;
+    }
+
     /**
     /**
      * 单个删除
      * 单个删除
      * @param projectMaterialCollectInfo
      * @param projectMaterialCollectInfo

+ 16 - 1
src/main/resources/mappings/modules/pojectMaterialsWarehouse/ProjectMaterialsWarehouseDao.xml

@@ -51,6 +51,9 @@
 			<if test="projectPart != null and projectPart != ''">
 			<if test="projectPart != null and projectPart != ''">
 				AND a.projectPart = #{projectPart}
 				AND a.projectPart = #{projectPart}
 			</if>
 			</if>
+			<if test="projectId != null and projectId != ''">
+				AND a.projectId = #{projectId}
+			</if>
 			<if test="projectName != null and projectName != ''">
 			<if test="projectName != null and projectName != ''">
 				AND rpr.project_name LIKE
 				AND rpr.project_name LIKE
 				<if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
 				<if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
@@ -94,6 +97,9 @@
 			<if test="projectPart != null and projectPart != ''">
 			<if test="projectPart != null and projectPart != ''">
 				AND a.projectPart = #{projectPart}
 				AND a.projectPart = #{projectPart}
 			</if>
 			</if>
+			<if test="projectId != null and projectId != ''">
+				AND a.projectId = #{projectId}
+			</if>
 			<if test="projectName != null and projectName != ''">
 			<if test="projectName != null and projectName != ''">
 				AND rpr.project_name LIKE
 				AND rpr.project_name LIKE
 				<if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
 				<if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
@@ -197,7 +203,16 @@
 		UPDATE project_material_collect_info SET
 		UPDATE project_material_collect_info SET
 			update_by = #{updateBy.id},
 			update_by = #{updateBy.id},
 			update_date = #{updateDate},
 			update_date = #{updateDate},
-			remarks = #{remarks}
+			remarks = #{remarks},
+			materialName = #{materialName},
+			specifications = #{specifications},
+			unit = #{unit},
+			userTheParts = #{userTheParts},
+			excludingTax = #{excludingTax},
+			projectType = #{projectType},
+			projectPart = #{projectPart},
+			start_date = #{startDate},
+			end_date = #{endDate}
 		WHERE id = #{id}
 		WHERE id = #{id}
 	</update>
 	</update>
 
 

+ 18 - 0
src/main/webapp/WEB-INF/tags/table/singleProjectAddRow.tag

@@ -0,0 +1,18 @@
+<%@ tag language="java" pageEncoding="UTF-8"%>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<%@ attribute name="url" type="java.lang.String" required="true"%>
+<%@ attribute name="title" type="java.lang.String" required="true"%>
+<%@ attribute name="width" type="java.lang.String" required="false"%>
+<%@ attribute name="height" type="java.lang.String" required="false"%>
+<%@ attribute name="target" type="java.lang.String" required="false"%>
+<%@ attribute name="label" type="java.lang.String" required="false"%>
+<button class="layui-btn layui-btn-sm layui-bg-blue" data-toggle="tooltip" data-placement="left" onclick="addSingle()" title="添加">
+<%--    <i class="fa fa-plus"></i> --%>
+    ${label==null?'添加':label}
+</button>
+<%-- 使用方法: 1.将本tag写在查询的form之前;2.传入table的id和controller的url --%>
+<script type="text/javascript">
+	function addSingle(){
+		openDialogSingle('${title}'+"登记",encodeURI("${url}"),"${width==null?'95%':width}", "${height==null?'95%':height}","${target}","inputForm"," layui-border-box");
+	}
+</script>

+ 157 - 0
src/main/webapp/webpage/modules/pojectMaterialsWarehouse/projectMaterialCollectForm.jsp

@@ -0,0 +1,157 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+
+<html>
+<head>
+    <title>项目管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript" src="${ctxStatic}/helloweba_editable-select/jquery.editable-select.min.js"></script>
+    <script type="text/javascript" src="${ctxStatic}/iCheck/icheck.min.js"></script>
+    <script type="text/javascript" src="${ctxStatic}/layui/layui.js"></script>
+    <script src="${ctxStatic}/common/html/js/script.js"></script>
+
+    <link rel='stylesheet' type="text/css" href="${ctxStatic}/helloweba_editable-select/jquery.editable-select.min.css"/>
+    <link rel='stylesheet' type="text/css" href="${ctxStatic}/layui/css/layui.css"/>
+
+    <style>
+        #projectDesc-error{
+            left:0;
+            top:82px;
+        }
+        .layui-layer-dialog{
+            background: #ff0000;
+        }
+        td input{
+            margin-left:-10px !important;
+            height: 42px !important;
+        }
+    </style>
+    <script type="text/javascript">
+        var validateForm;
+        var isMasterClient = true;//是否是委托方
+        var clientCount = 0;
+        function doSubmit(i){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+            if(validateForm.form()){
+                if(i==2){
+                    $("#inputForm").attr("action","${ctx}/project/projectRecords/tstore");
+                }else if (i==1){
+                    var flags=judgment();
+                    if (!flags){
+                        return flags;
+                    }
+                }
+                $("#inputForm").submit();
+                return true;
+            }
+
+            return false;
+        }
+        $(document).ready(function() {
+            validateForm = $("#inputForm").validate({
+                submitHandler: function(form){
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function(error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+
+            laydate.render({
+                elem: '#startDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
+                event: 'focus', //响应事件。如果没有传入event,则按照默认的click
+                type : 'date'
+                , trigger: 'click'
+            });
+            laydate.render({
+                elem: '#endDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
+                event: 'focus', //响应事件。如果没有传入event,则按照默认的click
+                type : 'date'
+                , trigger: 'click'
+            });
+        });
+    </script>
+</head>
+<body>
+<div class="single-form">
+    <div class="container">
+        <sys:message content="${message}"/>
+        <form:form id="inputForm" modelAttribute="projectMaterialCollectInfo" action="${ctx}/project/projectMaterialsWarehouse/singleSave" method="post" class="form-horizontal">
+            <form:hidden path="id"/>
+            <input type="hidden" id="projectId" name="projectId" value="${projectMaterialCollectInfo.projectId}">
+            <div class="form-group layui-row">
+                <div class="form-group-label"><h2>基础信息</h2></div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>工程类型:</label>
+                    <div class="layui-input-block">
+                        <form:select id="projectType" path="projectType" class="form-control simple-select required">
+                            <form:option value="" label=""/>
+                            <form:options id="test" items="${fns:getMainDictList('work_material_engineer_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+                        </form:select>
+                    </div>
+                </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>工程部位:</label>
+                    <div class="layui-input-block">
+                        <form:select path="projectPart" id="projectPart" class="form-control simple-select required">
+                            <form:option value="" label=""/>
+                            <form:options items="${fns:getMainDictList('work_material_engineer_part1')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
+                        </form:select>
+                    </div>
+                </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>工程日期:</label>
+                    <div class="layui-input-block readOnlyFFF">
+                        <input id="startDate" name="startDate" placeholder="开始时间" type="text" readonly="readonly" maxlength="20" value="<fmt:formatDate value="${projectMaterialCollectInfo.startDate}" pattern="yyyy-MM-dd"/>" class="laydate-icondate required form-control layer-date layui-input laydate-icon query-group"
+                        />
+                        </input>
+                        <span class="group-sep">-</span>
+                        <input id="endDate" name="endDate" placeholder="结束时间" type="text" readonly="readonly" maxlength="20" value="<fmt:formatDate value="${projectMaterialCollectInfo.endDate}" pattern="yyyy-MM-dd"/>" class="laydate-icondate required form-control layer-date layui-input laydate-icon query-group"
+                        />
+                        </input>
+                    </div>
+                </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>材料名称:</label>
+                    <div class="layui-input-block">
+                        <form:input path="materialName" placeholder="请输入材料名称" htmlEscape="false" maxlength="64"  class="form-control layui-input required"/>
+                    </div>
+                </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>规格:</label>
+                    <div class="layui-input-block">
+                        <form:input path="specifications" placeholder="请输入材料规格" htmlEscape="false" maxlength="64"  class="form-control layui-input required"/>
+                    </div>
+                </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>单位:</label>
+                    <div class="layui-input-block">
+                        <form:input path="unit" placeholder="请输入材料单位" htmlEscape="false" maxlength="64" class="form-control layui-input required"/>
+                    </div>
+                </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>除税市场价:</label>
+                    <div class="layui-input-block">
+                        <form:input path="excludingTax" placeholder="请输入材料除税市场价" htmlEscape="false" onkeyup="wirteNum(this)" maxlength="64" class="form-control layui-input required"/>
+                    </div>
+                </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label"><span class="require-item">*</span>使用部位:</label>
+                    <div class="layui-input-block">
+                        <form:input path="userTheParts" placeholder="请输入材料使用部位" htmlEscape="false" maxlength="64" class="form-control layui-input required"/>
+                    </div>
+                </div>
+
+            </div>
+            <div class="form-group layui-row page-end"></div>
+        </form:form>
+    </div>
+</div>
+</body>
+</html>

+ 85 - 5
src/main/webapp/webpage/modules/pojectMaterialsWarehouse/projectMaterialCollectInfoList.jsp

@@ -76,6 +76,79 @@
 				}
 				}
 			});
 			});
         }
         }
+        function openDialogSingle(title,url,width,height,target,formId,tableId) {
+
+            if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {//如果是移动端,就使用自适应大小弹窗
+                width = 'auto';
+                height = 'auto';
+            } else {//如果是PC端,根据用户设置的width和height显示。
+
+            }
+
+			top.layer.open({
+				type: 2,
+				area: [width, height],
+				title: title,
+				skin:"two-btns",
+				maxmin: false, //开启最大化最小化按钮
+				content: url ,
+				btn: ['提交','关闭'],
+				yes: function(index, layero){
+					var body = top.layer.getChildFrame('body', index);
+					var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+					var inputForm = body.find('#inputForm');
+					var top_iframe;
+					if(target){
+						top_iframe = target;//如果指定了iframe,则在改frame中跳转
+					}else{
+						top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+					}
+					inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+					inputForm.attr("action","${ctx}/project/projectMaterialsWarehouse/singleSave");//表单提交成功后,从服务器返回的url在当前tab中展示
+					var $document = iframeWin.contentWindow.document;
+					formSubmit2($document,formId,index,tableId);
+					return false;
+				},
+				cancel: function(index){
+				}
+			});
+        }
+		function openDialogreModify(title,url,width,height,target){
+
+			if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+				width='auto';
+				height='auto';
+			}else{//如果是PC端,根据用户设置的width和height显示。
+
+			}
+			top.layer.open({
+				type: 2,
+				area: [width, height],
+				title: title,
+				skin: 'two-btns',
+				maxmin: true, //开启最大化最小化按钮
+				content: url ,
+				btn: ['提交','关闭'],
+				yes: function(index, layero){
+					var body = top.layer.getChildFrame('body', index);
+					var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+					var inputForm = body.find('#inputForm');
+					var top_iframe;
+					if(target){
+						top_iframe = target;//如果指定了iframe,则在改frame中跳转
+					}else{
+						top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+					}
+					inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+					inputForm.attr("action","${ctx}/project/projectMaterialsWarehouse/singleSave");//表单提交成功后,从服务器返回的url在当前tab中展示
+					var $document = iframeWin.contentWindow.document;
+					formSubmit2($document,"inputForm",index," layui-border-box");
+					return false;
+				},
+				cancel: function(index){
+				}
+			});
+		}
 
 
 			function formSubmit2($document,inputForm,index,tableId){
 			function formSubmit2($document,inputForm,index,tableId){
 
 
@@ -126,7 +199,7 @@
 				skin:"two-btns",
 				skin:"two-btns",
 				maxmin: false, //开启最大化最小化按钮
 				maxmin: false, //开启最大化最小化按钮
 				content: url ,
 				content: url ,
-				btn: ['确定','关闭'],
+				btn: ['提交','关闭'],
 				yes: function(index, layero){
 				yes: function(index, layero){
 					var body = top.layer.getChildFrame('body', index);
 					var body = top.layer.getChildFrame('body', index);
 					var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
 					var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
@@ -181,12 +254,15 @@
 
 
 	</script>
 	</script>
 	<style>
 	<style>
-		body{
+		/*body{
 			background-color:transparent;
 			background-color:transparent;
 			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
 			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
 			color:#ffffff;
 			color:#ffffff;
 			background-color:rgba(255,255,255,0);
 			background-color:rgba(255,255,255,0);
 			height:100%;
 			height:100%;
+		}*/
+		#margin{
+			margin-left: 1px;
 		}
 		}
 	</style>
 	</style>
 </head>
 </head>
@@ -262,8 +338,11 @@
 				<div class="nav-btns">
 				<div class="nav-btns">
 					<div class="layui-btn-group ">
 					<div class="layui-btn-group ">
 
 
-						<shiro:hasPermission name="ruralProject:ruralProjectRecords:add">
-							<table:subProjectAddRow url="${ctx}/project/projectMaterialsWarehouse/form?projectId=${projectId}" width="500px" height="500px" label="导入" title="输变电项目材料信息"></table:subProjectAddRow><!-- 增加按钮 -->
+						<shiro:hasPermission name="project:pojectMaterialsWarehouse:list">
+							<table:singleProjectAddRow url="${ctx}/project/projectMaterialsWarehouse/singleForm?projectId=${projectId}" label="新增" title="新增"></table:singleProjectAddRow><!-- 增加按钮 -->
+						</shiro:hasPermission>
+						<shiro:hasPermission name="project:pojectMaterialsWarehouse:list">
+							<table:subProjectAddRow url="${ctx}/project/projectMaterialsWarehouse/form?projectId=${projectId}" width="500px" height="500px" label="导入" title="导入"></table:subProjectAddRow><!-- 增加按钮 -->
 						</shiro:hasPermission>
 						</shiro:hasPermission>
 						<shiro:hasPermission name="project:pojectMaterialsWarehouse:list">
 						<shiro:hasPermission name="project:pojectMaterialsWarehouse:list">
 							<button type="button" data-toggle="tooltip" data-placement="top" class="layui-btn layui-btn-sm layui-bg-red" id="delUser"> 批量删除</button>
 							<button type="button" data-toggle="tooltip" data-placement="top" class="layui-btn layui-btn-sm layui-bg-red" id="delUser"> 批量删除</button>
@@ -319,7 +398,8 @@
                         var xml="";
                         var xml="";
                         if(d.canedit1 != undefined && d.canedit1 =="1")
                         if(d.canedit1 != undefined && d.canedit1 =="1")
                         {
                         {
-							xml+="<a href=\"${ctx}/project/projectMaterialsWarehouse/delete?id=" + d.id + "\" onclick=\"return subConfirmx('确认要删除该信息吗?', this.href)\" class=\"layui-btn layui-btn-xs layui-bg-red\"> 删除</a>";
+							xml+="<a href=\"#\" onclick=\"openDialogreModify('修改信息', '${ctx}/project/projectMaterialsWarehouse/singleForm?id=" + d.id + "','95%', '95%','')\" class=\"layui-btn layui-btn-xs\" >修改</a>",
+							xml+="<a id=\"margin\" href=\"${ctx}/project/projectMaterialsWarehouse/delete?id=" + d.id + "\" onclick=\"return subConfirmx('确认要删除该信息吗?', this.href)\" class=\"layui-btn layui-btn-xs layui-bg-red \">删除</a>"
                         }
                         }
                         return xml;
                         return xml;
                     }}
                     }}

+ 1 - 0
src/main/webapp/webpage/modules/workcontractinfo/workContractInfoAdminForm.jsp

@@ -552,6 +552,7 @@
             }
             }
         }
         }
         //千位符号,保留两位小数
         //千位符号,保留两位小数
+        //千位符号,保留两位小数
         function toThousands(s){
         function toThousands(s){
             if(/[^0-9\.]/.test(s)) return "无效值";
             if(/[^0-9\.]/.test(s)) return "无效值";
             s=s.replace(/^(\d*)$/,"$1.");
             s=s.replace(/^(\d*)$/,"$1.");