浏览代码

添加编辑履约.开工投产时间功能

shuzhan 1 年之前
父节点
当前提交
6aa16e8bf1
共有 2 个文件被更改,包括 335 次插入3 次删除
  1. 304 0
      project-detail-time.html
  2. 31 3
      project_completion_report.html

+ 304 - 0
project-detail-time.html

@@ -0,0 +1,304 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<!--#include file="common/_header.html"-->
+	<title>项目详情页</title>
+</head>
+<body>
+	<article class="page-container">
+	<form class="form form-horizontal" id="form1">
+	<input type="hidden" class="input-text" id="projectId" name="projectId">
+	<div class="row cl">
+		<label class="form-label col-xs-4 col-sm-3">履约时间:</label>
+		<div class="formControls col-xs-8 col-sm-9">
+			<input id="timeNode1" name="timeNode1" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
+		</div>
+	</div>
+	<div class="row cl">
+		<label class="form-label col-xs-4 col-sm-3">开工时间:</label>
+		<div class="formControls col-xs-8 col-sm-9">
+			<input id="timeNode2" name="timeNode2" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
+		</div>
+	</div>
+	<div class="row cl">
+		<label class="form-label col-xs-4 col-sm-3">投产时间:</label>
+		<div class="formControls col-xs-8 col-sm-9">
+			<input id="timeNode3" name="timeNode3" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
+		</div>
+	</div>
+	<div class="row cl">
+		<label class="form-label col-xs-4 col-sm-3">实际履约时间:</label>
+		<div class="formControls col-xs-8 col-sm-9">
+			<input id="fulfillTime" name="fulfillTime" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
+		</div>
+	</div>
+	</form>
+	<div class="row cl">
+		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
+			<input class="btn btn-primary radius" type="button" id="subForm" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
+		</div>
+	</div>
+</article>
+<!--_footer 作为公共模版分离出去-->
+<!--#include file="common/_footer.html"-->
+<!--/_footer 作为公共模版分离出去-->
+
+<!--请在下方写此页面业务相关的脚本-->
+<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
+<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>  
+<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
+<script type="text/javascript" src="scripts/global.js"></script>
+
+<!--引入webuploader-->
+<link rel="stylesheet" type="text/css" href="lib/webuploader/0.1.5/webuploader.css">
+<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.js"></script>
+<!-- select2 start-->
+<link rel="stylesheet" type="text/css" href="lib/select2/select2.min.css" />
+<script src="lib/select2/select2.full.js"  type="text/javascript"></script>
+<script src="lib/select2/select2.zh-CN.js"  type="text/javascript"></script>
+<!-- select2 end -->
+<script type="text/javascript">
+	var path = global_backend_url;
+	$(document).ready(function(){
+		//获取url中传参
+		var id = getQueryString("id");
+		var needLoad = false;
+		
+		var remoteUrl = path + "/project/add";
+		
+		if(id!=null && id.length>0){
+			remoteUrl = path + "/project/update";
+			needLoad = true;
+		}
+					
+		$("#form1").validate({
+			onkeyup:false,
+			focusCleanup:true,
+			success:"valid",
+			submitHandler:function(form){
+				var loadingIndex = layer.load(1, {shade: [0.1,'#fff']}); 
+				$(form).ajaxSubmit({
+					type: 'post',
+					url: remoteUrl,
+					success: function(data){
+						layer.close(loadingIndex);
+						if(data.result){
+							layer.msg('修改成功!',{icon:1,time:1000});
+							
+							var index = parent.layer.getFrameIndex(window.name);
+							
+							if(index>=0){		
+								parent.reloadList();
+								parent.layer.close(index);
+							}
+						}
+						else{
+							layer.msg(data.message,{icon:1,time:1000});
+						}
+					},
+	                error: function(XmlHttpRequest, textStatus, errorThrown){
+						layer.msg('error!',{icon:1,time:1000});
+					}
+				});
+			}
+		});
+		
+		if(needLoad){
+			var loadingIndex = layer.load(1, {shade: [0.1,'#fff']}); 
+			
+			$.get(path + "/project/detail/" + id,null, function(json){
+				layer.close(loadingIndex);
+				
+				if(json.result){
+					json2Form(json.data,"form1");
+					// if(json.data.procInstId != null ){
+					// 	$("#projectAdminId").attr("disabled", true);
+					// }
+					loadFile(json.data.pfList);
+				}
+				else{
+        			layer.msg(json.message);					
+				}				
+			},"json");
+		}
+		
+		$("#subForm").click(function(){
+			$("#form1").submit();
+		});
+	});
+	
+	function getSelect(id,value){
+		if(value != null){
+			var Html = "<option value='"+value.id+"' selected>" + value.realName + "</option>";
+			$('#' + id).append(Html);
+			//$('#' + id).select2();
+		}
+		
+		$("#" + id).select2({
+			language: "zh-CN", 
+			placeholder:"请输入用户姓名",//文本框的提示信息
+			minimumInputLength:0,	//至少输入n个字符,才去加载数据
+			allowClear: true,	//是否允许用户清除文本信息
+			ajax:{
+				url:path + "/jpAdmin/selectUser",	//地址
+				type: "POST",
+				dataType:'json',	//接收的数据类型
+				delay:250,
+				cache: true,
+				processResults: function (data) {
+				  var results = data.map(function(item){
+					  return {
+						id : item.userId,
+						text : item.realName,
+						userName: item.userName,
+						orgName : item.orgName
+					  }
+				  });
+
+				  return {
+					results: results
+				  }
+				}
+			},
+			language: "zh-CN",
+			templateResult: function (state) {
+				var html = "<div>";
+				html += "<strong>姓名:" + state.text + "</strong>(" + state.userName + ")<br/>";
+				html += "单位:" + state.orgName;
+				html += "</div>";
+
+				return $(html);
+			}
+		}); 
+	}
+
+	function getSelectMany(id,userId,userName){
+		$("#" + id).select2({
+			language: "zh-CN", 
+			placeholder:"请输入用户姓名",//文本框的提示信息
+			minimumInputLength:0,	//至少输入n个字符,才去加载数据
+			allowClear: false,	//是否允许用户清除文本信息
+			multiple:true,
+			ajax:{
+				url:path + "/jpAdmin/selectUser",	//地址
+				type: "POST",
+				dataType:'json',	//接收的数据类型
+				delay:250,
+				cache: true,
+				processResults: function (data) {
+				  var results = data.map(function(item){
+					  return {
+						id : item.userId,
+						text : item.realName,
+						userName: item.userName,
+						orgName : item.orgName
+					  }
+				  });
+
+				  return {
+					results: results
+				  }
+				}
+			},
+			language: "zh-CN",
+			templateResult: function (state) {
+				var html = "<div>";
+				html += "<strong>姓名:" + state.text + "</strong>(" + state.userName + ")<br/>";
+				html += "单位:" + state.orgName;
+				html += "</div>";
+
+				return $(html);
+			}
+		}); 
+		
+		$("#" + id).on("select2-clearing",function(e){
+			//alert(true);
+		});
+		
+
+		if(userId!=null && userId.length>0){
+			var ids = userId.split(",");
+			var names = userName.split(",");
+			
+			$('option', $("#" + id)).remove();
+
+			for(var i=0;i<ids.length;i++){
+				if(ids[i] != ""){
+					$("#" + id).append(new Option(names[i],ids[i], false, false));//第一个参数时id,第二个参数是text
+				}
+			}
+
+			$($("#" + id)).val(ids).trigger('change');
+		}
+		else{
+			$('option', $("#" + id)).remove();
+			$($("#" + id)).val(null).trigger('change');
+		}
+	}
+	
+	function getParkList(parkId){
+	    $.post(path + "/park/allList",function(json){
+	        if(json.result){
+	            $.each(json.data,function(index,obj){
+	                if(parkId!=""){
+	                    if(obj.parkId==parkId){
+	                        $("#parkId").append("<option value='"+obj.parkId+"' selected>"+obj.title+"</option>")
+	                    }else{
+	                        $("#parkId").append("<option value='"+obj.parkId+"'>"+obj.title+"</option>")
+	                    }
+					}
+					else{
+	                    $("#parkId").append("<option value='"+obj.parkId+"'>"+obj.title+"</option>")
+	
+					}
+	            })
+	        }
+	        else{
+	            layer.msg(json.message);
+	        }
+	    },"json")
+	}
+	
+	function loadFile(fileList){
+		if(fileList.length > 0){
+			$("#thelist").append('<h4 class="info">已上传附件</h4>');
+			for(var i=0;i<fileList.length;i++){
+				$("#thelist").append( '<div id="' + fileList[i].fileId + '" class="item">' +
+					'<h6 class="info"><a href="' + fileList[i].realAddress + '" download = "' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '" target="_blank">' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '</a>' + 
+					'<a href="javacript:void(0);" onclick=delFile("' + fileList[i].fileId + '")>删除</a>' + 
+					'</h6>' +
+				'</div>' );
+			}
+		}
+	}	
+	
+	function delFile(fileId){
+		layer.confirm("是否删除?",{
+			btns:["是","否"]
+		},function(){
+			$.post(path + "/projectFile/deleteReturnFile/" + fileId,null,function(json){
+				if(json.result){
+					layer.msg("删除成功!",{icon:1,time:2000});
+					var fileList = json.data.fileList;
+					$("#thelist").empty();
+					if(fileList.length > 0){
+						$("#thelist").append('<h4 class="info">已上传附件</h4>');
+						for(var i=0;i<fileList.length;i++){
+							$("#thelist").append( '<div id="' + fileList[i].fileId + '" class="item">' +
+								'<h6 class="info"><a href="' + fileList[i].realAddress + '" download = "' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '" target="_blank">' + fileList[i].fileName + "." + fileList[i].fileType.toLowerCase() + '</a>' + 
+								'<a href="javacript:void(0);" onclick=delFile("' + fileList[i].fileId + '")>删除</a>' + 
+								'</h6>' +
+							'</div>' );
+						}
+					}
+				}
+				else{
+					layer.msg("删除失败!" + json.message);
+				}
+			});
+		});
+	}
+</script> 
+<!--/请在上方写此页面业务相关的脚本-->
+</body>
+</html>

