暫無描述

WorkOrderList.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. $(document).ready(function () {
  2. getReactionCategory();
  3. $("#reflectCategory").bind("input propertychange", function () {
  4. $(".layui-dropdown").hide();
  5. $(".CleansReactionCategory").show();
  6. if ($("#reflectCategory").val() == "") {
  7. $(".reflectCategoryList-wrapper").hide();
  8. return;
  9. }
  10. $(".reflectCategoryList-wrapper").show();
  11. var debounceGetSearchReactionCategory = debounce(
  12. getSearchReactionCategory,
  13. 500
  14. );
  15. debounceGetSearchReactionCategory($("#reflectCategory").val());
  16. });
  17. $("#reflectCategoryList").on("click", "li", function () {
  18. $(".reflectCategoryList-wrapper").hide();
  19. $("#reflectCategory").val($(this).attr("indexName"));
  20. $("#keyid").val($(this).attr("index"));
  21. });
  22. });
  23. // 查看工单详情
  24. function View(val, row) {
  25. var workId = val;
  26. var workIdCode = workId.slice(0, 4);
  27. var workIdAddress = workId.slice(4, 10);
  28. var workIdDate = workId.slice(10, 16);
  29. var workIdSerialNumber = workId.slice(16);
  30. return (
  31. '<div class="imgs" ><a class="" style="font-weight: 700;" index="' +
  32. row.CreateUser +
  33. '" onclick= ckxq("' +
  34. row.F_WorkOrderId +
  35. '") >' +
  36. '<span style="color: #000000">' +
  37. workIdCode +
  38. "</span>" +
  39. '<span style="color: #FF0000">' +
  40. workIdAddress +
  41. "</span>" +
  42. '<span style="color: #008000">' +
  43. workIdDate +
  44. "</span>" +
  45. '<span style="color: #800080">' +
  46. workIdSerialNumber +
  47. "</span>" +
  48. "</a></div>"
  49. );
  50. }
  51. //查看详情
  52. function ckxq(str) {
  53. layer.open({
  54. type: 2,
  55. content: "../CommonHtml/WorkDatil.html?wid=" + str, //iframe的url,no代表不显示滚动条
  56. title: "工单详情",
  57. area: ["100%", "100%"], //宽高
  58. maxmin: true,
  59. shade: 0,
  60. });
  61. }
  62. function getReactionCategory(pid = 38) {
  63. $.get(
  64. huayi.config.callcenter_url + "Dictionary/GetZTreeNew",
  65. {
  66. token: $.cookie("token"),
  67. pid: pid,
  68. },
  69. function (result) {
  70. result = $.parseJSON(result);
  71. var content = JSON.parse(result.data);
  72. layui.use("dropdown", function () {
  73. var dropdown = layui.dropdown;
  74. dropdown.render({
  75. elem: "#reflectCategory", //可绑定在任意元素中,此处以上述按钮为例
  76. data: content,
  77. id: "reflectCategory",
  78. isclickparent: true,
  79. //菜单被点击的事件
  80. click: function (obj) {
  81. $("#reflectCategory").val(obj.title);
  82. $("#keyid").val(obj.id);
  83. $(".CleansReactionCategory").show();
  84. },
  85. });
  86. });
  87. }
  88. );
  89. }
  90. function getSearchReactionCategory(key) {
  91. $("#reflectCategoryList").empty();
  92. $.get(
  93. huayi.config.callcenter_url + "Dictionary/GetKeyListNew",
  94. {
  95. token: $.cookie("token"),
  96. key: key,
  97. },
  98. function (result) {
  99. result = $.parseJSON(result);
  100. if (result.state.toLowerCase() === "success") {
  101. var content = result.data;
  102. if (content.length > 0) {
  103. content.forEach(function (e, i) {
  104. $(
  105. "<li index='" +
  106. e.id +
  107. "' indexName='" +
  108. e.name +
  109. "'>" +
  110. e.names +
  111. "</li>"
  112. ).appendTo("#reflectCategoryList");
  113. });
  114. } else {
  115. $("<li index='' indexName=''>没有相关数据</li>").appendTo(
  116. "#reflectCategoryList"
  117. );
  118. }
  119. }
  120. }
  121. );
  122. }
  123. function debounce(fun, delay) {
  124. return function (args) {
  125. var that = this;
  126. var _args = args;
  127. clearTimeout(fun.id);
  128. fun.id = setTimeout(function () {
  129. fun.call(that, _args);
  130. }, delay);
  131. };
  132. }
  133. $(".CleansReactionCategory").click(function () {
  134. $("#reflectCategory").val("");
  135. $("#keyid").val("");
  136. $(".CleansReactionCategory").hide();
  137. });