project_edit.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>编辑项目名称</title>
  7. </head>
  8. <body layout:fragment="content">
  9. <article class="page-container">
  10. <form class="form form-horizontal" id="form-project-edit">
  11. <input type="hidden" class="input-text" required th:value="${project.id}" th:id="project_id" th:name="id"/>
  12. <!--<div class="row cl">
  13. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目大类:</label>
  14. <div class="formControls col-xs-8 col-sm-9">
  15. <span class="select-box">
  16. <select class="select" th:name="project_super_type" id="project_super_type" required onchange="changeSuperType()">
  17. <option value="" >&#45;&#45; 请选择项目大类 &#45;&#45;</option>
  18. <option th:each="item : ${projectSuperTypeList}" th:value="${item.value}"
  19. th:text="${item.name}" th:selected = "${project.project_super_type}==${item.value}">
  20. </option>
  21. </select>
  22. </span>
  23. </div>
  24. </div>-->
  25. <div class="row cl">
  26. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>年份:</label>
  27. <div class="formControls col-xs-8 col-sm-9">
  28. <!--<input type="text" class="input-text" required th:value="${project.project_year}" th:id="project_year" th:name="project_year"/>-->
  29. <span class="select-box">
  30. <select class="select" th:name="project_year" id="project_year" required>
  31. </select>
  32. </span>
  33. </div>
  34. </div>
  35. <div class="row cl">
  36. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目大类:</label>
  37. <div class="formControls col-xs-8 col-sm-9">
  38. <span class="select-box">
  39. <select class="select" th:name="project_type" id="project_type" required>
  40. <option value="" >-- 请选择项目类别 --</option>
  41. <option th:each="item : ${projectTypeList}" th:value="${item.id}"
  42. th:text="${item.type_name}" th:selected = "${project.project_type}==${item.id}">
  43. </option>
  44. </select>
  45. </span>
  46. </div>
  47. </div>
  48. <div class="row cl">
  49. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>项目小类:</label>
  50. <div class="formControls col-xs-8 col-sm-9">
  51. <input type="text" class="input-text" required th:value="${project.project_name}" th:id="project_name" th:name="project_name"/>
  52. </div>
  53. </div>
  54. <div class="row cl">
  55. <label class="form-label col-xs-4 col-sm-2">互斥类:</label>
  56. <div class="formControls col-xs-8 col-sm-9">
  57. <span class="select-box">
  58. <select class="select" th:name="mutex" id="mutex" >
  59. <option value="" >-- 请选择互斥类 --</option>
  60. <option th:each="item : ${mutexList}" th:value="${item.value}"
  61. th:text="${item.name}" th:selected = "${project.mutex}==${item.value}" >
  62. </option>
  63. </select>
  64. </span>
  65. </div>
  66. </div>
  67. <div class="row cl">
  68. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span><span>技改类:</span></label>
  69. <div class="formControls col-xs-8 col-sm-9">
  70. <input type="radio" name="is_technical" th:checked="${project.is_technical}==true" value="1">是</input>
  71. <input type="radio" name="is_technical" th:checked="${project.is_technical}==false" value="0">否</input>
  72. </div>
  73. </div>
  74. <div class="row cl">
  75. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span><span>申请类:</span></label>
  76. <div class="formControls col-xs-8 col-sm-9">
  77. <input type="radio" name="is_application" th:checked="${project.is_application}==true" value="1">是</input>
  78. <input type="radio" name="is_application" th:checked="${project.is_application}==false" value="0">否</input>
  79. </div>
  80. </div>
  81. <div class="row cl">
  82. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>责任单位:</label>
  83. <div class="formControls col-xs-8 col-sm-9">
  84. <span class="select-box">
  85. <select class="select" th:name="department_id" id="department_id" required>
  86. <option value="" >-- 请选择责任单位 --</option>
  87. <option th:each="item : ${departmentList}" th:value="${item.id}"
  88. th:text="${item.name}" th:selected = "${project.department_id}==${item.id}">
  89. </option>
  90. </select>
  91. </span>
  92. </div>
  93. </div>
  94. <div class="row cl">
  95. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  96. <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i>保存</button>
  97. <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>
  98. </div>
  99. </div>
  100. </form>
  101. </article>
  102. <script type="text/javascript" th:src="@{/js/government/project/project_edit.js}"></script>
  103. <script th:inline="javascript">
  104. onload = function ()
  105. {
  106. var year=new Date().getFullYear(); //获取当前年份
  107. var sel = document.getElementById ('project_year');//获取select下拉列表
  108. for ( var i = 2018; i < year+3; i++)//循环添加2006到当前年份加3年的每个年份依次添加到下拉列表
  109. {
  110. var option = document.createElement ('option');
  111. option.value = i;
  112. var txt = document.createTextNode (i);
  113. option.appendChild (txt);
  114. sel.appendChild (option);
  115. }
  116. var selectYear = [[${project.project_year}]];
  117. $("#project_year").find("option:contains('"+selectYear+"')").attr("selected",true);
  118. };
  119. /**
  120. * 取消
  121. */
  122. function removeIframe() {
  123. var index = parent.layer.getFrameIndex(window.name);
  124. parent.layer.close(index);
  125. }
  126. function changeSuperType(){
  127. $.ajax({
  128. url :pagePath+"/project/getProjectTypeBySuper",
  129. type : "get",
  130. data : {
  131. 'superType': $("#project_super_type").val()
  132. },
  133. dataType : "json",
  134. success: function (result) {
  135. if (result.success) {
  136. var types = result.obj;
  137. if(types.length>0){
  138. $("#project_type").find("option").remove();
  139. var options = '';
  140. for(var i=0;i< types.length;i++){
  141. options += '<option value="'+types[i].id+'" >'+types[i].type_name+'</option>';
  142. }
  143. $("#project_type").append(options);
  144. }
  145. } else {
  146. errorMessage(result.message);
  147. }
  148. },
  149. error: function () {
  150. errorMessage('系统错误!');
  151. }
  152. });
  153. }
  154. </script>
  155. </body>
  156. </html>