Nav apraksta

editCategory.html 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. <link rel="stylesheet" href="../css/bootstrap-select.css" />
  8. <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
  9. <link rel="stylesheet" href="../css/addappeal.css" />
  10. <link href="../css/layer/need/layer.css" />
  11. <link rel="stylesheet" href="../css/init.css" />
  12. <link rel="stylesheet" href="../js/layui/css/layui.css">
  13. <script src="../js/laydate/laydate.js"></script>
  14. <title>新增诉求工单</title>
  15. <style>
  16. .reflectCategory-wrapper {
  17. position: relative;
  18. }
  19. .reflectCategoryList-wrapper {
  20. display: none;
  21. position: absolute;
  22. top: 38px;
  23. z-index: 9999;
  24. line-height: 32px;
  25. background: #FFF;
  26. }
  27. #reflectCategoryList {
  28. height: 240px;
  29. background: #FFF;
  30. border: 1px solid #e5e6e7;
  31. overflow: auto;
  32. }
  33. #reflectCategoryList li {
  34. padding: 0 10px;
  35. width: 100%;
  36. line-height: 32px;
  37. }
  38. #reflectCategoryList li:hover {
  39. background: #00a1cb;
  40. }
  41. .bootstrap-select .dropdown-menu {
  42. height: 360px !important;
  43. }
  44. .bootstrap-select .dropdown-menu li a span.text {
  45. color: inherit
  46. }
  47. </style>
  48. </head>
  49. <body>
  50. <input type="hidden" id="PID" value="" />
  51. <div class="wrapper wrapper-content animated fadeInRight">
  52. <div style="padding: 10px" class="tj_content clearFix">
  53. <div class="Common">
  54. <table>
  55. <tr>
  56. <th class="Importent">反映类别:</th>
  57. <td class="reflectCategory-wrapper">
  58. <input type="text" id="reflectCategory" class="form-control" autocomplete="off" />
  59. <div class="reflectCategoryList-wrapper">
  60. <ul id="reflectCategoryList">
  61. </ul>
  62. </div>
  63. </td>
  64. </tr>
  65. </table>
  66. <div class="btn_box">
  67. <button class="btns BC">提交</button>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <script src="../js/layui/layui.js"></script>
  73. <script src="../js/bootstrap-select.js"></script>
  74. <script src="../js/adjustHeight.js"></script>
  75. <script src="../js/zTree/jquery.ztree.core.js"></script>
  76. <script src="../js/ztreeSelect.js"></script>
  77. <script src="../Script/Common/huayi.common.js"></script>
  78. <script>
  79. var wid = helper.request.queryString("wid");
  80. console.log(wid)
  81. $(document).ready(function() {
  82. getReactionCategory();
  83. $("#reflectCategory").bind("input propertychange", function() {
  84. $(".layui-dropdown").hide();
  85. if($("#reflectCategory").val() == "") {
  86. $(".reflectCategoryList-wrapper").hide();
  87. return;
  88. }
  89. var debounceGetSearchReactionCategory = debounce(getSearchReactionCategory, 500)
  90. $(".reflectCategoryList-wrapper").show();
  91. debounceGetSearchReactionCategory($("#reflectCategory").val())
  92. })
  93. $("#reflectCategoryList").on("click", "li", function() {
  94. $(".reflectCategoryList-wrapper").hide();
  95. $("#reflectCategory").val($(this).attr("indexName"));
  96. $("#PID").val($(this).attr("index"));
  97. });
  98. $(".BC").click(function() {
  99. Add();
  100. });
  101. if(wid) {
  102. $.ajax({
  103. type: "get",
  104. url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrderNew",
  105. dataType: "json",
  106. async: false,
  107. data: {
  108. workorderid: wid,
  109. type: 0, // 工单信息
  110. token: $.cookie("token"),
  111. },
  112. success: function(data) {
  113. if(data.state.toLowerCase() == "success") {
  114. var Data = data.data.data;
  115. $("#reflectCategory").val(Data[0].KeyName)
  116. $("#PID").val(Data[0].F_Key)
  117. }
  118. },
  119. });
  120. }
  121. });
  122. ///修改工单
  123. function Add() {
  124. // if(!$("#PID").val()) {
  125. // layer.msg("请选择反应类别");
  126. // return
  127. // }
  128. $.ajax({
  129. type: "post",
  130. url: huayi.config.callcenter_url + "WorkOrder/EditCategory",
  131. dataType: "json",
  132. async: true,
  133. data: {
  134. workorderid: wid,
  135. keyid: $("#PID").val(), //=关键词id(多个用英文逗号,隔开) keys
  136. token: $.cookie("token"),
  137. },
  138. success: function(data) {
  139. if(data.state.toLowerCase() == "success") {
  140. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  141. parent.layer.close(index); //再执行关闭
  142. parent.$("#orderlist").bootstrapTable("refresh");
  143. parent.layer.msg(data.message);
  144. }
  145. },
  146. });
  147. // }
  148. }
  149. function closePage() {
  150. var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  151. parent.layer.close(index); //再执行关闭
  152. parent.$("#orderlist").bootstrapTable("refresh");
  153. parent.layer.msg("操作成功");
  154. }
  155. function getReactionCategory(pid = 38) {
  156. $.get(
  157. huayi.config.callcenter_url + "Dictionary/GetZTreeOld", {
  158. token: $.cookie("token"),
  159. pid: pid,
  160. },
  161. function(result) {
  162. result = $.parseJSON(result);
  163. var content = JSON.parse(result.data);
  164. layui.use("dropdown", function() {
  165. var dropdown = layui.dropdown;
  166. dropdown.render({
  167. elem: "#reflectCategory", //可绑定在任意元素中,此处以上述按钮为例
  168. data: content,
  169. id: "reflectCategory",
  170. //菜单被点击的事件
  171. click: function(obj) {
  172. $("#reflectCategory").val(obj.title);
  173. $("#PID").val(obj.id);
  174. },
  175. });
  176. });
  177. }
  178. );
  179. }
  180. function getSearchReactionCategory(key) {
  181. $("#reflectCategoryList").empty();
  182. $.get(
  183. huayi.config.callcenter_url + "Dictionary/GetKeyListNew", {
  184. token: $.cookie("token"),
  185. key: key,
  186. },
  187. function(result) {
  188. result = $.parseJSON(result);
  189. if(result.state.toLowerCase() === "success") {
  190. var content = result.data;
  191. if(content.length > 0) {
  192. content.forEach(function(e, i) {
  193. $(
  194. "<li index='" +
  195. e.id +
  196. "' indexName='" +
  197. e.name +
  198. "'>" +
  199. e.names +
  200. "</li>"
  201. ).appendTo("#reflectCategoryList");
  202. });
  203. } else {
  204. $("<li index='' indexName=''>没有相关数据</li>").appendTo(
  205. "#reflectCategoryList"
  206. );
  207. }
  208. }
  209. }
  210. );
  211. }
  212. function debounce(fun, delay) {
  213. return function(args) {
  214. var that = this;
  215. var _args = args;
  216. clearTimeout(fun.id);
  217. fun.id = setTimeout(function() {
  218. fun.call(that, _args);
  219. }, delay);
  220. };
  221. }
  222. </script>
  223. </body>
  224. </html>