모바일서류 추가
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled

This commit is contained in:
yangsh
2026-01-12 14:52:37 +09:00
parent 46f72e131a
commit 1cee60147c
6 changed files with 3669 additions and 0 deletions

View File

@@ -185,6 +185,7 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
*/ */
$routes->get('m708a/getResultList', 'M708::getResultList'); $routes->get('m708a/getResultList', 'M708::getResultList');
$routes->get('m708a/excel', 'M708::excel'); $routes->get('m708a/excel', 'M708::excel');
$routes->post('m708a/rotateImage', 'M708::rotateImage'); // 이미지 회전
$routes->get('m708a/getArticleInfo', 'M708::getArticleInfo'); // 매물검색 $routes->get('m708a/getArticleInfo', 'M708::getArticleInfo'); // 매물검색
$routes->post('m708a/saveNotArticle', 'M708::saveNotArticle'); // 홍보확인서 아님 저장 $routes->post('m708a/saveNotArticle', 'M708::saveNotArticle'); // 홍보확인서 아님 저장
$routes->post('m708a/saveDuplImgs', 'M708::saveDuplImgs'); // 중복으로 저장 $routes->post('m708a/saveDuplImgs', 'M708::saveDuplImgs'); // 중복으로 저장
@@ -197,6 +198,28 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
}); });
/**
* 모바일 추가 서류
*/
$routes->group('m709', static function ($routes) {
$routes->get('m709a/lists', 'M709::lists');
$routes->get('m709a/detail/(:num)', 'M709::detail/$1');
/**
* 모바일 추가 서류 - API
*/
$routes->get('m709a/getResultList', 'M709::getResultList');
$routes->get('m709a/excel', 'M709::excel');
$routes->post('m709a/rotateImage', 'M709::rotateImage'); // 이미지 회전
$routes->get('m709a/getArticleInfo', 'M709::getArticleInfo'); // 매물검색
$routes->post('m709a/saveNotArticle', 'M709::saveNotArticle'); // 홍보확인서 아님 저장
$routes->post('m709a/saveDuplImgs', 'M709::saveDuplImgs'); // 중복으로 저장
$routes->post('m709a/saveAddress', 'M709::saveAddress'); // 정보 저장
$routes->post('m709a/saveImageArticle', 'M709::saveImageArticle'); // 확인결과저장
$routes->post('m709a/getNextFaxImgs', 'M709::getNextFaxImgs'); // 다음매물
});
}); });

399
app/Controllers/V2/M709.php Normal file
View File

