商丘12345 前端

AnnDatil.html 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. <script src="../js/laydate/laydate.js"></script>
  8. <link rel="stylesheet" href="../css/init.css" />
  9. <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
  10. <title>详情</title>
  11. <style>
  12. .BiaoTi{
  13. width: 100%;
  14. border-color:#ccc ;
  15. border:1px solid #ccc;
  16. }
  17. textarea{
  18. border-color:#ccc ;
  19. border:1px solid #ccc;
  20. height: 100px;
  21. }
  22. .xl {
  23. display: inline-block;
  24. background: url(../img/dropDown.png) no-repeat;
  25. height: 100%;
  26. background-position: center center;
  27. width: 20px;
  28. position: absolute;
  29. right: 0;
  30. top: 0px;
  31. /* background-color: #f7bc8b; */
  32. cursor: pointer;
  33. }
  34. ul.ztree {
  35. /*margin-top: 10px;*/
  36. width: 161px;
  37. /*overflow-y: scroll;
  38. overflow-x: auto;*/
  39. }
  40. #organizer {
  41. height: 25px;
  42. width: 170px;
  43. display: inline-block;
  44. position: relative;
  45. height: 135px;
  46. overflow: hidden;
  47. }
  48. #menuContent {
  49. background: #fff;
  50. position: absolute;
  51. width: 100%;
  52. border: 1px solid #ccc;
  53. right: 0;
  54. top: 0;
  55. z-index: 10;
  56. /*display: none;*/
  57. overflow-y: auto;
  58. height: 100%;
  59. }
  60. .ztree li span {
  61. line-height: 16px;
  62. margin-right: 2px;
  63. padding: 0;
  64. border: none;
  65. }
  66. .Common{
  67. overflow-y:initial
  68. }
  69. .time-box{
  70. position: relative;
  71. padding-left: 0;
  72. }
  73. i.tub {
  74. position: absolute;
  75. right: 26px;
  76. top: 8px;
  77. font-size: 18px;
  78. color: #00a0ca;
  79. }
  80. </style>
  81. </head>
  82. <body>
  83. <div class="Common">
  84. <table >
  85. <tr>
  86. <th>标题:</th>
  87. <td>
  88. <input class="BiaoTi" id="title" type="text" style="" />
  89. </td>
  90. </tr>
  91. <tr>
  92. <th >有效期:</th>
  93. <td >
  94. <div class="col-md-6 time-box">
  95. <i class="tub fa fa-calendar"></i>
  96. <input class="form-control" type="text" id="greetingTimes">
  97. </div>
  98. </td>
  99. </tr>
  100. <tr>
  101. <th>角色:</th>
  102. <td>
  103. <div class="inpBox" id="organizer">
  104. <!--<input id="citySel" class="inps" readonly />-->
  105. <input type="hidden" id="OPID" />
  106. <!--<i class="xl xl_one" id="xl_one"></i>-->
  107. <div id="menuContent" class="menuContent">
  108. <ul id="treeDemo" class="ztree">
  109. </ul>
  110. </div>
  111. </div>
  112. </td>
  113. </tr>
  114. <tr>
  115. <th >内容:</th>
  116. <td colspan="2">
  117. <textarea data-adaptheight id="content" name="" rows="" cols=""></textarea>
  118. </td>
  119. </tr>
  120. </table>
  121. <div class="btn_box">
  122. <button class="btns">保存</button>
  123. </div>
  124. </div>
  125. <script src="../js/adjustHeight.js"></script>
  126. <!--<script src="../css/laydate/laydate.js"></script>-->
  127. <script src="../js/zTree/jquery.ztree.core.js"></script>
  128. <script src="../js/zTree/jquery.ztree.excheck.min.js"></script>
  129. <script >
  130. laydate.render({
  131. elem: '#greetingTimes',
  132. range: '~',
  133. // type: 'datetime',
  134. //max : 31,
  135. min: 0,
  136. theme: '#00a1cb',
  137. });
  138. // $('.inps').focus(function() {
  139. // $('#menuContent').css('display', 'block')
  140. // })
  141. // $('#menuContent').mouseleave(function() {
  142. // $(this).css('display', 'none')
  143. // })
  144. var wid = helper.request.queryString("wid");
  145. $(document).ready(function(){
  146. $(".btns").click(function(){
  147. if(!$("#title").val()){
  148. layer.msg("输入标题");
  149. }
  150. else if(!$("#greetingTimes").val()){
  151. layer.msg("输入选择日期");
  152. }else{
  153. var ztree = $.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true);
  154. console.log(ztree);
  155. var app = [];
  156. var app2=[];
  157. var user;
  158. var role;
  159. if(ztree.length > 0) {
  160. var Id=[];
  161. $.each(ztree, function(i, n) {
  162. if(n.F_Pid==0){
  163. Id.push(n.F_Id);
  164. }else{
  165. app.push(n.F_Id);
  166. }
  167. app2=Id;
  168. });
  169. user=app.join(',');
  170. role=app2.join(',')
  171. }
  172. Add(user,role)
  173. }
  174. })
  175. if(wid){
  176. $.getJSON(huayi.config.callcenter_url + 'Notice/GetNotice', {
  177. noticeid: wid,
  178. "token": $.cookie("token")
  179. },function(result){
  180. if(result.state.toLowerCase() == "success"){
  181. $("#title").val(result.data.F_Title);
  182. $("#content").val(result.data.F_Content);
  183. $('#greetingTimes').val(result.data.F_StartDate+' ~ '+result.data.F_EndDate);
  184. $('#role').val(result.data.F_RoleId);
  185. $("#zx").val(result.data.F_UserId);
  186. console.log(result.data);
  187. }
  188. });
  189. }
  190. })
  191. ////获取下拉框
  192. // $.getJSON(huayi.config.callcenter_url + "Notice/GetRoleList", {
  193. // "token": $.cookie("token")
  194. // }, function(result) {
  195. // if(result.state.toLowerCase() == "success") {
  196. // goodslist = result.data;
  197. // bindseat($("#role"));
  198. // }
  199. // });
  200. function Add(user,role){
  201. $.post(huayi.config.callcenter_url + "Notice/EditNotice", {
  202. title:$("#title").val(),
  203. content:$("#content").val(),
  204. stime: $('#greetingTimes').val() && $('#greetingTimes').val().split('~')[0],//开始时间
  205. etime:$('#greetingTimes').val() && $('#greetingTimes').val().split('~')[1],//结束时间
  206. nid:wid,
  207. userid:user,
  208. roleid:role,
  209. token: $.cookie("token")
  210. }, function(result) {
  211. result = JSON.parse(result);
  212. if(result.state.toLowerCase() == "success") {
  213. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  214. parent.layer.close(index); //再执行关闭
  215. parent.initTable();
  216. parent.layer.msg("修改成功");
  217. }
  218. })
  219. }
  220. var saveArr = []
  221. tree(saveArr);
  222. $("#xl_one").click(function() {
  223. $(this).parent().find(".menuContent").toggle();
  224. });
  225. $("#xl_ones").click(function() {
  226. $(this).parent().find(".menuContent").toggle();
  227. });
  228. //树形结构 所有角色
  229. function tree(saveArr) {
  230. $.get(huayi.config.callcenter_url + 'Notice/GetRoleUsersList', {
  231. "token": $.cookie("token"),
  232. noticeid: wid,
  233. }, function(result) {
  234. result = $.parseJSON(result);
  235. $(result.data).each(function(i, n) {
  236. if(n.F_ischeck == 1) {
  237. n.checked = "true";
  238. }
  239. })
  240. console.log(result);
  241. $.fn.zTree.init($("#treeDemo"), setting, result.data);
  242. });
  243. }
  244. var setting = {
  245. check: {
  246. enable: true,
  247. // chkboxType: {"Y":"", "N":""},
  248. },
  249. data: {
  250. key: {
  251. name: "F_Name"
  252. },
  253. simpleData: {
  254. enable: true,
  255. idKey: "F_Id",
  256. pIdKey: "F_Pid",
  257. rootPId: 0
  258. }
  259. },
  260. callback: {
  261. onCheck: zTreeOnClick
  262. }
  263. };
  264. function zTreeOnClick(event, treeId, treeNode) {
  265. var name = treeNode.name;
  266. // var c="";
  267. // for(var i=0;i<nodes.length;i++){
  268. // if(nodes[i].isParent!=true){
  269. // c+=nodes[i].id+",";
  270. // console.log(c);
  271. // }
  272. // }
  273. };
  274. function zTreeOnClick(e, treeId, treeNode) {
  275. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  276. nodes = zTree.getCheckedNodes(true);
  277. console.log(treeNode)
  278. var v = "",
  279. opid = '';
  280. for(var i = 0, l = nodes.length; i < l; i++) {
  281. v += nodes[i].F_Name + ",";
  282. console.log(v);
  283. opid += nodes[i].F_DeptId + ","
  284. }
  285. if(v.length > 0) v = v.substring(0, v.length - 1);
  286. var cityObj = $("#citySel");
  287. cityObj.val(v);
  288. $("#citySel").val(v);
  289. console.log(opid);
  290. if(opid.length > 0) opid = opid.substring(0, opid.length - 1);
  291. $('#OPID').attr("value", opid);
  292. $('#OPIDs').attr("value", opid);
  293. }
  294. </script>
  295. </body>
  296. </html>