Sin descripción

AnnDatil.html 18KB

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