+ 31 - 3
project_completion_report.html

@@ -52,7 +52,7 @@
 		<table id="projectList" class="table table-border table-bordered table-bg" style="width:100%;">
 			<thead>
 				<tr>
-					<th scope="col" colspan="18">列表</th>
+					<th scope="col" colspan="20">列表</th>
 				</tr>
 				<tr class="text-c">
 					<th width="25"><input type="checkbox" name="" value=""></th>
@@ -74,6 +74,7 @@
 					<th width="130">开工时间</th>
 					<th width="100">投产时间</th>
 					<th width="100">停止时间</th>
+					<th width="100">操作</th>
 				</tr>
 			</thead>
 			<tbody>
@@ -87,6 +88,11 @@
 	<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
 	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
 	<script type="text/javascript" src="scripts/global.js"></script>
+	<script id="rowTmpl" type="text/template">
+		<div>
+			<a href="javascript:item_edit('{{id}}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i>编辑</a>
+		</div>
+	</script>
 	<script type="text/javascript">
 		var path = global_backend_url;
 		var uploadPath = file_upload_url;
@@ -160,7 +166,8 @@
 					{ "data": "timeNode1" },
 					{ "data": "timeNode2" },
 					{ "data": "timeNode3" },
-					{ "data": "exitTime" }
+					{ "data": "exitTime" },
+					{"data":null}
 				],
 				columnDefs: [
 					{
@@ -170,7 +177,19 @@
 						render: function (data, type, row) {
 							return '<input type="checkbox" name="checkItems" value="' + data + '">';
 						}
-					}
+					},{
+	            		targets:19,
+	            		sClass:'center',
+	            		bSortable:false,
+	            		render: function (data, type, row) {
+							rowStr = "rowTmpl";
+	            			return  template(rowStr,{
+	            				id:  row.projectId,
+								title: row.title,
+								procInstId: row.procInstId
+	            			});
+	            		}
+	            	}
 				]
 			});
 
@@ -236,6 +255,15 @@
 				}
 			}, "json")
 		}
+
+		function item_edit(id){
+			layer_show("编辑","project-detail-time.html?id=" + id,800,600);
+		}
+
+		function reloadList(){
+			$('#projectList').DataTable().ajax.reload(null,false);
+		}
+		
 	</script>
 </body>