説明なし

AnnDatil.html 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  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"/>
  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 class="files-wrappper">
  142. <th class="Importent">附件:</th>
  143. <td colspan="5">
  144. <div class="fileBox"></div>
  145. <!--<span class="fjnr"></span>-->
  146. <input class="input" type="file" name="upFile" id="upFile" multiple="multiple"
  147. style="display: none" />
  148. <input class="input" type="button" value="上传" id="scwj" />
  149. <!--<input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />-->
  150. <input type="hidden" id="file" />
  151. <span style="color: #ff0000; border: none">
  152. (文件格式为png,jpg,mp4,mp3,pdf,doc,docx,xls,xlsx)
  153. </span>
  154. </td>
  155. </tr>
  156. <tr>
  157. <th>内容:</th>
  158. <td colspan="2">
  159. <textarea data-adaptheight id="content" name="" rows="" cols=""></textarea>
  160. </td>
  161. </tr>
  162. </table>
  163. <div class="btn_box">
  164. <button class="btns">保存</button>
  165. </div>
  166. </div>
  167. <script src="../js/adjustHeight.js"></script>
  168. <!--<script src="../css/laydate/laydate.js"></script>-->
  169. <script src="../js/zTree/jquery.ztree.core.js"></script>
  170. <script src="../js/zTree/jquery.ztree.excheck.min.js"></script>
  171. <script src="../js/kindeditor/kindeditor-all-min.js"></script>
  172. <script src="../js/kindeditor/lang/zh-CN.js"></script>
  173. <script src="../Script/Common/huayi.common.js"></script>
  174. <script>
  175. laydate.render({
  176. elem: '#greetingTimes',
  177. range: '~',
  178. // type: 'datetime',
  179. //max : 31,
  180. min: 0,
  181. theme: '#00a1cb',
  182. });
  183. // $('.inps').focus(function() {
  184. // $('#menuContent').css('display', 'block')
  185. // })
  186. // $('#menuContent').mouseleave(function() {
  187. // $(this).css('display', 'none')
  188. // })
  189. var wid = helper.request.queryString("wid");
  190. $(document).ready(function () {
  191. //编辑器配置
  192. KindEditor.ready(function (K) {
  193. window.editor = K.create('#content', {
  194. //urlType: 'domain',
  195. imgMaxSize: 10 * 1024 * 1024,
  196. uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
  197. fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
  198. allowFileManager: true
  199. }); //添加弹出框编辑器
  200. });
  201. $(".btns").click(function () {
  202. if (!$("#title").val()) {
  203. layer.msg("输入标题");
  204. } else if ($.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true).length <= 0) {
  205. layer.msg("请选择角色");
  206. } else if (!$("#greetingTimes").val()) {
  207. layer.msg("输入选择日期");
  208. } else {
  209. var ztree = $.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true);
  210. console.log(ztree);
  211. var app = [];
  212. var app2 = [];
  213. var user;
  214. var role;
  215. if (ztree.length > 0) {
  216. var Id = [];
  217. $.each(ztree, function (i, n) {
  218. if (n.F_Pid == 0) {
  219. Id.push(n.F_Id);
  220. } else {
  221. app.push(n.F_Id);
  222. }
  223. app2 = Id;
  224. });
  225. user = app.join(',');
  226. role = app2.join(',')
  227. }
  228. Add(user, role)
  229. }
  230. })
  231. setTimeout(function () {
  232. Detail()
  233. }, 1000)
  234. })
  235. function Detail() {
  236. if (wid) {
  237. // debugger
  238. $.ajax({
  239. type: "get",
  240. url: huayi.config.callcenter_url + 'Notice/GetNotice',
  241. dataType: 'json',
  242. async: false,
  243. data: {
  244. noticeid: wid,
  245. "token": $.cookie("token")
  246. },
  247. success: function (result) {
  248. debugger
  249. if (result.state.toLowerCase() == "success") {
  250. $("#title").val(result.data.F_Title);
  251. //$("#content").val(result.data.F_Content);
  252. $('#greetingTimes').val(result.data.F_StartDate + ' ~ ' + result.data
  253. .F_EndDate);
  254. $('#role').val(result.data.F_RoleId);
  255. $("#zx").val(result.data.F_UserId);
  256. editor.html(result.data.F_Content);
  257. var a = result.data.F_FilePath;
  258. $(a).each(function (i, n) {
  259. var strs =
  260. '<span class="files" fiel-num="' +
  261. n.F_FileId +
  262. '">' +
  263. n.F_FileName.substring(19) +
  264. '<i class="fa fa-remove del_file"></i></span>';
  265. $(strs)
  266. .appendTo($(".fileBox"))
  267. .find(".del_file")
  268. .click(function (event) {
  269. event.stopPropagation();
  270. $(this).parent().remove();
  271. file_num();
  272. });
  273. });
  274. file_num();
  275. }
  276. }
  277. })
  278. }
  279. }
  280. ////获取下拉框
  281. // $.getJSON(huayi.config.callcenter_url + "Notice/GetRoleList", {
  282. // "token": $.cookie("token")
  283. // }, function(result) {
  284. // if(result.state.toLowerCase() == "success") {
  285. // goodslist = result.data;
  286. // bindseat($("#role"));
  287. // }
  288. // });
  289. function Add(user, role) {
  290. $.post(huayi.config.callcenter_url + "Notice/EditNotice", {
  291. title: $("#title").val(),
  292. //content: $("#content").val(),
  293. content: encodeURIComponent(editor.html()),
  294. stime: $('#greetingTimes').val() && $('#greetingTimes').val().split('~')[0], //开始时间
  295. etime: $('#greetingTimes').val() && $('#greetingTimes').val().split('~')[1], //结束时间
  296. nid: wid,
  297. userid: user,
  298. roleid: role,
  299. file: $("#file").val(),
  300. token: $.cookie("token")
  301. }, function (result) {
  302. result = JSON.parse(result);
  303. if (result.state.toLowerCase() == "success") {
  304. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  305. parent.layer.close(index); //再执行关闭
  306. parent.initTable();
  307. parent.layer.msg("修改成功");
  308. }
  309. })
  310. }
  311. var saveArr = []
  312. tree(saveArr);
  313. $("#xl_one").click(function () {
  314. $(this).parent().find(".menuContent").toggle();
  315. });
  316. $("#xl_ones").click(function () {
  317. $(this).parent().find(".menuContent").toggle();
  318. });
  319. //树形结构 所有角色
  320. function tree(saveArr) {
  321. $.get(huayi.config.callcenter_url + 'Notice/GetRoleUsersList', {
  322. "token": $.cookie("token"),
  323. noticeid: wid,
  324. }, function (result) {
  325. result = $.parseJSON(result);
  326. $(result.data).each(function (i, n) {
  327. if (n.F_ischeck == 1) {
  328. n.checked = "true";
  329. }
  330. })
  331. $.fn.zTree.init($("#treeDemo"), setting, result.data);
  332. });
  333. }
  334. var setting = {
  335. check: {
  336. enable: true,
  337. // chkboxType: {"Y":"", "N":""},
  338. },
  339. data: {
  340. key: {
  341. name: "F_Name"
  342. },
  343. simpleData: {
  344. enable: true,
  345. idKey: "F_Id",
  346. pIdKey: "F_Pid",
  347. rootPId: 0
  348. }
  349. },
  350. callback: {
  351. onCheck: zTreeOnClick
  352. }
  353. };
  354. function zTreeOnClick(event, treeId, treeNode) {
  355. var name = treeNode.name;
  356. // var c="";
  357. // for(var i=0;i<nodes.length;i++){
  358. // if(nodes[i].isParent!=true){
  359. // c+=nodes[i].id+",";
  360. // console.log(c);
  361. // }
  362. // }
  363. };
  364. function zTreeOnClick(e, treeId, treeNode) {
  365. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  366. nodes = zTree.getCheckedNodes(true);
  367. console.log(treeNode)
  368. var v = "",
  369. opid = '';
  370. for (var i = 0, l = nodes.length; i < l; i++) {
  371. v += nodes[i].F_Name + ",";
  372. console.log(v);
  373. opid += nodes[i].F_DeptId + ","
  374. }
  375. if (v.length > 0) v = v.substring(0, v.length - 1);
  376. var cityObj = $("#citySel");
  377. cityObj.val(v);
  378. $("#citySel").val(v);
  379. console.log(opid);
  380. if (opid.length > 0) opid = opid.substring(0, opid.length - 1);
  381. $('#OPID').attr("value", opid);
  382. $('#OPIDs').attr("value", opid);
  383. }
  384. $("#scwj").click(function () {
  385. $("#upFile").trigger("click");
  386. });
  387. $("#upFile").change(function () {
  388. upload('upFile',".fileBox",['png','jpg','mp3','mp4','pdf','doc','docx','xls','xlsx'],'#file');
  389. });
  390. //上传文件
  391. // function upload() {
  392. // var Files = document.getElementById("upFile").files;
  393. // if (Files.length > 0) {
  394. // var formData = new FormData();
  395. // for (var i = 0; i < Files.length; i++) {
  396. // formData.append("file" + i, Files[i]);
  397. // }
  398. // formData.append("token", $.cookie("token"));
  399. // var typeName = Files[0].name.split(".")[Files[0].name.split(".").length-1];
  400. // if (
  401. // typeName == "png" ||
  402. // typeName == "jpg" ||
  403. // typeName == "mp4" ||
  404. // typeName == "mp3" ||
  405. // typeName == "pdf" ||
  406. // typeName == "doc" ||
  407. // typeName == "docx" ||
  408. // typeName == "xls" ||
  409. // typeName == "xlsx"
  410. // ) {
  411. // $.ajax({
  412. // url: huayi.config.callcenter_url +
  413. // "/WorkOrder/UploadFile",
  414. // type: "POST",
  415. // data: formData,
  416. // /**
  417. // *必须false才会自动加上正确的Content-Type
  418. // */
  419. // contentType: false,
  420. // /**
  421. // * 必须false才会避开jQuery对 formdata 的默认处理
  422. // * XMLHttpRequest会对 formdata 进行正确的处理
  423. // */
  424. // processData: false,
  425. // success: function (result) {
  426. // document.getElementById(
  427. // "upFile"
  428. // ).outerHTML = document.getElementById(
  429. // "upFile"
  430. // ).outerHTML;
  431. // $("#upFile").change(function () {
  432. // upload();
  433. // });
  434. // var r = $.parseJSON(result);
  435. // if (r.state.toLowerCase() == "success") {
  436. // $(".fjnr").text(r.data[0].F_FileName);
  437. // var a = r.data;
  438. // $(a).each(function (i, n) {
  439. // var strs =
  440. // '<span class="files" fiel-num="' +
  441. // n.F_FileId +
  442. // '">' +
  443. // n.F_FileName.substring(19) +
  444. // '<i class="fa fa-remove del_file"></i></span>';
  445. // $(strs)
  446. // .appendTo($(".fileBox"))
  447. // .find(".del_file")
  448. // .click(function (event) {
  449. // event.stopPropagation();
  450. // $(this).parent().remove();
  451. // file_num();
  452. // });
  453. // });
  454. // file_num();
  455. // }
  456. // },
  457. // });
  458. // } else {
  459. // layer.msg("格式不正确");
  460. // }
  461. // } else {
  462. // layer.confirm("请上传文件!", {
  463. // btn: ["确定"],
  464. // });
  465. // }
  466. // }
  467. // //上传文件隐藏域值
  468. // function file_num() {
  469. // var str = "";
  470. // var Str;
  471. // $(".fileBox .files").each(function (j, m) {
  472. // var aa = $(m).attr("fiel-num");
  473. // console.log(aa);
  474. // str += aa + ",";
  475. // Str =
  476. // str.substring(str.length - 1) == "," ?
  477. // str.substring(0, str.length - 1) :
  478. // str;
  479. // });
  480. // $("#file").val(Str);
  481. // }
  482. </script>
  483. </body>
  484. </html>