시스템관리 페이지 추가
This commit is contained in:
@@ -19,7 +19,7 @@ abstract class BaseController extends Controller
|
||||
|
||||
// 메뉴 전역 로딩
|
||||
$menuModel = new MenuModel();
|
||||
$menus = $menuModel->getMenuList();
|
||||
$menus = $menuModel->getMenuList(session('usr_level'));
|
||||
$this->data['menus'] = $menus["mainMenu"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,4 @@ class Home extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
160
app/Controllers/manage/Areas.php
Normal file
160
app/Controllers/manage/Areas.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
namespace App\Controllers\manage;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\manage\AreasModel;
|
||||
|
||||
class Areas extends BaseController
|
||||
{
|
||||
private $areaModel;
|
||||
public function __construct()
|
||||
{
|
||||
$this->areaModel = new AreasModel();
|
||||
}
|
||||
|
||||
// 지역코드조회
|
||||
public function getAreaList()
|
||||
{
|
||||
$sido = $this->request->getPost('srcSido');
|
||||
$gugun = $this->request->getPost('srcGugun');
|
||||
|
||||
|
||||
$datas = $this->areaModel->getAreaList($sido, $gugun);
|
||||
|
||||
return $this->response->setJson($datas);
|
||||
|
||||
}
|
||||
|
||||
public function lists(): string
|
||||
{
|
||||
|
||||
$sido = $this->areaModel->getAreaList();
|
||||
$bonbu = $this->areaModel->getBonbuList();
|
||||
$team = $this->areaModel->getTeamList();
|
||||
$user = $this->areaModel->getUserList();
|
||||
|
||||
return view("pages/manage/areas/lists", [
|
||||
'sido' => $sido,
|
||||
'bonbu' => $bonbu,
|
||||
'team' => $team,
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function getSvcArea()
|
||||
{
|
||||
$start = (int) $this->request->getGet('start') ?: 0;
|
||||
$end = (int) $this->request->getGet('length') ?: 10;
|
||||
|
||||
$srcSido = $this->request->getGet('srcSido'); // 시도
|
||||
$srcGugun = $this->request->getGet('srcGugun'); // 시도
|
||||
$srcDong = $this->request->getGet('srcDong'); // 시도
|
||||
|
||||
$region = "";
|
||||
if (!empty($srcDong)) {
|
||||
$region = substr($srcDong, 0, 8);
|
||||
} else if (!empty($srcGugun)) {
|
||||
$region = substr($srcGugun, 0, 5);
|
||||
if (substr($region, 4) == "0") {
|
||||
$region = substr($srcGugun, 0, 4);
|
||||
}
|
||||
} else if (!empty($srcSido)) {
|
||||
$region = substr($srcSido, 0, 2);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'region' => $region, // 지역코드
|
||||
'srcUserbonbu' => $this->request->getGet('srcUserbonbu'), // 본부
|
||||
'srcUserteam' => $this->request->getGet('srcUserteam'), // 팀
|
||||
'positionYn' => $this->request->getGet('positionYn'), // 지정유무
|
||||
];
|
||||
|
||||
$totalCount = $this->areaModel->getTotalCount($data);
|
||||
$datas = $this->areaModel->getSvcArea($start, $end, $data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'recordsTotal' => $totalCount,
|
||||
'recordsFiltered' => $totalCount,
|
||||
'data' => $datas,
|
||||
]);
|
||||
}
|
||||
|
||||
// 지역관리정보저장
|
||||
public function saveRegion()
|
||||
{
|
||||
try {
|
||||
|
||||
$json = $this->request->getJSON(true); // true = 배열로 반환
|
||||
|
||||
if (!$json) {
|
||||
return $this->response->setJSON([
|
||||
'status' => 'error',
|
||||
'msg' => '데이터 누락'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
foreach ($json as $row) {
|
||||
$regioncd = $row['region_cd'];
|
||||
$bonbu = $row['bonbu'];
|
||||
$team = $row['team'];
|
||||
$user = $row['user'];
|
||||
|
||||
// UPDATE region_codes
|
||||
$this->areaModel->saveRegion($regioncd, $team, $user);
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function saveAllRegion()
|
||||
{
|
||||
try {
|
||||
|
||||
$json = $this->request->getJSON(true); // true = 배열로 반환
|
||||
|
||||
if (!$json) {
|
||||
return $this->response->setJSON([
|
||||
'status' => 'error',
|
||||
'msg' => '데이터 누락'
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($json as $row) {
|
||||
$regioncd = $row['region_cd'];
|
||||
$bonbu = $row['bonbu'];
|
||||
$team = $row['team'];
|
||||
$user = $row['user'];
|
||||
|
||||
// UPDATE region_codes
|
||||
$this->areaModel->saveRegion($regioncd, $team, $user);
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ class Menu extends BaseController
|
||||
$params = [];
|
||||
|
||||
|
||||
|
||||
$total = $this->menuModel->getTotalCount();
|
||||
$datas = $this->menuModel->getMenuList($params);
|
||||
|
||||
@@ -133,93 +132,37 @@ class Menu extends BaseController
|
||||
}
|
||||
|
||||
|
||||
// private function buildTree(array $items, $parentId = 'ROOT', int $level = 0): array
|
||||
// {
|
||||
// $branch = [];
|
||||
// 메뉴정보저장
|
||||
public function saveMenu()
|
||||
{
|
||||
try {
|
||||
|
||||
// $lft = 1;
|
||||
// foreach ($items as $k => $item) {
|
||||
$data = [
|
||||
'mnu_pid' => $this->request->getPost('mnu_pid'),
|
||||
'mnu_id' => $this->request->getPost('mnu_id'),
|
||||
'mnu_nm' => $this->request->getPost('mnu_nm'),
|
||||
'mnu_url' => $this->request->getPost('mnu_url'),
|
||||
'mnu_tp' => $this->request->getPost('mnu_tp'),
|
||||
'view_odr' => $this->request->getPost('view_odr'),
|
||||
'use_yn' => $this->request->getPost('use_yn'),
|
||||
'usr_sq' => session('usr_sq'),
|
||||
];
|
||||
|
||||
// // 현재 parentId의 자식인지 확인
|
||||
// if ($item['mnu_pid'] === $parentId) {
|
||||
|
||||
// $item['lft'] = $lft;
|
||||
// INSERT UPDATE menu
|
||||
$this->menuModel->saveMenu($data);
|
||||
|
||||
// if ($item['mnu_tp'] === 'R') {
|
||||
// $item['isLeaf'] = false;
|
||||
// $item['rgt'] = 1 + (63 * 2 + 1);
|
||||
// } else if ($item['mnu_tp'] === 'D') {
|
||||
// $item['level'] = 1;
|
||||
// $item['menu_tp'] = 'D';
|
||||
// $item['menu_tp_nm'] = '디렉토리';
|
||||
// $item['iconCls'] = 'ui-icon-folder-open';
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
// $subCnt = 0;
|
||||
// foreach ($items as $item2):
|
||||
|
||||
// if (strpos($item2['mnu_id'], $item['mnu_id'] . '.') === 0) {
|
||||
// $subCnt++;
|
||||
// }
|
||||
|
||||
// endforeach;
|
||||
|
||||
// $item['rgt'] = $lft + ($subCnt * 2) + 1;
|
||||
|
||||
// if ($subCnt === 0) {
|
||||
// $item['isLeaf'] = true;
|
||||
// } else {
|
||||
// $item['isLeaf'] = false;
|
||||
// }
|
||||
|
||||
// } else if ($item['mnu_tp'] == 'P') {
|
||||
// $item['level'] = 2;
|
||||
// $item['menu_tp'] = 'R';
|
||||
// $item['menu_tp_nm'] = '화면';
|
||||
// $item['iconCls'] = 'ui-icon-document';
|
||||
// }
|
||||
// // else {
|
||||
// // // 예: 루트 R 같은 경우
|
||||
// // $item['menu_tp'] = $item['mnu_tp'];
|
||||
// // $item['menu_tp_nm'] = ($item['mnu_tp'] === 'R') ? '루트' : '메뉴';
|
||||
// // $item['iconCls'] = 'ui-icon-home';
|
||||
// // }
|
||||
|
||||
// // 자식 찾기 (⚠️ 여기 반드시 $this->buildTree)
|
||||
// // $children = $this->buildTree($items, $item['mnu_id'], $level + 1);
|
||||
|
||||
// // if (!empty($children)) {
|
||||
// // // 자식 정렬 (view_odr → mnu_id 순)
|
||||
// // usort($children, function ($a, $b) {
|
||||
// // $ao = $a['view_odr'] ?? 0;
|
||||
// // $bo = $b['view_odr'] ?? 0;
|
||||
|
||||
// // if ($ao == $bo) {
|
||||
// // return strcmp($a['mnu_id'], $b['mnu_id']);
|
||||
// // }
|
||||
// // return $ao <=> $bo;
|
||||
// // });
|
||||
|
||||
// // $item['children'] = $children;
|
||||
// // }
|
||||
|
||||
// $branch[] = $item;
|
||||
// }
|
||||
|
||||
// $lft++;
|
||||
// }
|
||||
|
||||
// // 현재 레벨도 정렬 (view_odr → mnu_id 순)
|
||||
// usort($branch, function ($a, $b) {
|
||||
// $ao = $a['view_odr'] ?? 0;
|
||||
// $bo = $b['view_odr'] ?? 0;
|
||||
|
||||
// if ($ao == $bo) {
|
||||
// return strcmp($a['mnu_id'], $b['mnu_id']);
|
||||
// }
|
||||
// return $ao <=> $bo;
|
||||
// });
|
||||
|
||||
// return $branch;
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
104
app/Controllers/manage/Permit.php
Normal file
104
app/Controllers/manage/Permit.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
namespace App\Controllers\manage;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\manage\PermitModel;
|
||||
|
||||
class Permit extends BaseController
|
||||
{
|
||||
|
||||
private $permitModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->permitModel = new PermitModel();
|
||||
}
|
||||
|
||||
public function lists(): string
|
||||
{
|
||||
$usrLevel = $this->permitModel->getUsrLevel();
|
||||
|
||||
return view("pages/manage/permit/lists", [
|
||||
'usrLevel' => $usrLevel,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
// 메뉴권한목록조회
|
||||
public function getMenuAuthList()
|
||||
{
|
||||
$usrLevel = $this->request->getGet('usr_level');
|
||||
|
||||
$lists = $this->permitModel->getMenuAuthList($usrLevel);
|
||||
|
||||
if (!empty($lists)) {
|
||||
foreach ($lists as $k => $d) {
|
||||
$state = [];
|
||||
|
||||
if ($d['state'] === "selected") {
|
||||
$state['selected'] = true;
|
||||
$lists[$k]['state'] = $state;
|
||||
} else {
|
||||
$state['selected'] = false;
|
||||
$lists[$k]['state'] = $state;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response->setJSON($lists);
|
||||
}
|
||||
|
||||
|
||||
// 메뉴권한정보저장
|
||||
public function saveMenuAuth()
|
||||
{
|
||||
try {
|
||||
$usrLevel = $this->request->getPost('usr_level');
|
||||
|
||||
if (empty($usrLevel)) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '1',
|
||||
'msg' => '그룹 데이터 누락'
|
||||
]);
|
||||
}
|
||||
|
||||
$menuArr = explode(',', $this->request->getPost('mnu_cd'));
|
||||
if (empty($menuArr)) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '1',
|
||||
'msg' => '메뉴 데이터 누락'
|
||||
]);
|
||||
} else {
|
||||
|
||||
// DELETE menu_perms
|
||||
$this->permitModel->deleteMenuPermit($usrLevel);
|
||||
|
||||
foreach ($menuArr as $m) {
|
||||
|
||||
$data = [
|
||||
'mnuId' => $m,
|
||||
'usrLevel' => $usrLevel,
|
||||
'usrSq' => session('usr_sq'),
|
||||
];
|
||||
|
||||
// INSERT menu_perms
|
||||
$this->permitModel->saveMenuAuth($data);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,11 @@ class Phone extends BaseController
|
||||
$end = (int) $this->request->getGet('length') ?: 10;
|
||||
|
||||
$data = [
|
||||
'srchTxt' => $this->request->getGet('search[value]') ?: '',
|
||||
'cpid' => $this->request->getGet('cpid') ?: '',
|
||||
's_date' => $this->request->getGet('s_date') ?: '',
|
||||
'e_date' => $this->request->getGet('e_date') ?: '',
|
||||
'phone' => $this->request->getGet('phone') ?: '',
|
||||
'useYn' => $this->request->getGet('useYn') ?: '',
|
||||
];
|
||||
|
||||
$totalCount = $this->phoneModel->getTotalCount($data);
|
||||
@@ -101,6 +105,33 @@ class Phone extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
// 엑셀다운로드
|
||||
public function excel()
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$data = [
|
||||
'cpid' => $this->request->getGet('cpid') ?: '',
|
||||
's_date' => $this->request->getGet('s_date') ?: '',
|
||||
'e_date' => $this->request->getGet('e_date') ?: '',
|
||||
'phone' => $this->request->getGet('phone') ?: '',
|
||||
'useYn' => $this->request->getGet('useYn') ?: '',
|
||||
];
|
||||
|
||||
$datas = $this->phoneModel->getExcelPhoneList($data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'data' => $datas,
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$e->getPrevious()->getTraceAsString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 연락처 유효성검사
|
||||
private function validPhone($phone)
|
||||
|
||||
120
app/Controllers/manage/Scomplex.php
Normal file
120
app/Controllers/manage/Scomplex.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace App\Controllers\manage;
|
||||
|
||||
use App\Controllers\BASeController;
|
||||
use App\Models\manage\ScomplexModel;
|
||||
|
||||
class Scomplex extends BASeController
|
||||
{
|
||||
private $model;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new ScomplexModel();
|
||||
}
|
||||
|
||||
public function lists(): string
|
||||
{
|
||||
$codes = $this->model->getCodeList();
|
||||
|
||||
return view("pages/manage/scomplex/lists", ['code' => $codes,]);
|
||||
}
|
||||
|
||||
|
||||
public function getScomplexList()
|
||||
{
|
||||
$start = (int) $this->request->getGet('start') ?: 0;
|
||||
$end = (int) $this->request->getGet('length') ?: 10;
|
||||
|
||||
$data = [
|
||||
'name' => $this->request->getGet('name'), // 단지명
|
||||
'apporval_date' => $this->request->getGet('apporval_date'), // 사용승인일
|
||||
'end_date' => $this->request->getGet('end_date'), // 승인종료일
|
||||
'code' => $this->request->getGet('code'), // 단지코드
|
||||
'cd' => $this->request->getGet('cd'), // 매물종류
|
||||
'address' => $this->request->getGet('address'), // 주소
|
||||
];
|
||||
|
||||
$totalCount = $this->model->getTotalCount($data);
|
||||
$datas = $this->model->getScomplexList($start, $end, $data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'recordsTotal' => $totalCount,
|
||||
'recordsFiltered' => $totalCount,
|
||||
'data' => $datas,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
// 특이단지 정보 저장
|
||||
public function saveScomplex()
|
||||
{
|
||||
try {
|
||||
|
||||
$type = $this->request->getPost('type');
|
||||
|
||||
$data = [
|
||||
$this->request->getPost('sm_name'),
|
||||
$this->request->getPost('sm_code'),
|
||||
$this->request->getPost('sm_address'),
|
||||
$this->request->getPost('codes'),
|
||||
$this->request->getPost('sm_apporval_date'),
|
||||
$this->request->getPost('sm_end_date'),
|
||||
$this->request->getPost('sm_memo'),
|
||||
session('usr_sq'),
|
||||
];
|
||||
|
||||
|
||||
if ($type === "create") {
|
||||
// INSERT scomplex_manage
|
||||
$this->model->insertScomplex($data);
|
||||
|
||||
} else if ($type === "update") {
|
||||
array_push($data, $this->request->getPost('sm_seq'));
|
||||
|
||||
// UPDATE scomplex_manage
|
||||
$this->model->updateScomplex($data);
|
||||
}
|
||||
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// 엑셀다운로드
|
||||
public function excel()
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$data = [
|
||||
'name' => $this->request->getGet('name'), // 단지명
|
||||
'apporval_date' => $this->request->getGet('apporval_date'), // 사용승인일
|
||||
'end_date' => $this->request->getGet('end_date'), // 승인종료일
|
||||
'code' => $this->request->getGet('code'), // 단지코드
|
||||
'cd' => $this->request->getGet('cd'), // 매물종류
|
||||
'address' => $this->request->getGet('address'), // 주소
|
||||
];
|
||||
|
||||
$datas = $this->model->getExcelScomplexList($data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'data' => $datas,
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$e->getPrevious()->getTraceAsString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user