Browse Source

마감/마감취소 버튼 별도 추가

SH 1 month ago
parent
commit
7daa40bfed

+ 2 - 0
src/main/java/sgc/portal/cw/cw0629/persistence/CW06290001UMapper.java

@@ -20,4 +20,6 @@ public interface CW06290001UMapper {
     int delete(CW06290001U cW06290001U);
 
 	int selectSeq(CW06290001U cW06290001U);
+
+    int updateYn(CW06290001U cW06290001U);
 }

+ 15 - 0
src/main/java/sgc/portal/cw/cw0629/service/CW06290001UService.java

@@ -62,4 +62,19 @@ public class CW06290001UService {
     private void delete(CW06290001U cW06290001U) {
         mapper.delete(cW06290001U);
     }
+
+    @Transactional
+    public Map<String, String> updateYn(List<CW06290001U> CW06290001U) {
+    	
+    	Map<String,String> result = new HashMap<>();
+    	
+    	for (CW06290001U cW06290001U : CW06290001U) {
+    		updateYn(cW06290001U);
+        }
+    	return result;
+    }
+
+    private void updateYn(CW06290001U cW06290001U) {
+        mapper.updateYn(cW06290001U);
+    }
 }

+ 5 - 0
src/main/java/sgc/portal/cw/cw0629/web/CW06290001UController.java

@@ -27,4 +27,9 @@ public class CW06290001UController {
     public Map<String, String> save(@RequestBody List<CW06290001U> CW06290001U) {
     	return service.save(CW06290001U);
     }
+    
+    @PostMapping("/CW06290001U/updateYn")
+    public Map<String, String> updateYn(@RequestBody List<CW06290001U> CW06290001U) {
+    	return service.updateYn(CW06290001U);
+    }
 }

+ 11 - 1
src/main/resources/sqlmap/mappers/cw/cw0629/CW06290001UMapper.xml

@@ -62,7 +62,6 @@
 		   SET MAIN_DATA1 = #{mainData1}
 		     , MAIN_DATA2 = #{mainData2}
 		     , MAIN_DATA3 = #{mainData3}
-		     , CONF_YN = #{confYn}
 		     , MDFT_DT = SYSDATE
 		     , MDFT_PR = #{mdftPr}
 		WHERE CMPN_CD= #{cmpnCd}
@@ -87,4 +86,15 @@
 		  AND GB_CD = #{gbCd}
     </select>
     
+    <update id="updateYn">
+        UPDATE ZEHR_CE_EVAL_ITEM
+		   SET CONF_YN = #{confYn}
+		     , MDFT_DT = SYSDATE
+		     , MDFT_PR = #{mdftPr}
+		WHERE CMPN_CD= #{cmpnCd}
+		  AND YEAR_YY = #{yearYy}
+		  AND GB_CD = #{gbCd}
+		  AND MAIN_CD = #{mainCd}
+    </update>
+    
 </mapper>

+ 109 - 2
src/main/webapp/ux/cw/cw0629/CW06290001U.xml

@@ -27,6 +27,7 @@
 			<w2:dataCollection baseNode="map">
 				<w2:dataList baseNode="list" repeatNode="map" id="dcdataList1" saveRemovedData="">
 					<w2:columnInfo>
+						<w2:column id="sel" name="선택" dataType="text" ignoreStatus="true"></w2:column>
 						<w2:column id="del" name="삭제" dataType="text"></w2:column>
 						<w2:column id="cmpnCd" name="cmpnCd" dataType="text"></w2:column>
 						<w2:column id="yearYy" name="yearYy" dataType="text"></w2:column>
@@ -161,6 +162,60 @@
         }
     };
     
