임차인 등록 수정.

main
jjh 2 months ago
parent c597bd2a2b
commit df74b1f2ce

@ -33,12 +33,33 @@
<div class="container-search">
<div class="row g-1">
<!-- 사용자 계정 -->
<div class="col-4">
<div class="col-6">
<label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end" for="schUserAcnt">사용자계정</label>
<input is="id-input" type="text" class="form-control w-px-160" name="schUserAcnt" autocomplete="off" readonly />
</div>
<!-- 동적검색 -->
<div class="col-6">
<input type="hidden" name="by" />
<input type="text" class="form-control w-px-120 text-end fw-bold" name="byOutput" value="동적 검색" readonly />
<input type="hidden" name="mainOption" />
<input type="hidden" name="subOption" />
<input type="text" class="form-control w-px-400" name="term" autocomplete="off" />
<!-- 상세 검색조건 버튼 -->
<span class="flr">
<button type="button" class="btn btn-open-detail" data-bs-toggle="collapse" data-bs-target="[data-doctx='${pageName}'] [name='searchDetail']">
<i class="bx bx-chevron-down"></i>
상세검색
</button>
</span>
</div> <!-- 동적검색 -->
</div>
</div> <!-- 메인 조건 -->
<!-- 상세 조건 -->
<div name="searchDetail" class="container-search container-search-detail collapse">
<div class="row g-1">
</div>
</div> <!-- 상세 조건 -->
</form>
<!-- 검색 조건 영역 -->
@ -262,6 +283,7 @@
// 기본 데이터 설정
$P.$findn("userId").val("${userId}"); // 사용자 ID
$P.$findn("schUserAcnt").val("${userAcnt}"); // 사용자 계정
$P.$findn("byOutput").val("동적 검색"); // 동적 검색
// 그리드 th
let colContent = $P.findn("tmpltCols").content;

