| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- /**
- * IVR配置管理
- * */
- $(function() {
- $('.tool_bars').authorizeButton();
- //系统名称
- //helper.getDropList.getlistDropByDic($('#sc_sysname'), 'XTMC');
- //项目下拉
- helper.getDropList.getProlistDrop($('#sc_pro'));
- laydate.render({
- elem: '#sc_times',
- range: '~',
- theme: '#249fea',
- });
- initTable();
- //搜索
- $("#sc_btns").click(function() {
- initTable();
- })
- });
- function initTable() {
- //先销毁表格
- $('#table_all').bootstrapTable('destroy');
- //初始化表格,动态从服务器加载数据
- $('#table_all').bootstrapTable({
- method: "get", //使用get请求到服务器获取数据
- url: huayi.config.callcenter_url + "configurationapi/api/AuthorizationU3D/getlistsbypage", //获取数据的Servlet地址
- contentType: "application/x-www-form-urlencoded",
- striped: true, //表格显示条纹
- pagination: true, //启动分页
- pageSize: 10, //每页显示的记录数
- pageNumber: 1, //当前第几页
- pageList: [10, 20, 50, 100], //记录数可选列表
- search: false, //是否启用查询
- showColumns: false, //显示下拉框勾选要显示的列
- showRefresh: false, //显示刷新按钮
- sidePagination: "server", //表示服务端请求
- //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
- //设置为limit可以获取limit, offset, search, sort, order
- queryParamsType: "undefined",
- queryParams: function queryParams(params) { //设置查询参数
- var param = {
- pageindex: params.pageNumber, //否 int 页码
- pagesize: params.pageSize, //否 int 条数
- projectid: $('#sc_pro').val(), //计划名称
- isopen: $('#sc_isopen').val(),//启用状态
- keyword: $('#keyword').val(),//验证序列号
- stime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[0], //开始时间
- etime: $('#sc_times').val() && $('#sc_times').val().split(' ~ ')[1] //结束时间
- };
- return param;
- },
- responseHandler: function(res) {
- //格式化数据
- return {
- "total": res.data && res.data.total, //总页数
- "rows": res.data && res.data.rows,
- }
- },
- onLoadSuccess: function(res) { //加载成功时执行
- //layer.msg("加载成功");
- $('.tool_down').authorizeOperateButton();
- },
- onLoadError: function() { //加载失败时执行
- //layer.msg("加载数据失败", { time: 1500, icon: 2 });
- }
- });
- }
- //查看项目详情
- function btn_details(edit_id) {
- layer.open({
- type: 2,
- content: "template/seeIvrDetail.html?ids=" + edit_id, //iframe的url,no代表不显示滚动条
- title: '查看IVR详情信息',
- resize: false,
- area: ['80%', '90%'], //宽高
- });
- }
- //添加
- function btn_add() {
- layer.open({
- type: 2,
- content: "template/addgrantAuthorization.html", //iframe的url,no代表不显示滚动条
- title: '添加授权验证',
- resize: false,
- area: ['80%', '90%'], //宽高
- });
- }
- //编辑
- function btn_edit(edit_id,proid,dates,remarks) {
- layer.open({
- type: 2,
- content: "template/addgrantAuthorization.html?edit_id=" + edit_id+"&proid="+proid+"&dates="+dates+"&remark="+escape(remarks), //iframe的url,no代表不显示滚动条
- title: '编辑授权验证',
- resize: false,
- area: ['80%', '90%'], //宽高
- });
- }
- //批量删除
- function btn_deletes() {
- var ids = $.map($('#table_all').bootstrapTable('getSelections'),
- function(row) {
- return row.authorizationcode;
- });
- /*判断长度*/
- if(ids.length <= 0) {
- layer.confirm('请选择要删除的选项', {
- icon: 7,
- btn: ['确定'] //按钮
- });
- return;
- }
- btn_delete(ids);
- }
- //删除
- function btn_delete(del_id) {
- layer.confirm('您确定要删除当前选中项吗?', {
- icon: 7,
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- $.post(huayi.config.callcenter_url + "configurationapi/api/AuthorizationU3D/delete", {
- ids: del_id,
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {
- layer.msg("删除成功");
- $('#table_all').bootstrapTable('refresh');
- }
- })
- },
- });
- }
- //启用
- function btn_on(on_id){
- layer.confirm('您确定要启用当前选中项吗?', {
- icon: 7,
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- $.post(huayi.config.callcenter_url + "configurationapi/api/AuthorizationU3D/open", {
- authorizationcode: on_id,
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {
- layer.msg("启用成功!");
- $('#table_all').bootstrapTable('refresh');
- }
- })
- },
- });
- }
- //禁用
- function btn_off(on_id){
- layer.confirm('您确定要禁用当前选中项吗?', {
- icon: 7,
- btn: ['确定', '取消'],
- yes: function(index, layero) {
- $.post(huayi.config.callcenter_url + "configurationapi/api/AuthorizationU3D/close", {
- authorizationcode: on_id,
- isenable:0
- }, function(result) {
- result = JSON.parse(result);
- if(result.state.toLowerCase() == "success") {
- layer.msg("禁用成功!");
- $('#table_all').bootstrapTable('refresh');
- }
- })
- },
- });
- }
- //格式化操作
- function formatterOperate(val, row) {
- var str = '<div class="task_tools" onclick = helper.methods.taskTools(this)>' +
- '<a title="操作"><i class="fa fa-cogs" aria-hidden="true"></i></a>' +
- '<ul class="tool_down">' +
- // '<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>' +
- '<li><a class="aBtn" authorize="yes" id="HY_edit_' + row.id + '" onclick="btn_edit(\'' + row.authorizationcode + '\',\'' + row.projectid + '\',\'' + formatterSdate(row.duedate)+ '\',\'' + row.remark + '\')"><i class="fa icon-edit tub"></i>编辑</a><li>' +
- '<li><a class="aBtn" authorize="yes" id="HY_delete_' + row.id + '" onclick="btn_delete(\'' + row.authorizationcode + '\')"><i class="fa icon-delete tub"></i>删除</a><li>'
- if(val==0){
- str +='<li><a class="aBtn" authorize="yes" id="HY_on_' + row.id + '" onclick="btn_on(\'' + row.authorizationcode + '\')"><i class="glyphicon glyphicon-play tub"></i>启用</a><li>'
-
- }else{
- str +='<li><a class="aBtn" authorize="yes" id="HY_off_' + row.id + '" onclick="btn_off(\'' + row.authorizationcode + '\')"><i class="glyphicon glyphicon-pause tub"></i>禁用</a><li>'
- }
- str += '</ul></div>'
- return str;
- }
- //格式化备注内容
- function formatterContent(val, row) {
- if(val) {
- var codeContent = decodeURIComponent(val);
- var str = '<div '
- if(codeContent.length > 10) {
- codeContent = codeContent.substr(0, 10) + "...";
- str = str + ' title="' + codeContent + '" ';
- }
- return str + '>' + codeContent + '</div>';
- } else {
- return '-';
- }
- }
- //格式化是否启用
- function formatterIsenable(val, row) {
- //是否启用(呼入流程默认开启)0不启用,1启用
- var str="";
- if(val==0){
- str="禁用";
- }else{
- str="启用";
- }
- return str
- }
- //格式化开始日期
- function formatterSdate(val, row) {
- return val && val.split(' ')[0];
- }
- //结束时间 超期变红
- function formatterEndTime(val, row) {
-
- if(val){
- val=val && val.split(' ')[0]
- var str="";
- if(row.duedate_day <0){
- str = '<div style="color:red;">' + val + '</div>';
- }else{
- str = '<div style="color:darkgreen;">' + val + '</div>';
- }
- return str
- } else{
- return "-";
- }
- // if(val) {
- // var d = val.replace(/-/g, "/");
- // var curDate = helper.DateFormat.getNowDateTime();
- // curDate = curDate.replace(/-/g, "/");
- // var str = '';
- // if(Date.parse(d) >= Date.parse(curDate)) {
- // str = '<div>' + val.split(' ')[0] + '</div>';
- // } else {
- // str = '<div style="color:red;">' + val.split(' ')[0] + '</div>';
- // }
- // return str
- // } else {
- // return "-";
- // }
- }
- function formatterDuedate(val, row){
- var str="";
- if(val <0){
- str = '<div style="color:red;">' + val + '</div>';
- }else{
- str = '<div style="color:darkgreen;">' + val + '</div>';
- }
- return str
-
- }
- //项目信息
- function GetEquipName(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择项目名称</option>');
- $.getJSON(huayi.config.callcenter_url + "equipmentapi/api/ProjectInfo/getlistdrop", function(data) {
- if(data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function(i, n) {
- $("<option value='" + n.id + "'>" + n.text + "</option>").appendTo(obj);
- })
- obj.selectpicker('refresh');
- obj.trigger('change');
- }
- })
- }
|