var token = $.cookie("token"); var table = $('#table1'); $('#depID').val(0); $(document).ready(function () { // $('#firstOne').trigger("click"); //右侧搜索事件 initTable($('#depID').val()); $('#rightSearch').click(function () { initTable($('#depID').val()); }) if ($('.allAdd').hasClass('active')) { $('.addTo').hide(); } else { $('.addTo').show(); } //右侧关键字鼠标移入效果 $('.keyList li').hover(function () { $('.keyList li').removeClass('active') $(this).addClass('active'); }, function () { $(this).removeClass('active'); }) $('.addTo').click(function () { var depid = $('#depID').val(); goAdd(depid); }) var headhtml = '
'; var lbhtml = headhtml + '
  • ' + ' ' + ' ' + '
    全部
    ' + '
    ' + '
  • '; $.getJSON(huayi.config.callcenter_url + "Department/GetDealDeptList", { "token": $.cookie("token") }, function (data) { if (data.state == "success") { $(data.data).each(function (i, n) { lbhtml += '
  • ' + ' ' + ' ' + '
    ' + n.F_DeptName + '
    ' + '
    ' + '
  • '; if (i + 1 != data.data.length) { if ((i + 2) % 18 == 0) { lbhtml += foothtml + headhtml; } } else { lbhtml += foothtml; } }) $(lbhtml).appendTo($(".swiper-container")); var mySwiper = new Swiper('.swiper-container', { // direction: 'vertical', // loop: true, // 如果需要分页器 pagination: { el: '.swiper-pagination', clickable: true, } }) $('.unitList li').click(function () { $('.unitList li').removeClass('active') $(this).addClass('active'); if ($('.allAdd').hasClass('active')) { $('.addTo').hide(); } else { $('.addTo').show(); } var depId = $(this).attr('data-id'); var keyWord = $(this).find('div').html(); $('.rightTabKey').html(keyWord); $('#depID').val(depId); initTable(depId); }) //左侧单位鼠标移入效果 $('.unitList li').hover(function () { $(this).addClass('acs'); }, function () { $(this).removeClass('acs'); }) } }) }) function goAdd(ids) { //iframe窗 layer.open({ type: 2, title: '新增知识库', area: ['70%', '60%'], content: 'newRepositoryAdd.html?depId=' + ids + '' }); } function initTable(ids) { //先销毁表格 table.bootstrapTable('destroy'); //初始化表格,动态从服务器加载数据 table.bootstrapTable({ method: "get", //使用get请求到服务器获取数据 url: huayi.config.callcenter_url + "Repository/GetList", //获取数据的Servlet地址 contentType: "application/x-www-form-urlencoded", striped: true, striped: true, //表格显示条纹 pagination: true, //启动分页 pageSize: 10, //每页显示的记录数 pageNumber: 1, //当前第几页 pageList: [10, 15, 25], //记录数可选列表 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 = { page: params.pageNumber, pagesize: params.pageSize, token: token, deptid: ids, key: $('.rightSearchKey').val(), // starttime: 否 string 开始时间 (2017-01-09) // endtime: }; return param; }, onLoadSuccess: function () { //加载成功时执行 //layer.msg("加载成功"); }, onLoadError: function () { //加载失败时执行 //layer.msg("加载数据失败", { time: 1500, icon: 2 }); } }); } //操作 function CZ(val, row) { var str = ''; if (top.$("#RoleCode").val() == 'GLY') { str = '
    ' + '查看' + '编辑' + '删除' + '
    ' } else { str = '
    ' + '查看' + '编辑' + '
    ' } return str } //详情 function goDetail(ids) { //iframe窗 layer.open({ type: 2, title: '查看知识库详情', area: ['70%', '60%'], maxmin: true, content: 'newRepositoryDetail.html?ids=' + ids + '' }); } //修改 function goEdit(ids) { //iframe窗 layer.open({ type: 2, title: '编辑知识库', area: ['70%', '60%'], maxmin: true, content: 'newRepositoryAdd.html?ids=' + ids + '&depId=' + $('#depID').val() }); } //删除 function goDel(id) { var arr = []; arr.push(id); var laye = layer.confirm('您确定要删除吗?', { btn: ['确定', '取消'] //可以无限个按钮 }, function () { //按钮【按钮一】的回调 $.ajax({ type: "post", url: huayi.config.callcenter_url + "Repository/DelRepository", async: true, dataType: 'json', data: { token: $.cookie("token"), ids: arr }, success: function (data) { if (data.state.toLowerCase() == 'success') { layer.msg("删除成功!"); layer.close(laye); table.bootstrapTable('refresh'); } } }); }, function (index) { //按钮【按钮二】的回调 layer.close(laye) }); }