睢县12345_前端

AnnDatil.html 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="../Script/Common/huayi.load.js"></script>
  6. <script src="../Script/Common/huayi.config.js"></script>
  7. <link href="../css/layer/need/layer.css" />
  8. <link rel="stylesheet" href="../css/init.css" />
  9. <title>详情</title>
  10. <style>
  11. .BiaoTi{
  12. width: 100%;
  13. border-color:#ccc ;
  14. border:1px solid #ccc;
  15. }
  16. textarea{
  17. border-color:#ccc ;
  18. border:1px solid #ccc;
  19. height: 100px;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div class="Common">
  25. <table >
  26. <tr>
  27. <th>标题:</th>
  28. <td>
  29. <input class="BiaoTi" id="title" type="text" style="" />
  30. </td>
  31. </tr>
  32. <tr>
  33. <th >有效期:</th>
  34. <td >
  35. <div class="time-box form-group" style="width: 230px;">
  36. <i class="tub fa fa-calendar"></i>
  37. <input class="form-control" type="text" id="startTime" placeholder="有效期">
  38. </div>
  39. </td>
  40. </td>
  41. </tr>
  42. <tr>
  43. <th>角色:</th>
  44. <td>
  45. <select name="" id="role" class="select_"></select>
  46. <select name="" id="zx" class="select_"></select>
  47. </td>
  48. </tr>
  49. <tr>
  50. <th >内容:</th>
  51. <td colspan="2">
  52. <textarea data-adaptheight id="content" name="" rows="" cols=""></textarea>
  53. </td>
  54. </tr>
  55. </table>
  56. <div class="btn_box">
  57. <button class="btns">保存</button>
  58. </div>
  59. </div>
  60. <script src="../js/adjustHeight.js"></script>
  61. <script src="../js/laydate/laydate.js"></script>
  62. <script >
  63. laydate.render({
  64. elem: '#startTime',
  65. range: '~',
  66. theme: '#00a1cb',
  67. });
  68. var wid = helper.request.queryString("wid");
  69. $(document).ready(function(){
  70. $(".btns").click(function(){
  71. if(!$("#title").val()){
  72. layer.msg("输入标题");
  73. }if(!$("#startTime").val()){
  74. layer.msg("请选择日期");
  75. }
  76. var user=$("#zx").val();
  77. var role=$('#role').val();
  78. Add(user,role)
  79. })
  80. if(wid){
  81. $.getJSON(huayi.config.callcenter_url + 'Notice/GetNotice', {
  82. noticeid: wid,
  83. "token": $.cookie("token")
  84. },function(result){
  85. if(result.state.toLowerCase() == "success"){
  86. $("#title").val(result.data.F_Title);
  87. $("#content").val(result.data.F_Content);
  88. // $('#startTime').val(result.data.F_StartDate);
  89. // $('#endTime').val(result.data.F_EndDate);
  90. $('#startTime').val(result.data.F_StartDate +" ~ " +result.data.F_EndDate);
  91. $('#role').val(result.data.F_RoleId);
  92. $("#zx").val(result.data.F_UserId);
  93. console.log(result.data);
  94. }
  95. });
  96. }
  97. })
  98. //获取下拉框
  99. $.getJSON(huayi.config.callcenter_url + "Notice/GetRoleList", {
  100. "token": $.cookie("token")
  101. }, function(result) {
  102. if(result.state.toLowerCase() == "success") {
  103. goodslist = result.data;
  104. bindseat($("#role"));
  105. }
  106. });
  107. //下拉框
  108. function bindseat(obj) {
  109. obj.empty();
  110. obj.append('<option value="0" selected="selected">所有角色</option>');
  111. $(goodslist).each(function(i, n) {
  112. obj.append('<option value="' + n.F_RoleId + '">' + n.F_RoleName + '</option>');
  113. })
  114. }
  115. $.getJSON(huayi.config.callcenter_url + "Notice/GetUserListByRoleId", {
  116. "token":$.cookie("token"),"roleid":0
  117. }, function(result) {
  118. if(result.state.toLowerCase() == "success") {
  119. goodslist = result.data;
  120. bindZX($("#zx"));
  121. }
  122. });
  123. function bindZX(obj) {
  124. obj.empty();
  125. obj.append('<option value="0" selected="selected">所有人</option>');
  126. $(goodslist).each(function(i, n) {
  127. obj.append('<option value="' + n.F_UserId + '">' + n.F_UserCode + '</option>');
  128. })
  129. }
  130. $("#role").change(function(){
  131. var pid=$(this).val();
  132. $.getJSON(huayi.config.callcenter_url + "Notice/GetUserListByRoleId", {
  133. "token":$.cookie("token"),"roleid":pid
  134. }, function(result) {
  135. if(result.state.toLowerCase() == "success") {
  136. goodslist = result.data;
  137. bindZX($("#zx"));
  138. }
  139. });
  140. })
  141. function Add(user,role){
  142. $.post(huayi.config.callcenter_url + "Notice/EditNotice", {
  143. title:$("#title").val(),
  144. content:$("#content").val(),
  145. stime:$('#startTime').val() && $('#startTime').val().split('~')[0],
  146. etime:$('#startTime').val() && $('#startTime').val().split('~')[1],
  147. nid:wid,
  148. userid:user,
  149. roleid:role,
  150. token: $.cookie("token")
  151. }, function(result) {
  152. result = JSON.parse(result);
  153. if(result.state.toLowerCase() == "success") {
  154. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  155. parent.layer.close(index); //再执行关闭
  156. parent.initTable();
  157. parent.layer.msg("修改成功");
  158. }
  159. })
  160. }
  161. </script>
  162. </body>
  163. </html>