@ -31,14 +31,14 @@
<div class="row g-1">
<!-- 단속 일자 -->
<div class="col-6">
<label class="form-label form-search-title w-px-120 text-end fw-bold">단속일자</label>
<label class="form-label form-search-title w-px-120 text-end fw-bold required">단속일자</label>
<span class="form-search-linebox">
<input type="text" class="form-control form-date" name="schCrdnYmdFrom"
data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" />
data-fmt-type="day" autocomplete="off" title="시작 날짜 선택" required />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
~
<input type="text" class="form-control form-date" name="schCrdnYmdTo"
data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" />
data-fmt-type="day" autocomplete="off" title="종료 날짜 선택" required />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
</span>
</div>
@ -52,13 +52,34 @@
</c:forEach>
</select>
</div>
<!-- 차량번호 -->
<!-- 자동차등록번호 -->
<div class="col-6">
<label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schVhrno">차량번호</label>
<label is="name-label" class="form-label form-search-title w-px-120 text-end fw-bold" for="schVhrno">자동차등록번호</label>
<input is="id-input" type="text" class="form-control w-px-160" name="schVhrno" autocomplete="off" />
</div>
<!-- 동적검색 -->
<div class="col-6">
<input type="hidden" name="by" />
<input type="text" class="form-control w-px-120 text-end fw-bold" name="byOutput" value="동적 검색" readonly />
<input type="hidden" name="mainOption" />
<input type="hidden" name="subOption" />
<input type="text" class="form-control w-px-400" name="term" autocomplete="off" />
<!-- 상세 검색조건 버튼 -->
<span class="flr">
<button type="button" class="btn btn-open-detail" data-bs-toggle="collapse" data-bs-target="[data-doctx='${pageName}'] [name='searchDetail']">
<i class="bx bx-chevron-down"></i>
상세검색
</button>
</span>
</div> <!-- 동적검색 -->
</div>
</div> <!-- 메인 조건 -->
<!-- 상세 조건 -->
<div name="searchDetail" class="container-search container-search-detail collapse">
<div class="row g-1">
</div>
</div> <!-- 상세 조건 -->
</form>
<!-- 검색 조건 영역 -->
@ -88,19 +109,19 @@
<div class="nav-align-top" name="tabMain">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<button type="button" class="nav-link w-px-160 h-100 active" role="tab" data-bs-toggle="tab"
<button type="button" class="nav-link w-px-160 h-100 active" role="tab" data-bs-toggle="tab" name="tabItem0"
onClick="pageObject['${pageName}'].fnSearchList('전체');">
전체
</button>
</li>
<li class="nav-item">
<button type="button" class="nav-link w-px-160 h-100" role="tab" data-bs-toggle="tab"
<button type="button" class="nav-link w-px-160 h-100" role="tab" data-bs-toggle="tab" name="tabItem1"
onClick="pageObject['${pageName}'].fnSearchList('대상');">
대상
</button>
</li>
<li class="nav-item">
<button type="button" class="nav-link w-px-160 h-100" role="tab" data-bs-toggle="tab"
<button type="button" class="nav-link w-px-160 h-100" role="tab" data-bs-toggle="tab" name="tabItem2"
onClick="pageObject['${pageName}'].fnSearchList('등록');">
등록
</button>
@ -124,7 +145,7 @@
<th class="cmn" style="width: 160px;">업무구분</th>
<th class="cmn" style="width: 100px;">대상여부</th>
<th class="cmn" style="width: 180px;" onclick="FimsSupport.searchFromGridTitle('CRDN_YMD', this.innerText, 'ymd', '');">단속일시</th>
<th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('VHRNO', this.innerText, 'match', 'part');">차량번호</th>
<th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('VHRNO', this.innerText, 'match', 'part');">자동차등록번호</th>
<th class="cmn" style="width: 120px;" onclick="FimsSupport.searchFromGridTitle('RTPYR_SE_CD', this.innerText, 'codeValue', 'FIM011');">납부자구분</th>
<th class="cmn" style="width: 160px;" onclick="FimsSupport.searchFromGridTitle('RTPYR_NO', this.innerText, 'ymd', '');">납부자번호</th>
<th class="cmn" style="width: 200px;" onclick="FimsSupport.searchFromGridTitle('RTPYR_NM', this.innerText, 'match', 'part');">납부자명</th>
@ -290,6 +311,21 @@
});
}
// 버튼 설정
$P.setButton = (tabName) => {
// tab
if (tabName == "대상") {
$P.$findn("btnCreate").prop("disabled", false);
$P.$findn("btnRemove").prop("disabled", true);
} else if (tabName == "등록") {
$P.$findn("btnCreate").prop("disabled", true);
$P.$findn("btnRemove").prop("disabled", false);
} else {
$P.$findn("btnCreate").prop("disabled", true);
$P.$findn("btnRemove").prop("disabled", true);
}
}
/**************************************************************************
* 버튼 clickEvent
**************************************************************************/
@ -316,7 +352,8 @@
// 기본 데이터 설정
$P.$findn("schCrdnYmdFrom").datepicker("setDate", DateSupport.getAddDay(-365)); // 단속 일자 시작
$P.$findn("schCrdnYmdTo").datepicker("setDate", TODAY()); // 단속 일자 종료
$P.$findn("schVhrno").val("167하9750"); // 차량번호
$P.$findn("schVhrno").val("167하9750"); // 자동차등록번호
$P.$findn("byOutput").val("동적 검색"); // 동적 검색
// 그리드 th
let colContent = $P.findn("tmpltCols").content;
@ -328,18 +365,36 @@
});
$P.findn("tableRspns").changeColumn(colsOuterHTML);
// 버튼 disabled
$P.$findn("btnCreate").prop("disabled", true);
$P.$findn("btnRemove").prop("disabled", true);
// 버튼 설정
$(".nav-link.active").removeClass("active"); // 기존의 활성화된 탭에서 active 클래스 제거
$P.$findn("tabItem0").addClass("active"); // 새로운 탭에 active 클래스 추가
let tabName = $P.$findn("tabMain").find("button.active").text().trim();
$P.setButton(tabName);
}
// 검색 버튼 이벤트
$P.fnSearchList = (tabName) => {
// validate 확인
if (!AppSupport.customValidate($P.$findn("frmSearch").find("input,select,textarea"))) return;
// 버튼 설정
if (!tabName) {
tabName = $P.$findn("tabMain").find("button.active").text().trim();
}
$P.setButton(tabName);
// 검색 조건
$P.ctrl.query = new FimsFormFields($P.selectorn("frmSearch")).get(); // 검색 조건
$P.ctrl.query.fetchSize = DEFAULT_FETCH_SIZE; // 한번에 조회되는 자료 건수
$P.ctrl.query.delYn = "N"; // 삭제 여부
if (tabName == "대상") {
$P.ctrl.query.regTrgtYn = "Y";
} else if (tabName == "등록") {
$P.ctrl.query.regTrgtYn = "N";
}
// 임대기업번호가 전체라면..
if ($P.ctrl.query.schEntNo == "" ) {
// schEntNo 의 option을 전체를 배열로 담는다.
@ -359,21 +414,6 @@
$P.ctrl.query.schEntNos = arrEntNo.filter((element) => element !== "").join(',');
}
// 버튼 disabled
$P.$findn("btnCreate").prop("disabled", true);
$P.$findn("btnRemove").prop("disabled", true);
// tab
if (tabName == "대상") {
$P.ctrl.query.regTrgtYn = "Y";
$P.$findn("btnCreate").prop("disabled", false);
} else if (tabName == "등록") {
$P.ctrl.query.regTrgtYn = "N";
$P.$findn("btnCreate").prop("disabled", true);
} else {
$P.$findn("btnCreate").prop("disabled", true);
}
$P.ctrl.load(1);
}

