Keine Beschreibung

AnnDatil.html 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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. .common {
  81. width: 100%;
  82. background: #fff;
  83. text-align: center;
  84. padding: 10px 15px;
  85. height: auto;
  86. overflow-y: initial;
  87. }
  88. .common table {
  89. width: 100%;
  90. }
  91. .common table th {
  92. padding: 5px 8px 5px 0;
  93. text-align: right;
  94. width: 20%;
  95. }
  96. .common table td {
  97. padding: 6px 0 5px 10px;
  98. text-align: left;
  99. color: #717171;
  100. line-height: 200%;
  101. }
  102. .common table td textarea {
  103. width: 100%;
  104. vertical-align: middle;
  105. resize: none;
  106. outline: none;
  107. }
  108. </style>
  109. </head>
  110. <body>
  111. <div class="common">
  112. <table>
  113. <tr>
  114. <th>标题:</th>
  115. <td>
  116. <input class="BiaoTi" id="title" type="text" style="" />
  117. </td>
  118. </tr>
  119. <tr>
  120. <th>有效期:</th>
  121. <td>
  122. <div class="col-md-6 time-box">
  123. <i class="tub fa fa-calendar"></i>
  124. <input class="form-control" type="text" id="greetingTimes">
  125. </div>
  126. </td>
  127. </tr>
  128. <tr>
  129. <th>角色:</th>
  130. <td>
  131. <div class="inpBox" id="organizer">
  132. <!--<input id="citySel" class="inps" readonly />-->
  133. <input type="hidden" id="OPID" />
  134. <!--<i class="xl xl_one" id="xl_one"></i>-->
  135. <div id="menuContent" class="menuContent">
  136. <ul id="treeDemo" class="ztree"></ul>
  137. </div>
  138. </div>
  139. </td>
  140. </tr>
  141. <tr>
  142. <th>内容:</th>
  143. <td colspan="2">
  144. <textarea data-adaptheight id="content" name="" rows="" cols=""></textarea>
  145. </td>
  146. </tr>
  147. </table>
  148. <div class="btn_box">
  149. <button class="btns">保存</button>
  150. </div>
  151. </div>
  152. <script src="../js/adjustHeight.js"></script>
  153. <!--<script src="../css/laydate/laydate.js"></script>-->
  154. <script src="../js/zTree/jquery.ztree.core.js"></script>
  155. <script src="../js/zTree/jquery.ztree.excheck.min.js"></script>
  156. <script src="../js/kindeditor/kindeditor-all-min.js"></script>
  157. <script src="../js/kindeditor/lang/zh-CN.js"></script>
  158. <script>
  159. laydate.render({
  160. elem: '#greetingTimes',
  161. range: '~',
  162. // type: 'datetime',
  163. //max : 31,
  164. min: 0,
  165. theme: '#00a1cb',
  166. });
  167. // $('.inps').focus(function() {
  168. // $('#menuContent').css('display', 'block')
  169. // })
  170. // $('#menuContent').mouseleave(function() {
  171. // $(this).css('display', 'none')
  172. // })
  173. var wid = helper.request.queryString("wid");
  174. $(document).ready(function () {
  175. //编辑器配置
  176. KindEditor.ready(function (K) {
  177. window.editor = K.create('#content', {
  178. //urlType: 'domain',
  179. imgMaxSize: 10 * 1024 * 1024,
  180. uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
  181. fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
  182. allowFileManager: true
  183. }); //添加弹出框编辑器
  184. });
  185. $(".btns").click(function () {
  186. if (!$("#title").val()) {
  187. layer.msg("输入标题");
  188. } else if ($.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true).length <= 0) {
  189. layer.msg("请选择角色");
  190. } else if (!$("#greetingTimes").val()) {
  191. layer.msg("输入选择日期");
  192. } else {
  193. var ztree = $.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true);
  194. console.log(ztree);
  195. var app = [];
  196. var app2 = [];
  197. var user;
  198. var role;
  199. if (ztree.length > 0) {
  200. var Id = [];
  201. $.each(ztree, function (i, n) {
  202. if (n.F_Pid == 0) {
  203. Id.push(n.F_Id);
  204. } else {
  205. app.push(n.F_Id);
  206. }
  207. app2 = Id;
  208. });
  209. user = app.join(',');
  210. role = app2.join(',')
  211. }
  212. Add(user, role)
  213. }
  214. })
  215. if (wid) {
  216. $.getJSON(huayi.config.callcenter_url + 'Notice/GetNotice', {
  217. noticeid: wid,
  218. "token": $.cookie("token")
  219. }, function (result) {
  220. if (result.state.toLowerCase() == "success") {
  221. $("#title").val(result.data.F_Title);
  222. //$("#content").val(result.data.F_Content);
  223. $('#greetingTimes').val(result.data.F_StartDate + ' ~ ' + result.data
  224. .F_EndDate);
  225. $('#role').val(result.data.F_RoleId);
  226. $("#zx").val(result.data.F_UserId);
  227. editor.html(result.data.F_Content);
  228. }
  229. });
  230. }
  231. })
  232. ////获取下拉框
  233. // $.getJSON(huayi.config.callcenter_url + "Notice/GetRoleList", {
  234. // "token": $.cookie("token")
  235. // }, function(result) {
  236. // if(result.state.toLowerCase() == "success") {
  237. // goodslist = result.data;
  238. // bindseat($("#role"));
  239. // }
  240. // });
  241. function Add(user, role) {
  242. $.post(huayi.config.callcenter_url + "Notice/EditNotice", {
  243. title: $("#title").val(),
  244. //content: $("#content").val(),
  245. content: encodeURIComponent(editor.html()),
  246. stime: $('#greetingTimes').val() && $('#greetingTimes').val().split('~')[0], //开始时间
  247. etime: $('#greetingTimes').val() && $('#greetingTimes').val().split('~')[1], //结束时间
  248. nid: wid,
  249. userid: user,
  250. roleid: role,
  251. token: $.cookie("token")
  252. }, function (result) {
  253. result = JSON.parse(result);
  254. if (result.state.toLowerCase() == "success") {
  255. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  256. parent.layer.close(index); //再执行关闭
  257. parent.initTable();
  258. parent.layer.msg("修改成功");
  259. }
  260. })
  261. }
  262. var saveArr = []
  263. tree(saveArr);
  264. $("#xl_one").click(function () {
  265. $(this).parent().find(".menuContent").toggle();
  266. });
  267. $("#xl_ones").click(function () {
  268. $(this).parent().find(".menuContent").toggle();
  269. });
  270. //树形结构 所有角色
  271. function tree(saveArr) {
  272. $.get(huayi.config.callcenter_url + 'Notice/GetRoleUsersList', {
  273. "token": $.cookie("token"),
  274. noticeid: wid,
  275. }, function (result) {
  276. result = $.parseJSON(result);
  277. $(result.data).each(function (i, n) {
  278. if (n.F_ischeck == 1) {
  279. n.checked = "true";
  280. }
  281. })
  282. $.fn.zTree.init($("#treeDemo"), setting, result.data);
  283. });
  284. }
  285. var setting = {
  286. check: {
  287. enable: true,
  288. // chkboxType: {"Y":"", "N":""},
  289. },
  290. data: {
  291. key: {
  292. name: "F_Name"
  293. },
  294. simpleData: {
  295. enable: true,
  296. idKey: "F_Id",
  297. pIdKey: "F_Pid",
  298. rootPId: 0
  299. }
  300. },
  301. callback: {
  302. onCheck: zTreeOnClick
  303. }
  304. };
  305. function zTreeOnClick(event, treeId, treeNode) {
  306. var name = treeNode.name;
  307. // var c="";
  308. // for(var i=0;i<nodes.length;i++){
  309. // if(nodes[i].isParent!=true){
  310. // c+=nodes[i].id+",";
  311. // console.log(c);
  312. // }
  313. // }
  314. };
  315. function zTreeOnClick(e, treeId, treeNode) {
  316. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  317. nodes = zTree.getCheckedNodes(true);
  318. console.log(treeNode)
  319. var v = "",
  320. opid = '';
  321. for (var i = 0, l = nodes.length; i < l; i++) {
  322. v += nodes[i].F_Name + ",";
  323. console.log(v);
  324. opid += nodes[i].F_DeptId + ","
  325. }
  326. if (v.length > 0) v = v.substring(0, v.length - 1);
  327. var cityObj = $("#citySel");
  328. cityObj.val(v);
  329. $("#citySel").val(v);
  330. console.log(opid);
  331. if (opid.length > 0) opid = opid.substring(0, opid.length - 1);
  332. $('#OPID').attr("value", opid);
  333. $('#OPIDs').attr("value", opid);
  334. }
  335. </script>
  336. </body>
  337. </html>