var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids(); var g; var specialty={"list":[ {value:"1",key:"输电",suggest:"输电|shudian|sd"}, {value:"2",key:"变电(一次)",suggest:"变电(一次)|biandianyici|bdyc"}, {value:"3",key:"变电(二次)",suggest:"变电(二次)|biandianerci|bdec"}, {value:"4",key:"通信",suggest:"通信|tongxi|tx"}, {value:"5",key:"配电(中压)",suggest:"配电(中压)|peidianzhongya|pdzy"}, {value:"6",key:"配电(低压)",suggest:"配电(低压)|peidiandiya|pddy"}, {value:"7",key:"土建",suggest:"土建|tujian|tj"}, {value:"8",key:"机械",suggest:"机械|jixie|jx"}, {value:"9",key:"水工",suggest:"水工|shuigong|sg"}, {value:"10",key:"后勤",suggest:"后勤|houqin|hq"}, {value:"11",key:"医疗",suggest:"医疗|yiliao|yl"}, {value:"12",key:"其他",suggest:"其他|qita|qt"}]}; var changeType={"list":[ {value:"1",key:"新建",suggest:""}, {value:"2",key:"更新",suggest:""}]}; var sex={"list":[ {value:"1",key:"男",suggest:""}, {value:"0",key:"女",suggest:""}]}; var staff={"list":[ {value:"0",key:"是",suggest:""}, {value:"1",key:"否",suggest:""}]}; var zhicheng={"list":[ {value:"1",key:"高级工程师",suggest:""}, {value:"2",key:"中级工程师",suggest:""}, {value:"3",key:"初级工程师",suggest:""}, {value:"4",key:"高级技师",suggest:""}, {value:"5",key:"技师",suggest:""}, {value:"6",key:"高级工",suggest:""}, {value:"7",key:"中级工",suggest:""}]}; var zhiwu={"list":[ {value:"1",key:"主任",suggest:""}, {value:"2",key:"副主任",suggest:""}, {value:"3",key:"科长",suggest:""}, {value:"4",key:"副科长",suggest:""}, {value:"5",key:"专责",suggest:""}, {value:"6",key:"班长",suggest:""}]}; var xieli={"list":[ {value:"1",key:"大专",suggest:""}, {value:"2",key:"本科",suggest:""}, {value:"3",key:"硕士",suggest:""}, {value:"4",key:"博士",suggest:""}, {value:"5",key:"中专",suggest:""}]}; function initGrid(data){ g = $("#maingrid").quiGrid({ columns: [ { display: '序号', name: 'EXPERT_ID_260', align: 'center', width: "150px" ,editor: { type: 'text'}}, { display: '姓名', name: 'EXPERT_NAME_260', align: 'center', width: "150px" ,editor: { type: 'text'}}, { display: '性别', name: 'EXPERT_SEX_260', align: 'center', width: "150px", editor: { type: 'select',data:sex,selWidth:150 },render:function (item){ for (var i = 0; i < sex["list"].length; i++) { if (sex["list"][i]['value'] == item.EXPERT_SEX_260) return sex["list"][i]['key']; } return item.EXPERT_SEX_260; } }, { display: '出生年月', name: 'EXPERT_BIRTHDAY_260', align: 'center', width: "150px" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}}, { display: '座机', name: 'EXPERT_TEL_260', align: 'center', width: "150px" ,editor: { type: 'text'}}, { display: '手机', name: 'EXPERT_CAL_260', align: 'center' , width: "150px" ,editor: { type: 'text'}}, { display: 'Email', name: 'EXPERT_EMAIL_260', align: 'center', width: "150px" ,editor: { type: 'text'}}, { display: '学历', name: 'EDUCATION_260', align: 'center', width: "150px" , editor: { type: 'select',data:xieli,selWidth:150 },render:function (item){ for (var i = 0; i < xieli["list"].length; i++) { if (xieli["list"][i]['value'] == item.EDUCATION_260) return xieli["list"][i]['key']; } return item.EDUCATION_260; } }, { display: '所属区域', name: 'EXPERT_AREA_260', align: 'center' , width: "150px" ,editor: { type: 'text'}}, { display: '是否南网员工', name: 'IS_SNSTAFF_260', align: 'center', width: "150px" , editor: { type: 'select',data:staff,selWidth:150 },render:function (item){ for (var i = 0; i < staff["list"].length; i++) { if (staff["list"][i]['value'] == item.IS_SNSTAFF_260) return staff["list"][i]['key']; } return item.IS_SNSTAFF_260; } }, { display: '参加工作时间', name: 'WORK_TIME_260', align: 'center', width: "150px" ,editor: { type: 'date',dateFmt:'yyyy-MM-dd'}}, { display: '职称', name: 'EXPERT_TYPE_260', align: 'center', width: "150px", editor: { type: 'select',data:zhicheng,selWidth:150 },render:function (item){ for (var i = 0; i < zhicheng["list"].length; i++) { if (zhicheng["list"][i]['value'] == item.EXPERT_TYPE_260) return zhicheng["list"][i]['key']; } return item.EXPERT_TYPE_260; } }, { display: '职务', name: 'EXPERT_POST_260', align: 'center', width: "150px", editor: { type: 'select',data:zhiwu,selWidth:150 },render:function (item){ for (var i = 0; i < zhiwu["list"].length; i++) { if (zhiwu["list"][i]['value'] == item.EXPERT_POST_260) return zhiwu["list"][i]['key']; } return item.EXPERT_POST_260; } }, { display: '住址', name: 'EXPERT_ADDRESS_260', align: 'center', width: "150px" ,editor: { type: 'text'}}, { display: '住址邮编', name: 'EXPERT_POSTALCODE_260', align: 'center', width: "150px",editor: { type: 'text'}}, { display: '专业特长', name: 'EXPERT_SPECIALTY_260', align: 'center', width: "150px" , editor: { type: 'select',data:specialty,selWidth:150 },render:function (item){ for (var i = 0; i < specialty["list"].length; i++) { if (specialty["list"][i]['value'] == item.EXPERT_SPECIALTY_260) return specialty["list"][i]['key']; } return item.EXPERT_SPECIALTY_260; } }, { display: '应急处理经验', name: 'EXPERT_EXP_260', align: 'center', width: "150px",editor: { type: 'text'}}, { display: '认定时间', name: 'IDENTIFICATION_TIME_260', align: 'center', width: "150px",editor: { type: 'date',dateFmt:'yyyy-MM-dd'}}, { display: '原所属单位', name: 'EXP_COMP_260', align: 'center', width: "150px",editor: { type: 'text'}} ], data:data, sortName : '', sortOrder : '', rownumbers:true, checkbox:true, // height: '100%', width:"100%", usePager : false, enabledEdit: true, //编辑用 percentWidthMode:true, onAfterShowData:function(){ setH(); }, //顶部图标按钮栏 toolbar:{ items:[ {text: '批量保存', click: saveAll, iconClass: 'icon_add'}, { line : true } ] } }); //监听页面显示的下拉框 $("select[name=rp]").bind("change",function(){ $(parent.document.body).find("#frmright").height($(window.document.body).height()+30); }); //下拉框高度自适应 $(parent.document.body).find("#frmright").height($(window.document.body).height()+30); } function saveAll(){ var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;//日期验证 var PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+");//特殊字符验证 var reg1 = /^[\u4e00-\u9fa5]+$/; var PatternsDict2=/^0?1[3|4|5|8][0-9]\d{8}$/;//手机验证 var PatternsDict3=/^(\d{3,4}\-)?\d{7,8}$/i;//座机验证 var PatternsDict4=/^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+(\.[a-zA-Z]{2,3})+$/;//email验证 var PatternsDict5=/^[1-9][0-9]{5}$/;//邮编验证 var rows=g.getSelectedRows(); var rowsLength = rows.length; if (rowsLength == 0) { top.Dialog.alert("请选中要导入的信息!"); return; } var json=JSON.stringify(rows); var myobj=eval(json); for(var i=0;i30){ top.Dialog.alert("第"+ fff + "行的序号长度超长,请检查!(30个数字以内)"); return; } if(EXPERT_NAME_260.length==0){ top.Dialog.alert("第"+ fff + "行的姓名不能为空,请检查!"); return; }else if(EXPERT_NAME_260.length>10){ top.Dialog.alert("第"+fff + "行的姓名长度超长,请检查!(10个汉字以内)"); return; }else if(!reg1.test(EXPERT_NAME_260)){ top.Dialog.alert("第"+ fff + "行的姓名输入不合法(只能输中文),请检查!(10个汉字以内)"); return; } if(EXPERT_SEX_260.length==0){ top.Dialog.alert("第"+ fff + "行的性别不能为空,请检查!"); return; } if(EXPERT_BIRTHDAY_260.length==0){ top.Dialog.alert("第"+ fff + "行的出生年月不能为空,请检查!"); return; }else if(!PatternsDict.test(EXPERT_BIRTHDAY_260)){ top.Dialog.alert("第"+ fff + "行的出生年月输入不合法,请检查!"); return; } if(EXPERT_TEL_260.length!=0){ if(!PatternsDict3.test(EXPERT_TEL_260)){ top.Dialog.alert("第"+ fff + "行的座机输入不合法,请检查!"); return; } } if(EXPERT_CAL_260.length==0){ top.Dialog.alert("第"+ fff + "行的手机不能为空,请检查!"); return; }else if(!PatternsDict2.test(EXPERT_CAL_260)){ top.Dialog.alert("第"+ fff + "行的手机输入不合法,请检查!"); return; } if(EXPERT_EMAIL_260.length!=0){ if(!PatternsDict4.test(EXPERT_EMAIL_260)){ top.Dialog.alert("第"+ fff + "行的Email输入不合法,请检查!"); return; } } if(EXPERT_AREA_260.length>40){ top.Dialog.alert("第"+fff + "行的所属区域长度超长,请检查!(40个汉字以内)"); return; }else if(PatternsDict1.test(EXPERT_AREA_260)){ top.Dialog.alert("第"+ fff + "行的所属区域输入不合法,请检查!(40个汉字以内)"); return; } if(IS_SNSTAFF_260.length==0){ top.Dialog.alert("第"+ fff + "行的是否南网员工不能为空,请检查!"); return; } if(WORK_TIME_260.length==0){ top.Dialog.alert("第"+ fff + "行的参加工作时间不能为空,请检查!"); return; }else if(!PatternsDict.test(WORK_TIME_260)){ top.Dialog.alert("第"+ fff + "行的参加工作时间输入不合法,请检查!"); return; } if(EXPERT_ADDRESS_260.length>40){ top.Dialog.alert("第"+fff + "行的地址长度超长,请检查!(40个汉字以内)"); return; }else if(PatternsDict1.test(EXPERT_ADDRESS_260)){ top.Dialog.alert("第"+ fff + "行的地址输入不合法,请检查!(40个汉字以内)"); return; } if(EXPERT_POSTALCODE_260.length!=0){ if(!PatternsDict5.test(EXPERT_POSTALCODE_260)){ top.Dialog.alert("第"+ fff + "行的邮编输入不合法,请检查!"); return; } } if(EXPERT_SPECIALTY_260.length==0){ top.Dialog.alert("第"+ fff + "行的专业不能为空,请检查!"); return; } if(EXPERT_EXP_260.length>300){ top.Dialog.alert("第"+fff + "行的应急处理经验长度超长,请检查!(300个汉字以内)"); return; } if(IDENTIFICATION_TIME_260.length==0){ top.Dialog.alert("第"+ fff + "行的认证时间不能为空,请检查!"); return; }else if(!PatternsDict.test(IDENTIFICATION_TIME_260)){ top.Dialog.alert("第"+ fff + "行的认证时间输入不合法,请检查!"); return; } if(EXPERT_BIRTHDAY_260 > WORK_TIME_260){ $.messager.alert('生日不能比参加工作时间晚'); return ; } if(WORK_TIME_260 > IDENTIFICATION_TIME_260){ $.messager.alert('参加工作时间不能比认证时间晚'); return ; } if(IS_SNSTAFF_260=="0"){ if(EXP_COMP_260.length!=0){ top.Dialog.alert("第"+ fff + "行的原所属单位应为空,请检查!"); return; } }else if(IS_SNSTAFF_260=="1"){ if(EXP_COMP_260.length==0){ top.Dialog.alert("第"+ fff + "行的原所属单位不能为空,请检查!"); return; }else if(EXP_COMP_260.length>50){ top.Dialog.alert("第"+fff + "行的原所属单位长度超长,请检查!(50个汉字以内)"); return; }else if(PatternsDict1.test(EXP_COMP_260)){ top.Dialog.alert("第"+ fff + "行的原所属单位输入不合法,请检查!(50个汉字以内)"); return; } } } var url = $.pathname() + "/ws/ExcelExpert/ReadExcelToDBTableTool/expertToDb"; var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id(); var params = { classId : '260', deptId:deptId, userid:userId, json:json }; $.ajax({ url : url, type : 'post', timeout : 15000, data : params, dataType : 'json', success : function(data) { // $.messager.alert('保存成功', null, null); window.location.href="expert-maintenance.jsp"; }, error : function(e) { $.messager.alert('系统提示信息', '访问服务失败!', 'error'); } }); } //下模板 function xiazai(){ /* var name ="应急专家模板.xls"; //encodeURI(encodeURI(value)); name = encodeURI(encodeURI(name)); //%25E5%25BA%2594%25E6%2580%25A5%25E4%25B8%2593%25E5%25AE%25B6%25E6%25A8%25A1%25E6%259D%25BF.xls alert(encodeURI(encodeURI("%25E5%25BA%2594%25E6%2580%25A5%25E4%25B8%2593%25E5%25AE%25B6%25E6%25A8%25A1%25E6%259D%25BF.xls")));*/ window.open("/nwyj/excels/expertzhuanjia.xls"); } //返回 function goBack() { window.location.href="expert-maintenance.jsp"; } $.messager = top.Dialog; function setH(){ var p_iframe = $(parent.document.body).find("#frmrightChild"); if(p_iframe && p_iframe.length>0){ p_iframe.css("height",$(window.document.body).height()+30); var left_h = $(parent.document.body).find("#layout1 .l-layout-left").height(); var left_c = p_iframe.height(); var height = left_h>left_c?left_h:left_c; $(parent.document.body).height(height); $(top.document.body).find("iframe").css("height",$(parent.document.body).height()+30); }else{ if(parent==top){ $(parent.document.body).find("iframe").css("height",$(window.document.body).height()+30); } if(parent!=top){ $(parent.document.body).find("iframe").css("height",$(window.document.body).height()+30); $(top.document.body).find("iframe").css("height",$(parent.document.body).height()+30); } } }