dbmsv2 init...1

This commit is contained in:
choi.jh 2025-08-21 18:57:58 +09:00
parent bfad1960ba
commit 3f56a6235f
10 changed files with 117 additions and 64 deletions

View File

@ -374,3 +374,9 @@ define(
'gdidc' => $_ENV['PREFIX_Client'] ?? $_SERVER['PREFIX_Client'] ?? 'GIC', 'gdidc' => $_ENV['PREFIX_Client'] ?? $_SERVER['PREFIX_Client'] ?? 'GIC',
], ],
); );
//서머 쳩렾 아이템 정의
define("SERVER_LINK_ITEMS", [
'IP' => "IP정보",
'CS' => "CS정보",
'PART' => "부품정보",
]);

View File

@ -130,34 +130,36 @@ abstract class CommonController extends BaseController
return array_key_exists($field, $this->_control['default_values']) ? $this->_control['default_values'][$field] : null; return array_key_exists($field, $this->_control['default_values']) ? $this->_control['default_values'][$field] : null;
} }
final protected function initAction(string $action, $fields = []): void final protected function initAction(string $action, $formFields = []): void
{ //각 Field 초기화 { //각 Field 초기화
$this->setAction($action); $this->setAction($action);
switch ($action) { switch ($action) {
case 'view': case 'view':
$fields = $this->_control['view_fields'] = array_key_exists('viewFields', $fields) ? $fields['viewFields'] : $this->getService()->getViewFields(); $fields = $this->_control['view_fields'] = array_key_exists('fields', $formFields) ? $formFields['fields'] : $this->getService()->getViewFields()['fields'] ?? [];
$filters = $this->_control['filter_fields'] = array_key_exists('filters', $formFields) ? $formFields['filters'] : $this->getService()->getViewFields()['filters'] ?? [];
break; break;
case 'index': case 'index':
$fields = $this->_control['index_fields'] = array_key_exists('indexFields', $fields) ? $fields['indexFields'] : $this->getService()->getIndexFields(); $fields = $this->_control['index_fields'] = array_key_exists('fields', $formFields) ? $formFields['fields'] : $this->getService()->getIndexFields()['fields'] ?? [];
$filters = $this->_control['filter_fields'] = array_key_exists('filters', $formFields) ? $formFields['filters'] : $this->getService()->getIndexFields()['filters'] ?? [];
$this->_control['batchjob_fields'] = array_key_exists('batchjobFields', $formFields) ? $formFields['batchjobFields'] : $this->getService()->getIndexFields()['batchjob_fields'] ?? [];
$this->_control['batchjob_buttions'] = array_key_exists('batchjobButtions', $formFields) ? $formFields['batchjobFields'] : $this->getService()->getIndexFields()['batchjob_buttions'] ?? [];
break; break;
default: default:
$fields = $this->_control['form_fields'] = array_key_exists('formFields', $fields) ? $fields['formFields'] : $this->getService()->getFormFields(); $fields = $this->_control['form_fields'] = array_key_exists('fields', $formFields) ? $formFields['fields'] : $this->getService()->getFormFields()['fields'] ?? [];
$filters = $this->_control['filter_fields'] = array_key_exists('filters', $formFields) ? $formFields['filters'] : $this->getService()->getFormFields()['filters'] ?? [];
break; break;
} }
$this->_control['field_rules'] = []; $this->_control['field_rules'] = [];
foreach ($fields as $field) { foreach ($fields as $field) {
$this->_control['field_rules'][$field] = $this->getService()->getFormFieldRule($action, $field); $this->_control['field_rules'][$field] = $this->getService()->getFormFieldRule($action, $field);
} }
$this->_control['filter_fields'] = array_key_exists('filterFields', $fields) ? $fields['filterFields'] : $this->getService()->getFilterFields();
$this->_control['filter_optons'] = []; $this->_control['filter_optons'] = [];
foreach ($this->getFilterFields() as $field) { foreach ($filters as $field) {
$this->_control['filter_optons'][$field] = []; $this->_control['filter_optons'][$field] = [];
foreach ($this->getService()->getFormFieldOption($field) as $option) { foreach ($this->getService()->getFormFieldOption($field) as $option) {
$this->_control['filter_optons'][$field][$option->getPK()] = $option; $this->_control['filter_optons'][$field][$option->getPK()] = $option;
} }
} }
$this->_control['batchjob_fields'] = array_key_exists('batchjobFields', $fields) ? $fields['batchjobFields'] : $this->getService()->getBatchJobFields();
$this->_control['batchjob_buttions'] = array_key_exists('batchjobButtions', $fields) ? $fields['batchjobFields'] : $this->getService()->getBatchJobButtons();
} }
protected function setValidation(Validation $validation, string $field, string $rule): Validation protected function setValidation(Validation $validation, string $field, string $rule): Validation
{ {
@ -347,7 +349,7 @@ abstract class CommonController extends BaseController
$this->_db->transStart(); $this->_db->transStart();
try { try {
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의 //각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
$this->initAction(__FUNCTION__, ['formFields' => [$field]]); $this->initAction(__FUNCTION__, ['fields' => [$field], 'filters' => [$field]]);
//입력값정의 //입력값정의
$formDatas = [$field => $this->request->getVar($field)]; $formDatas = [$field => $this->request->getVar($field)];
//기존 Entity 가져오기 //기존 Entity 가져오기
@ -404,7 +406,7 @@ abstract class CommonController extends BaseController
throw new \Exception("적용할 리스트을 선택하셔야합니다."); throw new \Exception("적용할 리스트을 선택하셔야합니다.");
} }
//각 Field 초기화: 일괄작업은 선택된 조건항목 Field만 존재하므로 Field와 Rule을 정의 //각 Field 초기화: 일괄작업은 선택된 조건항목 Field만 존재하므로 Field와 Rule을 정의
$this->initAction(__FUNCTION__, ['formFields' => [$selectedFields]]); $this->initAction(__FUNCTION__, ['fields' => [['fields' => $selectedFields, 'filters' => $selectedFields]]]);
$this->batchjob_process($uids, $formDatas); $this->batchjob_process($uids, $formDatas);
$this->_db->transCommit(); $this->_db->transCommit();
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities))); LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));