@@ -0,0 +1,399 @@
<?php
namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\Common;
use App\Models\common\CodeModel;
use App\Models\v2\M709Model;
class M709 extends BaseController
{
private $model, $codeModel;
public function __construct()
{
$this->model = new M709Model();
$this->codeModel = new CodeModel();
}
public function lists(): string
{
$codes = $this->codeModel->getCodeLists(['CP_ID', 'STEP_VERIFICATION', 'RECEIPT_STATUS3', 'ARTICLE_TYPE']); // 코드조회
$sido = $this->model->getAreaList(); // 지역조회
$bonbu = $this->model->getBonbuList();
$team = $this->model->getTeamList();
$user = $this->model->getUserList();
$this->data['sido'] = $sido;
$this->data['bonbu'] = $bonbu;
$this->data['team'] = $team;
$this->data['user'] = $user;
$this->data['codes'] = $codes;
return view("pages/v2/m709/lists", $this->data);
}
public function getResultList()
{
$start = (int) $this->request->getGet('start') ?: 0;
$end = (int) $this->request->getGet('length') ?: 10;
$data = [
'atcl_no' => $this->request->getGet('atcl_no'), // 매물번호
'chk_atcl_no' => $this->request->getGet('chk_atcl_no'), // 매물번호입력
'caller_no' => $this->request->getGet('caller_no'), // 발신팩스번호
'stat_cd' => $this->request->getGet('stat_cd'), // 현재상태
'realtor_nm' => $this->request->getGet('realtor_nm'), // 중개소
'charger_gbn' => $this->request->getGet('charger_gbn'), // 배정여부
'assign_yn' => $this->request->getGet('assign_yn'), // 배정여부2
'receipt_sdate' => $this->request->getGet('receipt_sdate'), // 접수기간1
'receipt_edate' => $this->request->getGet('receipt_edate'), // 접수기간2
'complete_sdate' => $this->request->getGet('complete_sdate'), // 완료기간1
'complete_edate' => $this->request->getGet('complete_edate'), // 완료기간2
'srcSido' => $this->request->getGet('srcSido'), // 시도
'srcGugun' => $this->request->getGet('srcGugun'), // 시군구
'srcDong' => $this->request->getGet('srcDong'), // 읍면동
'bonbu' => $this->request->getGet('bonbu'), // 본부
'team' => $this->request->getGet('team'), // 팀
'damdang' => $this->request->getGet('damdang'), // 담당
'target_yn' => $this->request->getGet('target_yn'), // 홍보확인서여부
'rcpt_cpid' => $this->request->getGet('rcpt_cpid'), // 매체사
'rlet_type_cd' => $this->request->getGet('rlet_type_cd'), // 매물종류
'rcpt_v2' => $this->request->getGet('rcpt_v2'), // 검증방식
];
$totalCount = $this->model->getTotalCount($data);
$datas = $this->model->getResultList($start, $end, $data);
return $this->response->setJSON(body: [
'recordsTotal' => $totalCount,
'recordsFiltered' => $totalCount,
'data' => $datas,
]);
}
public function excel()
{
try {
$data = [
'atcl_no' => $this->request->getGet('atcl_no'), // 매물번호
'chk_atcl_no' => $this->request->getGet('chk_atcl_no'), // 매물번호입력
'caller_no' => $this->request->getGet('caller_no'), // 발신팩스번호
'stat_cd' => $this->request->getGet('stat_cd'), // 현재상태
'realtor_nm' => $this->request->getGet('realtor_nm'), // 중개소
'charger_gbn' => $this->request->getGet('charger_gbn'), // 배정여부
'assign_yn' => $this->request->getGet('assign_yn'), // 배정여부2
'receipt_sdate' => $this->request->getGet('receipt_sdate'), // 접수기간1
'receipt_edate' => $this->request->getGet('receipt_edate'), // 접수기간2
'complete_sdate' => $this->request->getGet('complete_sdate'), // 완료기간1
'complete_edate' => $this->request->getGet('complete_edate'), // 완료기간2
'srcSido' => $this->request->getGet('srcSido'), // 시도
'srcGugun' => $this->request->getGet('srcGugun'), // 시군구
'srcDong' => $this->request->getGet('srcDong'), // 읍면동
'bonbu' => $this->request->getGet('bonbu'), // 본부
'team' => $this->request->getGet('team'), // 팀
'damdang' => $this->request->getGet('damdang'), // 담당
'target_yn' => $this->request->getGet('target_yn'), // 홍보확인서여부
'rcpt_cpid' => $this->request->getGet('rcpt_cpid'), // 매체사
'rlet_type_cd' => $this->request->getGet('rlet_type_cd'), // 매물종류
'rcpt_v2' => $this->request->getGet('rcpt_v2'), // 검증방식
];
$datas = $this->model->getExcelList($data);
return $this->response->setJSON(body: [
'data' => $datas,
]);
} catch (\Exception $e) {
$e->getPrevious()->getTraceAsString();
}
}
// 상세화면
public function detail($id)
{
$id = (int) $id;
if ($id <= 0) {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
$codes = $this->codeModel->getCodeLists(['CONFIRM_RESULT_D11', 'CONSULTANT_COMMENT']); // 코드조회
$data = $this->model->getDetail($id);
$memo = $this->model->getMemo($id);
$article = null;
$confirm = null;
if (!empty($data)) {
switch ($data['work_type']) {
case "1": // 현장확인 매물
$article = $this->model->getArticleInfo1($data['atcl_no']);
break;
case "2": // 일반확인 매물
$article = $this->model->getArticleInfo2($data['atcl_no']);
break;
}
$this->data['article'] = $article;
$this->data['confirm'] = $confirm;
}
// dd($data);
// exit;
$history = $this->model->getHistory($id);
$this->data['codes'] = $codes;
$this->data['data'] = $data;
$this->data['memo'] = $memo;
$this->data['history'] = $history;
return view("pages/v2/m709/detail", $this->data);
}
// 이미지회전
public function rotateImage()
{
$common = new Common();
try {
$vr_sq = $this->request->getPost('vr_sq');
$degress = $this->request->getPost('degress');
if (empty($degrees) || !is_numeric($degrees)) {
$degrees = 90;
}
$regist = $this->model->getRecordInfo($vr_sq, '2');
$fullPath = $regist['file_path'] . $regist['file_name'];
$fullPath = $_SERVER['DOCUMENT_ROOT'] . $common->realpath_to_webpath($fullPath);
$degrees = (float) $degrees;
$im = new \Imagick($fullPath);
// 배경색(회전 시 빈 공간 채우는 색). 투명 원하면 'transparent'
$im->setImageBackgroundColor(new \ImagickPixel('white'));
// 회전
$im->rotateImage($im->getImageBackgroundColor(), $degrees);
// 포맷/압축 유지(옵션)
$im->setImageCompressionQuality(90);
// 덮어쓰기
$im->writeImage($fullPath);
$im->clear();
$im->destroy();
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 매물검색
public function getArticleInfo()
{
try {
$atcl_no = $this->request->getGet('atcl_no');
$row = $this->model->getArticleInfo($atcl_no);
if (empty($row)) {
return $this->response->setJSON([
'code' => '9',
'msg' => '매물이 존재하지 않습니다.',
]);
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
'atcl_no' => $row['vr_sq'],
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 홍보확인서 아님 저장
public function saveNotArticle()
{
try {
$fax_sq = $this->request->getPost('fax_sq');
$this->model->saveNotArticle($fax_sq);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 중복으로 저장
public function saveDuplImgs()
{
try {
$fax_sq = $this->request->getPost('fax_sq');
$atcl_no = $this->request->getPost('atcl_no');
$vr_sq = $this->request->getPost('vr_sq');
$this->model->saveDuplImgs($fax_sq, $atcl_no, $vr_sq);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 정보저장
public function saveAddress()
{
try {
$vr_sq = $this->request->getPost('vr_sq'); // 확인요청순번
$atcl_no = $this->request->getPost('atcl_no'); // 매물번호
$fax_sq = $this->request->getPost('fax_sq'); // fax 순번
$address2 = $this->request->getPost('address2'); // 상세주소1
$address3 = $this->request->getPost('address3'); // 상세주소2
$trade_type = $this->request->getPost('trade_type'); // 거래구분
$floor = $this->request->getPost('floor'); // 층
$floor2 = $this->request->getPost('floor2'); // 총층
$data = [
'vr_sq' => $vr_sq,
'atcl_no' => $atcl_no,
'fax_sq' => $fax_sq,
'address2' => $address2,
'address3' => $address3,
'trade_type' => $trade_type,
'floor' => $floor,
'floor2' => $floor2,
];
$this->model->saveAddress($data);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 확인결과저장
public function saveImageArticle()
{
try {
$fax_sq = $this->request->getPost('fax_sq');
$work_type = $this->request->getPost('work_type');
$atcl_no = $this->request->getPost('atcl_no');
$vr_sq = $this->request->getPost('vr_sq');
$file_type = $this->request->getPost('file_type');
$data = [
'fax_sq' => $fax_sq,
'work_type' => $work_type,
'atcl_no' => $atcl_no,
'vr_sq' => $vr_sq,
'file_type' => $file_type,
];
$this->model->saveImageArticle($data);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 다음 매물정보 조회
public function getNextFaxImgs()
{
try {
$curr_fax_sq = $this->request->getPost('curr_fax_sq');
$data = $this->model->getNextFaxImgs($curr_fax_sq);
if (empty($data)) {
return $this->response->setJSON([
'code' => '9',
'msg' => 'FAX 이미지가 존재하지 않습니다.'
]);
} else {
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
'data' => $data
]);
}
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
}

View File

@@ -961,6 +961,8 @@ class M708Model extends Model
$current_tm = date('Y-m-d H:i:s'); $current_tm = date('Y-m-d H:i:s');
$article = $this->getArticleInfo2($atcl_no, $vr_sq); $article = $this->getArticleInfo2($atcl_no, $vr_sq);
$this->saveFaxImgs($fax_sq, '2', $vr_sq, $atcl_no, $article['cpid'], $article['realtor_nm'], $article['stat_cd'], $current_tm, $article['address_code'], $article['address2']);
return [ return [
'success' => true, 'success' => true,
]; ];

1122
app/Models/v2/M709Model.php Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,774 @@
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<style>
th {
font-size: 11px;
text-align: center;
}
td {
text-align: center;
}
#resultList tbody tr {
cursor: pointer;
font-size: 12px;
}
.blockUI {
z-index: 1500 !important;
}
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 180px;
}
.card-header {
display: flex !important;
align-items: center;
}
.card-header-tab {
justify-content: flex-start !important;
}
.table-scroll {
max-height: 300px;
overflow-y: scroll;
}
.swal2-cancel {
background-color: #ff0000 !important;
color: #fff !important;
}
</style>
<h1>모바일 추가 서류</h1>
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-body">
<form id="frm_srch_info" method="get" onsubmit="return false;">
<input type="hidden" name="m" id="m" value="M801" />
<input type="hidden" name="todo" id="todo" value="inq" />
<input type="hidden" name="usr_id" value="" />
<!-- 안내 -->
<div class="alert alert-warning py-2 mb-3">
<small class="mb-0">
매물번호 또는 발신팩스번호를 입력하면 <b>다른 조건은 무시</b>됩니다.
</small>
</div>
<!-- 검색 폼 -->
<div class="row g-3">
<!-- 매물번호 -->
<div class="col-md-1">
<label class="form-label mb-1">매물번호</label>
<input type="text" name="atcl_no" class="form-control form-control-sm" placeholder="매물번호" maxlength="10"
onkeypress="atcl_no_enter(event)">
</div>
<div class="col-md-1">
<label class="form-label mb-1">매물번호입력</label>
<select name="chk_atcl_no" class="form-select form-select-sm">
<option value="">-전체-</option>
<option value="Y">입력</option>
<option value="N">미입력</option>
</select>
</div>
<div class="col-md-1">
<label class="form-label mb-1">발신팩스번호</label>
<input type="text" name="caller_no" class="form-control form-control-sm" placeholder="발신팩스번호" maxlength="10"
onkeypress="atcl_no_enter(event)">
</div>
<!-- 현재상태 -->
<div class="col-md-2">
<label class="form-label mb-1">현재상태</label>
<select name="stat_cd" class="form-select form-select-sm">
<option value="">-선택-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<!-- 중개소 -->
<div class="col-md-1">
<label class="form-label mb-1">중개소</label>
<input type="text" name="realtor_nm" class="form-control form-control-sm" placeholder="중개소">
</div>
<!-- 배정여부 (2개 셀렉트) -->
<div class="col-md-3">
<label class="form-label mb-1">배정여부</label>
<div class="d-flex gap-2">
<select name="charger_gbn" id="code_charger_gbn" class="form-select form-select-sm">
<option value="1">전화/서류담당자</option>
<option value="2">등기부등본담당자</option>
</select>
<select name="assign_yn" id="assign_yn" class="form-select form-select-sm">
<option value="A">-전체-</option>
<option value="Y">배정</option>
<option value="N">미배정</option>
</select>
</div>
</div>
</div>
<div class="row g-3">
<!-- 접수기간 -->
<div class="col-md-3">
<label class="form-label mb-1">수신기간</label>
<div class="input-group input-group-sm">
<input type="date" class="form-control" name="receipt_sdate" id="receipt_sdate" placeholder="시작일">
<span class="input-group-text">~</span>
<input type="date" class="form-control" name="receipt_edate" id="receipt_edate" placeholder="종료일">
</div>
</div>
<!-- 완료기간 -->
<div class="col-md-3">
<label class="form-label mb-1">처리기간</label>
<div class="input-group input-group-sm">
<input type="text" class="form-control" name="complete_sdate" id="complete_sdate" placeholder="시작일">
<span class="input-group-text">~</span>
<input type="text" class="form-control" name="complete_edate" id="complete_edate" placeholder="종료일">
</div>
</div>
<!-- 지역구분 -->
<div class="col-md-4">
<label class="form-label mb-1">지역구분</label>
<div class="d-flex gap-2">
<select name="srcSido" id="srcSido" class="form-select form-select-sm">
<option value="">-시/도-</option>
<?php foreach ($sido as $s): ?>
<option value="<?= $s['region_cd'] ?>"><?= $s['region_nm'] ?></option>
<?php endforeach; ?>
</select>
<select name="srcGugun" id="srcGugun" class="form-select form-select-sm">
<option value="">-시/군/구-</option>
</select>
<select name="srcDong" id="srcDong" class="form-select form-select-sm">
<option value="">-읍/면/동-</option>
</select>
</div>
</div>
</div>
<div class="row g-3">
<!-- 담당자 (본부/팀/담당 3셀렉트) -->
<div class="col-md-3">
<label class="form-label mb-1">담당자</label>
<div class="d-flex gap-2">
<select name="bonbu" id="bonbu" class="form-select form-select-sm">
<option value="">-본부-</option>
<?php foreach ($bonbu as $d): ?>
<option value="<?= $d['dept_sq'] ?>"><?= $d['dept_nm'] ?></option>
<?php endforeach; ?>
</select>
<select name="team" id="team" class="form-select form-select-sm">
<option value="">-팀-</option>
</select>
<select name="damdang" id="damdang" class="form-select form-select-sm">
<option value="">-담당자-</option>
</select>
</div>
</div>
<!-- 검증방식 -->
<div class="col-md-1">
<label class="form-label mb-1">홍보확인서여부</label>
<div class="d-flex gap-2">
<select name="target_yn" id="target_yn" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<option value="A">미처리</option>
<option value="1">홍보확인서</option>
<option value="3">분양권</option>
<option value="E">홍보확인서 아님</option>
</select>
</div>
</div>
<!-- 매체사 -->
<div class="col-md-1">
<label class="form-label mb-1">매체사</label>
<select name="rcpt_cpid" class="form-select form-select-sm">
<option value="">-전체-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "CP_ID"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<!-- 매물종류 -->
<div class="col-md-1">
<label class="form-label mb-1">매물종류</label>
<select name="rlet_type_cd" class="form-select form-select-sm">
<option value="">-매물종류-</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "ARTICLE_TYPE"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<!-- 검증방식 -->
<div class="col-md-1">
<label class="form-label mb-1">검증방식</label>
<select name="rcpt_v2" class="form-select form-select-sm">
<option value="">-검증방식-</option>
<option value="N">현장확인</option>
<option value="Y">현장확인v2</option>
</select>
</div>
<div class="col-md-1 d-grid">
<label class="form-label mb-1 invisible">검색</label>
<button type="button" class="btn btn-primary" id="btnSearch">
<i class="pe-7s-search me-1"></i>검색
</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12 col-xl-12">
<div class="main-card mb-3 card">
<div class="card-header d-flex align-items-center">
<div class="d-flex align-items-center flex-wrap" style="gap: 8px; flex: 1">
</div>
<div class="ml-auto">
<button class="btn btn-sm btn-outline-success" id="excel-download">
<i class="fa fa-fw" aria-hidden="true" title="file-excel-o"></i>
엑셀다운로드
</button>
</div>
</div>
<div class="card-body">
<table id="resultList" class="table table-hover table-striped table-bordered">
<thead>
<tr>
<th>매물번호</th>
<th>현재상태</th>
<th>홍보확인서<br />여부</th>
<th>수신기간</th>
<th>발신번호</th>
<th>주소</th>
<th>상세주소</th>
<th>매체사</th>
<th>중개소</th>
<th>서류/전화<br />담당자</th>
<th>서류/전화<br />확인시간</th>
<th>등기부등본<br />담당자</th>
<th>검증완료<br />일시</th>
</tr>
</thead>
<tbody>
<!-- 여기는 비워둠: AJAX로 채움 -->
</tbody>
</table>
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
<link href="https://unpkg.com/dropzone@6.0.0-beta.1/dist/dropzone.css" rel="stylesheet" type="text/css" />
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
<script type="text/javascript" src="https://oapi.map.naver.com/openapi/v3/maps.js?ncpKeyId=dtounkwjc5"></script>
<script type="text/javascript">
const date = new Date();
const bonbuArr = <?= json_encode($bonbu, JSON_UNESCAPED_UNICODE); ?>;
const teamArr = <?= json_encode($team, JSON_UNESCAPED_UNICODE); ?>;
const userArr = <?= json_encode($user, JSON_UNESCAPED_UNICODE); ?>;
const codeArr = <?= json_encode($codes, JSON_UNESCAPED_UNICODE); ?>;
var table;
$(function () {
$("#bonbu").on("change", function (e) {
const value = e.target.value
$("#dept_sq").empty()
var str = "<option value=''>선택</option>"
if (teamArr != null) {
for (var i = 0; i < teamArr.length; i++) {
if (value === teamArr[i].pdept_sq) {
str += "<option value='" + teamArr[i].dept_sq + "'>" + teamArr[i].dept_nm + "</option>"
}
}
}
$("#dept_sq").append(str)
});
$("#srcSido, #srcGugun, #srcSido2, #srcGugun2").on("change", function (e) {
const targetId = this.id;
const isSecond = this.id.endsWith("2");
const params = {
srcSido: isSecond
? $("#srcSido2").val()
: $("#frm_srch_info [name=srcSido]").val(),
srcGugun: isSecond
? $("#srcGugun2").val()
: $("#frm_srch_info [name=srcGugun]").val(),
};
$.ajax({
url: "/manage/areas/getAreaList",
method: "POST",
dataType: "json",
data: params,
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) {
switch (targetId) {
case "srcSido":
$("#srcGugun").empty()
var str = "";
str += "<option value=''>시/군/구</option>";
if ($("#srcSido").val() !== "") {
if (result.length > 0) {
for (var i = 0; i < result.length; i++) {
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
}
}
}
$("#srcGugun").append(str);
break;
case "srcGugun":
$("#srcDong").empty()
var str = "";
str += "<option value=''>읍/면/동</option>";
if (result.length > 0) {
for (var i = 0; i < result.length; i++) {
str += "<option value='" + result[i]['region_cd'] + "'>" + result[i].region_nm + "</option>";
}
}
$("#srcDong").append(str);
break;
}
}
});
});
$("#bonbu, #team, #bonbu2, #team2").on("change", function (e) {
const targetId = this.id;
var str = "";
if (targetId === "bonbu" || targetId === "bonbu2") {
const dept_sq = $("#" + targetId).val();
str += `<option value="">-팀-</option>`;
if (teamArr.length > 0) {
for (var i = 0; i < teamArr.length; i++) {
// 이 팀이 현재 본부에 속한 팀인지 체크
if (String(teamArr[i].pdept_sq) === String(dept_sq)) {
str += `
<option value="${teamArr[i].dept_sq}">${teamArr[i].dept_nm}</option>
`;
}
}
}
if (targetId === "bonbu") {
$("#team").html(str);
} else if (targetId === "bonbu2") {
$("#team2").html(str);
}
} else if (targetId === "team" || targetId === "team2") {
const dept_sq = $("#" + targetId).val();
str += `<option value="">-담당자-</option>`;
if (userArr.length > 0) {
for (var i = 0; i < userArr.length; i++) {
// 이 팀이 현재 본부에 속한 팀인지 체크
if (String(userArr[i].dept_sq) === String(dept_sq)) {
str += `
<option value="${userArr[i].usr_id}">${userArr[i].usr_nm}</option>
`;
}
}
}
if (targetId === "team") {
$("#damdang").html(str);
} else if (targetId === "team2") {
$("#damdang2").html(str);
}
}
});
// 검증방식 onchange
$("#vrfcreq_way").on("change", function (e) {
const val = e.target.value;
var str = "";
str += `<option value="">-선택-</option>`;
if (e.val !== "") {
$.getJSON("/common/common/getVrfcCode?type=" + val, function (result) {
var total = result.length;
for (var i = 0; i < total; i++) {
var cateNm = result[i].cd_nm;
if (total == 1) {
str += "<option value=\"" + result[i].cd + "\" selected>" + cateNm + "</option>";
} else {
str += "<option value=\"" + result[i].cd + "\">" + cateNm + "</option>";
}
}
$("#vrfc_type_sub").html(str);
});
} else {
$("#vrfc_type_sub").html(str);
}
});
initReceiptDate();
table = $('#resultList').DataTable({
language: lang_kor,
serverSide: true,
processing: true,
ajax: {
url: '/m709/m709a/getResultList',
type: 'GET',
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
data: function (d) {
d.atcl_no = $("#frm_srch_info [name=atcl_no]").val(); // 매물번호
d.chk_atcl_no = $("#frm_srch_info [name=chk_atcl_no]").val(); // 매물번호입력
d.caller_no = $("#frm_srch_info [name=caller_no]").val(); // 발신팩스번호
d.stat_cd = $("#frm_srch_info [name=stat_cd]").val(); // 현재상태
d.realtor_nm = $("#frm_srch_info [name=realtor_nm]").val(); // 중개소
d.charger_gbn = $("#frm_srch_info [name=charger_gbn]").val(); // 배정여부
d.assign_yn = $("#frm_srch_info [name=assign_yn]").val(); // 배정여부2
d.receipt_sdate = $("#frm_srch_info [name=receipt_sdate]").val(); // 접수기간1
d.receipt_edate = $("#frm_srch_info [name=receipt_edate]").val(); // 접수기간2
d.complete_sdate = $("#frm_srch_info [name=complete_sdate]").val(); // 완료기간1
d.complete_edate = $("#frm_srch_info [name=complete_edate]").val(); // 완료기간2
d.srcSido = $("#frm_srch_info [name=srcSido]").val(); // 시도
d.srcGugun = $("#frm_srch_info [name=srcGugun]").val(); // 시군구
d.srcDong = $("#frm_srch_info [name=srcDong]").val(); // 읍면동
// d.bonbu = $("#frm_srch_info [name=bonbu]").val(); // 본부
d.team = $("#frm_srch_info [name=team]").val(); // 팀
d.damdang = $("#frm_srch_info [name=damdang]").val(); // 담당
d.target_yn = $("#frm_srch_info [name=target_yn]").val(); // 홍보확인서여부
d.rcpt_cpid = $("#frm_srch_info [name=rcpt_cpid]").val(); // 매체사
d.rlet_type_cd = $("#frm_srch_info [name=rlet_type_cd]").val(); // 매물종류
d.rcpt_v2 = $("#frm_srch_info [name=rcpt_v2]").val(); // 검증방식
d.start = d.start || 0
d.length = d.length || 10
},
},
"columnDefs": [
{ className: 'text-center', targets: '_all' },
{ 'targets': '_all', "defaultContent": "" },
],
columns: [
{ data: 'atcl_no' },
{ data: null, render: fn_stat_render },
{ data: null, render: fn_pr_render },
{ data: 'RECV_TIME' },
{ data: 'CALLER_NO' },
{ data: null, render: fn_region_render },
{ data: null, render: fn_addr_render },
{ data: 'cpid' },
{ data: 'realtor_nm' },
{ data: 'usr_nm', width: '80px' },
{ data: null, render: fn_tm_render },
{ data: 'rgbk_check_tm' },
{ data: 'send_tm' },
],
// 옵션들 예시
paging: true,
searching: false,
ordering: false,
});
$('#resultList tbody').on('click', 'tr', function (e) {
if ($(e.target).closest('td.dt-no-rowclick').length) return;
const rowData = table.row(this).data();
if (!rowData) return;
const fax_sq = rowData.fax_sq;
location.href = "<?= site_url('m709/m709a/detail') ?>/" + fax_sq;
});
$('#btnSearch').on('click', function () {
table.ajax.reload()
});
// 엑셀 다운로드 click
$("#excel-download").on("click", function () {
$.ajax({
url: "/m709/m709a/excel",
method: "GET",
dataType: "json",
data: $("#frm_srch_info").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
success: function (result) {
downloadExcel(result.data);
}
});
});
});
// 접수기간 초기화
function initReceiptDate() {
const before3 = new Date();
before3.setDate(date.getDate() - 2);
const fmt = d => d.toISOString().slice(0, 10);
$('#receipt_sdate').val(fmt(before3));
$('#receipt_edate').val(fmt(date));
$("#bonbu").val("3");;
$("#bonbu").trigger("change");
$("#bonbu").prop("disabled", true);
}
function atcl_no_enter(event) {
if (event.keyCode == 13) {
table.ajax.reload()
}
}
function fn_stat_render(data, type, row) {
var str = "";
if (row.stat_cd != null) {
str = getCodeName(row.stat_cd, 'STEP_VERIFICATION');
} else {
str = getCodeName(row.rcpt_stat, 'RECEIPT_STATUS3');
}
return str;
}
function fn_pr_render(datra, type, row) {
var str = "";
if (row.work_type == '1' & row.bunyang_yn == 'Y') {
str = '분양권';
} else if (row.work_type == '1' && row.send_yn == 'Y') {
str = '홍보확인서';
} else if (row.work_type == 'E') {
str = '홍보확인서 아님';
} else if (row.work_type == '1' && row.send_yn == 'N') {
str = '미처리';
}
return str;
}
function fn_region_render(data, type, row) {
var str = "";
str = row.region_nm;
return str;
}
// 주소 render
function fn_addr_render(data, type, row) {
var str = "";
if (row.address2b == null) {
str = row.address2 + " " + row.address3;
} else {
str = row.address2b + " " + row.address3;
}
return str;
}
function fn_tm_render(data, type, row) {
var str = "";
if (row.proc_tm == null) {
str = row.stat_39_tm;
} else {
str = row.proc_tm;
}
return str;
}
// 엑셀 다운로드
function downloadExcel(data) {
const ws = XLSX.utils.json_to_sheet(data);
ws['!cols'] = [
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
{ wpx: 100 },
];
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
const blob = new Blob([wbout], { type: 'application/octet-stream' });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = "모바일_추가_서류" + getDateTimeString() + ".xlsx";
link.click();
URL.revokeObjectURL(link.href);
}
function getDateTimeString() {
const d = new Date();
const yyyy = d.getFullYear();
const mm = String(d.getMonth() + 1).padStart(2, '0');
const dd = String(d.getDate()).padStart(2, '0');
const hh = String(d.getHours()).padStart(2, '0');
const mi = String(d.getMinutes()).padStart(2, '0');
const ss = String(d.getSeconds()).padStart(2, '0');
return `${yyyy}${mm}${dd}${hh}${mi}${ss}`;
}
function extractCode(code) {
var codeArr = new Array();
if (codes.length) {
for (var i = 0; i < codes.length; i++) {
if (code === codes[i].category) {
codeArr.push(codes[i]);
}
}
}
return codeArr;
}
// 이미지 프리뷰
function fn_preview(src) {
const $img = $('#imgPreview');
// 이미지 표시
$img.attr('src', src).show();
$('#previewTitle').text('이미지 미리보기');
const modal = new bootstrap.Modal(document.getElementById('previewModal'));
modal.show();
}
// 코드명 조회
function getCodeName(val, type) {
var str = "";
if (codeArr.length > 0) {
for (var i = 0; i < codeArr.length; i++) {
if (type === codeArr[i].category) {
if (val === codeArr[i].cd) {
str = codeArr[i].cd_nm;
}
}
}
}
return str;
}
</script>
<?= $this->endSection() ?>