Açıklama Yok

IVRManage.js 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /**
  2. * IVR配置管理
  3. * */
  4. $(function() {
  5. $('.tool_bars').authorizeButton();
  6. //系统名称
  7. //helper.getDropList.getlistDropByDic($('#sc_sysname'), 'XTMC');
  8. //项目下拉
  9. // helper.getDropList.getProlistDrop($('#sc_pro'));
  10. laydate.render({
  11. elem: '#sc_times',
  12. range: '~',
  13. theme: '#249fea',
  14. });
  15. initTable();
  16. //搜索
  17. $("#sc_btns").click(function() {
  18. initTable();
  19. })
  20. });
  21. function initTable() {
  22. //先销毁表格
  23. $('#table_all').bootstrapTable('destroy');
  24. //初始化表格,动态从服务器加载数据
  25. $('#table_all').bootstrapTable({
  26. method: "get", //使用get请求到服务器获取数据
  27. url: huayi.config.callcenter_url + "callcenterapi/api/SysIVRConfig/getlistbypage", //获取数据的Servlet地址
  28. contentType: "application/x-www-form-urlencoded",
  29. striped: true, //表格显示条纹
  30. pagination: true, //启动分页
  31. pageSize: 10, //每页显示的记录数
  32. pageNumber: 1, //当前第几页
  33. pageList: [10, 20, 50, 100], //记录数可选列表
  34. search: false, //是否启用查询
  35. showColumns: false, //显示下拉框勾选要显示的列
  36. showRefresh: false, //显示刷新按钮
  37. sidePagination: "server", //表示服务端请求
  38. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  39. //设置为limit可以获取limit, offset, search, sort, order
  40. queryParamsType: "undefined",
  41. queryParams: function queryParams(params) { //设置查询参数
  42. var param = {
  43. pageindex: params.pageNumber, //否 int 页码
  44. pagesize: params.pageSize, //否 int 条数
  45. groupcode: $('#sc_keyWords').val(), //计划名称
  46. // projectid: $('#sc_pro').val(),// 否 string 项目id
  47. stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0], //开始时间
  48. etime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1], //结束时间
  49. };
  50. return param;
  51. },
  52. responseHandler: function(res) {
  53. //格式化数据
  54. return {
  55. "total": res.data && res.data.total, //总页数
  56. "rows": res.data && res.data.rows,
  57. }
  58. },
  59. onLoadSuccess: function(res) { //加载成功时执行
  60. //layer.msg("加载成功");
  61. $('.tool_down').authorizeOperateButton();
  62. },
  63. onLoadError: function() { //加载失败时执行
  64. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  65. }
  66. });
  67. }
  68. //查看项目详情
  69. function btn_details(edit_id) {
  70. layer.open({
  71. type: 2,
  72. content: "template/seeIvrDetail.html?ids=" + edit_id, //iframe的url,no代表不显示滚动条
  73. title: '查看IVR详情信息',
  74. resize: false,
  75. area: ['80%', '90%'], //宽高
  76. });
  77. }
  78. //添加
  79. function btn_add() {
  80. layer.open({
  81. type: 2,
  82. content: "template/addIVRManage.html", //iframe的url,no代表不显示滚动条
  83. title: '添加IVR',
  84. resize: false,
  85. area: ['80%', '90%'], //宽高
  86. });
  87. }
  88. //编辑
  89. function btn_edit(edit_id) {
  90. layer.open({
  91. type: 2,
  92. content: "template/addIVRManage.html?edit_id=" + edit_id, //iframe的url,no代表不显示滚动条
  93. title: '编辑IVR',
  94. resize: false,
  95. area: ['80%', '90%'], //宽高
  96. });
  97. }
  98. //批量删除
  99. function btn_deletes() {
  100. var ids = $.map($('#table_all').bootstrapTable('getSelections'),
  101. function(row) {
  102. return row.id;
  103. });
  104. /*判断长度*/
  105. if(ids.length <= 0) {
  106. layer.confirm('请选择要删除的选项', {
  107. icon: 7,
  108. btn: ['确定'] //按钮
  109. });
  110. return;
  111. }
  112. btn_delete(ids);
  113. }
  114. //删除
  115. function btn_delete(del_id) {
  116. layer.confirm('您确定要删除当前选中项吗?', {
  117. icon: 7,
  118. btn: ['确定', '取消'],
  119. yes: function(index, layero) {
  120. $.post(huayi.config.callcenter_url + "callcenterapi/api/SysIVRConfig/delete", {
  121. ids: del_id,
  122. }, function(result) {
  123. result = JSON.parse(result);
  124. if(result.state.toLowerCase() == "success") {
  125. layer.msg("删除成功");
  126. $('#table_all').bootstrapTable('refresh');
  127. }
  128. })
  129. },
  130. });
  131. }
  132. //ivr启用
  133. function btn_on(on_id){
  134. layer.confirm('您确定要启用当前选中项吗?', {
  135. icon: 7,
  136. btn: ['确定', '取消'],
  137. yes: function(index, layero) {
  138. $.post(huayi.config.callcenter_url + "callcenterapi/api/SysIVRConfig/enable", {
  139. id: on_id,
  140. isenable:1
  141. }, function(result) {
  142. result = JSON.parse(result);
  143. if(result.state.toLowerCase() == "success") {
  144. layer.msg("启用成功!");
  145. $('#table_all').bootstrapTable('refresh');
  146. }
  147. })
  148. },
  149. });
  150. }
  151. //ivr禁用
  152. function btn_off(on_id){
  153. layer.confirm('您确定要禁用当前选中项吗?', {
  154. icon: 7,
  155. btn: ['确定', '取消'],
  156. yes: function(index, layero) {
  157. $.post(huayi.config.callcenter_url + "callcenterapi/api/SysIVRConfig/enable", {
  158. id: on_id,
  159. isenable:0
  160. }, function(result) {
  161. result = JSON.parse(result);
  162. if(result.state.toLowerCase() == "success") {
  163. layer.msg("禁用成功!");
  164. $('#table_all').bootstrapTable('refresh');
  165. }
  166. })
  167. },
  168. });
  169. }
  170. //格式化操作
  171. function formatterOperate(val, row) {
  172. var str = '<div class="task_tools" onclick = helper.methods.taskTools(this)>' +
  173. '<a title="操作"><i class="fa fa-cogs" aria-hidden="true"></i></a>' +
  174. '<ul class="tool_down">' +
  175. '<li><a class="aBtn" authorize="yes" id="HY_details_' + row.id + '" onclick="btn_details(\'' + row.id + '\')"><i class="fa icon-detail tub"></i>详情</a><li>' +
  176. '<li><a class="aBtn" authorize="yes" id="HY_edit_' + row.id + '" onclick="btn_edit(\'' + row.id + '\')"><i class="fa icon-edit tub"></i>编辑</a><li>' +
  177. '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.id + '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
  178. if(val==0){
  179. // str +='<li><a class="aBtn" authorize="yes" id="HY_on_' + row.id + '" onclick="btn_on(\'' + row.id + '\')"><i class="fa icon-zhenling tub"></i>启动</a><li>'
  180. str +='<li><a class="aBtn" authorize="yes" id="HY_on_' + row.id + '" onclick="btn_on(\'' + row.id + '\')"><i class="glyphicon glyphicon-play tub"></i>启动</a><li>'
  181. }else{
  182. // str +='<li><a class="aBtn" authorize="yes" id="HY_off_' + row.id + '" onclick="btn_off(\'' + row.id + '\')"><i class="fa icon-manglu tub"></i>禁止</a><li>'
  183. str +='<li><a class="aBtn" authorize="yes" id="HY_off_' + row.id + '" onclick="btn_off(\'' + row.id + '\')"><i class="glyphicon glyphicon-pause tub"></i>禁止</a><li>'
  184. }
  185. str += '</ul></div>'
  186. return str;
  187. }
  188. //格式化IVR内容
  189. function formatterIvrcontent(val, row) {
  190. if(val && val.length > 1) {
  191. return val[0] + '...';
  192. } else if(val && val.length === 1 && val[0] != "") {
  193. return val;
  194. } else {
  195. return '-';
  196. }
  197. }
  198. //格式化是否启用
  199. function formatterIsenable(val, row) {
  200. //是否启用(呼入流程默认开启)0不启用,1启用
  201. var str="";
  202. if(val==0){
  203. str="不启用";
  204. }else{
  205. str="启用";
  206. }
  207. return str
  208. }
  209. //格式化ivr类型
  210. function formatterIvrType(val, row){
  211. //1呼入,2满意度,3自动外呼
  212. var str="";
  213. if(val==1){
  214. str="呼入";
  215. }else if(val==2){
  216. str="满意度";
  217. }else{
  218. str="自动外呼";
  219. }
  220. return str
  221. }
  222. //格式化开始日期
  223. function formatterSdate(val, row) {
  224. return val && val.split(' ')[0];
  225. }
  226. //结束时间 超期变红
  227. function formatterEndTime(val, row) {
  228. if(val) {
  229. var d = val.replace(/-/g, "/");
  230. var curDate = helper.DateFormat.getNowDateTime();
  231. curDate = curDate.replace(/-/g, "/");
  232. var str = '';
  233. if(Date.parse(d) >= Date.parse(curDate)) {
  234. str = '<div>' + val.split(' ')[0] + '</div>';
  235. } else {
  236. str = '<div style="color:red;">' + val.split(' ')[0] + '</div>';
  237. }
  238. return str
  239. } else {
  240. return "-";
  241. }
  242. }