Ei kuvausta

reportCommon.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. var setting
  2. // 树形下拉开始
  3. function bindtree() {
  4. $.getJSON(
  5. huayi.config.callcenter_url + treeInputParam.treeApi, {
  6. token: $.cookie("token")
  7. },
  8. function(result) {
  9. if(result.state.toLowerCase() == "success") {
  10. $.fn.zTree.init($(treeInputParam.treeId), setting, result.data);
  11. }
  12. }
  13. );
  14. }
  15. $(document).ready(function () {
  16. $(treeInputParam.classInps).focus(function() {
  17. $(this).siblings(treeInputParam.classAddTree).css("display", "block");
  18. });
  19. $(treeInputParam.classXl).click(function() {
  20. var xl = $(this).siblings(treeInputParam.classXl);
  21. if(xl.css("display") == "block") {
  22. xl.css("display", "none");
  23. } else {
  24. xl.css("display", "block");
  25. }
  26. });
  27. $(treeInputParam.classAddTree).mouseleave(function() {
  28. $(this).css("display", "none");
  29. });
  30. //获取所属部门
  31. setting = {
  32. data: {
  33. key: {
  34. name: treeInputParam.treeObj.name,
  35. },
  36. simpleData: {
  37. enable: true,
  38. idKey: treeInputParam.treeObj.id,
  39. pIdKey: treeInputParam.treeObj.pid,
  40. rootPId: -1,
  41. },
  42. },
  43. callback: {
  44. onClick: treeInputParam.treeObj.onclick,
  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. window.location.href = url;
  108. }
  109. //导出列表结束