8d4fffe6a2865bf6b9f3803ebd6239336d351107.svn-base 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  2. var g;
  3. var specialty={"list":[
  4. {value:"1",key:"输电",suggest:"输电|shudian|sd"},
  5. {value:"2",key:"变电(一次)",suggest:"变电(一次)|biandianyici|bdyc"},
  6. {value:"3",key:"变电(二次)",suggest:"变电(二次)|biandianerci|bdec"},
  7. {value:"4",key:"通信",suggest:"通信|tongxi|tx"},
  8. {value:"5",key:"配电(中压)",suggest:"配电(中压)|peidianzhongya|pdzy"},
  9. {value:"6",key:"配电(低压)",suggest:"配电(低压)|peidiandiya|pddy"},
  10. {value:"7",key:"土建",suggest:"土建|tujian|tj"},
  11. {value:"8",key:"机械",suggest:"机械|jixie|jx"},
  12. {value:"9",key:"水工",suggest:"水工|shuigong|sg"},
  13. {value:"10",key:"后勤",suggest:"后勤|houqin|hq"},
  14. {value:"11",key:"医疗",suggest:"医疗|yiliao|yl"},
  15. {value:"12",key:"其他",suggest:"其他|qita|qt"}]};
  16. var changeType={"list":[
  17. {value:"1",key:"新建",suggest:""},
  18. {value:"2",key:"更新",suggest:""}]};
  19. var sex={"list":[
  20. {value:"1",key:"男",suggest:""},
  21. {value:"0",key:"女",suggest:""}]};
  22. var staff={"list":[
  23. {value:"0",key:"是",suggest:""},
  24. {value:"1",key:"否",suggest:""}]};
  25. var zhicheng={"list":[
  26. {value:"1",key:"高级工程师",suggest:""},
  27. {value:"2",key:"中级工程师",suggest:""},
  28. {value:"3",key:"初级工程师",suggest:""},
  29. {value:"4",key:"高级技师",suggest:""},
  30. {value:"5",key:"技师",suggest:""},
  31. {value:"6",key:"高级工",suggest:""},
  32. {value:"7",key:"中级工",suggest:""}]};
  33. var zhiwu={"list":[
  34. {value:"1",key:"主任",suggest:""},
  35. {value:"2",key:"副主任",suggest:""},
  36. {value:"3",key:"科长",suggest:""},
  37. {value:"4",key:"副科长",suggest:""},
  38. {value:"5",key:"专责",suggest:""},
  39. {value:"6",key:"班长",suggest:""}]};
  40. var xieli={"list":[
  41. {value:"1",key:"大专",suggest:""},
  42. {value:"2",key:"本科",suggest:""},
  43. {value:"3",key:"硕士",suggest:""},
  44. {value:"4",key:"博士",suggest:""},
  45. {value:"5",key:"中专",suggest:""}]};
  46. function initGrid(data){
  47. g = $("#maingrid").quiGrid({
  48. columns: [
  49. { display: '序号', name: 'EXPERT_ID_260', align: 'center', width: "150px" ,editor: { type: 'text'}},
  50. { display: '姓名', name: 'EXPERT_NAME_260', align: 'center', width: "150px" ,editor: { type: 'text'}},
  51. { display: '性别', name: 'EXPERT_SEX_260', align: 'center', width: "150px",
  52. editor: { type: 'select',data:sex,selWidth:150 },render:function (item){
  53. for (var i = 0; i < sex["list"].length; i++)
  54. {
  55. if (sex["list"][i]['value'] == item.EXPERT_SEX_260)
  56. return sex["list"][i]['key'];
  57. }
  58. return item.EXPERT_SEX_260;
  59. }
  60. },
  61. { display: '出生年月', name: 'EXPERT_BIRTHDAY_260', align: 'center', width: "150px" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
  62. { display: '座机', name: 'EXPERT_TEL_260', align: 'center', width: "150px" ,editor: { type: 'text'}},
  63. { display: '手机', name: 'EXPERT_CAL_260', align: 'center' , width: "150px" ,editor: { type: 'text'}},
  64. { display: 'Email', name: 'EXPERT_EMAIL_260', align: 'center', width: "150px" ,editor: { type: 'text'}},
  65. { display: '学历', name: 'EDUCATION_260', align: 'center', width: "150px" ,
  66. editor: { type: 'select',data:xieli,selWidth:150 },render:function (item){
  67. for (var i = 0; i < xieli["list"].length; i++)
  68. {
  69. if (xieli["list"][i]['value'] == item.EDUCATION_260)
  70. return xieli["list"][i]['key'];
  71. }
  72. return item.EDUCATION_260;
  73. }
  74. },
  75. { display: '所属区域', name: 'EXPERT_AREA_260', align: 'center' , width: "150px" ,editor: { type: 'text'}},
  76. { display: '是否南网员工', name: 'IS_SNSTAFF_260', align: 'center', width: "150px" ,
  77. editor: { type: 'select',data:staff,selWidth:150 },render:function (item){
  78. for (var i = 0; i < staff["list"].length; i++)
  79. {
  80. if (staff["list"][i]['value'] == item.IS_SNSTAFF_260)
  81. return staff["list"][i]['key'];
  82. }
  83. return item.IS_SNSTAFF_260;
  84. }
  85. },
  86. { display: '参加工作时间', name: 'WORK_TIME_260', align: 'center', width: "150px" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
  87. { display: '职称', name: 'EXPERT_TYPE_260', align: 'center', width: "150px",
  88. editor: { type: 'select',data:zhicheng,selWidth:150 },render:function (item){
  89. for (var i = 0; i < zhicheng["list"].length; i++)
  90. {
  91. if (zhicheng["list"][i]['value'] == item.EXPERT_TYPE_260)
  92. return zhicheng["list"][i]['key'];
  93. }
  94. return item.EXPERT_TYPE_260;
  95. }
  96. },
  97. { display: '职务', name: 'EXPERT_POST_260', align: 'center', width: "150px",
  98. editor: { type: 'select',data:zhiwu,selWidth:150 },render:function (item){
  99. for (var i = 0; i < zhiwu["list"].length; i++)
  100. {
  101. if (zhiwu["list"][i]['value'] == item.EXPERT_POST_260)
  102. return zhiwu["list"][i]['key'];
  103. }
  104. return item.EXPERT_POST_260;
  105. }
  106. },
  107. { display: '住址', name: 'EXPERT_ADDRESS_260', align: 'center', width: "150px" ,editor: { type: 'text'}},
  108. { display: '住址邮编', name: 'EXPERT_POSTALCODE_260', align: 'center', width: "150px",editor: { type: 'text'}},
  109. { display: '专业特长', name: 'EXPERT_SPECIALTY_260', align: 'center', width: "150px" ,
  110. editor: { type: 'select',data:specialty,selWidth:150 },render:function (item){
  111. for (var i = 0; i < specialty["list"].length; i++)
  112. {
  113. if (specialty["list"][i]['value'] == item.EXPERT_SPECIALTY_260)
  114. return specialty["list"][i]['key'];
  115. }
  116. return item.EXPERT_SPECIALTY_260;
  117. }
  118. },
  119. { display: '应急处理经验', name: 'EXPERT_EXP_260', align: 'center', width: "150px",editor: { type: 'text'}},
  120. { display: '认定时间', name: 'IDENTIFICATION_TIME_260', align: 'center', width: "150px",editor: { type: 'date',dateFmt:'yyyy-MM-dd'}},
  121. { display: '原所属单位', name: 'EXP_COMP_260', align: 'center', width: "150px",editor: { type: 'text'}}
  122. ],
  123. data:data,
  124. sortName : '',
  125. sortOrder : '',
  126. rownumbers:true,
  127. checkbox:true,
  128. // height: '100%',
  129. width:"100%",
  130. usePager : false,
  131. enabledEdit: true, //编辑用
  132. percentWidthMode:true,
  133. onAfterShowData:function(){
  134. setH();
  135. },
  136. //顶部图标按钮栏
  137. toolbar:{
  138. items:[
  139. {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
  140. { line : true }
  141. ]
  142. }
  143. });
  144. //监听页面显示的下拉框
  145. $("select[name=rp]").bind("change",function(){
  146. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  147. });
  148. //下拉框高度自适应
  149. $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
  150. }
  151. function saveAll(){
  152. var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;//日期验证
  153. var PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+");//特殊字符验证
  154. var reg1 = /^[\u4e00-\u9fa5]+$/;
  155. var PatternsDict2=/^0?1[3|4|5|8][0-9]\d{8}$/;//手机验证
  156. var PatternsDict3=/^(\d{3,4}\-)?\d{7,8}$/i;//座机验证
  157. var PatternsDict4=/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+(\.[a-zA-Z]{2,3})+$/;//email验证
  158. var PatternsDict5=/^[1-9][0-9]{5}$/;//邮编验证
  159. var rows=g.getSelectedRows();
  160. var rowsLength = rows.length;
  161. if (rowsLength == 0) {
  162. top.Dialog.alert("请选中要导入的信息!");
  163. return;
  164. }
  165. var json=JSON.stringify(rows);
  166. var myobj=eval(json);
  167. for(var i=0;i<myobj.length;i++){
  168. var EXPERT_ID_260 = myobj[i].EXPERT_ID_260;//序号
  169. var EXPERT_NAME_260 = myobj[i].EXPERT_NAME_260;//姓名
  170. var EXPERT_SEX_260 = myobj[i].EXPERT_SEX_260;//性别
  171. var EXPERT_BIRTHDAY_260 = myobj[i].EXPERT_BIRTHDAY_260;//出生年月
  172. var EXPERT_TEL_260 = myobj[i].EXPERT_TEL_260;//座机
  173. var EXPERT_CAL_260 = myobj[i].EXPERT_CAL_260;//手机
  174. var EXPERT_EMAIL_260 = myobj[i].EXPERT_EMAIL_260;//email
  175. var EXPERT_AREA_260 = myobj[i].EXPERT_AREA_260;//所属区域
  176. var IS_SNSTAFF_260 = myobj[i].IS_SNSTAFF_260;//是否南网员工
  177. var WORK_TIME_260 = myobj[i].WORK_TIME_260;//参加工作时间
  178. var EXPERT_ADDRESS_260 = myobj[i].EXPERT_ADDRESS_260;//住址
  179. var EXPERT_POSTALCODE_260 = myobj[i].EXPERT_POSTALCODE_260;//邮编
  180. var EXPERT_SPECIALTY_260 = myobj[i].EXPERT_SPECIALTY_260;//专业特长
  181. var EXPERT_EXP_260 = myobj[i].EXPERT_EXP_260;//应急处理经验
  182. var IDENTIFICATION_TIME_260 = myobj[i].IDENTIFICATION_TIME_260;//认定时间
  183. var EXP_COMP_260 = myobj[i].EXP_COMP_260;//原所属单位
  184. var fff =1;
  185. fff = fff+i;
  186. if(EXPERT_ID_260.length>30){
  187. top.Dialog.alert("第"+ fff + "行的序号长度超长,请检查!(30个数字以内)");
  188. return;
  189. }
  190. if(EXPERT_NAME_260.length==0){
  191. top.Dialog.alert("第"+ fff + "行的姓名不能为空,请检查!");
  192. return;
  193. }else if(EXPERT_NAME_260.length>10){
  194. top.Dialog.alert("第"+fff + "行的姓名长度超长,请检查!(10个汉字以内)");
  195. return;
  196. }else if(!reg1.test(EXPERT_NAME_260)){
  197. top.Dialog.alert("第"+ fff + "行的姓名输入不合法(只能输中文),请检查!(10个汉字以内)");
  198. return;
  199. }
  200. if(EXPERT_SEX_260.length==0){
  201. top.Dialog.alert("第"+ fff + "行的性别不能为空,请检查!");
  202. return;
  203. }
  204. if(EXPERT_BIRTHDAY_260.length==0){
  205. top.Dialog.alert("第"+ fff + "行的出生年月不能为空,请检查!");
  206. return;
  207. }else if(!PatternsDict.test(EXPERT_BIRTHDAY_260)){
  208. top.Dialog.alert("第"+ fff + "行的出生年月输入不合法,请检查!");
  209. return;
  210. }
  211. if(EXPERT_TEL_260.length!=0){
  212. if(!PatternsDict3.test(EXPERT_TEL_260)){
  213. top.Dialog.alert("第"+ fff + "行的座机输入不合法,请检查!");
  214. return;
  215. }
  216. }
  217. if(EXPERT_CAL_260.length==0){
  218. top.Dialog.alert("第"+ fff + "行的手机不能为空,请检查!");
  219. return;
  220. }else if(!PatternsDict2.test(EXPERT_CAL_260)){
  221. top.Dialog.alert("第"+ fff + "行的手机输入不合法,请检查!");
  222. return;
  223. }
  224. if(EXPERT_EMAIL_260.length!=0){
  225. if(!PatternsDict4.test(EXPERT_EMAIL_260)){
  226. top.Dialog.alert("第"+ fff + "行的Email输入不合法,请检查!");
  227. return;
  228. }
  229. }
  230. if(EXPERT_AREA_260.length>40){
  231. top.Dialog.alert("第"+fff + "行的所属区域长度超长,请检查!(40个汉字以内)");
  232. return;
  233. }else if(PatternsDict1.test(EXPERT_AREA_260)){
  234. top.Dialog.alert("第"+ fff + "行的所属区域输入不合法,请检查!(40个汉字以内)");
  235. return;
  236. }
  237. if(IS_SNSTAFF_260.length==0){
  238. top.Dialog.alert("第"+ fff + "行的是否南网员工不能为空,请检查!");
  239. return;
  240. }
  241. if(WORK_TIME_260.length==0){
  242. top.Dialog.alert("第"+ fff + "行的参加工作时间不能为空,请检查!");
  243. return;
  244. }else if(!PatternsDict.test(WORK_TIME_260)){
  245. top.Dialog.alert("第"+ fff + "行的参加工作时间输入不合法,请检查!");
  246. return;
  247. }
  248. if(EXPERT_ADDRESS_260.length>40){
  249. top.Dialog.alert("第"+fff + "行的地址长度超长,请检查!(40个汉字以内)");
  250. return;
  251. }else if(PatternsDict1.test(EXPERT_ADDRESS_260)){
  252. top.Dialog.alert("第"+ fff + "行的地址输入不合法,请检查!(40个汉字以内)");
  253. return;
  254. }
  255. if(EXPERT_POSTALCODE_260.length!=0){
  256. if(!PatternsDict5.test(EXPERT_POSTALCODE_260)){
  257. top.Dialog.alert("第"+ fff + "行的邮编输入不合法,请检查!");
  258. return;
  259. }
  260. }
  261. if(EXPERT_SPECIALTY_260.length==0){
  262. top.Dialog.alert("第"+ fff + "行的专业不能为空,请检查!");
  263. return;
  264. }
  265. if(EXPERT_EXP_260.length>300){
  266. top.Dialog.alert("第"+fff + "行的应急处理经验长度超长,请检查!(300个汉字以内)");
  267. return;
  268. }
  269. if(IDENTIFICATION_TIME_260.length==0){
  270. top.Dialog.alert("第"+ fff + "行的认证时间不能为空,请检查!");
  271. return;
  272. }else if(!PatternsDict.test(IDENTIFICATION_TIME_260)){
  273. top.Dialog.alert("第"+ fff + "行的认证时间输入不合法,请检查!");
  274. return;
  275. }
  276. if(EXPERT_BIRTHDAY_260 > WORK_TIME_260){
  277. $.messager.alert('生日不能比参加工作时间晚');
  278. return ;
  279. }
  280. if(WORK_TIME_260 > IDENTIFICATION_TIME_260){
  281. $.messager.alert('参加工作时间不能比认证时间晚');
  282. return ;
  283. }
  284. if(IS_SNSTAFF_260=="0"){
  285. if(EXP_COMP_260.length!=0){
  286. top.Dialog.alert("第"+ fff + "行的原所属单位应为空,请检查!");
  287. return;
  288. }
  289. }else if(IS_SNSTAFF_260=="1"){
  290. if(EXP_COMP_260.length==0){
  291. top.Dialog.alert("第"+ fff + "行的原所属单位不能为空,请检查!");
  292. return;
  293. }else if(EXP_COMP_260.length>50){
  294. top.Dialog.alert("第"+fff + "行的原所属单位长度超长,请检查!(50个汉字以内)");
  295. return;
  296. }else if(PatternsDict1.test(EXP_COMP_260)){
  297. top.Dialog.alert("第"+ fff + "行的原所属单位输入不合法,请检查!(50个汉字以内)");
  298. return;
  299. }
  300. }
  301. }
  302. var url = $.pathname()
  303. + "/ws/ExcelExpert/ReadExcelToDBTableTool/expertToDb";
  304. var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  305. var params = {
  306. classId : '260',
  307. deptId:deptId,
  308. userid:userId,
  309. json:json
  310. };
  311. $.ajax({
  312. url : url,
  313. type : 'post',
  314. timeout : 15000,
  315. data : params,
  316. dataType : 'json',
  317. success : function(data) {
  318. // $.messager.alert('保存成功', null, null);
  319. window.location.href="expert-maintenance.jsp";
  320. },
  321. error : function(e) {
  322. $.messager.alert('系统提示信息', '访问服务失败!', 'error');
  323. }
  324. });
  325. }
  326. //下模板
  327. function xiazai(){
  328. /* var name ="应急专家模板.xls";
  329. //encodeURI(encodeURI(value));
  330. name = encodeURI(encodeURI(name));
  331. //%25E5%25BA%2594%25E6%2580%25A5%25E4%25B8%2593%25E5%25AE%25B6%25E6%25A8%25A1%25E6%259D%25BF.xls
  332. alert(encodeURI(encodeURI("%25E5%25BA%2594%25E6%2580%25A5%25E4%25B8%2593%25E5%25AE%25B6%25E6%25A8%25A1%25E6%259D%25BF.xls")));*/
  333. window.open("/nwyj/excels/expertzhuanjia.xls");
  334. }
  335. //返回
  336. function goBack() {
  337. window.location.href="expert-maintenance.jsp";
  338. }
  339. $.messager = top.Dialog;
  340. function setH(){
  341. var p_iframe = $(parent.document.body).find("#frmrightChild");
  342. if(p_iframe && p_iframe.length>0){
  343. p_iframe.css("height",$(window.document.body).height()+30);
  344. var left_h = $(parent.document.body).find("#layout1 .l-layout-left").height();
  345. var left_c = p_iframe.height();
  346. var height = left_h>left_c?left_h:left_c;
  347. $(parent.document.body).height(height);
  348. $(top.document.body).find("iframe").css("height",$(parent.document.body).height()+30);
  349. }else{
  350. if(parent==top){
  351. $(parent.document.body).find("iframe").css("height",$(window.document.body).height()+30);
  352. }
  353. if(parent!=top){
  354. $(parent.document.body).find("iframe").css("height",$(window.document.body).height()+30);
  355. $(top.document.body).find("iframe").css("height",$(parent.document.body).height()+30);
  356. }
  357. }
  358. }