Нет описания

common.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. function getDicObjFn(obj) {
  2. return {
  3. ele:obj.ele,
  4. apiUrl: "Dictionary/GetDicValueListById",
  5. params: {
  6. id: obj.id
  7. },
  8. data: {
  9. textKey: 'F_Value',
  10. valueKey: 'F_ValueId'
  11. },
  12. getValue:obj.getValue?obj.getValue:'',
  13. getText:obj.getText?obj.getText:''
  14. }
  15. }
  16. function selectMultiple(obj) {
  17. var maindeptId = "";
  18. var maindeptId_ = obj.val(); //坐席
  19. if(maindeptId_ != null) {
  20. $(maindeptId_).each(function(i, n) {
  21. var obj2 = '';
  22. obj2 = n + ",";
  23. maindeptId += obj2;
  24. })
  25. maindeptId = maindeptId.substring(0, maindeptId.length)
  26. } else {
  27. maindeptId = ""
  28. }
  29. return maindeptId
  30. }
  31. //区域
  32. function selectCommonFn(obj) {
  33. var dataParam = {
  34. token: $.cookie("token")
  35. }
  36. if (obj.params) {
  37. var resultParam = Object.assign(dataParam, obj.params)
  38. }
  39. $(obj.ele).empty();
  40. $(obj.ele).append('<option selected="selected" value="">请选择</option>');
  41. $.ajax({
  42. type: "get",
  43. url: huayi.config.callcenter_url + obj.apiUrl,
  44. dataType: "json",
  45. async: true,
  46. data: resultParam,
  47. success: function(data) {
  48. if(data.state.toLowerCase() == "success") {
  49. var content = data.data;
  50. $(content).each(function(i, n) {
  51. $("<option value='" + n[obj.data.valueKey] + "'>" + n[obj.data.textKey] +
  52. "</option>").appendTo($(obj.ele));
  53. })
  54. if (obj.getValue) {
  55. $(obj.ele +" option:selected").val(obj.getValue);
  56. $(obj.ele +" option:selected").text(obj.getText);
  57. }
  58. }
  59. }
  60. });
  61. }
  62. //人员下拉
  63. function personSelect(obj,rolecode,apiUrl) {
  64. obj.empty();
  65. $.getJSON(
  66. huayi.config.callcenter_url + apiUrl,
  67. {
  68. rolecode: rolecode,
  69. token: $.cookie("token"),
  70. },
  71. function (data) {
  72. if (data.state.toLowerCase() == "success") {
  73. var content = data.data;
  74. $("<option value=''>请选择</option>").appendTo(obj)
  75. $(content).each(function (i, n) {
  76. $( "<option value='" + n.F_UserCode + "'>" +
  77. n.F_UserName + "</option>" ).appendTo(obj);
  78. });
  79. obj.selectpicker({
  80. noneSelectedText: "请选择", //默认显示内容
  81. });
  82. obj.selectpicker("refresh");
  83. }
  84. }
  85. );
  86. }