+    /**************************************************************************
+     * Event : scwin.btnConfY_onclick
+     * 기 능 : 마감 버튼 클릭 이벤트
+     **************************************************************************/
+    scwin.btnConfY_onclick = function() {
+   		
+    	scwin.checkCnt = 0;
+        
+    	for (var i = 0; i < dcdataList1.getTotalRow(); i++) {
+    	
+    		if(dcdataList1.getCellData( i , "sel" ) == "Y") {
+    			if(dcdataList1.getCellData( i , "confYn" ) == "N"){
+    				scwin.checkCnt++;
+                }
+                
+        	scwin.fnSetStatusCd(i, 1);
+    		}
+        }
+        
+        if(scwin.checkCnt == 0){
+        	commLib.getAlert("마감할 데이터가 없습니다.");
+            return;
+        }
+        
+		commLib.saveMsg(dcdataList1, "scwin.fnUpdateYn");
+    };
+    
+    /**************************************************************************
+     * Event : scwin.btnConfN_onclick
+     * 기 능 : 마감취소 버튼 클릭 이벤트
+     **************************************************************************/
+    scwin.btnConfN_onclick = function() {
+   		
+    	scwin.checkCnt = 0;
+        
+    	for (var i = 0; i < dcdataList1.getTotalRow(); i++) {
+    	
+    		if(dcdataList1.getCellData( i , "sel" ) == "Y") {
+    			if(dcdataList1.getCellData( i , "confYn" ) == "Y"){
+    				scwin.checkCnt++;
+                }
+                
+        	scwin.fnSetStatusCd(i, 2);
+    		}
+        }
+        
+        if(scwin.checkCnt == 0){
+        	commLib.getAlert("마감취소할 데이터가 없습니다.");
+            return;
+        }
+        
+		commLib.saveMsg(dcdataList1, "scwin.fnUpdateYn");
+    };
+    
 	/**************************************************************************
      * Event:scwin.btnExcel_onclick
      * 기능:엑셀버튼 클릭
@@ -289,6 +344,46 @@
         }
     };
     
+    /***************************************************************************
+     * 함 수 명: scwin.fnUpdateYn
+     * 기    능: 신청 처리
+     * param: 확인팝업 선택값
+     ***************************************************************************/
+	scwin.fnUpdateYn =  function(param) {
+        if(param){
+            if (JSON.parse(param).retval=="true") {
+            	var mdata = strLib.serialize(dcdataList1.getModifiedJSON({DB:true}));
+                ajaxLib.ajax("cw/cw0629/CW06290001U/updateYn", {
+	                method: "POST",
+	                requestData: mdata,
+	                processMsg:"yes",
+	                callback: function(result, e) {
+	                	if(result.result == null){
+	                		commLib.getAlert(commLib.getMessage("crud.0002"), "데이터 결과", "R");
+	                		scwin.grdSearch();
+	                	} else {
+	                		commLib.getAlert(result.result, "데이터 결과", "R");
+	                	}
+                    }
+                });
+            }
+        }
+    };
+    
+	/***************************************************************************
+     * 함 수 명 : scwin.fnSetStatusCd
+     * 기   능 : 요청 checkbox가 체크된 row 데이터들의 마감여부 변경
+     ***************************************************************************/
+    scwin.fnSetStatusCd = function(rowindex, gbn) {
+    	var rows = grdData1.getCheckedIndex("sel");
+    	
+   		if (gbn == "1") {
+  			dcdataList1.setCellData(rowindex, "confYn", "Y");
+   		} else if (gbn == "2") {
+  			dcdataList1.setCellData(rowindex, "confYn", "N");
+   		}
+    }
+    
     ]]></script>
 	</head>
 	<body>
@@ -314,6 +409,12 @@
 						<w2:anchor class="btn_cm" outerDiv="true" style="" id="btnSave" ev:onclick="scwin.btnSave_onclick">
 							<xf:label><![CDATA[저장]]></xf:label>
 						</w2:anchor>
+						<w2:anchor class="btn_cm" outerDiv="true" style="" id="btnConfY" ev:onclick="scwin.btnConfY_onclick">
+							<xf:label><![CDATA[마감]]></xf:label>
+						</w2:anchor>
+						<w2:anchor class="btn_cm" outerDiv="true" style="" id="btnConfN" ev:onclick="scwin.btnConfN_onclick">
+							<xf:label><![CDATA[마감취소]]></xf:label>
+						</w2:anchor>
 						<w2:anchor class="btn_cm" outerDiv="true" style="" id="btnExcel" ev:onclick="scwin.btnExcel_onclick">
 							<xf:label><![CDATA[엑셀]]></xf:label>
 						</w2:anchor>
@@ -370,6 +471,9 @@
 						<w2:caption style="" id="caption1" value="this is a grid caption."></w2:caption>
 						<w2:header style="" id="header1">
 							<w2:row style="" id="row1">
+								<w2:column removeBorderStyle="false" width="50" inputType="checkbox" id="selAll" value="선택"
+									blockSelect="false" displayMode="label" checkboxLabel="선택">
+								</w2:column>
 								<w2:column removeBorderStyle="false" width="50" inputType="checkbox" id="delAll" value="삭제"
 									blockSelect="false" displayMode="label" checkboxLabel="삭제" style="color:red">
 								</w2:column>
@@ -391,7 +495,7 @@
 								<w2:column removeBorderStyle="false" width="600" inputType="text" id="mainData2" value="정의"
 									blockSelect="false" displayMode="label">
 								</w2:column>
-								<w2:column removeBorderStyle="false" width="500" inputType="text" id="mainData3" value="행동키워드"
+								<w2:column removeBorderStyle="false" width="470" inputType="text" id="mainData3" value="행동키워드"
 									blockSelect="false" displayMode="label">
 								</w2:column>
 								<w2:column removeBorderStyle="false" width="60" inputType="text" id="confYn" value="마감여부"
@@ -401,6 +505,9 @@
 						</w2:header>
 						<w2:gBody style="" id="gBody1">
 							<w2:row style="" id="row2">
+								<w2:column removeBorderStyle="false" width="50" inputType="checkbox" id="sel" blockSelect="false"
+									displayMode="label" trueValue="Y" falseValue="N" valueType="other">
+								</w2:column>
 								<w2:column removeBorderStyle="false" width="50" inputType="checkbox" id="del" blockSelect="false"
 									displayMode="label" trueValue="Y" falseValue="N" valueType="other">
 								</w2:column>
@@ -428,7 +535,7 @@
 									displayMode="label" textAlign="left">
 								</w2:column>
 								<w2:column removeBorderStyle="false" width="60" inputType="select" id="confYn" blockSelect="false"
-									displayMode="label" allOption="" chooseOption="" ref="">
+									displayMode="label" readOnly="true" allOption="" chooseOption="" ref="">
 									<w2:choices>
 										<w2:item>
 											<w2:label><![CDATA[Y]]></w2:label>