商丘12345 前端

search.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. $(document).ready(function () {
  2. laydate.render({
  3. elem: '#starttime' //指定元素
  4. ,range:'~'
  5. });
  6. getDicValueList($("#source"),1); //工单来源
  7. getDicValueList($("#type"),2) //工单类别
  8. getDicValueList($("#keyid"),3) //主题词
  9. helper.getDropList.getOrderAreas($('#sourceAreas')) //区域
  10. getMultipleChoice($("#ZX"),"UserAccount/GetSeatList"); //受话坐席
  11. getMultipleChoice($("#yardman"),"UserAccount/GetUsersList","ZXLD")//审核员
  12. tree();
  13. });
  14. //键盘登录事件
  15. $('input').bind('keypress', function(event) {
  16. if(event.keyCode == "13") {
  17. $('.Seach').trigger("click");
  18. }
  19. });
  20. ///搜素
  21. $(".Seach").click(function() {
  22. load();
  23. })
  24. //承办单位下拉事件开始
  25. $(".inps").focus(function() {
  26. $(".xlAdd").css("display", "block");
  27. });
  28. $(".xl").click(function() {
  29. if($(".xlAdd").css("display") == "block") {
  30. $(".xlAdd").css("display", "none");
  31. } else {
  32. $(".xlAdd").css("display", "block");
  33. }
  34. });
  35. $(".addTree").mouseleave(function() {
  36. $(this).css("display", "none");
  37. });
  38. //清除
  39. $(".Cleans ").click(function() {
  40. $(".inps").val("");
  41. $("#PID").val("");
  42. $("#Dpment").val("");
  43. });
  44. //承办单位下拉事件结束
  45. //下拉框多选开始
  46. function selectMultiple(obj) {
  47. var maindeptId = "";
  48. var maindeptId_ = obj.val(); //坐席
  49. if(maindeptId_ != null) {
  50. $(maindeptId_).each(function(i, n) {
  51. var obj2 = '';
  52. obj2 = n + ",";
  53. maindeptId += obj2;
  54. })
  55. maindeptId = maindeptId.substring(0, maindeptId.length - 1)
  56. } else {
  57. maindeptId = ""
  58. }
  59. return maindeptId
  60. }
  61. function getMultipleChoice(obj,urlParame,rolecode) {
  62. obj.empty();
  63. var parameData = {
  64. token: $.cookie("token"),
  65. }
  66. if (rolecode) {
  67. parameData.rolecode = rolecode
  68. }
  69. $.getJSON(
  70. huayi.config.callcenter_url + urlParame, parameData,
  71. function(data) {
  72. if(data.state.toLowerCase() == "success") {
  73. var content = data.data;
  74. $(content).each(function(i, n) {
  75. $("<option value='" + n.F_UserCode + "'>" + n.F_UserName + "</option>").appendTo(obj);
  76. });
  77. obj.selectpicker({ noneSelectedText: "请选择",}); //默认显示内容
  78. obj.selectpicker("refresh");
  79. }
  80. }
  81. );
  82. }
  83. //下拉框多选结束
  84. //数据字典获取开始
  85. function getDicValueList(obj,id) {
  86. obj.empty();
  87. obj.append('<option selected="selected" value="">请选择</option>');
  88. $.getJSON(
  89. huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
  90. token: $.cookie("token"),
  91. id: id,
  92. },
  93. function(data) {
  94. if(data.state.toLowerCase() == "success") {
  95. var content = data.data;
  96. $(content).each(function(i, n) {
  97. $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(obj);
  98. });
  99. }
  100. }
  101. );
  102. }
  103. //数据字典获取结束
  104. //树形下拉开始
  105. function tree() {
  106. $.get(
  107. huayi.config.callcenter_url + "Department/GetDeptList", {
  108. token: $.cookie("token"),
  109. },
  110. function(result) {
  111. result = $.parseJSON(result);
  112. $.fn.zTree.init( $("#addTreeDemo"),setting1, result.data); //实例化树形图
  113. }
  114. );
  115. }
  116. var setting1 = {
  117. data: {
  118. key: {
  119. name: "F_DeptName",
  120. },
  121. simpleData: {
  122. enable: true,
  123. idKey: "F_DeptId",
  124. pIdKey: "F_PartentId",
  125. rootPId: 0,
  126. },
  127. },
  128. callback: {
  129. onClick: zTreeOnClick,
  130. },
  131. };
  132. function zTreeOnClick(event, treeId, treeNode) {
  133. if(treeNode.level >= 1) {
  134. $(".inps").val(treeNode.F_DeptName);
  135. $("#PID").val(treeNode.F_DeptId);
  136. $("#Dpment").val(treeNode.F_DeptId);
  137. $(".Cleans").show();
  138. }
  139. }
  140. //树形下拉开始