|
@@ -1351,6 +1351,13 @@ class Database
|
|
|
}
|
|
|
$url .= '&manage_log=update.' . $this->project . '.' . $this->table . '&manage_oper=' . $k;
|
|
|
$result .= ' <a class="btn btn-default layui-btn layuiadmin-btn-list layui-btn-danger" href="javascript:;"onclick="load(\'' . $url . '\', \'' . $content . '\', \'' . $title . '\')">' . $k . '</a>';
|
|
|
+ } elseif ($v[0] == 'oper_mul') {
|
|
|
+ $url = Dever::url($v[1]);
|
|
|
+ if (!isset($v[2])) {
|
|
|
+ $v[2] = 1;
|
|
|
+ }
|
|
|
+ //$url .= '&manage_log=update.' . $this->project . '.' . $this->table . '&manage_oper=' . $k;
|
|
|
+ $result .= ' <a class="btn btn-default layui-btn layuiadmin-btn-list layui-btn-danger" href="javascript:;" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('list') . '\');list_mul($(this), 1, \''.$url.'\')">' . $k . '</a>';
|
|
|
} elseif ($v[0] == 'show') {
|
|
|
$url = Dever::url($v[1]);
|
|
|
$submit = '';
|
|
@@ -2447,35 +2454,64 @@ class Database
|
|
|
return array($param, $high);
|
|
|
}
|
|
|
|
|
|
- private function list_tbody_mul($send)
|
|
|
+ private function list_tbody_mul($config, $send)
|
|
|
{
|
|
|
$mul = Dever::load('manage/auth.oper', 3) ? Dever::preInput('mul_') : false;
|
|
|
|
|
|
- if (Dever::input('method') == 'mul' && $mul && $mul['mul_type'] > 0) {
|
|
|
+ $method = Dever::input('method');
|
|
|
+ if (strstr($method, 'mul') && $mul && $mul['mul_type'] > 0) {
|
|
|
if ($mul['mul_type'] == 1 && empty($mul['mul_where_id'])) {
|
|
|
Dever::alert('您还未选择任何数据条目');
|
|
|
}
|
|
|
+
|
|
|
Dever::config('base')->mul_type = $mul['mul_type'];
|
|
|
- /*
|
|
|
+ unset($mul['mul_type']);
|
|
|
+ $param = $send;
|
|
|
if (isset($param['page'])) {
|
|
|
unset($param['page']);
|
|
|
}
|
|
|
- */
|
|
|
- unset($mul['mul_type']);
|
|
|
- $param = array();
|
|
|
foreach ($mul as $k => $v) {
|
|
|
if ($v) {
|
|
|
if (is_array($v)) {
|
|
|
$v = implode(',', $v);
|
|
|
}
|
|
|
$param[str_replace('mul_', '', $k)] = $v;
|
|
|
+
|
|
|
+ if (strstr($k, 'mul_set_')) {
|
|
|
+ $k = str_replace('mul_set_', '', $k);
|
|
|
+ if (isset($config['struct'][$k]) && isset($config['struct'][$k]['mul_where'])) {
|
|
|
+ $param = array_merge(Dever::prefix($config['struct'][$k]['mul_where'], 'option_'), $param);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (isset($param)) {
|
|
|
- $method = $this->project . '/' . $this->table . '-updatemul';
|
|
|
- $state = Dever::load($method, $param);
|
|
|
+ //print_r($param);die;
|
|
|
|
|
|
+ if (isset($param)) {
|
|
|
+ print_r($param);die;
|
|
|
+ if (strstr($method, 'mul.')) {
|
|
|
+ $url = str_replace('mul.', '', $method);
|
|
|
+ if ($url) {
|
|
|
+ $send = array();
|
|
|
+ foreach ($param as $k => $v) {
|
|
|
+ $send['search_' . $k] = $v;
|
|
|
+ }
|
|
|
+ if (strstr($url, '?')) {
|
|
|
+ $url .= '&' . http_build_query($send);
|
|
|
+ } else {
|
|
|
+ $url .= '?' . http_build_query($send);
|
|
|
+ }
|
|
|
+
|
|
|
+ Dever::alert($url, 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data = Dever::db($this->project . '/' . $this->table)->getmul($param);
|
|
|
+ if ($data) {
|
|
|
+ Dever::config('base')->mul_data = array_keys($data);
|
|
|
+ $method = $this->project . '/' . $this->table . '-updatemul';
|
|
|
+ $state = Dever::load($method, $param);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Dever::alert('reload');
|
|
@@ -2562,7 +2598,7 @@ class Database
|
|
|
}
|
|
|
|
|
|
# 批量更新
|
|
|
- $this->list_tbody_mul($param);
|
|
|
+ $this->list_tbody_mul($config, $param);
|
|
|
|
|
|
$result = $return = array();
|
|
|
|
|
@@ -3066,7 +3102,7 @@ class Database
|
|
|
$mul = Dever::preInput('mul_');
|
|
|
|
|
|
$node = Html::node(array('class="am-u-sm-12" style="margin-top:10px;"', 'class="am-form-group am-input-group-sm"'));
|
|
|
- $btn = '<button class="btn btn-danger layui-btn layui-btn-danger" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('list') . '\');list_mul($(this))" type="button" style="height: 38px;margin-left:10px;">更新</button>';
|
|
|
+ $btn = '<button class="btn btn-danger layui-btn layui-btn-danger" onclick="$(\'#form1\').attr(\'action\', \'' . $this->url('list') . '\');list_mul($(this), 1)" type="button" style="height: 38px;margin-left:10px;">批量操作</button>';
|
|
|
|
|
|
$prefix = 'mul_';
|
|
|
|
|
@@ -3081,11 +3117,11 @@ class Database
|
|
|
|
|
|
# 只有当有搜索条件时才会出现
|
|
|
if (Dever::load('manage/auth.oper', 2) && $this->search == true) {
|
|
|
- //$option[2] = '所有页面的数据';
|
|
|
- //$default = 2;
|
|
|
+ $option[2] = '所有页面的数据';
|
|
|
+ $default = 2;
|
|
|
}
|
|
|
|
|
|
- $this->list_search_select($result, $mul, $prefix . 'type' . '" id="' . $prefix . 'type', '请选择要更新的数据', $option, $default);
|
|
|
+ $this->list_search_select($result, $mul, $prefix . 'type' . '" id="' . $prefix . 'type', '请选择要批量操作的数据', $option, $default);
|
|
|
|
|
|
foreach ($config['struct'] as $k => $v) {
|
|
|
if ($k == 'state' && (!isset($config['manage']['delete']) || (isset($config['manage']['delete']) && $config['manage']['delete']))) {
|