|
@@ -139,6 +139,7 @@ class Database
|
|
|
'stat' => 'project/database/stat?{param}',
|
|
|
'excel' => 'database.list_excel?{param}',
|
|
|
'stat_excel' => 'database.stat_excel?{param}',
|
|
|
+ 'reset' => 'project/database/list?project=' . $this->project . '&table=' . $table . '&menu=' . $this->menu . '&menu_id=' . $this->menu_id,
|
|
|
'diy' => 'list?{param}',
|
|
|
);
|
|
|
$state = $this->getState();
|
|
@@ -561,7 +562,11 @@ class Database
|
|
|
|
|
|
if (isset($v['search']) && is_string($v['search'])) {
|
|
|
|
|
|
- if (strpos($v['search'], 'time') !== false || strpos($v['search'], 'day') !== false) {
|
|
|
+ if ($v['search'] == 'sday') {
|
|
|
+ $config['manage']['search']['sday'][$k] = $v['name'];
|
|
|
+ } elseif ($v['search'] == 'sdate') {
|
|
|
+ $config['manage']['search']['sdate'][$k] = $v['name'];
|
|
|
+ } elseif (strpos($v['search'], 'time') !== false || strpos($v['search'], 'day') !== false) {
|
|
|
$config['manage']['search']['day'][$k] = $v['name'];
|
|
|
}
|
|
|
|
|
@@ -688,6 +693,26 @@ class Database
|
|
|
$config['state'] = $this->getState();
|
|
|
$config['project'] = $project;
|
|
|
|
|
|
+ # 新增排序
|
|
|
+ $l = $_GET['l'];
|
|
|
+ if ($l == 'project/database/list' || $l == 'database.list_excel') {
|
|
|
+ $list_order = array();
|
|
|
+ $i = 0;
|
|
|
+ foreach ($config['struct'] as $ki => $vi) {
|
|
|
+ if (isset($vi['list_order'])) {
|
|
|
+ $list_order[] = $vi['list_order'];
|
|
|
+ } else {
|
|
|
+ $config['struct'][$ki]['list_order'] = $i;
|
|
|
+ $list_order[] = $i;
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($list_order) {
|
|
|
+ array_multisort($list_order, SORT_ASC, SORT_NUMERIC, $config['struct']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return $config;
|
|
|
}
|
|
|
|
|
@@ -979,11 +1004,26 @@ class Database
|
|
|
|
|
|
# 增加下载报表按钮
|
|
|
if (isset($config['manage']['excel'])) {
|
|
|
- $name = '导出数据';
|
|
|
- if (is_string($config['manage']['excel']) && !strstr($config['manage']['excel'], '.')) {
|
|
|
- $name = $config['manage']['excel'];
|
|
|
+ $url = $this->url('excel');
|
|
|
+ if (is_array($config['manage']['excel'])) {
|
|
|
+ foreach ($config['manage']['excel'] as $k => $v) {
|
|
|
+ if (is_array($v)) {
|
|
|
+ $name = $v[0];
|
|
|
+ $u = $url . '&excel_name='.$v[1].'&excel_load=' . $v[2];
|
|
|
+ $config['manage']['button'][$name] = 'onclick="jump(\''.$u.'\', \'#form1\')"';
|
|
|
+ } else {
|
|
|
+ $name = $v;
|
|
|
+ $config['manage']['button'][$name] = 'onclick="jump(\''.$url.'\', \'#form1\')"';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $name = '导出数据';
|
|
|
+ if (is_string($config['manage']['excel']) && !strstr($config['manage']['excel'], '.')) {
|
|
|
+ $name = $config['manage']['excel'];
|
|
|
+ }
|
|
|
+ $config['manage']['button'][$name] = 'onclick="jump(\''.$url.'\', \'#form1\')"';
|
|
|
}
|
|
|
- $config['manage']['button'][$name] = 'onclick="jump(\''.$this->url('excel').'\', \'#form1\')"';
|
|
|
+
|
|
|
}
|
|
|
# 增加回收站
|
|
|
if (Dever::load('manage/auth.oper', 5) != false && isset($config['struct']['state']) && (!isset($config['manage']['delete']) || (isset($config['manage']['delete']) && $config['manage']['delete'] && isset($config['manage']['_list']['value']['delete'])))) {
|
|
@@ -1156,7 +1196,7 @@ class Database
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $btn .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('search') . '\');list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">搜索</button></div>';
|
|
|
+ $btn .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('search') . '\');list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">搜索</button><a class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-primary" href=" '. $this->url('reset') . '" type="button" style="height: 38px;margin-right:5px;margin-top:-2px;display:none;">重置</a></div>';
|
|
|
|
|
|
//$result .= '<form id="f1" action="'.$this->url('list').'" method="post">';
|
|
|
|
|
@@ -1353,6 +1393,52 @@ class Database
|
|
|
$result .= Html::text($value, false);
|
|
|
}
|
|
|
|
|
|
+ if (isset($config['manage']['search']['sday'])) {
|
|
|
+ $result .= '<br />';
|
|
|
+ foreach ($config['manage']['search']['sday'] as $k => $v) {
|
|
|
+ $this->list_search_time($result, $search, $prefix, $k, $v, 'sday');
|
|
|
+ }
|
|
|
+ $sday = Dever::input('search_option_sday');
|
|
|
+
|
|
|
+ $s1 = $s2 = $s3 = '';
|
|
|
+ if ($sday == 7) {
|
|
|
+ $s2 = 'sday_button_border';
|
|
|
+ } elseif ($sday == 30) {
|
|
|
+ $s3 = 'sday_button_border';
|
|
|
+ } elseif ($sday) {
|
|
|
+ $s1 = 'sday_button_border';
|
|
|
+ }
|
|
|
+ $result .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-primary sday_button '.$s1.'" type="button" style="height: 38px;margin-right:5px;margin-top:-4px;" onclick="setDay($(this), 0)">今日</button>';
|
|
|
+
|
|
|
+ $result .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-primary sday_button '.$s2.'" onclick="setDay($(this), 7)" type="button" style="height: 38px;margin-right:5px;margin-top:-4px;">7日</button>';
|
|
|
+
|
|
|
+ $result .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-primary sday_button '.$s3.'" onclick="setDay($(this), 30)" type="button" style="height: 38px;margin-right:20px;margin-top:-4px;">30日</button><style>.sday_button_border{border-color: #009688;}</style>';
|
|
|
+
|
|
|
+ $result .= '<input type="hidden" name="search_option_sday" id="search_option_sday" value="0">';
|
|
|
+ } elseif (isset($config['manage']['search']['sdate'])) {
|
|
|
+ $result .= '<br />';
|
|
|
+ foreach ($config['manage']['search']['sdate'] as $k => $v) {
|
|
|
+ $this->list_search_time($result, $search, $prefix, $k, $v, 'sdate');
|
|
|
+ }
|
|
|
+ $sdate = Dever::input('search_option_sdate');
|
|
|
+
|
|
|
+ $s1 = $s2 = $s3 = '';
|
|
|
+ if ($sdate == 7) {
|
|
|
+ $s2 = 'sdate_button_border';
|
|
|
+ } elseif ($sdate == 30) {
|
|
|
+ $s3 = 'sdate_button_border';
|
|
|
+ } elseif ($sdate) {
|
|
|
+ $s1 = 'sdate_button_border';
|
|
|
+ }
|
|
|
+ $result .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-primary sdate_button '.$s1.'" type="button" style="height: 38px;margin-right:5px;margin-top:-4px;" onclick="setDate($(this), 0)">今日</button>';
|
|
|
+
|
|
|
+ $result .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-primary sdate_button '.$s2.'" onclick="setDate($(this), 7)" type="button" style="height: 38px;margin-right:5px;margin-top:-4px;">7日</button>';
|
|
|
+
|
|
|
+ $result .= '<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-primary sdate_button '.$s3.'" onclick="setDate($(this), 30)" type="button" style="height: 38px;margin-right:20px;margin-top:-4px;">30日</button><style>.sdate_button_border{border-color: #009688;}</style>';
|
|
|
+
|
|
|
+ $result .= '<input type="hidden" name="search_option_sdate" id="search_option_sdate" value="0">';
|
|
|
+ }
|
|
|
+
|
|
|
# 列表页按钮
|
|
|
if (isset($config['manage']['search_button'])) {
|
|
|
$btn .= $this->button_list($config['manage']['search_button']);
|
|
@@ -1636,19 +1722,23 @@ class Database
|
|
|
$this->list_search();
|
|
|
$data = $this->list_tbody(true);
|
|
|
|
|
|
-
|
|
|
if ($data) {
|
|
|
$config = $this->config();
|
|
|
if (isset($config['manage']['excel']) && $config['manage']['excel']) {
|
|
|
$method = 'excel';
|
|
|
$info = $this->info();
|
|
|
$data = $this->getAdminInfo($data);
|
|
|
- if (is_string($config['manage']['excel']) && strstr($config['manage']['excel'], '.')) {
|
|
|
+ $load = Dever::input('excel_load');
|
|
|
+ if ($load) {
|
|
|
+ Dever::load($load, $data);
|
|
|
+ } elseif (is_string($config['manage']['excel']) && strstr($config['manage']['excel'], '.')) {
|
|
|
Dever::load($config['manage']['excel'], $data);
|
|
|
} else {
|
|
|
$this->excel($info, $data, $config);
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ Dever::alert('无导出数据');
|
|
|
}
|
|
|
|
|
|
//print_r($data);die;
|
|
@@ -1656,7 +1746,10 @@ class Database
|
|
|
|
|
|
private function excel($info, $data, $config)
|
|
|
{
|
|
|
- $file = $info['list_header'] . '的' . $info['list_desc'] . '-' . $info['project_name'];
|
|
|
+ $file = Dever::input('excel_name');
|
|
|
+ if (!$file) {
|
|
|
+ $file = $info['list_header'] . '的' . $info['list_desc'] . '-' . $info['project_name'];
|
|
|
+ }
|
|
|
|
|
|
$header = $body = array();
|
|
|
$i = 0;
|
|
@@ -1670,6 +1763,9 @@ class Database
|
|
|
}
|
|
|
}
|
|
|
//$v['name'] = mb_convert_encoding($v['name'],'gb2312','utf-8');
|
|
|
+ if (isset($v['list_name']) && $v['list_name']) {
|
|
|
+ $v['name'] = $v['list_name'];
|
|
|
+ }
|
|
|
$header[$i] = $v['name'];
|
|
|
$i++;
|
|
|
$j = 0;
|
|
@@ -1677,6 +1773,12 @@ class Database
|
|
|
if (is_array($vi)) {
|
|
|
$body[$j][$i] = '';
|
|
|
//if (isset($vi[$k])) {
|
|
|
+ # 处理同步
|
|
|
+ if (isset($v['sync']) && strpos($k, '-')) {
|
|
|
+ $temp = explode('-', $k);
|
|
|
+ $load = Dever::load($temp[0] . '/' . $temp[1] . '-one', array('option_' . $v['sync'][1] => $vi[$v['sync'][0]]));
|
|
|
+ $data[$ki][$k] = $vi[$k] = isset($load[$temp[2]]) ? $load[$temp[2]] : $v['default'];
|
|
|
+ }
|
|
|
if (true) {
|
|
|
$value = $vi[$k];
|
|
|
|
|
@@ -2147,19 +2249,7 @@ class Database
|
|
|
$pg = Dever::input('pg', 1);
|
|
|
$cur = Dever::input('search_limit', 0);
|
|
|
$num = $this->getNumConfig($config);
|
|
|
-
|
|
|
- # 新增排序
|
|
|
- $list_order = $view_order = array();
|
|
|
- foreach ($config['struct'] as $ki => $vi) {
|
|
|
- if (isset($v1['list_order'])) {
|
|
|
- $list_order[] = $v1['list_order'];
|
|
|
- } else {
|
|
|
- $list_order[] = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- if ($list_order) {
|
|
|
- //array_multisort($list_order, SORT_DESC, SORT_NUMERIC, $config['struct']);
|
|
|
- }
|
|
|
+
|
|
|
foreach ($data as $k => $v) {
|
|
|
$data[$k] = $this->getAdminInfo($data[$k]);
|
|
|
$data[$k]['i'] = $i;
|