dbmsv2 init...1
This commit is contained in:
parent
bfad1960ba
commit
3f56a6235f
@ -374,3 +374,9 @@ define(
|
||||
'gdidc' => $_ENV['PREFIX_Client'] ?? $_SERVER['PREFIX_Client'] ?? 'GIC',
|
||||
],
|
||||
);
|
||||
//서머 쳩렾 아이템 정의
|
||||
define("SERVER_LINK_ITEMS", [
|
||||
'IP' => "IP정보",
|
||||
'CS' => "CS정보",
|
||||
'PART' => "부품정보",
|
||||
]);
|
||||
|
||||
@ -130,34 +130,36 @@ abstract class CommonController extends BaseController
|
||||
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 초기화
|
||||
$this->setAction($action);
|
||||
switch ($action) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
$this->_control['field_rules'] = [];
|
||||
foreach ($fields as $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'] = [];
|
||||
foreach ($this->getFilterFields() as $field) {
|
||||
foreach ($filters as $field) {
|
||||
$this->_control['filter_optons'][$field] = [];
|
||||
foreach ($this->getService()->getFormFieldOption($field) as $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
|
||||
{
|
||||
@ -347,7 +349,7 @@ abstract class CommonController extends BaseController
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//각 Field 초기화:조건항목 Field는 한개만 존재하므로 Field와 Rule을 정의
|
||||
$this->initAction(__FUNCTION__, ['formFields' => [$field]]);
|
||||
$this->initAction(__FUNCTION__, ['fields' => [$field], 'filters' => [$field]]);
|
||||
//입력값정의
|
||||
$formDatas = [$field => $this->request->getVar($field)];
|
||||
//기존 Entity 가져오기
|
||||
@ -404,7 +406,7 @@ abstract class CommonController extends BaseController
|
||||
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
//각 Field 초기화: 일괄작업은 선택된 조건항목 Field만 존재하므로 Field와 Rule을 정의
|
||||
$this->initAction(__FUNCTION__, ['formFields' => [$selectedFields]]);
|
||||
$this->initAction(__FUNCTION__, ['fields' => [['fields' => $selectedFields, 'filters' => $selectedFields]]]);
|
||||
$this->batchjob_process($uids, $formDatas);
|
||||
$this->_db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
"settings": {
|
||||
"width": 3000,
|
||||
"height": 3000,
|
||||
"scrollTop": -1450.0603,
|
||||
"scrollLeft": -1122,
|
||||
"scrollTop": -1410.0603,
|
||||
"scrollLeft": -924.0128,
|
||||
"zoomLevel": 1,
|
||||
"show": 511,
|
||||
"database": 4,
|
||||
@ -1636,15 +1636,15 @@
|
||||
"kDyVwSigBBYnp_F9MyRAw"
|
||||
],
|
||||
"ui": {
|
||||
"x": 1543.4598,
|
||||
"y": 1910.3055,
|
||||
"x": 1541.4598,
|
||||
"y": 1937.3055,
|
||||
"zIndex": 4514,
|
||||
"widthName": 101,
|
||||
"widthComment": 165,
|
||||
"color": ""
|
||||
},
|
||||
"meta": {
|
||||
"updateAt": 1755664896195,
|
||||
"updateAt": 1755764604813,
|
||||
"createAt": 1755476453282
|
||||
}
|
||||
},
|
||||
@ -15517,8 +15517,8 @@
|
||||
"columnIds": [
|
||||
"l2g7xess8DY86_ZOm7Ca1"
|
||||
],
|
||||
"x": 2138.4598,
|
||||
"y": 2046.3055,
|
||||
"x": 2136.4598,
|
||||
"y": 2073.3055,
|
||||
"direction": 2
|
||||
},
|
||||
"meta": {
|
||||
@ -16021,8 +16021,8 @@
|
||||
"columnIds": [
|
||||
"IbWdZlEEF70bGqUDkU5ub"
|
||||
],
|
||||
"x": 1543.4598,
|
||||
"y": 2046.3055,
|
||||
"x": 1541.4598,
|
||||
"y": 2073.3055,
|
||||
"direction": 1
|
||||
},
|
||||
"meta": {
|
||||
@ -16133,8 +16133,8 @@
|
||||
"columnIds": [
|
||||
"eu4eV0U7BRaP7Zk-oyBhV"
|
||||
],
|
||||
"x": 1840.9598,
|
||||
"y": 1910.3055,
|
||||
"x": 1838.9598,
|
||||
"y": 1937.3055,
|
||||
"direction": 4
|
||||
},
|
||||
"meta": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -33,11 +33,18 @@ class ServerHelper extends EquipmentHelper
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' calender' : 'calender';
|
||||
$form = form_input($field, $value ?? "", $extras);
|
||||
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';
|
||||
$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);
|
||||
$form .= " " . form_dropdown("{$field}_cnt", $viewDatas['partinfo_cnt_range'], $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;
|
||||
case 'ipinfo_uid':
|
||||
case 'csinfo_uid':
|
||||
@ -53,12 +60,15 @@ class ServerHelper extends EquipmentHelper
|
||||
public function getListFilter(string $field, mixed $value, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'cs_uid':
|
||||
case 'csinfo_uid':
|
||||
case 'ipinfo_uid':
|
||||
$extras['class'] = array_key_exists('class', $extras) ? $extras['class'] . ' select-field' : 'select-field';
|
||||
$form = parent::getListFilter($field, $value, $viewDatas, $extras);
|
||||
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';
|
||||
$form = form_dropdown($field, $this->getPartFormOption($field, $viewDatas), $value, $extras);
|
||||
break;
|
||||
|
||||
@ -18,6 +18,10 @@ return [
|
||||
"partinfo_uid" => "부품정보",
|
||||
"ipinfo_uid" => "IP정보",
|
||||
"csinfo_uid" => "CS정보",
|
||||
'partinfo_cpu_uid' => "CPU",
|
||||
'partinfo_ram_uid' => "RAM",
|
||||
'partinfo_disk_uid' => "DISK",
|
||||
'partinfo_software_uid' => "소프트웨어",
|
||||
],
|
||||
"TITLE" => [
|
||||
'HP DL360 Gen6' => "HP DL360 Gen6",
|
||||
|
||||
@ -19,14 +19,6 @@ class LocalService extends AuthService
|
||||
"passwd",
|
||||
];
|
||||
}
|
||||
public function getFilterFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
public function getBatchJobFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function login(array $formDatas): UserEntity
|
||||
{
|
||||
|
||||
@ -16,13 +16,11 @@ abstract class CommonService
|
||||
$this->_model = $model;
|
||||
}
|
||||
abstract public function getFormFields(): array;
|
||||
abstract public function getFilterFields(): array;
|
||||
abstract public function getBatchJobFields(): array;
|
||||
public function getIndexFields(): array
|
||||
public function getViewFields(): array
|
||||
{
|
||||
return $this->getFormFields();
|
||||
}
|
||||
public function getViewFields(): array
|
||||
public function getIndexFields(): array
|
||||
{
|
||||
return $this->getFormFields();
|
||||
}
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
namespace App\Services\Equipment;
|
||||
|
||||
use App\Entities\Equipment\PartEntity;
|
||||
use App\Entities\Equipment\IPEntity;
|
||||
use App\Entities\Equipment\CSEntity;
|
||||
use App\Models\Equipment\ServerModel;
|
||||
use App\Services\Equipment\EquipmentService;
|
||||
|
||||
@ -21,27 +19,49 @@ class ServerService extends EquipmentService
|
||||
public function getFormFields(): array
|
||||
{
|
||||
return [
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"partinfo_uid",
|
||||
"price",
|
||||
"manufactur_at",
|
||||
"format_at",
|
||||
"status",
|
||||
'fields' => [
|
||||
"code",
|
||||
"type",
|
||||
"title",
|
||||
"partinfo_cpu_uid",
|
||||
"partinfo_ram_uid",
|
||||
"partinfo_disk_uid",
|
||||
"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
|
||||
{
|
||||
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
|
||||
{
|
||||
@ -69,8 +89,29 @@ class ServerService extends EquipmentService
|
||||
public function getFormFieldOption(string $field, array $options = []): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'partinfo_uid':
|
||||
$options = $this->getPartService()->getEntities(['status' => PartEntity::STATUS_AVAILABLE]);
|
||||
case 'partinfo_cpu_uid':
|
||||
$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;
|
||||
case 'ipinfo_uid': //수정때문에 전체가 필요
|
||||
// $options = $this->getIPService()->getEntities(['status' => IPEntity::STATUS_AVAILABLE]);
|
||||
|
||||
@ -47,8 +47,8 @@
|
||||
<tr>
|
||||
<td colspan="<?= count($viewDatas['control']['index_fields']) + 2 ?>">
|
||||
<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 (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): ?><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): ?><td class="text-nowrap"><?= $viewDatas['helper']->getFieldView($item_type, $entity->$item_type, $viewDatas) ?></td><?php endforeach ?></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user