* Change tree params.

This commit is contained in:
caoyanyi
2023-08-02 09:02:29 +08:00
parent 4764625511
commit 2905dfd4eb
+17 -14
View File
@@ -38,22 +38,25 @@ class tree extends wg
foreach($items as $key => $item)
{
$item = (array)$item;
if(!isset($item['text'])) $item['text'] = $item['name'];
if(!isset($item['url'])) $item['url'] = '';
if(!isset($item['type'])) $item['type'] = '';
if($item['type'] == 'product')
if(!isset($item['content']))
{
$item['icon'] = 'product';
}
else
{
$item['actions'] = array();
$item['actions']['items'] = array();
if(!isset($item['text'])) $item['text'] = $item['name'];
if(!isset($item['url'])) $item['url'] = '';
if(!isset($item['type'])) $item['type'] = '';
if($canEdit) $item['actions']['items'][] = array('key' => 'edit', 'icon' => 'edit', 'id' => $item['id'], 'editType' => $editType, 'onClick' => jsRaw('(event, item) => window.editItem(item)'));
if($canDelete) $item['actions']['items'][] = array('key' => 'delete', 'icon' => 'trash', 'id' => $item['id'], 'className' => 'btn ghost toolbar-item square size-sm rounded ajax-submit','url' => helper::createLink('tree', 'delete', 'module=' . $item['id']));
if($canSplit) $item['actions']['items'][] = array('key' => 'view', 'icon' => 'split', 'url' => $item['url']);
if($item['type'] == 'product')
{
$item['icon'] = 'product';
}
else
{
$item['actions'] = array();
$item['actions']['items'] = array();
if($canEdit) $item['actions']['items'][] = array('key' => 'edit', 'icon' => 'edit', 'id' => $item['id'], 'editType' => $editType, 'onClick' => jsRaw('(event, item) => window.editItem(item)'));
if($canDelete) $item['actions']['items'][] = array('key' => 'delete', 'icon' => 'trash', 'id' => $item['id'], 'className' => 'btn ghost toolbar-item square size-sm rounded ajax-submit','url' => helper::createLink('tree', 'delete', 'module=' . $item['id']));
if($canSplit) $item['actions']['items'][] = array('key' => 'view', 'icon' => 'split', 'url' => $item['url']);
}
}
if(isset($item['children']))