|
@@ -158,7 +158,7 @@ class Database
|
|
private function getUrlParam($key, $table, $suffix, $state)
|
|
private function getUrlParam($key, $table, $suffix, $state)
|
|
{
|
|
{
|
|
$param = '';
|
|
$param = '';
|
|
- $array = array('project', 'add', 'list', 'update');
|
|
|
|
|
|
+ $array = array('project', 'add', 'list', 'update', 'edit');
|
|
if (in_array($key, $array) && !strstr($table, 'oper_')) {
|
|
if (in_array($key, $array) && !strstr($table, 'oper_')) {
|
|
$where = Dever::preInput('search_');
|
|
$where = Dever::preInput('search_');
|
|
if ($where) {
|
|
if ($where) {
|
|
@@ -324,8 +324,12 @@ class Database
|
|
'add' => $this->url('add'),
|
|
'add' => $this->url('add'),
|
|
'add_state' => $display,
|
|
'add_state' => $display,
|
|
|
|
|
|
|
|
+ 'state' => $this->getState(),
|
|
|
|
+ 'l' => 'project/database/list',
|
|
'project' => $this->project,
|
|
'project' => $this->project,
|
|
'table' => $this->table,
|
|
'table' => $this->table,
|
|
|
|
+ 'menu' => $this->menu,
|
|
|
|
+ 'menu_id' => $this->menu_id,
|
|
'id' => $this->id,
|
|
'id' => $this->id,
|
|
'main' => '数据管理' . $this->refer('url'),
|
|
'main' => '数据管理' . $this->refer('url'),
|
|
|
|
|
|
@@ -2305,7 +2309,11 @@ class Database
|
|
$result[$k] = '<div class="form-group ' . $class . '"><div class="margin-top">';
|
|
$result[$k] = '<div class="form-group ' . $class . '"><div class="margin-top">';
|
|
|
|
|
|
if (layadmin()) {
|
|
if (layadmin()) {
|
|
- $result[$k] = '<div class="layui-form-item ' . $class . '"><div class="layui-col-lg6">';
|
|
|
|
|
|
+ $result[$k] = '<div class="layui-form-item ' . $class . '"><div classs="layui-col-lg6">';
|
|
|
|
+
|
|
|
|
+ if (isset($v['update']) && is_array($v['update'])) {
|
|
|
|
+ $result[$k] = '<div class="layui-form-item ' . $class . '"><div class="layui-tab-card">';
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
$result[$k] .= $this->create_update_html($k, $v, $data);
|
|
$result[$k] .= $this->create_update_html($k, $v, $data);
|
|
@@ -2509,29 +2517,72 @@ class Database
|
|
if (layadmin()) {
|
|
if (layadmin()) {
|
|
$c = 'layui-tab-title';
|
|
$c = 'layui-tab-title';
|
|
}
|
|
}
|
|
- $result .= '<ul class="nav nav-tabs '.$c.'">{tab}<li><a href="javascript:;" class="dever_form_add" toggle_key="' . $key . '">增加一条</a></li></ul>';
|
|
|
|
|
|
|
|
- $tab = '';
|
|
|
|
|
|
+ $delete = true;
|
|
|
|
+ if (isset($param['option'])) {
|
|
|
|
+ $delete = false;
|
|
|
|
+ $result .= '<ul class="nav nav-tabs '.$c.'">{tab}</ul>';
|
|
|
|
+
|
|
|
|
+ $order = array
|
|
|
|
+ (
|
|
|
|
+ 'col' => $key,
|
|
|
|
+ 'name' => $param['desc'],
|
|
|
|
+ 'default' => '1',
|
|
|
|
+ 'desc' => $param['desc'],
|
|
|
|
+ 'match' => 'is_string',
|
|
|
|
+ 'update' => 'hidden',
|
|
|
|
+ 'option' => $param['option']
|
|
|
|
+ );
|
|
|
|
+ array_unshift($method, $order);
|
|
|
|
+
|
|
|
|
+ if (isset($param['value']) && $param['value']) {
|
|
|
|
+ $value = json_decode(base64_decode($param['value']), true);
|
|
|
|
+ $param['value'] = array();
|
|
|
|
+ foreach ($param['option'] as $k => $v) {
|
|
|
|
+ foreach ($value[$k-1] as $k1 => $v1) {
|
|
|
|
+ $param['value'][$v][$k1] = $v1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ $param['value'] = array();
|
|
|
|
+ foreach ($param['option'] as $k => $v) {
|
|
|
|
+ $param['value'][$v][$key] = $k;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- $order = array
|
|
|
|
- (
|
|
|
|
- 'col' => 'order',
|
|
|
|
- 'name' => '排序-按照数字正序排列',
|
|
|
|
- 'default' => '1',
|
|
|
|
- 'desc' => '排序',
|
|
|
|
- 'match' => 'is_string',
|
|
|
|
- 'update' => 'text',
|
|
|
|
- );
|
|
|
|
- array_unshift($method, $order);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ $result .= '<ul class="nav nav-tabs '.$c.'">{tab}<li><a href="javascript:;" class="dever_form_add" toggle_key="' . $key . '">增加一条</a></li></ul>';
|
|
|
|
|
|
- $this->update_child(array(), $method, $key, $result, -1);
|
|
|
|
|
|
+ $order = array
|
|
|
|
+ (
|
|
|
|
+ 'col' => 'order',
|
|
|
|
+ 'name' => '排序-按照数字正序排列',
|
|
|
|
+ 'default' => '1',
|
|
|
|
+ 'desc' => '排序',
|
|
|
|
+ 'match' => 'is_string',
|
|
|
|
+ 'update' => 'text',
|
|
|
|
+ );
|
|
|
|
+ array_unshift($method, $order);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $tab = '';
|
|
|
|
+
|
|
|
|
+ $this->update_child(array(), $method, $key, $result, -1, $delete);
|
|
|
|
|
|
if (isset($param['value']) && $param['value']) {
|
|
if (isset($param['value']) && $param['value']) {
|
|
- $param['value'] = json_decode(base64_decode($param['value']), true);
|
|
|
|
|
|
+
|
|
|
|
+ if (!is_array($param['value'])) {
|
|
|
|
+ $param['value'] = json_decode(base64_decode($param['value']), true);
|
|
|
|
+ }
|
|
|
|
|
|
if (is_array($param['value'])) {
|
|
if (is_array($param['value'])) {
|
|
|
|
+ $i = 0;
|
|
foreach ($param['value'] as $k => $v) {
|
|
foreach ($param['value'] as $k => $v) {
|
|
- $this->update_child($v, $method, $key, $result, $k);
|
|
|
|
|
|
+ $n = $k;
|
|
|
|
+ if (is_string($k)) {
|
|
|
|
+ $k = $i;
|
|
|
|
+ }
|
|
|
|
+ $this->update_child($v, $method, $key, $result, $k, $delete);
|
|
|
|
|
|
$active = '';
|
|
$active = '';
|
|
if ($k == 0) {
|
|
if ($k == 0) {
|
|
@@ -2541,12 +2592,16 @@ class Database
|
|
$active .= ' layui-this';
|
|
$active .= ' layui-this';
|
|
}
|
|
}
|
|
$k = $k + 1;
|
|
$k = $k + 1;
|
|
- $tab .= '<li class="' . $active . '"><a href="javascript:;" id="tab-' . $key . '-child-' . $k . '" toggle_key="' . $key . '" toggle_id="' . $k . '" toggle_child=".dever_' . $key . '_child" toggle="#' . $key . '-child-' . $k . '" onclick="showToggle($(this))">第' . $k . '条</a></li>';
|
|
|
|
|
|
+ if (!is_string($n)) {
|
|
|
|
+ $n = '第' . $k . '条';
|
|
|
|
+ }
|
|
|
|
+ $tab .= '<li class="' . $active . '"><a href="javascript:;" id="tab-' . $key . '-child-' . $k . '" toggle_key="' . $key . '" toggle_id="' . $k . '" toggle_child=".dever_' . $key . '_child" toggle="#' . $key . '-child-' . $k . '" onclick="showToggle($(this))">'.$n.'</a></li>';
|
|
|
|
+ $i++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- $this->update_child(array(), $method, $key, $result, 0);
|
|
|
|
|
|
+ $this->update_child(array(), $method, $key, $result, 0, $delete);
|
|
|
|
|
|
$tab = '<li class="active layui-this"><a href="javascript:;" id="tab-' . $key . '-child-1" toggle_key="' . $key . '" toggle_id="1" toggle_child=".dever_' . $param['col'] . '_child" toggle="#' . $key . '-child-1" onclick="showToggle($(this))">第1条</a></li>';
|
|
$tab = '<li class="active layui-this"><a href="javascript:;" id="tab-' . $key . '-child-1" toggle_key="' . $key . '" toggle_id="1" toggle_child=".dever_' . $param['col'] . '_child" toggle="#' . $key . '-child-1" onclick="showToggle($(this))">第1条</a></li>';
|
|
}
|
|
}
|
|
@@ -2570,13 +2625,18 @@ class Database
|
|
*
|
|
*
|
|
* @return array
|
|
* @return array
|
|
*/
|
|
*/
|
|
- private function update_child($data, $param, $key, &$result, $index)
|
|
|
|
|
|
+ private function update_child($data, $param, $key, &$result, $index, $delete = true)
|
|
{
|
|
{
|
|
$style = '';
|
|
$style = '';
|
|
if ($index != 0) {
|
|
if ($index != 0) {
|
|
$style = 'style="display:none;"';
|
|
$style = 'style="display:none;"';
|
|
}
|
|
}
|
|
- $result .= '<div id="' . $key . '-child-' . ($index + 1) . '" class="dever_' . $key . '_child dever_form_add_child" ' . $style . '><div class="dever_form_delete">[删除]</div>';
|
|
|
|
|
|
+ $result .= '<div id="' . $key . '-child-' . ($index + 1) . '" class="dever_' . $key . '_child dever_form_add_child" ' . $style . '>';
|
|
|
|
+
|
|
|
|
+ if ($delete) {
|
|
|
|
+ $result .= '<div class="dever_form_delete">[删除]</div>';
|
|
|
|
+ }
|
|
|
|
+
|
|
foreach ($param as $k => $v) {
|
|
foreach ($param as $k => $v) {
|
|
$v['type'] = $v['update'];
|
|
$v['type'] = $v['update'];
|
|
|
|
|