자주하는질문 기능 추가

This commit is contained in:
KNKIM 2021-08-04 15:25:28 +09:00
parent e99528ea7c
commit 0913ab07f1
5 changed files with 103 additions and 15 deletions

View File

@ -6,32 +6,83 @@
<records>125</records>
<results>
<articleNo>1</articleNo>
<title>질문있습니다.</title>
<faqType>회원가입</faqType>
<title>질문있습니다.1</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>2</articleNo>
<title>질문있습니다.</title>
<faqType>회원가입</faqType>
<title>질문있습니다.2</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>3</articleNo>
<title>질문있습니다.</title>
<faqType>자료대출</faqType>
<title>질문있습니다.3</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>4</articleNo>
<title>질문있습니다.</title>
<faqType>자료대출</faqType>
<title>질문있습니다.4</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>5</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.5</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>1</articleNo>
<faqType>회원가입</faqType>
<title>질문있습니다.1</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>2</articleNo>
<faqType>회원가입</faqType>
<title>질문있습니다.2</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>3</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.3</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>4</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.4</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>5</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.5</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
</result>

View File

@ -226,20 +226,26 @@ public class BoardController extends NlibCommonController
log.debug("listFAQs > message = " + message);
log.debug("listFAQs > faqType = " + faqType);
// 페이징 사이즈 코드 목록 조회
DataApiReqVO reqVOforCode = new DataApiReqVO();
reqVOforCode.setAuthKey(createAuthKey(req, authentication));
reqVOforCode.setPageIndex(pageIndex);
reqVOforCode.setPageSize(pageSize);
reqVOforCode.addInfoItem("codeUpperId", "FAQ_TYPE");
reqVOforCode.setPageIndex(0);
reqVOforCode.setPageSize(0);
// 페이징 사이즈 코드 목록 조회
reqVOforCode.addInfoItem("codeUpperId", "PAGE_SIZE");
DataApiResVO resVOforPageSize = codeService.listCodes(reqVOforCode);
// 유형 코드 목록 조회
reqVOforCode.addInfoItem("codeUpperId", "FAQ_TYPE");
DataApiResVO resVOforFaqType = codeService.listCodes(reqVOforCode);
// 반환 정보
model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize);
model.addAttribute("searchKeyword", searchKeyword);
model.addAttribute("faqTypeCodes" , resVOforPageSize.getList());
model.addAttribute("pageSizeCodes", resVOforPageSize.getList());
model.addAttribute("faqTypeCodes" , resVOforFaqType.getList());
model.addAttribute("message" , message);
model.addAttribute("faqType" , faqType);
model.addAttribute("faqType" , faqType);
return "nlib/board/listFAQs";

View File

@ -52,6 +52,7 @@
//=======================================================
$("#jsGrid").jsGrid({
pageSize : $("#pageSize").val(),
scrollOffset:0,
controller: {
loadData: function (filter) { // 그리드에 데이터를 가져올 때 실팽되는 함수
var data = $.Deferred();
@ -101,7 +102,7 @@
// 추출할 컬럼의 데이터 가져오기
var articleNo = getData["articleNo"];
var selectedRow = $("#jsGrid").find('table tr.highlight');
var selectedRow = $("#jsGrid").find('table tr.jsgrid-selected-row');
// 상세 내용 보기
fn_viewDetail(articleNo, selectedRow);
@ -122,6 +123,12 @@
fn_searchArticle($("#pageSize").val(), 1);
});
// 유형 변경시 재조회
$("#faqType").on("change", function(e) {
fn_searchArticle($("#pageSize").val(), 1);
});
// 검색 버튼 클릭
$("#btnSearch").on("click", function(e) {
fn_searchArticle($("#pageSize").val(), 1);
@ -159,9 +166,21 @@
dataType: "json",
data: JSON.stringify(inputData),
}).done(function(response){
$selectedRow.css("color","red");
var jsonObj = JSON.parse(response);
$("#jsGrid").find('table tr.answer').remove();
//alert("DDDDDDDD remove = " + $("#jsGrid")[0].scrollHeight);
$selectedRow.after("<tr class='answer'><td colspan='3'>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "</td></tr>");
//alert("DDDDDDDD add = " + $("#jsGrid")[0].scrollHeight);
//$("#jsGrid").find('table.jsgrid-table.jsgrid-grid-body').height($("#jsGrid").find('table.jsgrid-table')[0].scrollHeight + 100);
});
$("#jsGrid").closest('.ui-jqgrid-bdiv').width($("#jsGrid").closest('.ui-jqgrid-bdiv').width() + 1);
}
// 게시글 작성으로 이동
@ -179,6 +198,11 @@
}
);
}
function fn_changeFaqType(selectedFaqType) {
$('#faqType').val(selectedFaqType).trigger('change');
}
</script>
</head>
@ -200,7 +224,7 @@
</c:forEach>
</select>
<select name="faqType" id="faqType" title="공지사항 유형">
<option value="">유형</option>
<option value="">유형</option>
<c:forEach var="faqTypeItem" items="${faqTypeCodes}" varStatus="status">
<option value="<c:out value="${faqTypeItem.code }" />" <c:if test="${faqTypeItem.code == faqType }">selected</c:if> ><c:out value="${faqTypeItem.name }" /></option>
</c:forEach>
@ -209,6 +233,13 @@
<input type="text" name="pageIndex" id="pageIndex" title="페이지번호" value="${pageIndex }" size="5" maxlength="5" />
<input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword }" size="35" maxlength="50" />
<input type="button" name="btnSearch" id="btnSearch" title="검색버튼" value="검색" />
<br/>
<a href="javascript:void(0)" onclick="fn_changeFaqType('')" <c:if test="${'' == faqType }"> class="selected" </c:if> >전체</a>
<c:forEach var="faqTypeItem" items="${faqTypeCodes}" varStatus="status">
<a href="javascript:void(0)" onclick="fn_changeFaqType('<c:out value="${faqTypeItem.code }" />')" <c:if test="${faqTypeItem.code == faqType }"> class="selected" </c:if> ><c:out value="${faqTypeItem.name }" /></a>
</c:forEach>
<div id="jsGrid" name="jsGrid" style="height: 100%"></div>

View File

@ -32,8 +32,8 @@
}
.jsgrid-grid-body {
overflow-x: auto;
overflow-y: scroll;
/*overflow-x: auto;
overflow-y: scroll;*/ /* NLIB */
-webkit-overflow-scrolling: touch;
}