0cb77fc2b456905494b70b400fa10881d20ee109.svn-base 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  3. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  4. var g;
  5. var classes={"list":[
  6. {value:"R002105430201",key:"应急总指挥",suggest:""},
  7. {value:"R002105430202",key:"应急副总指挥",suggest:""},
  8. {value:"R002105430203",key:"应急办主任",suggest:""},
  9. {value:"R002105430204",key:"应急办副主任",suggest:""},
  10. {value:"R002105430205",key:"应急办成员",suggest:""},
  11. {value:"R002105430213",key:"专业管理部门(安全监管部)",suggest:""},
  12. {value:"R002105430210",key:"专业管理部门(系统运行部)",suggest:""},
  13. {value:"R002105430211",key:"专业管理部门(生产设备部)",suggest:""},
  14. {value:"R002105430212",key:"专业管理部门(市场营销部)",suggest:""}]};
  15. var yesorno = {"list":[
  16. {value:"0",key:"是",suggest:""},
  17. {value:"1",key:"否",suggest:""}]};
  18. function initGrid(data){
  19. g = $("#maingrid").quiGrid({
  20. columns: [
  21. { display: '姓名', name: 'NAME_777', align: 'center', width: "25%" ,editor: { type: 'text',maxlength:20}},
  22. { display: '电话', name: 'TELPHONE_777', align: 'center', width: "25%" ,editor: { type: 'text',maxlength:20}},
  23. { display: '职能', name: 'COMPETENCY_777', align: 'center', width: "25%" ,
  24. editor: { type: 'select',data:classes,selWidth:200 },render:function (item){
  25. for (var i = 0; i < classes["list"].length; i++)
  26. {
  27. if (classes["list"][i]['value'] == item.COMPETENCY_777)
  28. return classes["list"][i]['key'];
  29. }
  30. return item.COMPETENCY_777;
  31. }
  32. },
  33. { display: '是否领导', name: 'ISLEADER_777', align: 'center', width: "25%" ,
  34. editor: { type: 'select',data:yesorno,selWidth:200 },render:function (item){
  35. for (var i = 0; i < yesorno["list"].length; i++)
  36. {
  37. if (yesorno["list"][i]['value'] == item.ISLEADER_777)
  38. return yesorno["list"][i]['key'];
  39. }
  40. return item.ISLEADER_777;
  41. }
  42. }
  43. ],
  44. data:data,
  45. sortName : '',
  46. sortOrder : '',
  47. rownumbers:true,
  48. checkbox:true,
  49. // height: '100%',
  50. width:"100%",
  51. usePager : false,
  52. enabledEdit: true, //编辑用
  53. percentWidthMode:true,
  54. //顶部图标按钮栏
  55. toolbar:{
  56. items:[
  57. {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
  58. { line : true }
  59. ]
  60. }
  61. });
  62. //监听页面显示的下拉框
  63. $("select[name=rp]").bind("change",function(){
  64. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  65. });
  66. //下拉框高度自适应
  67. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  68. }
  69. function saveAll(){
  70. var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;//日期验证
  71. var PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+");//特殊字符验证
  72. var rows=g.getSelectedRows();
  73. var rowsLength = rows.length;
  74. if (rowsLength == 0) {
  75. top.Dialog.alert("请选中要导入的信息!");
  76. return;
  77. }
  78. var json=JSON.stringify(rows);
  79. var myobj=eval(json);
  80. for(var i=0;i<myobj.length;i++){
  81. var NAME_777 = myobj[i].NAME_777;
  82. var TELPHONE_777 = myobj[i].TELPHONE_777;
  83. var COMPETENCY_777 = myobj[i].COMPETENCY_777;
  84. var ISLEADER_777 = myobj[i].ISLEADER_777;
  85. var fff =1;
  86. fff = fff+i;
  87. if(NAME_777.length==0){
  88. top.Dialog.alert("第"+ fff + "行的姓名不能为空,请检查!");
  89. return;
  90. }
  91. if(TELPHONE_777.length==0){
  92. top.Dialog.alert("第"+ fff + "行的电话不能为空,请检查!");
  93. return;
  94. }
  95. for(var j=0;j<myobj.length;j++){
  96. var HHH =1;
  97. HHH = HHH+j;
  98. if(j!=i){
  99. if(TELPHONE_777==myobj[j].TELPHONE_777){
  100. top.Dialog.alert("第"+ fff + "行和第"+HHH+"行的电话重复,请检查!");
  101. return;
  102. }
  103. }
  104. }
  105. if(COMPETENCY_777.length==0){
  106. top.Dialog.alert("第"+ fff + "行的职能不能为空,请检查!");
  107. return;
  108. }
  109. if(ISLEADER_777.length==0){
  110. top.Dialog.alert("第"+ fff + "行的是否领导不能为空,请检查!");
  111. return;
  112. }
  113. }
  114. var url = $.pathname() + "/ws/MsgUserExcel/MsgUserExcelToDBTableTool/msguserToDb";
  115. var params = {
  116. classId : '777',
  117. compid:compId,
  118. json:json
  119. };
  120. $.ajax({
  121. url : url,
  122. type : 'post',
  123. timeout : 15000,
  124. data : params,
  125. dataType : 'json',
  126. success : function(data) {
  127. if(data.Msg.sucsess!=true){
  128. top.Dialog.alert(data.Msg.info);
  129. }else{
  130. $.messager.alert('保存成功');
  131. window.location.href="msguser.jsp";
  132. }
  133. },
  134. error : function(e) {
  135. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  136. }
  137. });
  138. }
  139. //下模板
  140. function xiazai(){
  141. window.open("/nwyj/excels/msguser.xls");
  142. }
  143. //返回
  144. function goBack() {
  145. window.location.href="msguser.jsp";
  146. }
  147. $.messager = top.Dialog;