f671b224ccc83c5a1d7e8c24a382d0bc787db24a.svn-base 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. var comp_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  3. function initComplete(){
  4. var condition ='1=1';
  5. initGrid(condition);
  6. }
  7. function initGrid(condition){
  8. var roleCons = roleButtonArr();
  9. var option = {
  10. columns : [
  11. // {display : '报表名称', name : 'REPORT_NAME_443',align : 'center',width : "100%",isPrimaryKey:true,render:editReport}
  12. {display : '报表名称', name : 'REPORT_NAME_443',align : 'center',width : "100%",isPrimaryKey:true,//render:editReport,
  13. render : function(rowdata, rowindex, value, column) {
  14. // return "<div onclick=editmodel("+rowdata.REPORT_TYPE_443+",'"+value+"')>"+rowdata.REPORT_NAME_443+"</div>";
  15. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick=editmodel("+rowdata.REPORT_TYPE_443+",'"+value+"')>" + value + "</a>";
  16. }
  17. }
  18. /* {display : '填报部门', name : 'TABLE_NAME_443',align : 'center', width : "50%",showTitle:true}*/
  19. ],
  20. pageSize : 10,
  21. rownumbers : true,
  22. percentWidthMode : true,
  23. checkbox : true
  24. };
  25. var toolBars =getItem(comp_id, role_id, roleCons);
  26. function getItem(compId,roleId,roleCons){
  27. var item = "";
  28. var roleArr = role_id.split(",");
  29. if(compId=="8F6F2D6B24494CB6B1F1E0931E7AF87D" && $.inArray("R002105430213",roleArr)>-1){
  30. item= {
  31. items: [
  32. { text: '新增', click: 'onAdd', iconClass: 'add1_tem', disabled: false ,id:"bbxz"},
  33. { text: '删除', click: 'onDelete', iconClass: 'delete_tem', disabled: false,id:"bbsc" }
  34. ],
  35. roleCons:roleCons
  36. };
  37. }else{
  38. item = false;
  39. }
  40. return item;
  41. }
  42. var options={
  43. url : $.pathname() + '/ws/crud/CRUDService/queryQui',
  44. params:{
  45. "listId":443,
  46. "condition":condition,
  47. direction : 'desc', // 排序方式
  48. sort : 'REPORT_NAME'
  49. },
  50. width:"100%",
  51. gridOptions:option,
  52. paperOpration:{showInput:"true"},
  53. toolBarOptions:toolBars
  54. };
  55. g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options);
  56. }
  57. function onAdd(){
  58. /*if(comp_id!="8F6F2D6B24494CB6B1F1E0931E7AF87D"){
  59. top.Dialog.alert("只有省公司的安监部人员才有权限新增");
  60. return;
  61. }*/
  62. var url = "/nwyj/page/business/am/report/addReport/addNewReport.jsp";
  63. window.parent.document.getElementById("frmright").setAttribute("src", encodeURI(url));
  64. }
  65. function editReport(rowdata,rowindex,value,column){
  66. return "<div onclick=editmodel("+rowdata.REPORT_TYPE_443+",'"+value+"')>"+rowdata.REPORT_NAME_443+"</div>";
  67. }
  68. function editmodel(val,table){
  69. var iframe = parent.document.getElementsByName("frmright")[0];
  70. iframe.src = encodeURI("/nwyj/page/business/am/report/dictionary/Show_Type.html?"+val+"?"+table);
  71. }
  72. /*window.onload = function (){
  73. $(".selectbox").attr("readonly","readonly");
  74. };*/
  75. function getRole_id(id){
  76. /*var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();*/
  77. if(id.indexOf(",")!=-1){
  78. var role_ids = id.split(",");
  79. for(var i=0;i<role_ids.length;i++){
  80. if(role_ids[i]=="R002105430210"||role_ids[i]=="R002105430211"||role_ids[i]=="R002105430212"||role_ids[i]=="R002105430213"){
  81. return role_ids[i];
  82. }
  83. }
  84. }else{
  85. return id;
  86. }
  87. }
  88. function onDelete(){
  89. var row = g.getSelectedRows();
  90. /*if(comp_id!="8F6F2D6B24494CB6B1F1E0931E7AF87D"){
  91. top.Dialog.alert("只有省公司的安监部人员才有权限删除");
  92. return;
  93. }*/
  94. if(row.length==0){
  95. top.Dialog.alert("请选择要删除的记录");
  96. return;
  97. }
  98. if(row.length>1){
  99. top.Dialog.alert("一次只能删除一条记录");
  100. return;
  101. }
  102. var fd_id = row[0].FD_OBJECTID_443;
  103. //var report_name = row[0].REPORT_NAME_443;
  104. var report_type=row[0].REPORT_TYPE_443;
  105. var delUrl = $.pathname() +"/ws/xianlutingyun/XianlutingyunService/deleteRcTables";
  106. var params = {fd_id:fd_id,
  107. check:"rc",
  108. type:report_type};
  109. top.Dialog.confirm("确定要删除吗?|删除", function() {
  110. addRecords(delUrl,params,"删除表");
  111. g.rend();
  112. });
  113. }