|
@@ -1196,7 +1196,7 @@ class Database
|
|
|
*
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function list_thead()
|
|
|
+ public function list_thead($type = false)
|
|
|
{
|
|
|
# 新增权限
|
|
|
if (Dever::load('manage/auth.oper', 1) == false) {
|
|
@@ -1222,7 +1222,17 @@ class Database
|
|
|
return Dever::location($url);
|
|
|
} else {
|
|
|
if (isset($config['manage']['mul'])) {
|
|
|
- $result[] = '<th><input type="checkbox" class="checkbox-checkall" name="checkall" id="checkall" value="list"/></th>';
|
|
|
+ if ($type == 'layui') {
|
|
|
+ $layui = array
|
|
|
+ (
|
|
|
+ 'field' => 'checkbox',
|
|
|
+ 'title' => '<input type="checkbox" class="checkbox-checkall" name="checkall" id="checkall" value="list" lay-ignore/>',
|
|
|
+ 'fixed' => 'left',
|
|
|
+ );
|
|
|
+ $result[] = $layui;
|
|
|
+ } else {
|
|
|
+ $result[] = '<th><input type="checkbox" class="checkbox-checkall" name="checkall" id="checkall" value="list"/></th>';
|
|
|
+ }
|
|
|
}
|
|
|
$data = array();
|
|
|
$data = $this->getAdminInfo($data);
|
|
@@ -1280,15 +1290,55 @@ class Database
|
|
|
|
|
|
$link = str_replace('{order}', '&' . $order . '=' . $asc, $link);
|
|
|
|
|
|
- $result[] = '<th data-priority="'.$v['level'].'"><a href="' . $link . '" title="' . $text . '" style="color:black;">' . $v['name'] . ' <span class="glyphicon glyphicon-circle-arrow-' . $icon . '"></span></a>' . $cancel . '</th>';
|
|
|
+
|
|
|
+ if ($type == 'layui') {
|
|
|
+ $layui = array
|
|
|
+ (
|
|
|
+ 'field' => $k,
|
|
|
+ 'title' => $v['name'],
|
|
|
+ );
|
|
|
+ $result[] = $layui;
|
|
|
+
|
|
|
+ } else {
|
|
|
+ $result[] = '<th data-priority="'.$v['level'].'"><a href="' . $link . '" title="' . $text . '" style="color:black;">' . $v['name'] . ' <span class="glyphicon glyphicon-circle-arrow-' . $icon . '"></span></a>' . $cancel . '</th>';
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
- $result[] = '<th data-priority="'.$v['level'].'">' . $v['name'] . '</th>';
|
|
|
+ if ($type == 'layui') {
|
|
|
+ if ($k == 'id' || isset($v['fixed'])) {
|
|
|
+ $layui = array
|
|
|
+ (
|
|
|
+ 'field' => $k,
|
|
|
+ 'title' => $v['name'],
|
|
|
+ 'fixed' => 'left',
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ $layui = array
|
|
|
+ (
|
|
|
+ 'field' => $k,
|
|
|
+ 'title' => $v['name'],
|
|
|
+ );
|
|
|
+ }
|
|
|
+ $result[] = $layui;
|
|
|
+ } else {
|
|
|
+ $result[] = '<th data-priority="'.$v['level'].'">' . $v['name'] . '</th>';
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if ((Dever::load('manage/auth.oper', 3) != false || Dever::load('manage/auth.oper', 5) != false) && isset($config['manage']['_list']['value'])) {
|
|
|
- $result[] = '<th data-priority="1">' . $config['manage']['_list']['name'] . '</th>';
|
|
|
+ if ($type == 'layui') {
|
|
|
+ $layui = array
|
|
|
+ (
|
|
|
+ 'field' => $config['manage']['_list']['col'],
|
|
|
+ 'title' => $config['manage']['_list']['name'],
|
|
|
+ 'fixed' => 'right',
|
|
|
+ );
|
|
|
+ $result[] = $layui;
|
|
|
+ } else {
|
|
|
+ $result[] = '<th data-priority="1">' . $config['manage']['_list']['name'] . '</th>';
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1296,14 +1346,26 @@ class Database
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+ # layui表头
|
|
|
public function list_thead_layui()
|
|
|
{
|
|
|
+ $html = 'config.table = {};config.table.cols = [];';
|
|
|
|
|
|
+ $data = array($this->list_thead('layui'));
|
|
|
+ $data = Dever::json_encode($data);
|
|
|
+ $html .= 'config.table.cols = ' . $data;
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
+ # layui表的数据 没有使用其异步方式
|
|
|
public function list_tbody_layui()
|
|
|
{
|
|
|
-
|
|
|
+ $html = 'config.table.data = [];';
|
|
|
+
|
|
|
+ $data = $this->list_tbody(false, 'layui');
|
|
|
+ $data = Dever::json_encode($data);
|
|
|
+ $html .= 'config.table.data = ' . $data;
|
|
|
+ return $html;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1682,7 +1744,7 @@ class Database
|
|
|
*
|
|
|
* @return array
|
|
|
*/
|
|
|
- public function list_tbody($excel = false)
|
|
|
+ public function list_tbody($excel = false, $type = false)
|
|
|
{
|
|
|
# 新增权限
|
|
|
if (Dever::load('manage/auth.oper', 1) == false) {
|
|
@@ -1716,7 +1778,7 @@ class Database
|
|
|
# 批量更新
|
|
|
$this->list_tbody_mul($param);
|
|
|
|
|
|
- $result = array();
|
|
|
+ $result = $return = array();
|
|
|
|
|
|
if ($excel == true) {
|
|
|
$method = $this->project . '/' . $this->table . '-all';
|
|
@@ -1776,11 +1838,13 @@ class Database
|
|
|
$data[$k]['i'] = $i;
|
|
|
$ii = intval($num[$cur])*($pg-1);
|
|
|
$data[$k]['r'] = $i+1+$ii;
|
|
|
- $i++;
|
|
|
$result[$k] = '<tr>';
|
|
|
+ $return[$i] = array();
|
|
|
|
|
|
if (isset($config['manage']['mul'])) {
|
|
|
- $result[$k] .= '<td><input type="checkbox" name="mul_where_id[]" class="checkbox-checkall-list" value="' . $v['id'] . '"/></td>';
|
|
|
+ $checkbox = '<input type="checkbox" name="mul_where_id[]" class="checkbox-checkall-list" lay-ignore value="' . $v['id'] . '"/>';
|
|
|
+ $result[$k] .= '<td>'.$checkbox.'</td>';
|
|
|
+ $return[$i]['checkbox'] = $checkbox;
|
|
|
}
|
|
|
|
|
|
foreach ($config['struct'] as $ki => $vi) {
|
|
@@ -1884,16 +1948,34 @@ class Database
|
|
|
|
|
|
$vi['edit'] = $vi['edit'] == 'textarea' ? $vi['edit'] : 'text';
|
|
|
|
|
|
- $result[$k] .= '<td class="edit" data-col="' . $ki . '" data-url="' . $url . '" data-id="' . $v['id'] . '" data-project="' . $this->project . '" data-table="' . $this->table . '" data-content="' . $show . '" data-type="' . $vi['edit'] . '">' . $text . '</td>';
|
|
|
+ $text = '<span class="edit" data-col="' . $ki . '" data-url="' . $url . '" data-id="' . $v['id'] . '" data-project="' . $this->project . '" data-table="' . $this->table . '" data-content="' . $show . '" data-type="' . $vi['edit'] . '">'.$text.'</span>';
|
|
|
+
|
|
|
+ $result[$k] .= '<td >' . $text . '</td>';
|
|
|
+
|
|
|
+ if (isset($return[$i][$ki])) {
|
|
|
+ $text = $return[$i][$ki] . $text;
|
|
|
+ }
|
|
|
+ $return[$i][$ki] = $text;
|
|
|
} else {
|
|
|
$result[$k] .= '<td>' . $text . '</td>';
|
|
|
+
|
|
|
+ if (isset($return[$i][$ki])) {
|
|
|
+ $text = $return[$i][$ki] . $text;
|
|
|
+ }
|
|
|
+ $return[$i][$ki] = $text;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $result[$k] .= $this->list_tbody_button($config, $data[$k]);
|
|
|
+ $button = $this->list_tbody_button($config, $data[$k]);
|
|
|
+ $result[$k] .= $button;
|
|
|
+
|
|
|
+ $return[$i]['manage'] = str_replace(array('<td>', '</td>'), '', $button);
|
|
|
|
|
|
$result[$k] .= '</tr>';
|
|
|
+
|
|
|
+ $i++;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1911,6 +1993,9 @@ class Database
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
+ if ($type) {
|
|
|
+ return $return;
|
|
|
+ }
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
@@ -1954,19 +2039,22 @@ class Database
|
|
|
}
|
|
|
|
|
|
if ($oper == true) {
|
|
|
+ if ($kj == 'delete') {
|
|
|
+ $class = 'layui-btn layui-btn-danger';
|
|
|
+ } else {
|
|
|
+ $class = 'layui-btn';
|
|
|
+ }
|
|
|
+ if (layadmin()) {
|
|
|
+ $class .= ' layui-btn-xs';
|
|
|
+ }
|
|
|
if (strpos($kj, 'edit') !== false) {
|
|
|
- $result .= '<a href="javascript:;" onclick="fastEdit($(this), \'' . $this->url($kj, $data['id']) . '\', \''.$vj[0].'\', \''.$vj[1].'\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn">' . $vj[0] . '</button></a> ';
|
|
|
+ $result .= '<a href="javascript:;" onclick="fastEdit($(this), \'' . $this->url($kj, $data['id']) . '\', \''.$vj[0].'\', \''.$vj[1].'\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 '.$class.'">' . $vj[0] . '</button></a> ';
|
|
|
} elseif (strpos($kj, 'oper') !== false) {
|
|
|
- $result .= '<a href="javascript:;" onclick="load(\'' . Dever::url($pj) . '\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn">' . $vj[0] . '</button></a> ';
|
|
|
+ $result .= '<a href="javascript:;" onclick="load(\'' . Dever::url($pj) . '\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 '.$class.'">' . $vj[0] . '</button></a> ';
|
|
|
} elseif (isset($vj[1]) && strpos($vj[1], 'modal|') !== false) {
|
|
|
$t = explode('|', $vj[1]);
|
|
|
- $result .= '<a href="#dever_modal" data-toggle="modal" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn" onclick=' . $t[1] . ' msg-send="' . $this->value($t[2], $data) . '">' . $vj[0] . '</a> ';
|
|
|
+ $result .= '<a href="#dever_modal" data-toggle="modal" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 '.$class.'" onclick=' . $t[1] . ' msg-send="' . $this->value($t[2], $data) . '">' . $vj[0] . '</a> ';
|
|
|
} elseif (isset($vj[1])) {
|
|
|
- if ($kj == 'delete') {
|
|
|
- $class = 'layui-btn layui-btn-danger';
|
|
|
- } else {
|
|
|
- $class = 'layui-btn';
|
|
|
- }
|
|
|
$result .= '<a href="' . $this->url($kj, $data['id'], $pj) . '" class="oper_' . $kj . '"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 '.$class.'">' . $h . $vjn . '</button></a> ';
|
|
|
} else {
|
|
|
$result .= '<span style="margin-left:5px;margin-right:10px;">' . $vj[0] . '</span>';
|