* [bug#55294,done,3h] Add dataviews.

This commit is contained in:
daitingting
2024-09-26 17:15:42 +08:00
committed by 綦新志
parent 88d5b73b07
commit 6fc5a5e83a
2 changed files with 23 additions and 3 deletions
+5 -1
View File
@@ -34,10 +34,13 @@ window.changeBuilderTable = function(event)
const value = $target.val();
const from = getSqlBuilder('from');
const joins = getSqlBuilder('joins');
const $items = $target.zui('picker').options.items;
const prefix = $items.find(function(item){ return item.value === value}).prefix;
if(name == 'from')
{
from.table = value;
from.table = value;
from.prefix = prefix;
from.select = [];
}
if(name.startsWith('left'))
@@ -47,6 +50,7 @@ window.changeBuilderTable = function(event)
if(index < 0) return;
joins[index].table = value;
joins[index].prefix = prefix;
joins[index].select = [];
}
if(name.startsWith('join'))
+18 -2
View File
@@ -1709,6 +1709,7 @@ class biModel extends model
public function getTableList()
{
$originTableTreeMenu = $this->loadModel('dataview')->getOriginTreeMenu();
$dataviewTreeMenu = $this->loadModel('tree')->getGroupTree(0, 'dataview');
$tableList = array();
foreach($originTableTreeMenu as $menu)
@@ -1720,11 +1721,26 @@ class biModel extends model
if(!is_array($item))
{
$text = $item->key == 'story' ? $this->lang->story->common : $item->text;
$tableList[$item->key] = $text;
$tableList[] = array('value' => $item->key, 'text' => $text, 'prefix' => 'zt_');
continue;
}
foreach($item->items as $subItem) $tableList[$subItem->key] = $subItem->text;
foreach($item->items as $subItem) $tableList[] = array('value' => $subItem->key, 'text' => $subItem->text, 'prefix' => 'zt_');
}
}
foreach($dataviewTreeMenu as $menu)
{
if(empty($menu->items)) continue;
foreach($menu->items as $item)
{
if(!is_array($item))
{
$tableList[] = array('value' => $item->key, 'text' => $item->text, 'prefix' => 'ztv_');
continue;
}
foreach($item->items as $subItem) $tableList[] = array('value' => $subItem->key, 'text' => $subItem->text, 'prefix' => 'ztv_');
}
}