df3e4673bfbf46fd9ef9564f03db0237d5d1b9ae.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. $(function(){
  2. teamid = (window.location.href).split('?')[1];
  3. var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
  4. var params = {
  5. classid : '261',
  6. objectID : teamid
  7. };
  8. $.ajax({
  9. url : url,
  10. type : 'post',
  11. timeout : 60000,
  12. data : params,
  13. dataType : 'json',
  14. success : function(data){
  15. unit=data.TEAM_COMP_ID_261;
  16. teamname=data.TEAM_NAME_261;
  17. },
  18. error : function(e){
  19. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  20. }
  21. });
  22. });
  23. var g;
  24. var teamid;
  25. var unit;
  26. var teamname;
  27. var sex={"list":[
  28. {value:"1",key:"男",suggest:""},
  29. {value:"0",key:"女",suggest:""}]};
  30. var specialty={"list":[
  31. {value:"1",key:"输电线路",suggest:""},
  32. {value:"2",key:"输电电缆",suggest:""},
  33. {value:"3",key:"一次变电",suggest:""},
  34. {value:"4",key:"二次变电",suggest:""},
  35. {value:"5",key:"配电线路",suggest:""},
  36. {value:"6",key:"配电电缆",suggest:""},
  37. {value:"7",key:"低压电房",suggest:""},
  38. {value:"8",key:"应急保电",suggest:""},
  39. {value:"9",key:"通信",suggest:""},
  40. {value:"10",key:"网络信息",suggest:""},
  41. {value:"11",key:"试验",suggest:""}]};
  42. var dwgw={"list":[
  43. {value:"1",key:"队长",suggest:""},
  44. {value:"2",key:"副队长",suggest:""},
  45. {value:"3",key:"队员",suggest:""},
  46. {value:"4",key:"安全员",suggest:""},
  47. {value:"5",key:"设计",suggest:""},
  48. {value:"6",key:"监理",suggest:""}]};
  49. var dydj={"list":[
  50. // {value:"132",key:"±800KV(直流)",suggest:""},
  51. // {value:"133",key:"±500KV(直流)",suggest:""},
  52. {value:"134",key:"500kV",suggest:""},
  53. {value:"135",key:"220kV",suggest:""},
  54. {value:"136",key:"110kV",suggest:""},
  55. {value:"137",key:"35kV",suggest:""},
  56. {value:"138",key:"10kV",suggest:""},
  57. {value:"139",key:"400V以下",suggest:""}]};
  58. function initGrid(data){
  59. //下拉框状态之后再加
  60. g = $("#maingrid").quiGrid({
  61. columns: [
  62. // { display: '单位名称', name: 'TEAM_UNIT_262', align: 'center', width: "150px",editor: { type: 'text'}},
  63. // { display: '队伍名称及编号', name: 'TEAM_NAME_262', align: 'center', width: "150px",editor: { type: 'text'}},
  64. { display: '人员编号', name: 'CODE_262', align: 'center', width: "150px",editor: { type: 'text'}},
  65. { display: '姓名', name: 'NAME_262', align: 'center', width: "150px",editor: { type: 'text'}},
  66. { display: '身份证号码', name: 'ID_NUMBER_262', align: 'center', width: "150px",editor: { type: 'text'}},
  67. { display: '出生年月', name: 'BIRTH_DATE_262', align: 'center', width: "150px",editor: { type: 'date',dateFmt:'yyyy-MM'}},
  68. { display: '性别', name: 'SEX_262', align: 'center', width: "150px",
  69. editor: { type: 'select',data:sex,selWidth:150},render:function (item){
  70. for (var i = 0; i < sex["list"].length; i++)
  71. {
  72. if (sex["list"][i]['value'] == item.SEX_262)
  73. return sex["list"][i]['key'];
  74. }
  75. return item.SEX_262;
  76. }
  77. },
  78. { display: '本工种工龄', name: 'WORK_TYPE_AGE_262', align: 'center', width: "150px",editor: { type: 'text'}},
  79. { display: '所在部门', name: 'DEPT_ID_262', align: 'center', width: "150px",editor: { type: 'text'}},
  80. { display: '职务岗位', name: 'DEPT_QUARTERS_262', align: 'center', width: "150px",editor: { type: 'text'}},
  81. { display: '技术职称', name: 'TECHNICAL_TITLE_262', align: 'center', width: "150px",editor: { type: 'text'}},
  82. { display: '技能等级', name: 'SKILL_LEVEL_262', align: 'center', width: "150px",editor: { type: 'text'}},
  83. { display: '专业', name: 'PROFESSIONAL_262', align: 'center', width: "150px",
  84. editor: { type: 'select',data:specialty,selWidth:150},render:function (item){
  85. for (var i = 0; i < specialty["list"].length; i++)
  86. {
  87. if (specialty["list"][i]['value'] == item.PROFESSIONAL_262)
  88. return specialty["list"][i]['key'];
  89. }
  90. return item.PROFESSIONAL_262;
  91. }
  92. },
  93. { display: '电压等级', name: 'VOLTAGE_LEVEL_262', align: 'center', width: "150px",
  94. editor: { type: 'select',data:dydj,selWidth:150},render:function (item){
  95. for (var i = 0; i < dydj["list"].length; i++)
  96. {
  97. if (dydj["list"][i]['value'] == item.VOLTAGE_LEVEL_262)
  98. return dydj["list"][i]['key'];
  99. }
  100. return item.VOLTAGE_LEVEL_262;
  101. }
  102. },
  103. { display: '联系手机', name: 'TELEPHONE_262', align: 'center', width: "150px",editor: { type: 'text'}},
  104. { display: '抢险经历', name: 'RESCUE_EXP_262', align: 'center', width: "150px",editor: { type: 'text'}},
  105. { display: '队伍岗位', name: 'TEAM_QUARTERS_262', align: 'center', width: "150px",
  106. editor: { type: 'select',data:dwgw,selWidth:150},render:function (item){
  107. for (var i = 0; i < dwgw["list"].length; i++)
  108. {
  109. if (dwgw["list"][i]['value'] == item.TEAM_QUARTERS_262)
  110. return dwgw["list"][i]['key'];
  111. }
  112. return item.TEAM_QUARTERS_262;
  113. }
  114. },
  115. { display: '备注', name: 'REMARK_262', align: 'center', width: "150px",editor: { type: 'text'}}
  116. ],
  117. // url :$.pathname() + '/ws/ExcelTeamer/TeamerExcelToDBTableTool/getTeamerInExpertExcel',
  118. // params : {fileName:"D:\\apache-tomcat-6.0.36\\webapps\\nwyj\\upload\\.xls"},
  119. data:data,
  120. sortName : '',
  121. sortOrder : '',
  122. rownumbers:true,
  123. checkbox:true,
  124. // height: '100%',
  125. width:"100%",
  126. usePager : false,
  127. enabledEdit: true, //编辑用
  128. percentWidthMode:true,
  129. onAfterShowData:function(){
  130. setH();
  131. },
  132. //顶部图标按钮栏
  133. toolbar:{
  134. items:[
  135. {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
  136. { line : true }
  137. ]
  138. }
  139. });
  140. //监听页面显示的下拉框
  141. $("select[name=rp]").bind("change",function(){
  142. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  143. });
  144. //下拉框高度自适应
  145. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  146. }
  147. function saveAll(){
  148. var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;
  149. var rows=g.getSelectedRows();
  150. var rowsLength = rows.length;
  151. if (rowsLength == 0) {
  152. top.Dialog.alert("请选中要导入的信息!");
  153. return;
  154. }
  155. var json=JSON.stringify(rows);
  156. var myobj=eval(json);
  157. for(var i=0;i<myobj.length;i++){
  158. var fff =1;
  159. fff = fff+i;
  160. var NAME_262 = myobj[i].NAME_262;
  161. var SEX_262 = myobj[i].SEX_262;
  162. // var ID_NUMBER_262 = myobj[i].ID_NUMBER_262;
  163. var BIRTH_DATE_262 = myobj[i].BIRTH_DATE_262;
  164. var WORK_TYPE_AGE_262 = myobj[i].WORK_TYPE_AGE_262;
  165. var PROFESSIONAL_262 = myobj[i].PROFESSIONAL_262;
  166. var TELEPHONE_262 = myobj[i].TELEPHONE_262;
  167. var TEAM_QUARTERS_262 = myobj[i].TEAM_QUARTERS_262;
  168. var REMARK_262 = myobj[i].REMARK_262;
  169. if(NAME_262.length==0){
  170. top.Dialog.alert("第"+fff +"行姓名不能为空值,请补全!");
  171. return;
  172. }
  173. if(SEX_262.length==0){
  174. top.Dialog.alert("第"+fff +"行性别不能为空值,请补全!");
  175. return;
  176. }
  177. if(BIRTH_DATE_262.length==0){
  178. top.Dialog.alert("第"+fff +"行出生年月不能为空值,请补全!");
  179. return;
  180. }
  181. /*if(PatternsDict.test(BIRTH_DATE_262)){
  182. }else{
  183. top.Dialog.alert("第"+ fff + "行的出生年月不合法,请检查!");
  184. return;
  185. }*/
  186. if(WORK_TYPE_AGE_262.length==0){
  187. top.Dialog.alert("第"+fff +"行本工种工龄不能为空值,请补全!");
  188. return;
  189. }
  190. if(PROFESSIONAL_262.length==0){
  191. top.Dialog.alert("第"+fff +"行专业不能为空值,请补全!");
  192. return;
  193. }
  194. if(TELEPHONE_262.length==0){
  195. top.Dialog.alert("第"+fff +"行联系方式不能为空值,请补全!");
  196. return;
  197. }
  198. if(TEAM_QUARTERS_262.length==0){
  199. top.Dialog.alert("第"+fff +"行队伍岗位不能为空值,请补全!");
  200. return;
  201. }
  202. if(REMARK_262.length>300){
  203. top.Dialog.alert("第"+fff +"行备注长度超长,请检查!(300个汉字以内)");
  204. return;
  205. }
  206. }
  207. var url = $.pathname() + "/ws/ExcelTeamer/TeamerExcelToDBTableTool/teamerInToDb";
  208. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  209. var params = {
  210. classId : '262',
  211. teamId:teamid,
  212. unit:unit,
  213. teamName:teamname,
  214. userid : userId,
  215. json:json
  216. };
  217. $.ajax({
  218. url : url,
  219. type : 'post',
  220. timeout : 15000,
  221. data : params,
  222. dataType : 'json',
  223. success : function(data) {
  224. $.messager.alert('保存成功');
  225. // window.location.href="team.jsp";
  226. window.history.back();
  227. },
  228. error : function(e) {
  229. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  230. }
  231. });
  232. }
  233. //下模板
  234. function xiazai(){
  235. window.open("/nwyj/excels/teamerduiwurenyuan.xls");
  236. }
  237. $.messager=top.Dialog;
  238. function setH(){
  239. var p_iframe = $(parent.document.body).find("#frmrightChild");
  240. if(p_iframe && p_iframe.length>0){
  241. p_iframe.css("height",$(window.document.body).height()+30);
  242. var left_h = $(parent.document.body).find("#layout1 .l-layout-left").height();
  243. var left_c = p_iframe.height();
  244. var height = left_h>left_c?left_h:left_c;
  245. $(parent.document.body).height(height);
  246. $(top.document.body).find("iframe").css("height",$(parent.document.body).height()+30);
  247. }else{
  248. if(parent==top){
  249. $(parent.document.body).find("iframe").css("height",$(window.document.body).height()+30);
  250. }
  251. if(parent!=top){
  252. $(parent.document.body).find("iframe").css("height",$(window.document.body).height()+30);
  253. $(top.document.body).find("iframe").css("height",$(parent.document.body).height()+30);
  254. }
  255. }
  256. }