@ -195,7 +195,7 @@
* 사용자 함수(function)
**************************************************************************/
// URL 설정
$P.fnSetUrl = (prefixUrl) => {
$P.setUrl = (prefixUrl) => {
$P.ctrl.urls.load = wctx.url(prefixUrl + "/020/list.do"); // 검색
$P.ctrl.urls.create = wctx.url(prefixUrl + "/020/createMpng.do") // 등록
$P.ctrl.urls.remove = wctx.url(prefixUrl + "/020/removeEnt.do") // 삭제
@ -213,7 +213,7 @@
$P.ctrl.dataset.clear();
// URL 설정
$P.fnSetUrl("${prefixUrl}");
$P.setUrl("${prefixUrl}");
// 기본 데이터 설정
$P.$findn("userId").val("${userId}"); // 사용자 ID

@ -36,11 +36,21 @@
data-fmt-type="day" autocomplete="off" title="날짜 선택" maxlength="10" required />
<button type="button" class="bx bx-lg bx-calendar bg-white" name="btnCtrtYmd"></button>
</div>
<!-- 차량번호 -->
<!-- 자동차등록번호 -->
<div class="col-6">
<label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end required" for="schVhrno">차량번호</label>
<label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end required" for="schVhrno">자동차등록번호</label>
<input is="id-input" type="text" class="form-control w-px-160" name="schVhrno" required autocomplete="off" />
</div>
<!-- 임차인 등록 번호 -->
<div class="col-6">
<label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end" for="schHirerRegNo">임차인번호</label>
<input is="id-input" type="text" class="form-control w-px-160" name="schHirerRegNo" autocomplete="off" />
</div>
<!-- 임차인 명 -->
<div class="col-6">
<label is="name-label" class="form-label fw-bold form-search-title w-px-120 text-end" for="schHirerNm">임차인명</label>
<input is="id-input" type="text" class="form-control w-px-160" name="schHirerNm" autocomplete="off" />
</div>
</div>
</div> <!-- 메인 조건 -->
</form>
@ -83,14 +93,21 @@
<template name="tmpltCols">
<th class="cmn" style="width: 72px;">No.</th>
<th class="cmn" style="width: 56px;"><input type="checkbox" class="form-check-input" name="gridAllCheckbox" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></th>
<th class="cmn" style="width: 200px;">기업명</th>
<th class="cmn" style="width: 160px;">법인(사업자)번호</th>
<th class="cmn" style="width: 120px;">대표자명</th>
<th class="cmn" style="width: 160px;">자동차등록번호</th>
<th class="cmn" style="width: 180px;">계약시작일시</th>
<th class="cmn" style="width: 180px;">계약종료일시</th>
<th class="cmn" style="width: 100px;">임차인구분</th>
<th class="cmn" style="width: 160px;">임차인번호</th>
<th class="cmn" style="width: 200px;">임차인명</th>
<th class="cmn" style="width: 160px;">전화번호</th>
<th class="cmn" style="width: 160px;">팩스번호</th>
<th class="cmn" style="width: 160px;">휴대전화번호</th>
<th class="cmn" style="width: 200px;">이메일주소</th>
<th class="cmn" style="width: 100px;">우편번호</th>
<th class="cmn" style="width: 280px;">주소</th>
<th class="cmn" style="width: 320px;">상세주소</th>
<th class="cmn" style="width: 100px;">첨부파일수</th>
<th class="cmn" style="width: 180px;">등록일시</th>
<th class="cmn" style="width: 140px;">등록사용자</th>
<th class="cmn dummy-th"></th>
</template>
@ -100,20 +117,27 @@
<tr data-index="{data-index}">
<td class="cmn text-center" onclick ondblclick>{ROW_NUM}</td>
<td class="cmn text-center"><input type="checkbox" class="form-check-input" name="gridCheckbox" value="{data-index}" onchange="pageObject['${pageName}'].dataTableCheckbox(this, this.checked);" /></td>
<td class="cmn text-start" onclick ondblclick>{ENT_NM}</td>
<td class="cmn text-center" onclick ondblclick>{ENT_NO}</td>
<td class="cmn text-center" onclick ondblclick>{RPRSV_NM}</td>
<td class="cmn text-center" onclick ondblclick>{ENT_TELNO}</td>
<td class="cmn text-center" onclick ondblclick>{ENT_FXNO}</td>
<td class="cmn text-center" onclick ondblclick>{ENT_ZIP}</td>
<td class="cmn text-start" onclick ondblclick>{ENT_ADDR}</td>
<td class="cmn text-start" onclick ondblclick>{VHRNO}</td>
<td class="cmn text-center" onclick ondblclick>{CTRT_BGNG_DT}</td>
<td class="cmn text-center" onclick ondblclick>{CTRT_END_DT}</td>
<td class="cmn text-center" onclick ondblclick>{HIRER_SE_NM}</td>
<td class="cmn text-center" onclick ondblclick>{HIRER_REG_NO}</td>
<td class="cmn text-start" onclick ondblclick>{HIRER_NM}</td>
<td class="cmn text-center" onclick ondblclick>{HIRER_TELNO}</td>
<td class="cmn text-center" onclick ondblclick>{HIRER_MBL_TELNO}</td>
<td class="cmn text-start" onclick ondblclick>{HIRER_EML_ADDR}</td>
<td class="cmn text-center" onclick ondblclick>{HIRER_ZIP}</td>
<td class="cmn text-start" onclick ondblclick>{HIRER_ADDR}</td>
<td class="cmn text-start" onclick ondblclick>{HIRER_DTL_ADDR}</td>
<td class="cmn text-center" onclick ondblclick>{ATCH_FILE_CNT}</td>
<td class="cmn text-center" onclick ondblclick>{REG_DT}</td>
<td class="cmn text-center" onclick ondblclick>{RGTR_NM}</td>
<td class="cmn dummy-td"></td>
</tr>
</template>
<template name="tmpltNotFound">
<tr class="cmn">
<td valign="top" colspan="11" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
<td valign="top" colspan="18" class="dataTables_empty text-center">${prefixName} 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
@ -178,7 +202,7 @@
$P.dataTableDblClick = (dataIndex, dataKey) => {
let params = {
callPurpose: "update"
, entId: $P.ctrl.getValue("LSCT_ID") // 임대차계약 ID
, hirerId: $P.ctrl.getValue("HIRER_ID") // 임차인 ID
};
$P.ctrl.getInfo(params);
@ -360,8 +384,7 @@
$P.$findn("btnOK").on("click", () => { $P.fnOK(); }); // 선택 확인
// input에서 엔터(Enter) 키를 누르면 검색한다.
$P.$findn("schEntNo").onEnterPress($P.fnSearchList); // 법인(사업자)번호
$P.$findn("schEntNm").onEnterPress($P.fnSearchList); // 기업명
$P.$findn("schVhrno").onEnterPress($P.fnSearchList); // 자동차등록번호
// 업무 버튼 이벤트
$P.$findn("btnCreate").on("click", () => { $P.fnCreate(); }); // 등록

@ -14,64 +14,110 @@
<input type="hidden" name="hirerId" data-map="HIRER_ID" />
<div class="row g-1">
<!-- 기업 구분 코드 -->
<!-- 계약 시작 일시 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="entSeCd">기업구분</label>
<select is="id-select" class="form-select" name="entSeCd" data-map="ENT_SE_CD" required>
<option value="">선택하세요</option>
<c:forEach items="${FIM088List}" var="item">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="ctrtBgngYmd">계약시작일시</label>
<input is="id-input" type="text" class="form-control form-date" name="ctrtBgngYmd" data-map="CTRT_BGNG_YMD"
data-fmt-type="day" autocomplete="off" title="날짜 선택" maxlength="10" required />
<button type="button" class="bx bx-lg bx-calendar bg-white" name="btnCtrtBgngYmd"></button>
<input type="text" is="id-input" class="form-control form-time" name="ctrtBgngTm" data-map="CTRT_BGNG_TM"
data-fmt-type="time" autocomplete="off" title="시간 입력" maxlength="8" required placeholder="시:분:초" />
</div>
<!-- 계약 종료 일시 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="ctrtEndYmd">계약종료일시</label>
<input is="id-input" type="text" class="form-control form-date" name="ctrtEndYmd" data-map="CTRT_END_YMD"
data-fmt-type="day" autocomplete="off" title="날짜 선택" maxlength="10" required />
<button type="button" class="bx bx-lg bx-calendar bg-white" name="btnCtrtEndYmd"></button>
<input type="text" is="id-input" class="form-control form-time" name="ctrtEndTm" data-map="CTRT_END_TM"
data-fmt-type="time" autocomplete="off" title="시간 입력" maxlength="8" required placeholder="시:분:초" />
</div>
<!-- 자동차등록번호 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="vhrno">자동차등록번호</label>
<input is="id-input" type="text" class="form-control w-30" name="vhrno" data-map="VHRNO" required autocomplete="off" />
</div>
<!-- 임차인 구분 코드 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="hirerSeCd">임차인구분</label>
<select is="id-select" class="form-select" name="hirerSeCd" data-map="HIRER_SE_CD" required>
<c:forEach items="${FIM089List}" var="item">
<option value="${item.code}">${item.value}</option>
</c:forEach>
</select>
</div>
<!-- 기업 번호 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="entNo">법인(사업자)번호</label>
<input is="id-input" type="text" class="form-control w-30" name="entNo" data-map="ENT_NO" required autocomplete="off" />
</div>
<!-- 기업 명 -->
<!-- 임차인 등록 번호 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="entNm">기업명</label>
<input is="id-input" type="text" class="form-control w-40" name="entNm" data-map="ENT_NM" required autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="hirerRegNo">등록번호</label>
<input is="id-input" type="text" class="form-control w-30" name="hirerRegNo" data-map="HIRER_REG_NO" required autocomplete="off" />
</div>
<!-- 대표자 명 -->
<!-- 임차인 명 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="rprsvNm">대표자명</label>
<input is="id-input" type="text" class="form-control w-30" name="rprsvNm" data-map="RPRSV_NM" required autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end required" for="hirerNm">임차인명</label>
<input is="id-input" type="text" class="form-control w-30" name="hirerNm" data-map="HIRER_NM" required autocomplete="off" />
</div>
<!-- 기업 전화번호 -->
<!-- 임차인 전화번호 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="entTelno">전화번호</label>
<input is="id-input" type="text" class="form-control w-30" name="entTelno" data-map="ENT_TELNO" autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="hirerTelno">전화번호</label>
<input is="id-input" type="text" class="form-control w-30" name="hirerTelno" data-map="HIRER_TELNO" autocomplete="off" />
</div>
<!-- 기업 팩스번호 -->
<!-- 임차인 휴대 전화번호 -->
<div class="col-md-6">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="entFxno--${pageName}">팩스번호</label>
<input is="id-input" type="text" class="form-control w-30" name="entFxno" data-map="ENT_FXNO" autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="hirerMblTelno">휴대전화번호</label>
<input is="id-input" type="text" class="form-control w-30" name="hirerMblTelno" data-map="HIRER_MBL_TELNO" autocomplete="off" />
</div>
<!-- 기업 이메일 -->
<!-- 임차인 이메일 주소 -->
<div class="col-md-12">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="entEmlAddr--${pageName}">이메일</label>
<input is="id-input" type="text" class="form-control w-30" name="entEmlAddr" data-map="ENT_EML_ADDR" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="hirerEmlAddr">이메일</label>
<input is="id-input" type="text" class="form-control w-30" name="hirerEmlAddr" data-map="HIRER_EML_ADDR" />
</div>
<!-- 주소 --><!-- 우편번호 -->
<div class="col-md-12">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="entAddr">주소</label>
<input is="id-input" type="text" class="form-control w-70" name="entAddr" data-map="ENT_ADDR" autocomplete="off" />
<input is="id-input" type="text" class="form-control w-px-80" name="entZip" data-map="ENT_ZIP" autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="hirerAddr">주소</label>
<input is="id-input" type="text" class="form-control w-70" name="hirerAddr" data-map="HIRER_ADDR" autocomplete="off" />
<input is="id-input" type="text" class="form-control w-px-80" name="hirerZip" data-map="HIRER_ZIP" autocomplete="off" />
<button type="button" class="btn btn-sm btn-outline-dark" name="btnZipCode" title="우편번호검색">
검색
</button>
</div>
<!-- 상세주소 -->
<div class="col-md-12">
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="entDtlAddr">상세주소</label>
<input is="id-input" type="text" class="form-control w-85" name="entDtlAddr" data-map="ENT_DTL_ADDR" autocomplete="off" />
<label is="name-label" class="col-form-label bg-lighter pe-2 w-px-120 text-sm-end" for="hirerDtlAddr">상세주소</label>
<input is="id-input" type="text" class="form-control w-85" name="hirerDtlAddr" data-map="HIRER_DTL_ADDR" autocomplete="off" />
</div>
</div>
</form>
<!-- 입력 영역 -->
<!-- 첨부 파일 -->
<div class="card">
<form name="frmFile" method="post" enctype="multipart/form-data" >
<input type="file" name="uploadFiles" multiple="multiple" onchange="pageObject['${pageName}'].fnAddFiles(this);" hidden />
</form>
<div class="row g-1">
<div class="col-md-12">
<button type="button" class="btn btn-blue w-px-120" name="btnAddFile" title="첨부파일 추가">파일추가</button>
</div>
</div>
<!-- 첨부 파일 테이블 -->
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped" name="fileList">
<thead>
<th class="text-center" style="width: 24px">No.</th>
<th class="text-center" style="width: 200px">파일번호</th>
<th class="text-center">파일이름</th>
<th class="text-center" style="width: 200px">파일크기</th>
<th class="text-center" style="width: 120px">다운로드</th>
<th class="text-center" style="width: 120px">삭제</th>
</thead>
<tbody name="tbodyFileList">
</tbody>
</table>
</div> <!-- 첨부 파일 테이블 <div class="table-responsive"> -->
</div> <!-- <div class="card"> -->
<!-- 첨부 파일 -->
<!-- 업무 버튼 및 건수 표시 -->
<div>
<span class="container-page-btn" name="gridButtonArea">
@ -107,21 +153,146 @@
// datasetControl
$P.ctrl = newRent02040Control("${pageName}", "[data-doctx=${pageName}]");
// 파일 리스트
$P.fileListArr = new Array();
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// URL 설정
$P.setUrl = (prefixUrl) => {
$P.ctrl.urls.create = wctx.url(prefixUrl + "/040/createEnt.do") // 등록
$P.ctrl.urls.update = wctx.url(prefixUrl + "/040/updateEnt.do") // 수정
$P.ctrl.urls.create = wctx.url(prefixUrl + "/040/createHirer.do") // 등록
$P.ctrl.urls.update = wctx.url(prefixUrl + "/040/updateHirer.do") // 수정
}
// 우편번호 검색 결과
$P.callbackSearchAddr = (obj) => {
$P.$findn("entAddr").val(obj.ADDR); // 주소
$P.$findn("entZip").val(obj.ZIP); // 우편번호
$P.$findn("entDtlAddr").val(obj.DTL_ADDR); // 상세 주소
$P.$findn("hirerAddr").val(obj.ADDR); // 주소
$P.$findn("hirerZip").val(obj.ZIP); // 우편번호
$P.$findn("hirerDtlAddr").val(obj.DTL_ADDR); // 상세 주소
}
// 첨부파일 조회
$P.fnSearchFileList = (hirerId) => {
let tableFileList = $P.findn("fileList"); // table element 찾기
let fileLength = tableFileList.rows.length;
// 기존 table에 자료가 존재하면 tableRow 삭제
for (let iLoop = 1; iLoop < fileLength; iLoop++) {
tableFileList.deleteRow(1); // table 행(Row) 삭제
}
// 임차인 등록일 경우에는 첨부파일을 조회하지 안는다..
if (!hirerId) return;
// 첨부파일 리스트
ajax.get({
url: "file/list.do"
, data: {
infoType: "120"
, infoKeys: hirerId
, fetchSize: 0
}
, success: (resp) => {
let fileNo = 0;
let fileList = resp.fileList;
fileList.forEach(function (item, index, array) {
fileNo = index + 1;
let innerHtml = "";
innerHtml += "<tr>";
innerHtml += "<td class='text-center'>" + fileNo + "</td>";
innerHtml += "<td class='text-center'>" + item.FILE_ID + "</td>";
innerHtml += "<td class='text-center'>" + item.FILE_NM + "</td>";
innerHtml += "<td class='text-center'>" + item.FILE_SIZE + " byte</td>";
innerHtml += "<td class='text-center'>" + "<button type='button' class='btn' onclick=";
innerHtml += "pageObject['${pageName}'].fnFileDownload(" + item.FILE_ID + ");" + "><i class='bx bx-download me-1'></i></button>" + "</td>";
innerHtml += "<td class='text-center'>" + "<button type='button' class='btn' onclick=";
innerHtml += "pageObject['${pageName}'].fnFileRemove(this);" + "><i class='bx bx-trash me-1'></i></button>" + "</td>";
innerHtml += "</tr>";
$P.$findn("tbodyFileList").append(innerHtml);
});
}
});
}
// 첨부파일 등록
$P.fnAddFiles = (obj) => {
let tableFileList = $P.findn("fileList"); // table element 찾기
let fileNo = tableFileList.rows.length - 1; // table에 있는 파일 갯수 (첫번째 title은 제외하기 위해서 -1 처리)
let maxFileCnt = 3; // 의견제출에 등록 할 수 있는 첨부 파일 최대 개수
let attFileCnt = obj.files.length; // 선택한 파일의 개수
let fileArr = new Array(); // 파일 배열
fileArr = $P.fileListArr;
// 등록할 파일 개수 확인
if (attFileCnt + fileNo > maxFileCnt) {
dialog.alert({
content : "첨부파일은 최대 " + maxFileCnt + "개 까지 첨부 가능합니다."
, init: () => { AppSupport.setDialogZindex(); }
, onOK: () => { }
});
return;
}
// 첨부파일을 table에 추가.
for (let iLoop = 0; iLoop < attFileCnt; iLoop++) {
let selectedFile = obj.files[iLoop];
let innerHtml = "";
fileNo += 1;
innerHtml += "<tr>";
innerHtml += "<td class='text-center'>" + fileNo + "</td>";
innerHtml += "<td class='text-center'>" + "</td>";
innerHtml += "<td class='text-center'>" + selectedFile.name + "</td>";
innerHtml += "<td class='text-center'>" + selectedFile.size + " byte</td>";
innerHtml += "<td class='text-center'>" + "</td>";
innerHtml += "<td class='text-center'>" + "<button type='button' class='btn' onclick=";
innerHtml += "pageObject['${pageName}'].fnFileRemove(this);" + "><i class='bx bx-trash me-1'></i></button>" + "</td>";
innerHtml += "</tr>";
$P.$findn("tbodyFileList").append(innerHtml);
fileArr.push(obj.files[iLoop]);
}
}
// 첨부파일 삭제 아이콘 클릭 이벤트
$P.fnFileRemove = (obj) => {
dialog.alert({
content: "선택한 파일을 삭제하시겠습니까?"
, onOK: () => {
let tr = $(obj).parent().parent(); // 클릭한 버튼이 속한 tr 요소
let td = tr.children();
let fileId = td.eq(1).text(); // 삭제할 파일번호
let fileName = td.eq(2).text(); // 삭제할 파일이름
if (fileId != null && fileId != "") {
ajax.post({
url: "file/remove.do"
, data: { fileIDs: fileId }
, success: (resp) => { }
});
} else {
let filtered = $P.fileListArr.filter((value, index, arr) => {
return (value.name != fileName);
});
$P.fileListArr = filtered;
}
$(obj).closest("tr").remove(); // table 에서 제거
}
});
}
// 첨부파일 다운로드 아이콘 클릭 이벤트
$P.fnFileDownload = (fileID) => {
top.location.href = "/file/download.do?fileID=" + fileID;
}
/**************************************************************************
@ -134,6 +305,11 @@
// URL 설정
$P.setUrl("${prefixUrl}");
// 기본 데이터 설정
AppSupport.initDatepicker($P.findn("frmEdit")); // 달력 초기화
$P.$findn("ctrtBgngYmd").datepicker("setDate", TODAY()); // 계약 시작 일자
$P.$findn("ctrtEndYmd").datepicker("setDate", TODAY()); // 계약 종료 일자
}
// 우편번호 검색
@ -154,7 +330,7 @@
});
}
// 임대기업 등록 버튼 클릭 이벤트
// 임차인 등록
$P.fnSave = () => {
// validate 확인
if (!AppSupport.customValidate($P.$findn("frmEdit").find("input,select,textarea"))) return;
@ -181,10 +357,36 @@
**************************************************************************/
// 이벤트
$P.setEvent = () => {
// form-date 항목에서 키보드로 입력시 날짜, 시간 포맷팅 적용
$P.$findn("frmEdit").find(".form-date").each(function() {
$(this).on("input",function() {
let value = this.value.replaceAll("-", "");
if (value.length > 7) {
this.value = value.substring(0,4) + "-" + value.substring(4,6) + "-" + value.substring(6);
} else if(value.length > 5) {
this.value = value.substring(0,4) + "-" + value.substring(4);
}
});
});
$P.$findn("frmEdit").find(".form-time").each(function() {
$(this).on("input",function() {
let value = this.value.replaceAll(":", "");
if (value.length > 5) {
this.value = value.substring(0,2) + ":" + value.substring(2,4) + ":" + value.substring(4);
} else if (value.length > 3) {
this.value = value.substring(0,2) + ":" + value.substring(2);
}
});
});
// 기본 버튼 이벤트
$P.$findn("btnZipCode").on("click", () => { $P.fnZipCode() }); // 우편번호 검색
$P.$findn("btnZipCode").on("click", () => { $P.fnZipCode() }); // 우편번호 검색 버튼 클릭 이벤트
// 버튼 이벤트
$P.$findn("btnSave").on("click", () => { $P.fnSave() }); // 저장
$P.$findn("btnAddFile").on("click", () => $P.$findn("uploadFiles").trigger("click")); // 파일 등록 버튼 클릭 이벤트
$P.$findn("btnSave").on("click", () => { $P.fnSave() }); // 저장 버튼 클릭 이벤트
}
/**************************************************************************

@ -15,7 +15,9 @@ function newRent02030Control(pageName, doctx="[data-doctx='rent02030']") {
, remove: "/remove.do"
}
, formats: {
REG_DT: datetimeFormat
CTRT_BGNG_DT: datetimeFormat
, CTRT_END_DT: datetimeFormat
, REG_DT: datetimeFormat
}
});

@ -21,6 +21,11 @@ function newRent02040Control(pageName, doctx="[data-doctx='rent02040']") {
// 화면에 Dataset 셋팅
let formFields = new FimsFormFields(ctrl.selector("[name='frmEdit']"));
formFields.set(ctrl, item);
let key = item.data.HIRER_ID;
if (key != null) {
pageObject[pageName].fnSearchFileList(key);
}
};
// 저장 callback
@ -50,10 +55,22 @@ function newRent02040Control(pageName, doctx="[data-doctx='rent02040']") {
if (!params) return;
let create = (params.callPurpose == "create");
let formData = new FormData();
// pageObject[pageName] 첨부파일 배열에 있는 내용을 등록
for (let iLoop = 0; iLoop < pageObject[pageName].fileListArr.length; iLoop++) {
formData.append("uploadFiles" , pageObject[pageName].fileListArr[iLoop]);
}
for (let key in params) {
let value = params[key];
formData.append(key, value);
}
ajax.post({
url: !create ? ctrl.urls.update : ctrl.urls.create
, data: params || {}
, data: formData
, contentType: false
, processData: false
, success: (resp) => { ctrl.onSave(params, resp); }
});
}

Loading…
Cancel
Save