View File

@ -4,8 +4,8 @@
"settings": { "settings": {
"width": 3000, "width": 3000,
"height": 3000, "height": 3000,
"scrollTop": -1450.0603, "scrollTop": -1410.0603,
"scrollLeft": -1122, "scrollLeft": -924.0128,
"zoomLevel": 1, "zoomLevel": 1,
"show": 511, "show": 511,
"database": 4, "database": 4,
@ -1636,15 +1636,15 @@
"kDyVwSigBBYnp_F9MyRAw" "kDyVwSigBBYnp_F9MyRAw"
], ],
"ui": { "ui": {
"x": 1543.4598, "x": 1541.4598,
"y": 1910.3055, "y": 1937.3055,
"zIndex": 4514, "zIndex": 4514,
"widthName": 101, "widthName": 101,
"widthComment": 165, "widthComment": 165,
"color": "" "color": ""
}, },
"meta": { "meta": {
"updateAt": 1755664896195, "updateAt": 1755764604813,
"createAt": 1755476453282 "createAt": 1755476453282
} }
}, },
@ -15517,8 +15517,8 @@
"columnIds": [ "columnIds": [
"l2g7xess8DY86_ZOm7Ca1" "l2g7xess8DY86_ZOm7Ca1"
], ],
"x": 2138.4598, "x": 2136.4598,
"y": 2046.3055, "y": 2073.3055,
"direction": 2 "direction": 2
}, },
"meta": { "meta": {
@ -16021,8 +16021,8 @@
"columnIds": [ "columnIds": [
"IbWdZlEEF70bGqUDkU5ub" "IbWdZlEEF70bGqUDkU5ub"
], ],
"x": 1543.4598, "x": 1541.4598,
"y": 2046.3055, "y": 2073.3055,
"direction": 1 "direction": 1
}, },
"meta": { "meta": {
@ -16133,8 +16133,8 @@
"columnIds": [ "columnIds": [
"eu4eV0U7BRaP7Zk-oyBhV" "eu4eV0U7BRaP7Zk-oyBhV"
], ],
"x": 1840.9598, "x": 1838.9598,
"y": 1910.3055, "y": 1937.3055,
"direction": 4 "direction": 4
}, },
"meta": { "meta": {

File diff suppressed because one or more lines are too long

View File

@ -33,11 +33,18 @@ class ServerHelper extends EquipmentHelper
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender'; $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
$form = form_input($field, $value ?? "", $extras); $form = form_input($field, $value ?? "", $extras);
break; break;
case 'partinfo_uid': case 'partinfo_cpu_uid':
case 'partinfo_ram_uid':
case 'partinfo_software_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras); $form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras);
$form .= " 갯수 " . form_dropdown("{$field}_cnt", $viewDatas['partinfo_cnt_range'], $value ?? 1); $form .= " " . form_dropdown("{$field}_cnt", $viewDatas['partinfo_cnt_range'], $value ?? 1) . "";
$form .= " 옵션 " . form_dropdown("{$field}_extra", $viewDatas['partinfo_extra_options'], $value ?? 1); break;
case 'partinfo_disk_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras);
$form .= " " . form_dropdown("{$field}_cnt", $viewDatas['partinfo_cnt_range'], $value ?? 1) . "";
$form .= form_dropdown("{$field}_extra", $viewDatas['partinfo_extra_options'], $value ?? 1);
break; break;
case 'ipinfo_uid': case 'ipinfo_uid':
case 'csinfo_uid': case 'csinfo_uid':
@ -53,12 +60,15 @@ class ServerHelper extends EquipmentHelper
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
{ {
switch ($field) { switch ($field) {
case 'cs_uid': case 'csinfo_uid':
case 'ipinfo_uid': case 'ipinfo_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = parent::getListFilter($field, $value, $viewDatas, $extras); $form = parent::getListFilter($field, $value, $viewDatas, $extras);
break; break;
case 'partinfo_uid': case 'partinfo_cpu_uid':
case 'partinfo_ram_uid':
case 'partinfo_software_uid':
case 'partinfo_disk_uid':
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field'; $extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
$form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras); $form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras);
break; break;

View File

@ -18,6 +18,10 @@ return [
"partinfo_uid" => "부품정보", "partinfo_uid" => "부품정보",
"ipinfo_uid" => "IP정보", "ipinfo_uid" => "IP정보",
"csinfo_uid" => "CS정보", "csinfo_uid" => "CS정보",
'partinfo_cpu_uid' => "CPU",
'partinfo_ram_uid' => "RAM",
'partinfo_disk_uid' => "DISK",
'partinfo_software_uid' => "소프트웨어",
], ],
"TITLE" => [ "TITLE" => [
'HP DL360 Gen6' => "HP DL360 Gen6", 'HP DL360 Gen6' => "HP DL360 Gen6",

View File

@ -19,14 +19,6 @@ class LocalService extends AuthService
"passwd", "passwd",
]; ];
} }
public function getFilterFields(): array
{
return [];
}
public function getBatchJobFields(): array
{
return [];
}
public function login(array $formDatas): UserEntity public function login(array $formDatas): UserEntity
{ {

View File

@ -16,13 +16,11 @@ abstract class CommonService
$this->_model = $model; $this->_model = $model;
} }
abstract public function getFormFields(): array; abstract public function getFormFields(): array;
abstract public function getFilterFields(): array; public function getViewFields(): array
abstract public function getBatchJobFields(): array;
public function getIndexFields(): array
{ {
return $this->getFormFields(); return $this->getFormFields();
} }
public function getViewFields(): array public function getIndexFields(): array
{ {
return $this->getFormFields(); return $this->getFormFields();
} }

View File

@ -3,8 +3,6 @@
namespace App\Services\Equipment; namespace App\Services\Equipment;
use App\Entities\Equipment\PartEntity; use App\Entities\Equipment\PartEntity;
use App\Entities\Equipment\IPEntity;
use App\Entities\Equipment\CSEntity;
use App\Models\Equipment\ServerModel; use App\Models\Equipment\ServerModel;
use App\Services\Equipment\EquipmentService; use App\Services\Equipment\EquipmentService;
@ -21,27 +19,49 @@ class ServerService extends EquipmentService
public function getFormFields(): array public function getFormFields(): array
{ {
return [ return [
"code", 'fields' => [
"type", "code",
"title", "type",
"partinfo_uid", "title",
"price", "partinfo_cpu_uid",
"manufactur_at", "partinfo_ram_uid",
"format_at", "partinfo_disk_uid",
"status", "partinfo_software_uid",
"price",
"manufactur_at",
"format_at",
"status",
],
'filters' => [
"clientinfo_uid",
"serviceinfo_uid",
"type",
"title",
"partinfo_cpu_uid",
"partinfo_ram_uid",
"partinfo_disk_uid",
"partinfo_software_uid",
"status"
],
]; ];
} }
public function getFilterFields(): array
{
return ['clientinfo_uid', 'serviceinfo_uid', 'type', 'title', 'status', 'partinfo_uid'];
}
public function getBatchJobFields(): array
{
return ['clientinfo_uid', 'type', 'status'];
}
public function getIndexFields(): array public function getIndexFields(): array
{ {
return ['clientinfo_uid', 'serviceinfo_uid', "type", 'title', 'price', 'total_price', 'manufactur_at', "format_at", 'status']; return [
'fields' => [
'clientinfo_uid',
'serviceinfo_uid',
"type",
'title',
'price',
'total_price',
'manufactur_at',
"format_at",
'status'
],
'filters' => ['clientinfo_uid', 'serviceinfo_uid', 'type', 'status'],
'batchjob_fields' => ['clientinfo_uid', 'type', 'status'],
];
} }
final public function getPartService(): PartService final public function getPartService(): PartService
{ {
@ -69,8 +89,29 @@ class ServerService extends EquipmentService
public function getFormFieldOption(string $field, array $options = []): array public function getFormFieldOption(string $field, array $options = []): array
{ {
switch ($field) { switch ($field) {
case 'partinfo_uid': case 'partinfo_cpu_uid':
$options = $this->getPartService()->getEntities(['status' => PartEntity::STATUS_AVAILABLE]); $options = $this->getPartService()->getEntities([
'type' => 'CPU',
'status' => PartEntity::STATUS_AVAILABLE
]);
break;
case 'partinfo_ram_uid':
$options = $this->getPartService()->getEntities([
'type' => 'RAM',
'status' => PartEntity::STATUS_AVAILABLE
]);
break;
case 'partinfo_disk_uid':
$options = $this->getPartService()->getEntities([
'type' => 'DISK',
'status' => PartEntity::STATUS_AVAILABLE
]);
break;
case 'partinfo_software_uid':
$options = $this->getPartService()->getEntities([
'type' => 'SOFTWARE',
'status' => PartEntity::STATUS_AVAILABLE
]);
break; break;
case 'ipinfo_uid': //수정때문에 전체가 필요 case 'ipinfo_uid': //수정때문에 전체가 필요
// $options = $this->getIPService()->getEntities(['status' => IPEntity::STATUS_AVAILABLE]); // $options = $this->getIPService()->getEntities(['status' => IPEntity::STATUS_AVAILABLE]);

View File

@ -47,8 +47,8 @@
<tr> <tr>
<td colspan="<?= count($viewDatas['control']['index_fields']) + 2 ?>"> <td colspan="<?= count($viewDatas['control']['index_fields']) + 2 ?>">
<table class="table table-bordered table-hover table-striped"> <table class="table table-bordered table-hover table-striped">
<tr><?php foreach (SERVICE_ITEM_TYPES as $item_type => $label): ?><th data-rtc-resizable="<?= $item_type ?>" nowrap><?= $viewDatas['helper']->getFieldLabel($item_type, $label, $viewDatas) ?></th><?php endforeach ?></tr> <tr><?php foreach (SERVER_LINK_ITEMS as $item_type => $label): ?><th data-rtc-resizable="<?= $item_type ?>" nowrap><?= $viewDatas['helper']->getFieldLabel($item_type, $label, $viewDatas) ?></th><?php endforeach ?></tr>
<tr><?php foreach (SERVICE_ITEM_TYPES as $item_type => $label): ?><td class="text-nowrap"><?= $viewDatas['helper']->getFieldView($item_type, $entity->$item_type, $viewDatas) ?></td><?php endforeach ?></tr> <tr><?php foreach (SERVER_LINK_ITEMS as $item_type => $label): ?><td class="text-nowrap"><?= $viewDatas['helper']->getFieldView($item_type, $entity->$item_type, $viewDatas) ?></td><?php endforeach ?></tr>
</table> </table>
</td> </td>
</tr> </tr>