project-detail-time.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <!--#include file="common/_header.html"-->
  5. <title>项目详情页</title>
  6. </head>
  7. <body>
  8. <article class="page-container">
  9. <form class="form form-horizontal" id="form1">
  10. <input type="hidden" class="input-text" id="projectId" name="projectId">
  11. <div class="row cl">
  12. <label class="form-label col-xs-4 col-sm-3">履约时间:</label>
  13. <div class="formControls col-xs-8 col-sm-9">
  14. <input id="timeNode1" name="timeNode1" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
  15. </div>
  16. </div>
  17. <div class="row cl">
  18. <label class="form-label col-xs-4 col-sm-3">开工时间:</label>
  19. <div class="formControls col-xs-8 col-sm-9">
  20. <input id="timeNode2" name="timeNode2" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
  21. </div>
  22. </div>
  23. <div class="row cl">
  24. <label class="form-label col-xs-4 col-sm-3">投产时间:</label>
  25. <div class="formControls col-xs-8 col-sm-9">
  26. <input id="timeNode3" name="timeNode3" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
  27. </div>
  28. </div>
  29. <div class="row cl">
  30. <label class="form-label col-xs-4 col-sm-3">实际履约时间:</label>
  31. <div class="formControls col-xs-8 col-sm-9">
  32. <input id="fulfillTime" name="fulfillTime" class="input-text" style="width:180px;" onfocus="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})" />
  33. </div>
  34. </div>
  35. </form>
  36. <div class="row cl">
  37. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
  38. <input class="btn btn-primary radius" type="button" id="subForm" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
  39. </div>
  40. </div>
  41. </article>
  42. <!--_footer 作为公共模版分离出去-->
  43. <!--#include file="common/_footer.html"-->
  44. <!--/_footer 作为公共模版分离出去-->
  45. <!--请在下方写此页面业务相关的脚本-->
  46. <script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
  47. <script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
  48. <script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
  49. <script type="text/javascript" src="scripts/global.js"></script>
  50. <!--引入webuploader-->
  51. <link rel="stylesheet" type="text/css" href="lib/webuploader/0.1.5/webuploader.css">
  52. <script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.js"></script>
  53. <!-- select2 start-->
  54. <link rel="stylesheet" type="text/css" href="lib/select2/select2.min.css" />
  55. <script src="lib/select2/select2.full.js" type="text/javascript"></script>
  56. <script src="lib/select2/select2.zh-CN.js" type="text/javascript"></script>
  57. <!-- select2 end -->
  58. <script type="text/javascript">
  59. var path = global_backend_url;
  60. $(document).ready(function(){
  61. //获取url中传参
  62. var id = getQueryString("id");
  63. var needLoad = false;
  64. var remoteUrl = path + "/project/add";
  65. if(id!=null && id.length>0){
  66. remoteUrl = path + "/project/update";
  67. needLoad = true;
  68. }
  69. $("#form1").validate({
  70. onkeyup:false,
  71. focusCleanup:true,
  72. success:"valid",
  73. submitHandler:function(form){
  74. var loadingIndex = layer.load(1, {shade: [0.1,'#fff']});
  75. $(form).ajaxSubmit({
  76. type: 'post',
  77. url: remoteUrl,
  78. success: function(data){
  79. layer.close(loadingIndex);
  80. if(data.result){
  81. layer.msg('修改成功!',{icon:1,time:1000});
  82. var index = parent.layer.getFrameIndex(window.name);
  83. if(index>=0){
  84. parent.reloadList();
  85. parent.layer.close(index);
  86. }
  87. }
  88. else{
  89. layer.msg(data.message,{icon:1,time:1000});
  90. }
  91. },
  92. error: function(XmlHttpRequest, textStatus, errorThrown){
  93. layer.msg('error!',{icon:1,time:1000});
  94. }
  95. });
  96. }
  97. });
  98. if(needLoad){
  99. var loadingIndex = layer.load(1, {shade: [0.1,'#fff']});
  100. $.get(path + "/project/detail/" + id,null, function(json){
  101. layer.close(loadingIndex);
  102. if(json.result){
  103. json2Form(json.data,"form1");
  104. // if(json.data.procInstId != null ){
  105. // $("#projectAdminId").attr("disabled", true);
  106. // }
  107. loadFile(json.data.pfList);
  108. }
  109. else{
  110. layer.msg(json.message);
  111. }
  112. },"json");
  113. }
  114. $("#subForm").click(function(){
  115. $("#form1").submit();
  116. });
  117. });
  118. function getSelect(id,value){
  119. if(value != null){
  120. var Html = "<option value='"+value.id+"' selected>" + value.realName + "</option>";
  121. $('#' + id).append(Html);
  122. //$('#' + id).select2();
  123. }
  124. $("#" + id).select2({
  125. language: "zh-CN",
  126. placeholder:"请输入用户姓名",//文本框的提示信息
  127. minimumInputLength:0, //至少输入n个字符,才去加载数据
  128. allowClear: true, //是否允许用户清除文本信息
  129. ajax:{
  130. url:path + "/jpAdmin/selectUser", //地址
  131. type: "POST",
  132. dataType:'json', //接收的数据类型
  133. delay:250,
  134. cache: true,
  135. processResults: function (data) {
  136. var results = data.map(function(item){
  137. return {
  138. id : item.userId,
  139. text : item.realName,
  140. userName: item.userName,
  141. orgName : item.orgName
  142. }
  143. });
  144. return {
  145. results: results
  146. }
  147. }
  148. },
  149. language: "zh-CN",
  150. templateResult: function (state) {
  151. var html = "<div>";
  152. html += "<strong>姓名:" + state.text + "</strong>(" + state.userName + ")<br/>";
  153. html += "单位:" + state.orgName;
  154. html += "</div>";
  155. return $(html);
  156. }
  157. });
  158. }
  159. function getSelectMany(id,userId,userName){
  160. $("#" + id).select2({
  161. language: "zh-CN",
  162. placeholder:"请输入用户姓名",//文本框的提示信息
  163. minimumInputLength:0, //至少输入n个字符,才去加载数据
  164. allowClear: false, //是否允许用户清除文本信息
  165. multiple:true,
  166. ajax:{
  167. url:path + "/jpAdmin/selectUser", //地址
  168. type: "POST",
  169. dataType:'json', //接收的数据类型
  170. delay:250,
  171. cache: true,
  172. processResults: function (data) {
  173. var results = data.map(function(item){
  174. return {
  175. id : item.userId,
  176. text : item.realName,
  177. userName: item.userName,
  178. orgName : item.orgName
  179. }
  180. });
  181. return {
  182. results: results
  183. }
  184. }
  185. },
  186. language: "zh-CN",
  187. templateResult: function (state) {
  188. var html = "<div>";
  189. html += "<strong>姓名:" + state.text + "</strong>(" + state.userName + ")<br/>";
  190. html += "单位:" + state.orgName;
  191. html += "</div>";
  192. return $(html);
  193. }
  194. });
  195. $("#" + id).on("select2-clearing",function(e){
  196. //alert(true);
  197. });
  198. if(userId!=null && userId.length>0){
  199. var ids = userId.split(",");
  200. var names = userName.split(",");
  201. $('option', $("#" + id)).remove();
  202. for(var i=0;i<ids.length;i++){
  203. if(ids[i] != ""){
  204. $("#" + id).append(new Option(names[i],ids[i], false, false));//第一个参数时id,第二个参数是text
  205. }
  206. }
  207. $($("#" + id)).val(ids).trigger('change');
  208. }
  209. else{
  210. $('option', $("#" + id)).remove();
  211. $($("#" + id)).val(null).trigger('change');
  212. }
  213. }
  214. function getParkList(parkId){
  215. $.post(path + "/park/allList",function(json){
  216. if(json.result){
  217. $.each(json.data,function(index,obj){
  218. if(parkId!=""){
  219. if(obj.parkId==parkId){
  220. $("#parkId").append("<option value='"+obj.parkId+"' selected>"+obj.title+"</option>")
  221. }else{
  222. $("#parkId").append("<option value='"+obj.parkId+"'>"+obj.title+"</option>")
  223. }
  224. }
  225. else{
  226. $("#parkId").append("<option value='"+obj.parkId+"'>"+obj.title+"</option>")
  227. }
  228. })
  229. }
  230. else{
  231. layer.msg(json.message);
  232. }
  233. },"json")
  234. }
  235. function loadFile(fileList){
  236. if(fileList.length > 0){
  237. $("#thelist").append('<h4 class="info">已上传附件</h4>');
  238. for(var i=0;i<fileList.length;i++){
  239. $("#thelist").append( '<div id="' + fileList[i].fileId + '" class="item">' +
  240. '<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>' +
  241. '<a href="javacript:void(0);" onclick=delFile("' + fileList[i].fileId + '")>删除</a>' +
  242. '</h6>' +
  243. '</div>' );
  244. }
  245. }
  246. }
  247. function delFile(fileId){
  248. layer.confirm("是否删除?",{
  249. btns:["是","否"]
  250. },function(){
  251. $.post(path + "/projectFile/deleteReturnFile/" + fileId,null,function(json){
  252. if(json.result){
  253. layer.msg("删除成功!",{icon:1,time:2000});
  254. var fileList = json.data.fileList;
  255. $("#thelist").empty();
  256. if(fileList.length > 0){
  257. $("#thelist").append('<h4 class="info">已上传附件</h4>');
  258. for(var i=0;i<fileList.length;i++){
  259. $("#thelist").append( '<div id="' + fileList[i].fileId + '" class="item">' +
  260. '<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>' +
  261. '<a href="javacript:void(0);" onclick=delFile("' + fileList[i].fileId + '")>删除</a>' +
  262. '</h6>' +
  263. '</div>' );
  264. }
  265. }
  266. }
  267. else{
  268. layer.msg("删除失败!" + json.message);
  269. }
  270. });
  271. });
  272. }
  273. </script>
  274. <!--/请在上方写此页面业务相关的脚本-->
  275. </body>
  276. </html>