updateItemForm.jsp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: user
  4. Date: 2019/8/19
  5. Time: 15:30
  6. To change this template use File | Settings | File Templates.
  7. --%>
  8. <%@ page contentType="text/html;charset=UTF-8" language="java" %>
  9. <%@ include file="/webpage/include/taglib.jsp"%>
  10. <html>
  11. <head>
  12. <title>修改</title>
  13. <link rel="stylesheet" href="${ctxp}/static/plugin/assets/layui/css/layui.css">
  14. <link rel="stylesheet" href="${ctxp}/static/plugin/assets/common.css"/>
  15. <script type="text/javascript" src="${ctxp}/static/plugin/assets/jquery-3.2.1.min.js"></script>
  16. <script src="${ctxp}/static/plugin/assets/layui/layui.js"></script>
  17. </head>
  18. <style>
  19. .layui-input{height: 28px;margin-top: 6px;/*background: whitesmoke;*/}
  20. .layui-form-label { float: left;display: block;padding: 9px 15px;width: 100px;font-weight: 400;line-height: 20px;text-align: right;}
  21. .layui-table-view .layui-table {width:100%}
  22. </style>
  23. <body>
  24. <c:if test="${ not empty list}">
  25. <c:forEach items="${list}" var="data" varStatus="index">
  26. <form id="updateForm">
  27. <div class="layui-form-item" style="margin-top: 10px;">
  28. <input name="id" value="${data.id}" hidden>
  29. <div class="layui-inline">
  30. <label class="layui-form-label">工程名称</label>
  31. <div class="layui-input-inline">
  32. <input type="text" name="projectName" autocomplete="off" class="layui-input" value="${data.projectName}">
  33. </div>
  34. </div>
  35. <div class="layui-inline">
  36. <label class="layui-form-label">创建时间</label>
  37. <div class="layui-input-inline">
  38. <input style=" background: whitesmoke;" type="text" name="beginUpdate" readonly="readonly" placeholder="yyyy-MM-dd" autocomplete="off"
  39. class="layui-input" value="<fmt:formatDate value="${data.createDate}" pattern="yyyy/MM/dd "/>">
  40. </div>
  41. </div>
  42. </div>
  43. </form>
  44. <div style="margin: 20px;">
  45. <fieldset class="layui-elem-field layui-field-title">
  46. <legend style="font-size: 15px;">结算书信息</legend>
  47. </fieldset>
  48. <table class="layui-hide" id="updatetable" lay-filter="updatetable"></table>
  49. </div>
  50. <input id="updatebtn" type="button" onclick="updateProject()" style="display: none" />
  51. <script>
  52. layui.use(['table','form','layedit', 'laydate'], function(){
  53. var table = layui.table
  54. ,form = layui.form
  55. ,laydate = layui.laydate;
  56. laydate.render({
  57. elem: '#beginUpdate'
  58. });
  59. laydate.render({
  60. elem: '#endUpdate'
  61. });
  62. //日期
  63. form.render();
  64. table.render({
  65. elem: '#updatetable'
  66. ,cols: [[
  67. {field:'xmmc',title:'结算书名称'}
  68. ,{field:'sgdw',title:'供应商'}
  69. ,{field:'xmlx',title:'结算书类型'}
  70. ,{field:'xmbh',title:'结算书编号'}
  71. ,{field:'op',align:'center',title:"操作",width:100,templet:function(d){
  72. ////对操作进行初始化
  73. var xml = "<a class='layui-btn layui-btn-xs' style='margin-top: 3px' onclick=\"view( '" + d.id +" ','" + d.type + "')\">编辑</a>";
  74. return xml;
  75. }}
  76. ]]
  77. ,data:[
  78. <c:if test="${ not empty data.wbsItems}">
  79. <c:forEach items="${data.wbsItems}" var="data1" varStatus="index">
  80. {
  81. "id":"${data1.id}",
  82. "type":"${data1.type}",
  83. "xmmc": "${data1.itemName}",
  84. "sgdw": "${data1.unit}",
  85. "xmlx":<c:if test="${data1.type eq '1'}">"架空线路"</c:if><c:if test="${data1.type eq '2'}">"电缆线路"</c:if><c:if test="${data1.type eq '3'}">"变电站工程"</c:if>,
  86. "xmbh":"${data1.itemNo}"
  87. },
  88. </c:forEach>
  89. </c:if>
  90. ]
  91. ,page: true
  92. });
  93. table.on('tool(updatetable)', function(obj){
  94. var data = obj.data;
  95. //console.log(obj)
  96. if(obj.event == 'update'){
  97. // alert(data.id);
  98. }
  99. });
  100. });
  101. </script>
  102. <script>
  103. function updateProject(){
  104. $.ajax({
  105. type:"post",
  106. url:"${ctx}/project/save",
  107. // data:JSON.stringify({id:newid2,type:xmmc2,fee:fyje2}),
  108. data:$('#updateForm').serialize(),
  109. success:function(result){
  110. parent.location.reload();
  111. }
  112. });
  113. }
  114. function view(id,type) {
  115. var url = '${ctx}/jkxl/list?id='+id+'&type='+type;
  116. parent.location.href=url;
  117. }
  118. </script>
  119. </c:forEach>
  120. </c:if>
  121. </body>
  122. </html>