Nav apraksta

reportCommon.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. var setting
  2. // 树形下拉开始
  3. function bindtree() {
  4. $(treeInputParam.classInps).focus(function() {
  5. $(this).siblings(treeInputParam.classAddTree).css("display", "block");
  6. });
  7. $(treeInputParam.classXl).click(function() {
  8. var xl = $(this).siblings(treeInputParam.classXl);
  9. if(xl.css("display") == "block") {
  10. xl.css("display", "none");
  11. } else {
  12. xl.css("display", "block");
  13. }
  14. });
  15. $(treeInputParam.classAddTree).mouseleave(function() {
  16. $(this).css("display", "none");
  17. });
  18. //获取所属部门
  19. setting = {
  20. data: {
  21. key: {
  22. name: treeInputParam.treeObj.name,
  23. },
  24. simpleData: {
  25. enable: true,
  26. idKey: treeInputParam.treeObj.id,
  27. pIdKey: treeInputParam.treeObj.pid,
  28. rootPId: -1,
  29. },
  30. },
  31. callback: {
  32. onClick: treeInputParam.treeObj.onclick,
  33. },
  34. };
  35. if(treeInputParam) {
  36. $.getJSON(
  37. huayi.config.callcenter_url + treeInputParam.treeApi, {
  38. token: $.cookie("token")
  39. },
  40. function(result) {
  41. if(result.state.toLowerCase() == "success") {
  42. $.fn.zTree.init($(treeInputParam.treeId), setting, result.data);
  43. }
  44. }
  45. );
  46. }
  47. }
  48. function zTreeOnClick(event, treeId, treeNode) {
  49. $(treeInputParam.classInps).val(treeNode[treeInputParam.treeObj.name]);
  50. $(treeInputParam.classId).val(treeNode[treeInputParam.treeObj.id]);
  51. }
  52. // 树形下拉结束
  53. // 下拉框
  54. function selectCommon(obj) {
  55. var resultParam
  56. var dataParam = {
  57. token: $.cookie("token")
  58. }
  59. if(obj.dataParam) {
  60. resultParam = Object.assign(dataParam, obj.dataParam)
  61. } else {
  62. resultParam = dataParam
  63. }
  64. $(obj.id).empty();
  65. $(obj.id).append(
  66. '<option selected="selected" value="">请选择</option>'
  67. );
  68. $.getJSON(
  69. huayi.config.callcenter_url +
  70. obj.apiUrl, resultParam,
  71. function(data) {
  72. if(data.state.toLowerCase() == "success") {
  73. var content = data.data;
  74. $(content).each(function(i, n) {
  75. $(
  76. "<option value='" +
  77. n.F_ValueId +
  78. "'>" +
  79. n.F_Value +
  80. "</option>"
  81. ).appendTo($(obj.id));
  82. });
  83. }
  84. }
  85. );
  86. }
  87. //下拉框结束
  88. // 导出列表
  89. function exportFileFun(api, params) {
  90. var url = huayi.config.callcenter_url + api;
  91. if(typeof(params) !== "object") {
  92. return
  93. }
  94. delete params.page
  95. delete params.pagesize
  96. delete params.pageindex
  97. Object.keys(params).forEach(function(key, index) {
  98. if(!params[key]) {
  99. params[key] = ""
  100. }
  101. if(index === 0) {
  102. url += `?${key}=${params[key]}`
  103. } else {
  104. url += `&${key}=${params[key]}`
  105. }
  106. })
  107. console.log(url)
  108. window.location.href = url;
  109. }
  110. //导出列表结束