사용자 입력버튼 클릭시 모델창으로 팝업창이 생성
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | //사용자 정보입력 $("#userInsert_Btn").click(function(){ // 사용자 입력버튼 클릭시 userInsertShow() 실행 userInsertShow(); }); function userInsertShow(){ var modalTitle = {}; modalTitle.formClass = "USER_insertPopup"; modalTitle.title = "사용자 정보입력"; modalFormClean(); $("#modal_insertForm").attr("class",modalTitle.formClass);// form에 추가할 class $(".modal-title").html( "<strong>"+modalTitle.title+"</strong>" ); //사원정보 상세보기 $("#grid_list_modal").html( "<li>" + "<label>사원ID</label> "+ "<input type='text' name='ename' id='ENAME_insert'>"+ "<label>자택정보</label>"+ "<input type='text' name='address' id='ADDRESS_insert' >"+ "</li>"+ "<li>" + "<label>이름</label>"+ "<input type='text' name='name' id='NAME_insert' >"+ "<label>사원번호</label>"+ "<input type='text' name='dcode' id='DCODE_insert' >"+ "</li>"+ "<li>" + "<label>부서</label>"+ "<select name='department' id='DEPARTMENT_insert'>"+ "<option value='select' selected='selected'>선택해주세요</option>"+ "<option value='DEPT01' >도서관관리팀</option>"+ "<option value='DEPT02' >일본사업팀 </option>"+ "<option value='DEPT03' >디자인팀 </option>"+ "<option value='DEPT04' >자료관리팀 </option>"+ "</select>"+ "<label>직급</label>"+ "<select name='position' id='POSITION_insert'>"+ "<option value='select' selected='selected'>선택해주세요</option>"+ "<option value='W_PO1' >사원 </option>"+ "<option value='W_PO2' >선임</option>"+ "<option value='W_PO3' >책임 </option>"+ "<option value='W_PO4' >과장 </option>"+ "<option value='W_PO5' >차장 </option>"+ "<option value='W_PO6' >팀장 </option>"+ "<option value='W_PO7' >이사 </option>"+ "</select>"+ "</li>"+ "<li>" + "<label>생년월일</label>"+ "<input type='text' name='birthday' id='birthday_piker'>"+ //value='birthday"+data.birthday +" ' "<label>입사일</label>"+ "<input type='text' name='bireday' id='bireday_piker' >"+ //value='"+data.bireday +" ' "</li>"+ "<li>" + "<label>전화번호</label>"+ "<input type='text' name='phone' id='PHONE_insert'>"+ "<label>내선번호</label>"+ "<input type='text' name='exnum' id='EXNUM_insert'>"+ "</li>"+ "<li>" + "<label>이메일</label>"+ "<input type='text' name='email' id='EMAIL_insert' >"+ "<label>사원상태</label>"+ "<select name='present' id='PRESENT_insert'>"+ "<option value='select' selected='selected'>선택해주세요</option>"+ "<option value='W_PE1' >정상회원</option>"+ "<option value='W_PE2' >대출정지</option>"+ "<option value='W_PE3' >관리자</option>"+ "</select>"+ "</li>"+ "<li>" + "<label>비고</label>"+ "<input type='text' name='note' id='NOTE_insert' >"+ "</li>" ); listCss(); $("#popup_btn").html( "<button type='button' id='close' class='btn btn-default' data-dismiss='modal'>닫기</button>"+ "<button type='button' id='userInsertSave_Btn' class='btn btn-default' data-dismiss='' >입력하기</button>" ); $("#birthday_piker , #bireday_piker").datepicker({ dateFormat: "yy-mm-dd" // 만약 2011년 4월 29일 선택하면 inputbox 에 '2011/04/29' 로표시 , changeMonth: true // 월선택 select box 표시 (기본은 false) ,changeYear: true // 년선택 selectbox 표시 (기본은 false) ,monthNames: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'] ,monthNamesShort: ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'] ,dayNames: ['일', '월', '화', '수', '목', '금', '토'] ,dayNamesShort: ['일', '월', '화', '수', '목', '금', '토'] ,dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'] ,showMonthAfterYear: true ,yearSuffix: '년' }); $("#userInsertSave_Btn").click(function(){ var insert = $(".USER_insertPopup").serialize(); // 정규식 체크 - 숫자체크 var numberCh = /^[0-9]+$/; // 정규식체크 - 한글,영문 체크 var charCh = /^[가-힣a-zA-Z]+$/; if ($("#ENAME_insert").val() == "") { alert("사원id를 입력하세요"); $("#ENAME_insert").focus(); } else if ($("#ADDRESS_insert").val() == "") { alert("자택정보를 입력하세요"); $("#ADDRESS_insert").focus(); } else if ($("#NAME_insert").val() == "") { alert("이름를 입력하세요"); $("#NAME_insert").focus(); } else if ($("#DCODE_insert").val() == "") { alert("사원번호를 입력하세요"); $("#DCODE_insert").focus(); } else if ($("#DEPARTMENT_insert").val() == "") { alert("부서를 입력하세요"); $("#DEPARTMENT_insert").focus(); } else if ($("#POSITION_insert").val() == "") { alert("직급를 입력하세요"); $("#POSITION_insert").focus(); } else if ($("#BIRTHDAY_insert").val() == "") { alert("생일을 입력하세요"); $("#BIRTHDAY_insert").focus(); } else if ($("#BIREDAY_insert").val() == "") { alert("입사일 입력하세요"); $("#BIREDAY_insert").focus(); } else if ($("#PHONE_insert").val() == "") { alert("전화번호를 입력하세요"); $("#PHONE_insert").focus(); } else if ($("#EXNUM_insert").val() == "") { alert("내선번호를 입력하세요"); $("#EXNUM_insert").focus(); } else if ($("#EMAIL_insert").val() == "") { alert("이메일를 입력하세요"); $("#EMAIL_insert").focus(); } else if ($("#PRESENT_insert").val() == "select") { alert("사원상태를 입력하세요"); $("#PRESENT_insert").focus(); }else if(!charCh.test($("#NAME_insert").val())){ alert("문자를 입력해주세요"); $("#NAME_insert").focus(); }else if(!numberCh.test($("#DCODE_insert").val())){ alert("숫자를 입력해주세요"); $("#DCODE_insert").focus(); }else{ var DCODE = $("#DCODE_insert").val(); var ENAME = $("#ENAME_insert").val(); $.ajax({ url: '/library/ChackIdDcode.do', type: 'POST', data:{"DCODE":DCODE,"ENAME":ENAME}, contentType: 'application/x-www-form-urlencoded; charset=UTF-8', dataType: 'html', async: false, success: function(data){ var dcode = JSON.parse(data).dcode; var ename = JSON.parse(data).ename; if(dcode!="널값" || ename!="널값"){ if(dcode!="널값"){ alert("존재하는 사원번호입니다 다시 입력헤주세요."); $("#DCODE_insert").focus(); }else if(ename!="널값"){ alert("존재하는 아이디입니다 다시 입력헤주세요."); $("#ENAME_insert").focus(); } }else { // 사원번호, 사원ID 둘다 널값이면 사원정보입력 실행 userInsertSave(insert); } },error:function(request,status,error){ console.log("code:"+request.status+"\n"+"message:" +request.responseText+"\n"+"error:"+error); alert("실패"); } }); } }); }; function userInsertSave(insert){ $.ajax({ url: '/library/user.do', type: 'POST', data:insert, // contentType: 'application/json; charset=UTF-8', dataType: 'html', complete:function(){ $("#list2").jqGrid({ // jqGrid 리로드 url : '/library/gridView.do', datatype : 'json'}).trigger("reloadGrid"); $("#close").click(); } }); } | cs |
'개발 > 개인' 카테고리의 다른 글
function userUpdateModalShow(emp,title) // 사용자 정보 상세보기 - 정보수정부분전체 (0) | 2016.12.01 |
---|---|
사용자 상세검색 _modal (0) | 2016.11.30 |
사용자 상세보기 , 다중상세보기 _modal (0) | 2016.11.30 |
사용자 수정,검색.입력,상세보기창 하나의 모델로 바꾸기, jqgrid 더블클릭 (0) | 2016.11.30 |
사용자 정보수정 - 사원ID,사원번호 클릭시 알럿창 발생 (0) | 2016.11.16 |
댓글