index.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!DOCTYPE html>
  2. <!--
  3. To change this license header, choose License Headers in Project Properties.
  4. To change this template file, choose Tools | Templates
  5. and open the template in the editor.
  6. -->
  7. <html>
  8. <head>
  9. <title>审核单位设置</title>
  10. <meta charset="UTF-8">
  11. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  12. <script src="/static/js/jquery.min.js"></script>
  13. <style>
  14. *{margin:0;padding:0;transition:background-color .25s ease;}
  15. body{color:#434343;}
  16. .content{width:1210px;margin:0 auto;padding:20px;}
  17. table{border-collapse:collapse;}
  18. td,th{border:1px solid #ddd;padding:5px 5px;text-align:center;}
  19. td:nth-child(3){text-align:left;}
  20. tr:hover{background:#e0edff}
  21. select{background:#fff;border:1px solid #ddd;padding:5px;}
  22. input[type=checkbox]{width:30px;height:30px;cursor:pointer;}
  23. .btnBox{width:1210px;position:fixed;bottom:0;left:50%;margin-left:-605px;}
  24. #submit{width:100px;height:40px;border:none;background:#078ef0;;color:#fff;float:right;box-shadow:2px 2px 1px #ddd;margin:0 15px 15px 0;}
  25. </style>
  26. </head>
  27. <body>
  28. <div class="content">
  29. <div style="text-align:right;color:#ac0835;padding:5px;">设置单位:{$company.name}</div>
  30. <table>
  31. <thead>
  32. <tr>
  33. <th width="15%">人才层次
  34. <select id="level" onchange="Policy.levelChange(event);" autocomplete="off">
  35. <option value="1">一</option>
  36. <option value="2">二</option>
  37. <option value="3">三</option>
  38. <option value="4">四</option>
  39. <option value="5">五</option>
  40. <option value="6">六</option>
  41. <option value="7">七</option>
  42. <option value="">全部</option>
  43. </select>
  44. </th>
  45. <th width="15%">标签</th>
  46. <th width="30%">人才认定标准</th>
  47. <th width="5%">选择</th>
  48. <th width="35%">附件清单(请填写上传人才认定标准佐证材料清单,多个材料请换行填报)</th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. {volist name="policys" id="policy"}
  53. <tr data-level="{$policy.level}" {gt name="policy.level" value="1"}style="display:none;"{/gt}>
  54. <td>{$policy.level}</td>
  55. <td>{$policy.tag}</td>
  56. <td>{$policy.policy_name}</td>
  57. <td><input type="checkbox" data-id="{$policy.id}" {if condition="$policy['checked']"}checked="checked"{/if} autocomplete="off"></td>
  58. <td>
  59. <textarea class="files" style="width:100%;height:100%;" placeholder="一个材料清单一行,多个请换行" autocomplete="off">{$policy.files}</textarea>
  60. </td>
  61. </tr>
  62. {/volist}
  63. </tbody>
  64. </table>
  65. <div class="btnBox">
  66. <button type="button" id="submit">提交</button>
  67. </div>
  68. </div
  69. </body>
  70. <script>
  71. $(document).ready(function () {
  72. var lock = false;
  73. $("#submit").click(function () {
  74. lock = true;
  75. if (lock) {
  76. var data = [];
  77. var selLvl = $("#level").val();
  78. if (selLvl) {
  79. lines = $("tbody tr[data-level='" + selLvl + "']");
  80. } else {
  81. lines = $("tbody tr[data-level]");
  82. }
  83. var chks = 0;
  84. for (var i = 0; i < lines.length; i++) {
  85. let line = lines.eq(i);
  86. let d = {};
  87. d.id = line.find("[data-id]").data("id");
  88. d.checked = line.find("[data-id]").is(":checked") ? 1 : 2;
  89. d.files = line.find("textarea.files").val();
  90. data.push(d);
  91. chks += d.checked == 1 ? 1 : 0;
  92. }
  93. if (confirm("确定提交当前页面共" + data.length + "条(勾选" + chks + "条)人才认定标准?")) {
  94. $.ajax({
  95. url: "/admin/policy/submit",
  96. type: "post",
  97. data: {data: data},
  98. success: function (res) {
  99. alert(res.msg);
  100. lock = false;
  101. }
  102. })
  103. }
  104. }
  105. })
  106. $("input[type=checkbox]").change(function () {
  107. if ($(this).is(":checked") == false) {
  108. $(this).parents("tr").find("textarea").val("");
  109. }
  110. /*var data = {};
  111. data.id = $(this).data("id");
  112. data.checked = 2;
  113. if ($(this).is(":checked")) {
  114. data.checked = 1;
  115. }
  116. $.ajax({
  117. url: "/admin/policy/checked",
  118. type: "post",
  119. data: data,
  120. success: function (res) {
  121. if (res.code != 200)
  122. alert(res.msg);
  123. }
  124. })*/
  125. })
  126. })
  127. var Policy = {};
  128. Policy.levelChange = function (e) {
  129. var that = e.target;
  130. var selLvl = $(that).val();
  131. if (selLvl) {
  132. $("tbody tr[data-level!='" + selLvl + "']").css("display", "none");
  133. $("tbody tr[data-level='" + selLvl + "']").css("display", "table-row");
  134. } else {
  135. $("tbody tr[data-level]").css("display", "table-row");
  136. }
  137. }
  138. </script>
  139. </html>