Нет описания

IVRedit.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**
  2. * IVR编辑
  3. * */
  4. list();
  5. function list() {
  6. $.ajax({
  7. url: huayi.config.callcenter_url + '/callcenterapi/api/sysivrconfig/loadivrlist',
  8. data: {},
  9. async: true,
  10. dataType: 'json',
  11. type: 'get', //HTTP请求类型
  12. success: function(data) {
  13. if(data.state.toLowerCase() == "success") {
  14. var IVRlistData= data.data;
  15. // alert(IVRlistData.length);
  16. if (IVRlistData.length>0) {
  17. for ( var i=0; i<IVRlistData.length; i++) {
  18. $('<li>'+IVRlistData[i]+
  19. '</li>').appendTo('.ivrlist');
  20. }
  21. }
  22. }
  23. },
  24. error: function(xhr, type, errorThrown) {
  25. //异常处理;
  26. }
  27. })
  28. }
  29. Ajax();
  30. //获取详情
  31. function Ajax() {
  32. $.ajax({
  33. url: huayi.config.callcenter_url + '/callcenterapi/api/sysivrconfig/loadivr',
  34. data: {},
  35. async: true,
  36. dataType: 'json',
  37. type: 'get', //HTTP请求类型
  38. success: function(data) {
  39. if(data.state.toLowerCase() == "success") {
  40. $("#IVRedit").val(data.data);
  41. }
  42. },
  43. error: function(xhr, type, errorThrown) {
  44. //异常处理;
  45. }
  46. })
  47. }
  48. //提交按钮
  49. $(function() {
  50. $(".ivrlist").on("click", "li",function(){
  51. var listText=$(this).text();
  52. $.ajax({
  53. url: huayi.config.callcenter_url + '/callcenterapi/api/sysivrconfig/loadivr',
  54. data: {
  55. ivrname:listText
  56. },
  57. async: true,
  58. dataType: 'json',
  59. type: 'get', //HTTP请求类型
  60. success: function(data) {
  61. if(data.state.toLowerCase() == "success") {
  62. $("#IVRedit").val(data.data);
  63. }
  64. },
  65. error: function(xhr, type, errorThrown) {
  66. //异常处理;
  67. }
  68. })
  69. });
  70. $('#sc_btns').on('click', function() {
  71. // alert($('#IVRedit').val());
  72. if($('#IVRedit').val() == '') {
  73. mui.alert('请输入编辑内容!') //请输入编辑内容
  74. } else {
  75. $.ajax({
  76. type: "post",
  77. dataType: 'json',
  78. url: huayi.config.callcenter_url + '/callcenterapi/api/SysIVRConfig/editivr',
  79. async: true,
  80. data: {
  81. ivrcontent: $('#IVRedit').val()
  82. },
  83. success: function(data) {
  84. if(data.state == "success") {
  85. layer.msg("修改成功");
  86. window.location.reload();
  87. } else {
  88. mui.toast(data.message);
  89. }
  90. }
  91. });
  92. }
  93. })
  94. })