Nav apraksta

ziDianEdit.html 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>部门编辑</title>
  6. <script src="../Script/Common/huayi.load.js"></script>
  7. <script src="../Script/Common/huayi.config.js"></script>
  8. <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
  9. <link rel="stylesheet" href="../css/init.css" />
  10. <style>
  11. th {
  12. padding: 5px 8px 5px 0;
  13. text-align: right;
  14. }
  15. input {
  16. background-color: #FFF;
  17. background-image: none;
  18. border: 1px solid #ccc;
  19. border-radius: 1px;
  20. color: inherit;
  21. padding: 6px 12px;
  22. }
  23. td {
  24. padding: 6px 0 5px 10px;
  25. }
  26. .addts {
  27. background: #00a0cd;
  28. color: #fff;
  29. padding: 6px 10px;
  30. outline: none;
  31. font-size: 12px;
  32. margin-left: 15px;
  33. border: 0;
  34. border-radius: 3px;
  35. box-sizing: border-box;
  36. }
  37. .seldept {
  38. position: absolute;
  39. z-index: 100;
  40. display: none;
  41. }
  42. ul.ztree {
  43. border: 1px solid #617775;
  44. background: #f0f6e4;
  45. overflow-y: scroll;
  46. overflow-x: auto;
  47. height:150px;
  48. }
  49. </style>
  50. </head>
  51. <body class="gray-bg">
  52. <div style="padding: 10px;">
  53. <div style="padding: 10px;" class="clearFix">
  54. <div>
  55. <div class="box_content">
  56. <table id="sqzx" style="width: 100%;" border="0" cellspacing="0" cellpadding="0">
  57. <tr>
  58. <th>所属分类:</th>
  59. <td>
  60. <input type="text" class="pname" readonly="readonly" /><input type="hidden" class="pid" />
  61. <div class="seldept">
  62. <ul id="treeDemo" class="ztree">
  63. <!--类名为ztree是必须的-->
  64. </ul>
  65. </div>
  66. </td>
  67. </tr>
  68. <tr>
  69. <th>字典标志:</th>
  70. <td>
  71. <input type="text" class="name" /><input type="hidden" class="id" />
  72. </td>
  73. </tr>
  74. </table>
  75. </div>
  76. </div>
  77. <div class="bton" style="text-align: center;">
  78. <input class="addts" type="button" value="保存" />
  79. </div>
  80. </div>
  81. </div>
  82. <script src="../js/zTree/jquery.ztree.core.js"></script>
  83. <script>
  84. var id = helper.request.queryString("id");
  85. $(document).ready(function () {
  86. bind();
  87. $(".pname").click(function () {
  88. if ($(".seldept").is(":hidden")) {
  89. $(".seldept").show();
  90. } else {
  91. $(".seldept").hide();
  92. }
  93. })
  94. $(".seldept").mouseleave(function () {
  95. $(".seldept").hide();
  96. })
  97. if (id) {
  98. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValue', {
  99. id: id,
  100. "token": $.cookie("token")
  101. }, function (result) {
  102. if (result.state.toLowerCase() == "success") {
  103. var content = result.data;
  104. if (content.F_PartentId && content.F_PartentId != '0') {
  105. getpname(content.F_PartentId);
  106. }
  107. else {
  108. $(".pid").val(0);
  109. $(".pname").val("顶级字典");
  110. }
  111. $(".id").val(content.F_ValueId);
  112. $(".name").val(content.F_Value);
  113. }
  114. })
  115. }
  116. });
  117. function getpname(strpid) {
  118. $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValue', {
  119. id: strpid,
  120. "token": $.cookie("token")
  121. }, function (result) {
  122. if (result.state.toLowerCase() == "success") {
  123. var content = result.data;
  124. $(".pid").val(content.id);
  125. $(".pname").val(content.text);
  126. }
  127. })
  128. }
  129. var setting = {
  130. data: {
  131. key: {
  132. name: "text"
  133. },
  134. // simpleData: {
  135. // enable: true,
  136. // idKey: "F_DeptId",
  137. // pIdKey: "F_PartentId",
  138. // rootPId: -1
  139. // }
  140. },
  141. callback: {
  142. onClick: zTreeOnClick
  143. }
  144. };
  145. function zTreeOnClick(event, treeId, treeNode) {
  146. $(".pid").val(treeNode.id);
  147. $(".pname").val(treeNode.text);
  148. $(".seldept").hide();
  149. };
  150. function bind() {
  151. $.getJSON(huayi.config.callcenter_url + "Dictionary/GetZTreeList", { "token": $.cookie("token") }, function (result) {
  152. if (result.state.toLowerCase() == "success") {
  153. tree = $.fn.zTree.init($("#treeDemo"), setting, result.data);
  154. // tree.addNodes(null, 0, { "id": 0, "text": "顶级字典"});
  155. }
  156. })
  157. }
  158. //修改工单
  159. $(".addts").click(function () {
  160. var pid = $(".pid").val();
  161. var id = $(".id").val();
  162. var name = $(".name").val();
  163. var tel = $(".tel").val();
  164. var sort = $(".sort").val();
  165. if (!name) {
  166. layer.confirm('请输入字典标志!', {
  167. btn: ['确定']
  168. });
  169. return;
  170. }
  171. $.post(huayi.config.callcenter_url + 'Department/AddDept', {
  172. id: id, pid: pid, name: name,"token": $.cookie("token")
  173. }, function (result) {
  174. result = $.parseJSON(result);
  175. if (result.state.toLowerCase() == "success") {
  176. layer.msg("操作成功");
  177. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  178. parent.layer.close(index); //再执行关闭
  179. parent.bind()();
  180. }
  181. })
  182. });
  183. </script>
  184. </body>
  185. </html>