123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566 |
- $(function(){
- //加载时添加
- $("#PROFESSIONAL_262").initCanstSelect('BM_TEAMERTYPE');
- $("#PROFESSIONAL_262").render();
- $("#VOLTAGE_LEVEL_262").initCanstSelect('BM_DYDJ');
- $("#VOLTAGE_LEVEL_262").render();
- $("#TEAM_QUARTERS_262").initCanstSelect('BM_TEAMER_QUARTERS');
- $("#TEAM_QUARTERS_262").render();
- //修改表单信息,获取记录
- if((window.location.href).split('?')[1]=="xg"){
- $("#titleShow").text("修改队伍人员");
- var fd_id = (window.location.href).split('?')[2];
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params = {
- classid : '262',
- objectID : fd_id
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data){
- $("#tabletr").attr("style","");
- $('#fillForm').ajaxWrite({data:data});
- $('#fillForm input[name="classid"]').val('262');
- init();
-
- PROFESSIONAL = data.PROFESSIONAL_262;
-
- $("#TYPEIN_TIME").html(data.UPDATEDATE_262);
- typein(data.TYPEIN_PEOPLE_262);
-
- teamid = (window.location.href).split('?')[3];
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params = {
- classid : '261',
- objectID : teamid
- };
-
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data){
- // alert(data.TEAM_MEMBER_NUMBER_261);
- SD_XIANLU = data.SD_XIANLU_261;//输电线路
- SD_XIANLANG = data.SD_XIANLANG_261;//输电线缆
- BD_YICI = data.BD_YICI_261;//变电一次
- BD_ERCI = data.BD_ERCI_261;//变电二次
- PD_XIANLU = data.PD_XIANLU_261;//信息通信
- PD_XIANLANG = data.PD_XIANLANG_261;//海缆
- PD_DIANFANG = data.PD_DIANFANG_261;//物资
- PD_BAODIAN = data.PD_BAODIAN_261;//消防
- TONGXING = data.TONGXING_261;//后勤保障
- /*WANGLUO = data.WANGLUO_261;//网络
- SHIYAN = data.SHIYAN_261;//试验
- */ COLUMN = data.COLUMN_1_261;
- // if(data.COLUMN_1_261=="0"){
- // teamValue=data.FD_OBJECTID261;
- // }else{
- // teamValue=data.COLUMN_1_261;
- // }
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }else if((window.location.href).split('?')[1]=="xz"){
- $("#titleShow").text("新增队伍人员");
- teamid = (window.location.href).split('?')[2];//队伍第一id
- teamid2 = (window.location.href).split('?')[3];//0或新id
- if(teamid2=="0"){
- teamid3 = teamid;
- }else{
- teamid3 = teamid2;
- }
-
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params = {
- classid : '261',
- objectID : teamid3
- };
-
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data){
- TEAM_MEMBER_NUMBER = data.TEAM_MEMBER_NUMBER_261;//队伍人数
- SD_XIANLU = data.SD_XIANLU_261;//输电线路
- SD_XIANLANG = data.SD_XIANLANG_261;//输电线缆
- BD_YICI = data.BD_YICI_261;//变电一次
- BD_ERCI = data.BD_ERCI_261;//变电二次
- PD_XIANLU = data.PD_XIANLU_261;//信息通信
- PD_XIANLANG = data.PD_XIANLANG_261;//海缆
- PD_DIANFANG = data.PD_DIANFANG_261;//物资
- PD_BAODIAN = data.PD_BAODIAN_261;//消防
- TONGXING = data.TONGXING_261;//后勤保障
- /*WANGLUO = data.WANGLUO_261;//网络
- SHIYAN = data.SHIYAN_261;//试验
- */ $('#TEAM_UNIT_262').val(data.TEAM_COMP_ID_261);
- $('#TEAM_NAME_262').val(data.TEAM_NAME_261);
- // if(data.COLUMN_1_261=="0"){
- // $('#TEAM_ID_262').val(data.FD_OBJECTID261);
- // teamValue=data.FD_OBJECTID261;
- // }else{
- // $('#TEAM_ID_262').val(data.COLUMN_1_261);
- // teamValue=data.COLUMN_1_261;
- // }
- $('#TEAM_ID_262').val(teamid);
- /******************录入人信息start********************/
- /* 页面展示用 */
- //取登录用户信息
- //登录用户姓名 要调整,还是要用id
- var userName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- $("#TYPEIN_PEOPLE").html(userName);
- //用户手机号
- var getMobile = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
- if(getMobile==undefined){
- $("#TYPEIN_PEOPLE_PHONE_NUM").html("暂无手机号码");
- }else{
- $("#TYPEIN_PEOPLE_PHONE_NUM").html(getMobile);
- }
- //用户所属单位
- var getCorp_names = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- $("#UNITE").html(getCorp_names);
- //用户所属部门
- var getDeptnames = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- $("#DEPT").html(getDeptnames);
- /*****************录入人信息end*********************/
-
- getSortNo(teamid);
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
-
- $("#back").hover(function(){
- $(this).attr("src","/nwyj/images/temp/back_hover.png");
- },function(){
- $(this).attr("src","/nwyj/images/temp/back.png");
- });
-
- });
- function getSortNo(teamid){
- var url = $.pathname() + '/ws/ExcelTeamer/TeamerExcelToDBTableTool/getAddSort';
- var params = {
- id : teamid
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params,
- dataType : 'json',
- success : function(data){
- $("#SORT_NO_262").val(data);
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
- var teamid;//队伍ID
- var teamid2;
- var teamid3;
- var TEAM_MEMBER_NUMBER = "";//队伍人数
- var teamValue;//修改队伍是的fd_id
- var SD_XIANLU;var SD_XIANLANG;var BD_YICI;var BD_ERCI;var PD_XIANLU;var PD_XIANLANG;var PD_DIANFANG;var PD_BAODIAN;var TONGXING;var WANGLUO;var SHIYAN; var COLUMN;
-
- var PROFESSIONAL;//修改之前的专业
- var zy;//修改之后的专业
- //加载时判断单选按钮
- function init(){
- // alert(1111);
- var sex = document.getElementById("SEX_262").value;
- if(sex=="1"){
- // alert(sex);
- $("input:radio[name=ra]").eq(0).attr("checked",true);
- }
- if(sex=="0"){
- $("input:radio[name=ra]").eq(1).attr("checked",true);
- }
- }
-
- //录入人信息
- function typein(id){
- var url = $.pathname() + '/ws/crud/CRUDService/getDataById/';
- var params1 = {
- classid : '880',
- objectID : id
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 60000,
- data : params1,
- async:false, //异步
- dataType : 'json',
- success : function(data){
- $("#TYPEIN_PEOPLE").html(data.REAL_NAME_880); //录入人
- $("#TYPEIN_PEOPLE_PHONE_NUM").html(data.MOBILE_880); //手机
- // $("#UNITE").html(data.COMPANY_ID_880_SHOW);//所属单位
- $("#DEPT").html(data.ORG_ID_880_SHOW);//所属部门
- getDeptName(data.DEPT_ID_880);
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
-
- function getDeptName(id){
-
- $.ajax({
- url : $.pathname()+ "/ws/DrillCount/DrillCountService/getDeptNameInfo",
- type : 'post',
- timeout : 60000,
- data : {id:id},
- dataType : 'text',
- success : function(data){
-
- $("#UNITE").html(data);
-
- }
- });
- }
-
- //表单验证
- function validateForm(containerId){
- //判断内外队伍
- var seletedValue;
- if(document.getElementById("radio-1").checked){
- seletedValue = document.getElementById("radio-1").value;
- }else if(document.getElementById("radio-2").checked){
- seletedValue = document.getElementById("radio-2").value;
- }
- $('#SEX_262').val(seletedValue);
-
- var NAME_262 = $('#NAME_262').val();
- var SEX_262 = $('#SEX_262').val();
- var ID_NUMBER_262 = $('#ID_NUMBER_262').val();
- var BIRTH_DATE_262 = $('#BIRTH_DATE_262').val();
- var WORK_TYPE_AGE_262 = $('#WORK_TYPE_AGE_262').val();
- var PROFESSIONAL_262 = $('#PROFESSIONAL_262').val();
- var TELEPHONE_262 = $('#TELEPHONE_262').val();
- var TEAM_QUARTERS_262 = $('#TEAM_QUARTERS_262').val();
-
-
- var valid = $(containerId).validationEngine({returnIsValid: true});
-
-
-
- if(valid == true){
- var id = document.getElementById("fd_id262").value;
-
- if(id==""){
- add();
- }else{
- var Zhuanye1;
- var Zhuanye2;
- zy = $('#PROFESSIONAL_262').val();
- //修改专业
- if(zy!=PROFESSIONAL){
- if(PROFESSIONAL=="1"){
- Zhuanye1 = "SD_XIANLU='"+ (Number(SD_XIANLU)-1) +"',";
- }else if(PROFESSIONAL=="2"){
- Zhuanye1 = "SD_XIANLANG='"+ (Number(SD_XIANLANG)-1) +"',";
- }else if(PROFESSIONAL=="3"){
- Zhuanye1 = "BD_YICI='"+ (Number(BD_YICI)-1) +"',";
- }else if(PROFESSIONAL=="4"){
- Zhuanye1 = "BD_ERCI='"+ (Number(BD_ERCI)-1) +"',";
- }else if(PROFESSIONAL=="5"){
- Zhuanye1 = "PD_XIANLU='"+ (Number(PD_XIANLU)-1) +"',";
- }else if(PROFESSIONAL=="6"){
- Zhuanye1 = "PD_XIANLANG='"+ (Number(PD_XIANLANG)-1) +"',";
- }else if(PROFESSIONAL=="7"){
- Zhuanye1 = "PD_DIANFANG='"+ (Number(PD_DIANFANG)-1) +"',";
- }else if(PROFESSIONAL=="8"){
- Zhuanye1 = "PD_BAODIAN='"+ (Number(PD_BAODIAN)-1) +"',";
- }else if(PROFESSIONAL=="9"){
- Zhuanye1 = "TONGXING='"+ (Number(TONGXING)-1) +"',";
- }
- if(zy =="1"){
- Zhuanye2 = "SD_XIANLU='"+ (Number(SD_XIANLU)+1) +"'";
- }else if(zy=="2"){
- Zhuanye2 = "SD_XIANLANG='"+ (Number(SD_XIANLANG)+1) +"'";
- }else if(zy=="3"){
- Zhuanye2 = "BD_YICI='"+ (Number(BD_YICI)+1) +"'";
- }else if(zy=="4"){
- Zhuanye2 = "BD_ERCI='"+ (Number(BD_ERCI)+1) +"'";
- }else if(zy=="5"){
- Zhuanye2 = "PD_XIANLU='"+ (Number(PD_XIANLU)+1) +"'";
- }else if(zy=="6"){
- Zhuanye2 = "PD_XIANLANG='"+ (Number(PD_XIANLANG)+1) +"'";
- }else if(zy=="7"){
- Zhuanye2 = "PD_DIANFANG='"+ (Number(PD_DIANFANG)+1) +"'";
- }else if(zy=="8"){
- Zhuanye2 = "PD_BAODIAN='"+ (Number(PD_BAODIAN)+1) +"'";
- }else if(zy=="9"){
- Zhuanye2 = "TONGXING='"+ (Number(TONGXING)+1) +"'";
- }
- Zhuanye = Zhuanye1 + Zhuanye2;
- $.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/tremUpdate/", {
- //应急队伍各个类型人数:字段名 + 人数 例如:应急保电人数:PD_BAODIAN:1
- comp_id :Zhuanye,
- //将应急队伍ID作为公共变量在这里取就行。
- fd_id : (window.location.href).split('?')[4],//应急队伍ID
- }, function(result) {
- if (result.Msg.sucsess == true) {
- // edit();
- } else {
- top.Dialog.alert("保存失败");
- return;
- }
- }, "json");
- }
- edit();
- }
-
- }else{
- if(NAME_262==""||NAME_262==null){
- top.Dialog.alert('姓名不能为空!');
- return;
- }
- var PatternsDict = /^[\u4e00-\u9fa5]+$/;
- if(!PatternsDict.test(NAME_262)){
- top.Dialog.alert('请输入中文!');
- return;
- }
- if(SEX_262==""||SEX_262==null){
- top.Dialog.alert('请选择性别!');
- return;
- }
- if(ID_NUMBER_262!=""){
- if(!validateIdCard(ID_NUMBER_262)){
- top.Dialog.alert('请输入有效的身份证号码!');
- return;
- }
- }
-
- if(BIRTH_DATE_262==""||BIRTH_DATE_262==null){
- top.Dialog.alert('出生年月不能为空!');
- return;
- }
- if(WORK_TYPE_AGE_262==""||WORK_TYPE_AGE_262==null){
- top.Dialog.alert('本工种工龄不能为空!');
- return;
- }
- if(PROFESSIONAL_262==""||PROFESSIONAL_262==null){
- top.Dialog.alert('请选择专业!');
- return;
- }
- if(TELEPHONE_262==""||TELEPHONE_262==null){
- top.Dialog.alert('联系方式不能为空!');
- return;
- }
- if(TEAM_QUARTERS_262==""||TEAM_QUARTERS_262==null){
- top.Dialog.alert('请选择队伍岗位!');
- return;
- }
- top.Dialog.alert('表单填写不正确,请按要求填写!');
- }
- }
- function validateIdCard(idCard){
- //15位和18位身份证号码的正则表达式
- var regIdCard=/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
- //如果通过该验证,说明身份证格式正确,但准确性还需计算
- if(regIdCard.test(idCard)){
- if(idCard.length==18){
- var idCardWi=new Array( 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ); //将前17位加权因子保存在数组里
- var idCardY=new Array( 1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2 ); //这是除以11后,可能产生的11位余数、验证码,也保存成数组
- var idCardWiSum=0; //用来保存前17位各自乖以加权因子后的总和
- for(var i=0;i<17;i++){
- idCardWiSum+=idCard.substring(i,i+1)*idCardWi[i];
- }
- var idCardMod=idCardWiSum%11;//计算出校验码所在数组的位置
- var idCardLast=idCard.substring(17);//得到最后一位身份证号码
- //如果等于2,则说明校验码是10,身份证号码最后一位应该是X
- if(idCardMod==2){
- if(idCardLast=="X"||idCardLast=="x"){
- return true;
- }else{
- return false;
- }
- }else{
- //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
- if(idCardLast==idCardY[idCardMod]){
- return true;
- }else{
- return false;
- }
- }
- }
- }else{
- return false;
- }
- }
- var Zhuanye = "";
-
- //判断新增的人是什么专业的人,后面好修改应急队伍各个专业的人数。其他不用变。
- function isZhuanye(){
- var isZhuanye = $("#PROFESSIONAL_262").val();
- if(isZhuanye =="1"){
- //PLAN_STAT='1' TEAM_MEMBER_NUMBER
- Zhuanye = "SD_XIANLU='"+ (Number(SD_XIANLU)+1) +"' , TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="2"){
- Zhuanye = "SD_XIANLANG='"+(Number(SD_XIANLANG)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="3"){
- Zhuanye = "BD_YICI='"+(Number(BD_YICI)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="4"){
- Zhuanye = "BD_ERCI='"+(Number(BD_ERCI)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="5"){
- Zhuanye = "PD_XIANLU='"+(Number(PD_XIANLU)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="6"){
- Zhuanye = "PD_XIANLANG='"+(Number(PD_XIANLANG)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="7"){
- Zhuanye = "PD_DIANFANG='"+(Number(PD_DIANFANG)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="8"){
- Zhuanye = "PD_BAODIAN='"+(Number(PD_BAODIAN)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="9"){
- Zhuanye = "TONGXING='"+(Number(TONGXING)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }/*else if(isZhuanye=="10"){
- Zhuanye = "WANGLUO='"+(Number(WANGLUO)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }else if(isZhuanye=="11"){
- Zhuanye = "SHIYAN='"+(Number(SHIYAN)+1)+"', TEAM_MEMBER_NUMBER='"+(Number(TEAM_MEMBER_NUMBER )+1)+"'";
- }*/
- }
-
- //传入应急队伍的ID
- function tremUpdate(){
- isZhuanye();
- $.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/tremUpdate/", {
- //应急队伍各个类型人数:字段名 + 人数 例如:应急保电人数:PD_BAODIAN:1
- comp_id : Zhuanye,
- //将应急队伍ID作为公共变量在这里取就行。
- fd_id : teamid3,//应急队伍ID
- }, function(result) {
- if (result.Msg.sucsess == true) {
- $("body").eq(0).hideLoading();
- $.messager.alert("保存成功",null,null,null,-1);
- window.history.back();
- } else {
- $("body").eq(0).hideLoading();
- top.Dialog.alert("保存失败");
- return;
- }
- }, "json");
- }
- //新增
- function add(){
- //录入人id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- $('#TYPEIN_PEOPLE_262').val(userId);
-
- $("body").eq(0).showLoading();
- var formValue = $('#fillForm').serialize();
- var url = $.pathname() + '/ws/crud/CRUDService/create';
- $.ajax({
- url : url,
- type : 'post',
- data : formValue,
- dataType : 'text',
- timeout : 60000,
- success : function(data){
-
- // $.messager.alert('保存成功');
- tremUpdate();
- // window.location.href = "teamerupdate";
-
- },
- error : function(){
- $.messager.alert('操作失败');
- }
- });
- }
- //修改
- function edit(){
- //录入人id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- $('#TYPEIN_PEOPLE_262').val(userId);
- $("body").eq(0).showLoading();
- var formValue = $('#fillForm').serialize();
-
- var url = $.pathname() + '/ws/crud/CRUDService/update';
-
- $.ajax({
- url : url,
- type : 'post',
- data : formValue,
- dataType : 'text',
- timeout : 60000,
- success : function(data){
- $("body").eq(0).hideLoading();
- $.messager.alert('保存成功');
- window.history.back();
- // if(COLUMN=="0"){
- // window.location.href="teamer-inside.jsp?"+teamValue+"?0";//修改前
- // }else{
- // window.location.href="teamer-inside.jsp?"+COLUMN+"?"+teamValue;//修改后
- // }
- },
- error : function(){
- $("body").eq(0).hideLoading();
- $.messager.alert('操作失败');
- }
- });
- }
- function goBack(){
-
- window.history.back();
- }
- //重置
- function resetSearch(){
- document.location.reload();
- $("#PROFESSIONAL_262").resetValue();
- $("#VOLTAGE_LEVEL_262").resetValue();
- $("#TEAM_QUARTERS_262").resetValue();
-
- }
- $.messager=top.Dialog;
|