Merge branch 'develop' of gitee.com:karson/fastadmin into develop

pull/406/head
Karson 2022-05-27 15:30:18 +08:00
commit 378aad4409
12 changed files with 1280 additions and 1288 deletions

View File

@ -9,12 +9,16 @@ use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
use think\Db;
use think\db\exception\BindParamException;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\response\Json;
trait Backend
{
/**
* 排除前台提交过来的字段
* @param $params
@ -24,76 +28,81 @@ trait Backend
{
if (is_array($this->excludeFields)) {
foreach ($this->excludeFields as $field) {
if (key_exists($field, $params)) {
if (array_key_exists($field, $params)) {
unset($params[$field]);
}
}
} else {
if (key_exists($this->excludeFields, $params)) {
} else if (array_key_exists($this->excludeFields, $params)) {
unset($params[$this->excludeFields]);
}
}
return $params;
}
/**
* 查看
*
* @return string|Json
* @throws \think\Exception
* @throws DbException
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
$result = array("total" => $list->total(), "rows" => $list->items());
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
return $this->view->fetch();
}
/**
* 回收站
*
* @return string|Json
* @throws \think\Exception
*/
public function recyclebin()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->onlyTrashed()
->where($where)
->order($sort, $order)
->paginate($limit);
$result = array("total" => $list->total(), "rows" => $list->items());
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
if (false === $this->request->isPost()) {
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
$params = $this->preExcludeFields($params);
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
@ -106,33 +115,27 @@ trait Backend
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
$this->model->validateFailException()->validate($validate);
}
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
if ($result === false) {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
$this->success();
}
/**
* 编辑
*
* @param $ids
* @return string
* @throws DbException
* @throws \think\Exception
*/
public function edit($ids = null)
{
@ -141,14 +144,17 @@ trait Backend
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
if (false === $this->request->isPost()) {
$this->view->assign('row', $row);
return $this->view->fetch();
}
$params = $this->request->post('row/a');
if (empty($params)) {
$this->error(__('Parameter %s can not be empty', ''));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
@ -157,42 +163,38 @@ trait Backend
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
$row->validateFailException()->validate($validate);
}
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
if (false === $result) {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->view->assign("row", $row);
return $this->view->fetch();
$this->success();
}
/**
* 删除
*
* @param $ids
* @return void
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
*/
public function del($ids = "")
public function del($ids = null)
{
if (!$this->request->isPost()) {
if (false === $this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$ids = $ids ?: $this->request->post("ids");
if (empty($ids)) {
$this->error(__('Parameter %s can not be empty', 'ids'));
}
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
@ -203,75 +205,71 @@ trait Backend
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
foreach ($list as $item) {
$count += $item->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
} catch (PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
}
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 真实删除
*
* @param $ids
* @return void
*/
public function destroy($ids = "")
public function destroy($ids = null)
{
if (!$this->request->isPost()) {
if (false === $this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
$ids = $ids ?: $this->request->post('ids');
if (empty($ids)) {
$this->error(__('Parameter %s can not be empty', 'ids'));
}
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
if ($ids) {
$this->model->where($pk, 'in', $ids);
}
$count = 0;
Db::startTrans();
try {
$list = $this->model->onlyTrashed()->select();
foreach ($list as $k => $v) {
$count += $v->delete(true);
foreach ($list as $item) {
$count += $item->delete(true);
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
} catch (PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
$this->error(__('Parameter %s can not be empty', 'ids'));
$this->error(__('No rows were deleted'));
}
/**
* 还原
*
* @param $ids
* @return void
*/
public function restore($ids = "")
public function restore($ids = null)
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
if (false === $this->request->isPost()) {
$this->error(__('Invalid parameters'));
}
$ids = $ids ? $ids : $this->request->post("ids");
$ids = $ids ?: $this->request->post('ids');
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
@ -284,14 +282,11 @@ trait Backend
Db::startTrans();
try {
$list = $this->model->onlyTrashed()->select();
foreach ($list as $index => $item) {
foreach ($list as $item) {
$count += $item->restore();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
} catch (PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
@ -303,18 +298,28 @@ trait Backend
/**
* 批量更新
*
* @param $ids
* @return void
*/
public function multi($ids = "")
public function multi($ids = null)
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
if (false === $this->request->isPost()) {
$this->error(__('Invalid parameters'));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
if ($this->request->has('params')) {
parse_str($this->request->post("params"), $values);
$ids = $ids ?: $this->request->post('ids');
if (empty($ids)) {
$this->error(__('Parameter %s can not be empty', 'ids'));
}
if (false === $this->request->has('params')) {
$this->error(__('No rows were updated'));
}
parse_str($this->request->post('params'), $values);
$values = $this->auth->isSuperAdmin() ? $values : array_intersect_key($values, array_flip(is_array($this->multiFields) ? $this->multiFields : explode(',', $this->multiFields)));
if ($values) {
if (empty($values)) {
$this->error(__('You have no permission'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
@ -323,32 +328,26 @@ trait Backend
Db::startTrans();
try {
$list = $this->model->where($this->model->getPk(), 'in', $ids)->select();
foreach ($list as $index => $item) {
foreach ($list as $item) {
$count += $item->allowField(true)->isUpdate(true)->save($values);
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
} catch (PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
}
$this->error(__('No rows were updated'));
}
} else {
$this->error(__('You have no permission'));
}
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 导入
*
* @return void
* @throws PDOException
* @throws BindParamException
*/
protected function import()
{
@ -368,12 +367,12 @@ trait Backend
if ($ext === 'csv') {
$file = fopen($filePath, 'r');
$filePath = tempnam(sys_get_temp_dir(), 'import_csv');
$fp = fopen($filePath, "w");
$fp = fopen($filePath, 'w');
$n = 0;
while ($line = fgets($file)) {
$line = rtrim($line, "\n\r\0");
$encoding = mb_detect_encoding($line, ['utf-8', 'gbk', 'latin1', 'big5']);
if ($encoding != 'utf-8') {
if ($encoding !== 'utf-8') {
$line = mb_convert_encoding($line, 'utf-8', $encoding);
}
if ($n == 0 || preg_match('/^".*"$/', $line)) {

View File

@ -7,7 +7,7 @@ return [
'Sign up successful' => '注册成功',
'Username can not be empty' => '用户名不能为空',
'Username must be 3 to 30 characters' => '用户名必须3-30个字符',
'Username must be 6 to 30 characters' => '用户名必须3-30个字符',
'Username must be 6 to 30 characters' => '用户名必须6-30个字符',
'Password can not be empty' => '密码不能为空',
'Password must be 6 to 30 characters' => '密码必须6-30个字符',
'Mobile is incorrect' => '手机格式不正确',

View File

@ -1,11 +1,11 @@
<!--@formatter:off-->
{if "[type]" == 'email'}
<input type="text" name="captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});integer[+];remote({:url('api/validate/check_ems_correct')}, event=[event], email:#email)" />
<input type="text" name="captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});digits;remote({:url('api/validate/check_ems_correct')}, event=[event], email:#email)" />
<span class="input-group-btn" style="padding:0;border:none;">
<a href="javascript:;" class="btn btn-info btn-captcha" data-url="{:url('api/ems/send')}" data-type="email" data-event="[event]">发送验证码</a>
</span>
{elseif "[type]" == 'mobile'/}
<input type="text" name="captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});integer[+];remote({:url('api/validate/check_sms_correct')}, event=[event], mobile:#mobile)" />
<input type="text" name="captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});digits;remote({:url('api/validate/check_sms_correct')}, event=[event], mobile:#mobile)" />
<span class="input-group-btn" style="padding:0;border:none;">
<a href="javascript:;" class="btn btn-info btn-captcha" data-url="{:url('api/sms/send')}" data-type="mobile" data-event="[event]">发送验证码</a>
</span>

View File

@ -69,7 +69,7 @@
<label for="captcha" class="control-label col-xs-12 col-sm-3">{:__('Captcha')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input type="text" name="captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});integer[+];remote({:url('api/validate/check_ems_correct')}, event=resetpwd, email:#email)"/>
<input type="text" name="captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});digits;remote({:url('api/validate/check_ems_correct')}, event=resetpwd, email:#email)"/>
<span class="input-group-btn" style="padding:0;border:none;">
<a href="javascript:;" class="btn btn-primary btn-captcha" data-url="{:url('api/ems/send')}" data-type="email" data-event="resetpwd">{:__('Send verification code')}</a>
</span>

View File

@ -121,7 +121,7 @@
<label class="control-label col-xs-12 col-sm-3">{:__('Captcha')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input type="text" name="captcha" id="email-captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});integer[+];remote({:url('api/validate/check_ems_correct')}, event=changeemail, email:#email)" />
<input type="text" name="captcha" id="email-captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});digits;remote({:url('api/validate/check_ems_correct')}, event=changeemail, email:#email)" />
<span class="input-group-btn" style="padding:0;border:none;">
<a href="javascript:;" class="btn btn-info btn-captcha" data-url="{:url('api/ems/send')}" data-type="email" data-event="changeemail">获取验证码</a>
</span>
@ -155,7 +155,7 @@
<label for="mobile-captcha" class="control-label col-xs-12 col-sm-3">{:__('Captcha')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input type="text" name="captcha" id="mobile-captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});integer[+];remote({:url('api/validate/check_sms_correct')}, event=changemobile, mobile:#mobile)" />
<input type="text" name="captcha" id="mobile-captcha" class="form-control" data-rule="required;length({$Think.config.captcha.length});digits;remote({:url('api/validate/check_sms_correct')}, event=changemobile, mobile:#mobile)" />
<span class="input-group-btn" style="padding:0;border:none;">
<a href="javascript:;" class="btn btn-info btn-captcha" data-url="{:url('api/sms/send')}" data-type="mobile" data-event="changemobile">获取验证码</a>
</span>

View File

@ -38,7 +38,7 @@
"repositories": [
{
"type": "git",
"url": "https://gitee.com/karson/framework"
"url": "https://gitee.com/fastadminnet/framework.git"
}
]
}

View File

@ -8,45 +8,45 @@ use ArrayAccess;
* 表单元素生成
* @class Form
* @package fast
* @method string token() static 生成Token
* @method string label(string $name, string $value = null, array $options = []) static label标签
* @method string input($type, $name, string $value = null, array $options = []) static 按类型生成文本框
* @method string text(string $name, string $value = null, array $options = []) static 普通文本框
* @method string password(string $name, array $options = []) static 密码文本框
* @method string hidden(string $name, string $value = null, array $options = []) static 隐藏文本框
* @method string email(string $name, string $value = null, array $options = []) static Email文本框
* @method string url(string $name, string $value = null, array $options = []) static URL文本框
* @method string file(string $name, array $options = []) static 文件上传组件
* @method string textarea(string $name, string $value = null, array $options = []) static 多行文本框
* @method string editor(string $name, string $value = null, array $options = []) static 富文本编辑器
* @method string select(string $name, array $list = [], string $selected = null, array $options = []) static 下拉列表组件
* @method string selects(string $name, array $list = [], string $selected = null, array $options = []) static 下拉列表组件(多选)
* @method string selectpicker(string $name, array $list = [], string $selected = null, array $options = []) static 下拉列表组件(友好)
* @method string selectpickers(string $name, array $list = [], string $selected = null, array $options = []) static 下拉列表组件(友好)(多选)
* @method string selectpage(string $name, string $value, string $url, string $field = null, string $primaryKey = null, array $options = []) static 动态下拉列表组件
* @method string selectpages(string $name, string $value, string $url, string $field = null, string $primaryKey = null, array $options = []) static 动态下拉列表组件(多选)
* @method string citypicker(string $name, string $value, array $options = []) static 城市选择组件
* @method string switcher(string $name, string $value, array $options = []) static 切换组件
* @method string datepicker(string $name, string $value, array $options = []) static 日期选择组件
* @method string timepicker(string $name, string $value, array $options = []) static 时间选择组件
* @method string datetimepicker(string $name, string $value, array $options = []) static 日期时间选择组件
* @method string daterange(string $name, string $value, array $options = []) static 日期区间组件
* @method string timerange(string $name, string $value, array $options = []) static 时间区间组件
* @method string datetimerange(string $name, string $value, array $options = []) static 日期时间区间组件
* @method string fieldlist(string $name, string $value, string $title = null, string $template = null, array $options = []) static 字段列表组件
* @method string cxselect(string $url, array $names = [], array $values = [], array $options = []) static 联动组件
* @method string selectRange(string $name, string $begin, string $end, string $selected = null, array $options = []) static 选择数字区间
* @method string selectYear(string $name, string $begin, string $end, string $selected = null, array $options = []) static 选择年
* @method string selectMonth(string $name, string $selected = null, array $options = [], string $format = '%m') static 选择月
* @method string checkbox(string $name, string $value = '1', string $checked = null, array $options = []) static 单个复选框
* @method string checkboxs(string $name, array $list = [], string $checked = null, array $options = []) static 一组复选框
* @method string radio(string $name, string $value = null, string $checked = null, array $options = [])) static 单个单选框
* @method string radios(string $name, array $list = [], string $checked = null, array $options = [])) static 一组单选框
* @method string image(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) static 上传图片组件
* @method string images(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) static 上传图片组件(多图)
* @method string upload(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) static 上传文件组件
* @method string uploads(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) static 上传文件组件(多文件)
* @method string button(string $value = null, array $options = []) static 表单button
* @method static string token() 生成Token
* @method static string label(string $name, string $value = null, array $options = []) label标签
* @method static string input($type, $name, string $value = null, array $options = []) 按类型生成文本框
* @method static string text(string $name, string $value = null, array $options = []) 普通文本框
* @method static string password(string $name, array $options = []) 密码文本框
* @method static string hidden(string $name, string $value = null, array $options = []) 隐藏文本框
* @method static string email(string $name, string $value = null, array $options = []) Email文本框
* @method static string url(string $name, string $value = null, array $options = []) URL文本框
* @method static string file(string $name, array $options = []) 文件上传组件
* @method static string textarea(string $name, string $value = null, array $options = []) 多行文本框
* @method static string editor(string $name, string $value = null, array $options = []) 富文本编辑器
* @method static string select(string $name, array $list = [], string $selected = null, array $options = []) 下拉列表组件
* @method static string selects(string $name, array $list = [], string $selected = null, array $options = []) 下拉列表组件(多选)
* @method static string selectpicker(string $name, array $list = [], string $selected = null, array $options = []) 下拉列表组件(友好)
* @method static string selectpickers(string $name, array $list = [], string $selected = null, array $options = []) 下拉列表组件(友好)(多选)
* @method static string selectpage(string $name, string $value, string $url, string $field = null, string $primaryKey = null, array $options = []) 动态下拉列表组件
* @method static string selectpages(string $name, string $value, string $url, string $field = null, string $primaryKey = null, array $options = []) 动态下拉列表组件(多选)
* @method static string citypicker(string $name, string $value, array $options = []) 城市选择组件
* @method static string switcher(string $name, string $value, array $options = []) 切换组件
* @method static string datepicker(string $name, string $value, array $options = []) 日期选择组件
* @method static string timepicker(string $name, string $value, array $options = []) 时间选择组件
* @method static string datetimepicker(string $name, string $value, array $options = []) 日期时间选择组件
* @method static string daterange(string $name, string $value, array $options = []) 日期区间组件
* @method static string timerange(string $name, string $value, array $options = []) 时间区间组件
* @method static string datetimerange(string $name, string $value, array $options = []) 日期时间区间组件
* @method static string fieldlist(string $name, string $value, string $title = null, string $template = null, array $options = []) 字段列表组件
* @method static string cxselect(string $url, array $names = [], array $values = [], array $options = []) 联动组件
* @method static string selectRange(string $name, string $begin, string $end, string $selected = null, array $options = []) 选择数字区间
* @method static string selectYear(string $name, string $begin, string $end, string $selected = null, array $options = []) 选择年
* @method static string selectMonth(string $name, string $selected = null, array $options = [], string $format = '%m') 选择月
* @method static string checkbox(string $name, string $value = '1', string $checked = null, array $options = []) 单个复选框
* @method static string checkboxs(string $name, array $list = [], string $checked = null, array $options = []) 一组复选框
* @method static string radio(string $name, string $value = null, string $checked = null, array $options = [])) 单个单选框
* @method static string radios(string $name, array $list = [], string $checked = null, array $options = [])) 一组单选框
* @method static string image(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传图片组件
* @method static string images(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传图片组件(多图)
* @method static string upload(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传文件组件
* @method static string uploads(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传文件组件(多文件)
* @method static string button(string $value = null, array $options = []) 表单button
*/
class Form
{

View File

@ -68,13 +68,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
});
});
//当表格分页变更时
table.on('page-change.bs.table', function (e, page, pagesize) {
if (!isNaN(pagesize)) {
localStorage.setItem("pagesize-addon", pagesize);
}
});
Template.helper("Moment", Moment);
Template.helper("addons", Config['addons']);
@ -90,6 +83,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pageSize: 50,
queryParams: function (params) {
var userinfo = Controller.api.userinfo.get();
$.extend(params, {
@ -181,7 +175,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
commonSearch: true,
searchFormVisible: true,
searchFormTemplate: 'searchformtpl',
pageSize: localStorage.getItem('pagesize-addon') || 50,
});
// 为表格绑定事件

View File

@ -11759,7 +11759,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
},
ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
},
pageSize: localStorage.getItem("pagesize") || 10,
pageSize: localStorage.getItem('page-size') || 10,
pageList: [10, 15, 20, 25, 50, 'All'],
pagination: true,
clickToSelect: true, //是否启用点击选中
@ -11923,12 +11923,6 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
table.on('refresh.bs.table', function (e, settings, data) {
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
});
//当表格分页变更时
table.on('page-change.bs.table', function (e, page, pagesize) {
if (!isNaN(pagesize)) {
localStorage.setItem("pagesize", pagesize);
}
});
//当执行搜索时
table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
table.trigger("uncheckbox");
@ -12273,6 +12267,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
Table.list[id] = table;
return table;
},
// 设置全局分页的单页显示数
pageSize: function (pageSize) {
if (!isNaN(pageSize)) {
localStorage.setItem('page-size', pageSize);
}
},
// 批量操作请求
multi: function (action, ids, table, element) {
var options = table.bootstrapTable('getOptions');

View File

@ -11607,7 +11607,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
},
ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
},
pageSize: localStorage.getItem("pagesize") || 10,
pageSize: localStorage.getItem('page-size') || 10,
pageList: [10, 15, 20, 25, 50, 'All'],
pagination: true,
clickToSelect: true, //是否启用点击选中
@ -11771,12 +11771,6 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
table.on('refresh.bs.table', function (e, settings, data) {
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
});
//当表格分页变更时
table.on('page-change.bs.table', function (e, page, pagesize) {
if (!isNaN(pagesize)) {
localStorage.setItem("pagesize", pagesize);
}
});
//当执行搜索时
table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
table.trigger("uncheckbox");
@ -12121,6 +12115,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
Table.list[id] = table;
return table;
},
// 设置全局分页的单页显示数
pageSize: function (pageSize) {
if (!isNaN(pageSize)) {
localStorage.setItem('page-size', pageSize);
}
},
// 批量操作请求
multi: function (action, ids, table, element) {
var options = table.bootstrapTable('getOptions');

View File

@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
},
ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
},
pageSize: localStorage.getItem("pagesize") || 10,
pageSize: localStorage.getItem('page-size') || 10,
pageList: [10, 15, 20, 25, 50, 'All'],
pagination: true,
clickToSelect: true, //是否启用点击选中
@ -190,12 +190,6 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
table.on('refresh.bs.table', function (e, settings, data) {
$(Table.config.refreshbtn, toolbar).find(".fa").addClass("fa-spin");
});
//当表格分页变更时
table.on('page-change.bs.table', function (e, page, pagesize) {
if (!isNaN(pagesize)) {
localStorage.setItem("pagesize", pagesize);
}
});
//当执行搜索时
table.on('search.bs.table common-search.bs.table', function (e, settings, data) {
table.trigger("uncheckbox");
@ -540,6 +534,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
Table.list[id] = table;
return table;
},
// 设置全局分页的单页显示数
pageSize: function (pageSize) {
if (!isNaN(pageSize)) {
localStorage.setItem('page-size', pageSize);
}
},
// 批量操作请求
multi: function (action, ids, table, element) {
var options = table.bootstrapTable('getOptions');

2
think
View File

@ -14,4 +14,4 @@
define('APP_PATH', __DIR__ . '/application/');
// 加载框架引导文件
require './thinkphp/console.php';
require __DIR__ . '/thinkphp/console.php';