123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- /* ---------------------------------------------------------------------
- 회복실 V/S 항목관리(SMMNP00720.xfm - JScript )
- - Version :
- 1) : Ver.1.00.01
- : Create By taebum
- : 2008-06-19 오후 6:08:34
- ---------------------------------------------------------------------- */
- var sGGridXPath = "/root/main/list/codelists/codelist";
- var sLGridXPath = "/root/main/list/codelists/lrglist";
- /**
- * 초기화
- *
- */
- function fInitialize(){
- model.removeNodeset("/root/main/list/codelists");
- model.resetInstanceNode("/root/send");
- model.refresh();
- cmb_useyn.select(2);
- cmb_defaultyn.select(2);
-
- //대분류 콤보 리스트 조회
- fGetLrgList();
- fbtnSearch();
-
- }
- function fGetLrgList(pFlag){
- model.setValue("/root/send/temp","temp");
- model.removeNodeset("/root/init/lrgcombolists/lrglist");
- submit("TRMNP00721");
- addComboItem( "combo1", "전체", "%", "above" );
- if(pFlag != "" && pFlag != null && pFlag != "undefined"){
- model.setValue("/root/send/s_lrgcd",pFlag);
- combo1.refresh();
- }else{
- model.setValue("/root/send/s_lrgcd","%");
- combo1.refresh();
- }
- }
- /**
- * 그리드 행추가 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickRowAddBtn(){
- var cur_LrgRow = datagrid1.row; // 행 번호 가져오기
- if(cur_LrgRow <= 0 || cur_LrgRow =="undefined") {
- alert("분류를 선택하시기 바랍니다...");
- return;
- }
-
- grd_codelist.addRow(); // 입력할 행 추가.
- var cur_row = grd_codelist.row; // 추가된 행 번호 가져오기
- var cnt_row = grd_codelist.rows; // 현재 행의 갯수 가져오기
-
- //줄 추가시 기본세팅
- //대분류코드, 명칭
- model.setValue(sGGridXPath+"["+cur_row+"]/lrgcd",model.getValue("/root/main/list/codelists/lrglist["+cur_LrgRow+"]/lrgcd"));
- model.setValue(sGGridXPath+"["+cur_row+"]/lrgnm",model.getValue("/root/main/list/codelists/lrglist["+cur_LrgRow+"]/lrgnm"));
- model.setValue(sGGridXPath+"["+cur_row+"]/lrgsortno",model.getValue("/root/main/list/codelists/lrglist["+cur_LrgRow+"]/lrgsortno"));
-
- model.setValue(sGGridXPath+"["+cur_row+"]/useyn","Y");
- model.setValue(sGGridXPath+"["+cur_row+"]/defaultyn","Y");
- model.setValue(sGGridXPath+"["+cur_row+"]/useyn","Y");
- //현재 사용하지 않는 이력관리용 frdd, todd
- model.setValue(sGGridXPath+"["+cur_row+"]/frdd","20081003");
- model.setValue(sGGridXPath+"["+cur_row+"]/todd","29991231");
- grd_codelist.refresh();
-
- grd_codelist.row = cur_row;
- grd_codelist.select(cur_row, 2) = true;
- grd_codelist.editcell();
- }
- /**
- * 그리드 행추가 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickLrgRowAddBtn(){
- datagrid1.addRow(); // 입력할 행 추가.
- var cur_row = datagrid1.row; // 추가된 행 번호 가져오기
- var cnt_row = datagrid1.rows; // 현재 행의 갯수 가져오기
-
- //줄 추가시 기본세팅
- model.setValue(sLGridXPath+"["+cur_row+"]/vsitemcd","00000");
- model.setValue(sLGridXPath+"["+cur_row+"]/vsitemnm","-");
- model.setValue(sLGridXPath+"["+cur_row+"]/defaultyn","-");
- model.setValue(sLGridXPath+"["+cur_row+"]/useyn","Y");
- model.setValue(sLGridXPath+"["+cur_row+"]/sortno","0");
- model.setValue(sLGridXPath+"["+cur_row+"]/ioflag","-");
- //현재 사용하지 않는 이력관리용 frdd, todd
- model.setValue(sLGridXPath+"["+cur_row+"]/frdd","20081003");
- model.setValue(sLGridXPath+"["+cur_row+"]/todd","29991231");
- datagrid1.refresh();
- datagrid1.row = cur_row;
- datagrid1.select(cur_row, 2) = true;
- datagrid1.editcell();
- }
- /**
- * 그리드 Row가 추가될 경우 이벤트
- *
- */
- function fRowChanged(){
- var cur_row = grd_codelist.row;
- if ( cur_row > 0 ) {
- model.copyNode("/root/main/item","/root/main/list/codelists["+cur_row+"]");
- model.refresh();
- }
- }
- /**
- * 그리드 ValueChanged가 발생되었을 경우 이벤트
- *
- */
- function fGridValueChanged(){
- var cur_row = grd_codelist.row; // 추가된 행 번호 가져오기
- var cur_cel = grd_codelist.col;
- var cnt_row = grd_codelist.rows; // 현재 행의 갯수 가져오기
- var stat = grd_codelist.colstatus(0);
- if(cur_cel == 4){
- if(model.getValue("/root/main/list/codelists/codelist["+cur_row+"]/vsitemcd") == "00000"){
- messageBox("00000 항목코드는 사용하실 수 없습니다. ","I000");
- model.setValue("/root/main/list/codelists/codelist["+cur_row+"]/vsitemcd" , model.getValue("/root/main/list/codelists/codelist["+cur_row+"]/org_vsitemcd"));
- grd_codelist.refresh();
- grd_codelist.select(cur_row, 4) = true;
- grd_codelist.editcell();
- grd_codelist.rowstatus(cur_row) = 0;
- }
- }
- }
- /**
- * 삭제 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickDeleteBtn(){
- var cur_row = grd_codelist.row; // 행 번호 가져오기
- var iStatus = grd_codelist.rowstatus(cur_row);
-
- if(cur_row <= 0 || cur_row =="undefined") {
- alert("삭제할 행을 선택하시기 바랍니다...");
- return;
- }
-
- if (iStatus == 1 || iStatus == 3){ // 새로 삽입된 행이면
- grd_codelist.deleteitem(cur_row);
-
- }else if (iStatus == 4){ // 삭제로 표시된 행이면
- grd_codelist.removestatus(cur_row, "delete");
- }else{
- grd_codelist.addStatus(cur_row, "delete");
- }
- }
- /**
- * 삭제 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fClickLrgDeleteBtn(){
- var cur_row = datagrid1.row; // 행 번호 가져오기
- var iStatus = datagrid1.rowstatus(cur_row);
-
- if(cur_row <= 0 || cur_row =="undefined") {
- alert("삭제할 행을 선택하시기 바랍니다...");
- return;
- }
-
- if( messageBox(model.getValue("/root/main/list/codelists/lrglist["+cur_row+"]/lrgnm")+" 분류에 포함된 모든 항목이 삭제됩니다. 삭제하시겠습니까? ","Q000") != "6") {
- return;
- }
-
- if (iStatus == 1 || iStatus == 3){ // 새로 삽입된 행이면
- datagrid1.deleteitem(cur_row);
-
- }else if (iStatus == 4){ // 삭제로 표시된 행이면
- datagrid1.removestatus(cur_row, "delete");
- }else{
- datagrid1.addStatus(cur_row, "delete");
- }
- }
- /*
- * 저장 버튼을 클릭하였을 경우 이벤트
- *
- */
- function fOnClickSaveBtn(){
- if(!checkGridUpdate(grd_codelist) && !checkGridUpdate(datagrid1)){
- alert("저장할 자료가 존재하지 않습니다.");
- return;
- }
- if(!checkGridField(grd_codelist,"lrgcd▦lrgnm▦lrgsortno▦vsitemcd▦vsitemnm▦ioflag▦defaultyn▦useyn▦sortno▦")){
- alert("데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
-
- if(!checkGridField(datagrid1,"lrgcd▦lrgnm▦vsitemcd▦vsitemnm▦ioflag▦lrgsortno▦")){
- alert("데이터중에 비어있는 필수필드가 있습니다.");
- return;
- }
- model.setValue("/root/send/listdata" , grd_codelist.getUpdateData());
- model.setValue("/root/send/lrglistdata", datagrid1.getUpdateData());
- if ( submit("TXMNP00720") ) {
- grd_codelist.clearStatus(); // submit() 성공하면 그리드의 i,u,d 상태 제거
- model.setValue("/root/send/listdata","");
- //changeNodeSet();
- //대분류 콤보 리스트 조회
- fGetLrgList();
- cmb_useyn.select(2);
- cmb_defaultyn.select(2);
- }
- }
- /**
- * @group :
- * @ver : 2006.12.20
- * @by :
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc :
- * @return : bool
- * @---------------------------------------------------
- */
- function checkGridUpdate(grid)
- {
- var iData = grid.getUpdateDataXml("insert");
- var uData = grid.getUpdateDataXml("update");
- var dData = grid.getUpdateDataXml("delete");
- if (iData=="" && uData=="" && dData=="") return false;
- else return true;
- }
- /**
- * @group :
- * @ver : 2006.12.20
- * @by :
- * @---------------------------------------------------
- * @type : function
- * @access : public
- * @desc :
- * @return : bool
- * @---------------------------------------------------
- */
- function checkGridField(grid, field){
- var nodeset = grid.nodeset;
- var iStatus;
- //var iData = grid.getUpdateDataXml("insert");
- for (i=grid.fixedRows; i<grid.rows; i++){
- iStatus = grid.rowstatus(i);
- if (iStatus == 1 || iStatus == 2 || iStatus == 3){
- var fieldArr = field.split("▦");
- if(fieldArr.length < 1){
- return false;
- }
- for(var j = 0; j < fieldArr.length; j++){
- if(fieldArr[j] == null || fieldArr[j] == "" || fieldArr[j] == "undefined"){
- continue;
- }
-
- if(model.getValue(nodeset+"["+i+"]/"+fieldArr[j])=="") return false;
- }
- }
- }
- return true;
- }
- /* @group :
- * @ver : 2008-06-02 오후 5:01:10
- * @by : taebum
- * @-----------------------------------
- * @type : function
- * @access : public
- * @desc : 조회 및 검색
- */
- function fbtnSearch() {
- model.removeNodeSet("/root/main/list/codelists/codelist");
- model.removeNodeSet("/root/main/list/codelists/lrglist");
-
- grd_codelist.refresh();
- datagrid1.refresh();
- //model.refresh();
- submit("TRMNP00720");
- //changeNodeSet();
- }
- /* @group :
- * @ver : 2008-06-02 오후 5:19:26
- * @by : taebum
- * @-----------------------------------
- * @type : function
- * @access : public
- * @desc : Excel 버튼 클릭시 이벤트
- */
- function fOnClickExcelBtn(){
- var fileName = window.fileDialog("save", ",", false, "excel", "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
-
- if (fileName != ""){
- grd_codelist.saveExcel(fileName);
- }
- }
- /* @group :
- * @ver : 2008-12-11 오후 4:04:55
- * @by : taebum
- * @-----------------------------------
- * @type : function
- * @access : public
- * @desc : 분류 클릭시 아이템 리스트조회
- */
- function fClickLrgGrid(){
- var cur_LrgRow = datagrid1.row;
- if(cur_LrgRow > 0){
- model.removeNodeSet("/root/main/list/codelists/codelist");
- grd_codelist.refresh();
- model.removeNodeSet("/root/hidden/itemlists/codelist");
- model.setValue("/root/send/s_lrgcd", model.getValue("/root/main/list/codelists/lrglist["+cur_LrgRow+"]/lrgcd"));
- combo1.refresh();
- submit("TRMNP00722");
- var iItemcnt = getNodesetCnt(model, "/root/hidden/itemlists/codelist");
- if(iItemcnt > 0){
- for(var i = 1; i <= iItemcnt; i++){
- model.duplicate("/root/main/list/codelists", "/root/hidden/itemlists/codelist["+i+"]");
- }
-
- grd_codelist.refresh();
- model.removeNodeSet("/root/hidden/itemlists/codelist");
- }
- }
-
- }
- /* ------------------------------------------------- */
- /* ------End Of List ------------------------------- */
- /* -------------------------------------------------- */
|