商丘12345 前端

repositoryDrafts.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. var mySwiper = new Swiper ('.swiper-container', {
  2. // direction: 'vertical',
  3. // loop: true,
  4. // 如果需要分页器
  5. pagination: {
  6. el: '.swiper-pagination',
  7. clickable: true,
  8. },
  9. })
  10. var token = $.cookie("token");
  11. var table = $('#table1');
  12. $('#depID').val(0);
  13. $(document).ready(function(){
  14. // $('#firstOne').trigger("click");
  15. //右侧搜索事件
  16. initTable($('#depID').val());
  17. $('#rightSearch').click(function(){
  18. initTable($('#depID').val());
  19. })
  20. function initTable(ids) {
  21. //先销毁表格
  22. table.bootstrapTable('destroy');
  23. //初始化表格,动态从服务器加载数据
  24. table.bootstrapTable({
  25. method: "get", //使用get请求到服务器获取数据
  26. url: huayi.config.callcenter_url + "Repository/GetList", //获取数据的Servlet地址
  27. contentType: "application/x-www-form-urlencoded", striped: true,
  28. striped: true, //表格显示条纹
  29. pagination: true, //启动分页
  30. pageSize: 10, //每页显示的记录数
  31. pageNumber: 1, //当前第几页
  32. pageList: [10, 15, 25], //记录数可选列表
  33. search: false, //是否启用查询
  34. showColumns: false, //显示下拉框勾选要显示的列
  35. showRefresh: false, //显示刷新按钮
  36. sidePagination: "server", //表示服务端请求
  37. //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
  38. //设置为limit可以获取limit, offset, search, sort, order
  39. queryParamsType: "undefined",
  40. queryParams: function queryParams(params) { //设置查询参数
  41. var param = {
  42. page: params.pageNumber,
  43. pagesize: params.pageSize,
  44. token: token,
  45. deptid:ids,
  46. type:0,
  47. key:$('.rightSearchKey').val(),
  48. // starttime: 否 string 开始时间 (2017-01-09)
  49. // endtime:
  50. };
  51. return param;
  52. },
  53. onLoadSuccess: function () { //加载成功时执行
  54. //layer.msg("加载成功");
  55. },
  56. onLoadError: function () { //加载失败时执行
  57. //layer.msg("加载数据失败", { time: 1500, icon: 2 });
  58. }
  59. });
  60. }
  61. if($('.allAdd').hasClass('active')){
  62. $('.addTo').hide();
  63. }else{
  64. $('.addTo').show();
  65. }
  66. $('.unitList li').click(function(){
  67. $('.unitList li').removeClass('active')
  68. $(this).addClass('active');
  69. if($('.allAdd').hasClass('active')){
  70. $('.addTo').hide();
  71. }else{
  72. $('.addTo').show();
  73. }
  74. var depId=$(this).attr('data-id');
  75. var keyWord=$(this).find('div').html();
  76. $('.rightTabKey').html(keyWord);
  77. $('#depID').val(depId);
  78. initTable(depId);
  79. })
  80. //左侧单位鼠标移入效果
  81. $('.unitList li').hover(function(){
  82. $(this).addClass('acs');
  83. },function(){
  84. $(this).removeClass('acs');
  85. })
  86. //右侧关键字鼠标移入效果
  87. $('.keyList li').hover(function(){
  88. $('.keyList li').removeClass('active')
  89. $(this).addClass('active');
  90. },function(){
  91. $(this).removeClass('active');
  92. })
  93. $('.addTo').click(function(){
  94. var depid=$('#depID').val();
  95. goAdd(depid)
  96. })
  97. function goAdd(ids){
  98. //iframe窗
  99. layer.open({
  100. type: 2,
  101. title: '新增知识库',
  102. area: ['70%', '60%'],
  103. content: 'newRepositoryAdd.html?depId='+ ids +''
  104. });
  105. }
  106. })
  107. //操作
  108. function CZ(val,row){
  109. var str='';
  110. if(top.$("#RoleCode").val()=='GLY'){
  111. str='<div>'+
  112. '<a class="xg" onclick="goDetail(' + row.F_Id + ')" title="点击查看详情">查看</a>'+
  113. '<a class="xg" onclick="goEdit(' + row.F_Id + ')" title="点击编辑">编辑</a>'+
  114. '<a class="xg" onclick="goDel(' + row.F_Id + ')" title="点击编辑">删除</a>'+
  115. '</div>'
  116. }else{
  117. str='<div>'+
  118. '<a class="xg" onclick="goDetail(' + row.F_Id + ')" title="点击查看详情">查看</a>'+
  119. '<a class="xg" onclick="goEdit(' + row.F_Id + ')" title="点击编辑">编辑</a>'+
  120. '</div>'
  121. }
  122. return str
  123. }
  124. //详情
  125. function goDetail(ids){
  126. //iframe窗
  127. layer.open({
  128. type: 2,
  129. title: '查看知识库详情',
  130. area: ['70%', '60%'],
  131. maxmin:true,
  132. content: 'newRepositoryDetail.html?ids='+ ids +''
  133. });
  134. }
  135. //修改
  136. function goEdit(ids){
  137. //iframe窗
  138. layer.open({
  139. type: 2,
  140. title: '编辑知识库',
  141. area: ['70%', '60%'],
  142. maxmin:true,
  143. content: 'newRepositoryAdd.html?ids='+ ids +'&depId='+$('#depID').val()
  144. });
  145. }
  146. //删除
  147. function goDel(id) {
  148. var arr=[];
  149. arr.push(id);
  150. var laye = layer.confirm('您确定要删除吗?', {
  151. btn: ['确定', '取消'] //可以无限个按钮
  152. }, function() {
  153. //按钮【按钮一】的回调
  154. $.ajax({
  155. type: "post",
  156. url: huayi.config.callcenter_url + "Repository/DelRepository",
  157. async: true,
  158. dataType: 'json',
  159. data: {
  160. token: $.cookie("token"),
  161. ids: arr
  162. },
  163. success: function(data) {
  164. if(data.state.toLowerCase() == 'success') {
  165. layer.msg("删除成功!");
  166. layer.close(laye);
  167. table.bootstrapTable('refresh');
  168. }
  169. }
  170. });
  171. }, function(index) {
  172. //按钮【按钮二】的回调
  173. layer.close(laye)
  174. });
  175. }