diff --git a/application/admin/controller/home/MediaMatrix.php b/application/admin/controller/home/MediaMatrix.php new file mode 100644 index 0000000..e60e0b4 --- /dev/null +++ b/application/admin/controller/home/MediaMatrix.php @@ -0,0 +1,71 @@ +model = new \app\admin\model\home\MediaMatrix; + $this->view->assign("showtypeList", $this->model->getShowtypeList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['cate']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('cate')->visible(['name']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/home/MediaMatrixCate.php b/application/admin/controller/home/MediaMatrixCate.php new file mode 100644 index 0000000..29baa4d --- /dev/null +++ b/application/admin/controller/home/MediaMatrixCate.php @@ -0,0 +1,37 @@ +model = new \app\admin\model\home\MediaMatrixCate; + $this->view->assign("statusList", $this->model->getStatusList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + +} diff --git a/application/admin/lang/zh-cn/home/media_matrix.php b/application/admin/lang/zh-cn/home/media_matrix.php new file mode 100644 index 0000000..697fe47 --- /dev/null +++ b/application/admin/lang/zh-cn/home/media_matrix.php @@ -0,0 +1,14 @@ + '类目', + 'Showtype' => '展示类型', + 'Showtype image' => '图片', + 'Title' => '二维码标题', + 'Image' => '展示图', + 'Qrimage' => '二维码图片', + 'Weigh' => '权重', + 'Createtime' => '创建时间', + 'Deletetime' => '删除时间', + 'Cate.name' => '类目名' +]; diff --git a/application/admin/lang/zh-cn/home/media_matrix_cate.php b/application/admin/lang/zh-cn/home/media_matrix_cate.php new file mode 100644 index 0000000..e60f3a6 --- /dev/null +++ b/application/admin/lang/zh-cn/home/media_matrix_cate.php @@ -0,0 +1,14 @@ + '类目名', + 'Status' => '状态', + 'Status 1' => '上架', + 'Set status to 1'=> '设为上架', + 'Status 2' => '下架', + 'Set status to 2'=> '设为下架', + 'Weigh' => '权重', + 'Createtime' => '创建时间', + 'Updatetime' => '修改时间', + 'Deletetime' => '删除时间' +]; diff --git a/application/admin/model/home/MediaMatrix.php b/application/admin/model/home/MediaMatrix.php new file mode 100644 index 0000000..2d1c274 --- /dev/null +++ b/application/admin/model/home/MediaMatrix.php @@ -0,0 +1,64 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getShowtypeList() + { + return ['image' => __('Showtype image')]; + } + + + public function getShowtypeTextAttr($value, $data) + { + $value = $value ?: ($data['showtype'] ?? ''); + $list = $this->getShowtypeList(); + return $list[$value] ?? ''; + } + + + + + public function cate() + { + return $this->belongsTo(MediaMatrixCate::class, 'cate_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/model/home/MediaMatrixCate.php b/application/admin/model/home/MediaMatrixCate.php new file mode 100644 index 0000000..3c763f5 --- /dev/null +++ b/application/admin/model/home/MediaMatrixCate.php @@ -0,0 +1,60 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getStatusList() + { + return ['1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ?: ($data['status'] ?? ''); + $list = $this->getStatusList(); + return $list[$value] ?? ''; + } + + + + +} diff --git a/application/admin/model/home/media/matrix/Cate.php b/application/admin/model/home/media/matrix/Cate.php new file mode 100644 index 0000000..b565563 --- /dev/null +++ b/application/admin/model/home/media/matrix/Cate.php @@ -0,0 +1,12 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/home/MediaMatrixCate.php b/application/admin/validate/home/MediaMatrixCate.php new file mode 100644 index 0000000..1d125ab --- /dev/null +++ b/application/admin/validate/home/MediaMatrixCate.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/home/media_matrix/add.html b/application/admin/view/home/media_matrix/add.html new file mode 100644 index 0000000..5202666 --- /dev/null +++ b/application/admin/view/home/media_matrix/add.html @@ -0,0 +1,67 @@ +
+ +
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      + +
      +
      + +
      diff --git a/application/admin/view/home/media_matrix/edit.html b/application/admin/view/home/media_matrix/edit.html new file mode 100644 index 0000000..6c3090d --- /dev/null +++ b/application/admin/view/home/media_matrix/edit.html @@ -0,0 +1,67 @@ +
      + +
      + +
      + +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + +
      +
      +
      + +
      +
      + +
      + + +
      + +
      +
        +
        +
        +
        + +
        +
        + +
        + + +
        + +
        +
          +
          +
          +
          + +
          + +
          +
          + +
          diff --git a/application/admin/view/home/media_matrix/index.html b/application/admin/view/home/media_matrix/index.html new file mode 100644 index 0000000..fb03764 --- /dev/null +++ b/application/admin/view/home/media_matrix/index.html @@ -0,0 +1,29 @@ +
          + {:build_heading()} + +
          + +
          +
          diff --git a/application/admin/view/home/media_matrix/recyclebin.html b/application/admin/view/home/media_matrix/recyclebin.html new file mode 100644 index 0000000..d8227a0 --- /dev/null +++ b/application/admin/view/home/media_matrix/recyclebin.html @@ -0,0 +1,25 @@ +
          + {:build_heading()} + +
          +
          +
          + +
          + +
          +
          +
          diff --git a/application/admin/view/home/media_matrix_cate/add.html b/application/admin/view/home/media_matrix_cate/add.html new file mode 100644 index 0000000..7fc2e3e --- /dev/null +++ b/application/admin/view/home/media_matrix_cate/add.html @@ -0,0 +1,33 @@ +
          + +
          + +
          + +
          +
          +
          + +
          + +
          + {foreach name="statusList" item="vo"} + + {/foreach} +
          + +
          +
          +
          + +
          + +
          +
          + +
          diff --git a/application/admin/view/home/media_matrix_cate/edit.html b/application/admin/view/home/media_matrix_cate/edit.html new file mode 100644 index 0000000..1b5468d --- /dev/null +++ b/application/admin/view/home/media_matrix_cate/edit.html @@ -0,0 +1,33 @@ +
          + +
          + +
          + +
          +
          +
          + +
          + +
          + {foreach name="statusList" item="vo"} + + {/foreach} +
          + +
          +
          +
          + +
          + +
          +
          + +
          diff --git a/application/admin/view/home/media_matrix_cate/index.html b/application/admin/view/home/media_matrix_cate/index.html new file mode 100644 index 0000000..65a42b0 --- /dev/null +++ b/application/admin/view/home/media_matrix_cate/index.html @@ -0,0 +1,46 @@ +
          + +
          + {:build_heading(null,FALSE)} + +
          + + +
          +
          +
          +
          +
          + + {:__('Add')} + {:__('Edit')} + {:__('Delete')} + + + + + {:__('Recycle bin')} +
          + +
          +
          +
          + +
          +
          +
          diff --git a/application/admin/view/home/media_matrix_cate/recyclebin.html b/application/admin/view/home/media_matrix_cate/recyclebin.html new file mode 100644 index 0000000..55baf45 --- /dev/null +++ b/application/admin/view/home/media_matrix_cate/recyclebin.html @@ -0,0 +1,25 @@ +
          + {:build_heading()} + +
          +
          +
          + +
          + +
          +
          +
          diff --git a/application/api/controller/home/MediaMatrix.php b/application/api/controller/home/MediaMatrix.php new file mode 100644 index 0000000..890d5b3 --- /dev/null +++ b/application/api/controller/home/MediaMatrix.php @@ -0,0 +1,110 @@ +model = new MediaMatrixModel; + + + } + + + + /** + * @ApiTitle(分类) + * @ApiSummary(分类) + * @ApiMethod(GET) + * @ApiParams(name = "page", type = "string",required=true,description = "页数") + * @ApiParams(name = "limit", type = "string",required=true,description = "条数") + * @ApiReturn({ + * + *}) + */ + public function cate() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params=[]; + $page = $this->request->param('page/d', 1); //页数 + $limit = $this->request->param('limit/d', 100); //条数 + +// $params["flag"] = $this->request->param('flag/s', ''); //搜索关键字 +// $params["hot"] = $this->request->param('hot/s', ''); //搜索关键字 +// $params["home"] = $this->request->param('home/s', ''); //搜索关键字 +// $params["isnews"] = $this->request->param('isnews/s', ''); //搜索关键字 + + try{ + //当前申请状态 + $res = MediaMatrixCate::allList($page, $limit,$params); + + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + + + + /** + * @ApiTitle( 媒体矩阵列表) + * @ApiSummary(媒体矩阵列表) + * @ApiMethod(GET) + * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字") + * @ApiParams(name = "page", type = "string",required=true,description = "页数") + * @ApiParams(name = "limit", type = "string",required=true,description = "条数") + * @ApiReturn({ + * + *}) + */ + public function index() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $page = $this->request->param('page/d', 0); //页数 + $limit = $this->request->param('limit/d', 0); //条数 + $keywords = $this->request->param('keywords/s', ''); //搜索关键字 +// $recommend = $this->request->param('recommend/s', ''); //搜索关键字 + $params =[]; + $cate_id = $this->request->param('cate_id/s', ''); //搜索关键字 +// $params["flag"] = $this->request->get('flag/s', ''); //搜索关键字 +// $params["hot"] = $this->request->get('hot/s', ''); //搜索关键字 +// $params["fine"] = $this->request->get('fine/s', ''); //搜索关键字 + + +// $type = $this->request->get('type/s', ''); //筛选学员和教练单 + + + try{ + //当前申请状态 + $res = $this->model::allList($page, $limit,$keywords,$cate_id,$params); +// var_dump($this->model->getLastSql()); + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + + +} \ No newline at end of file diff --git a/application/common/model/home/MediaMatrix.php b/application/common/model/home/MediaMatrix.php new file mode 100644 index 0000000..a172a16 --- /dev/null +++ b/application/common/model/home/MediaMatrix.php @@ -0,0 +1,170 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getShowtypeList() + { + return ['image' => __('Showtype image')]; + } + + + public function getShowtypeTextAttr($value, $data) + { + $value = $value ?: ($data['showtype'] ?? ''); + $list = $this->getShowtypeList(); + return $list[$value] ?? ''; + } + + + + + public function cate() + { + return $this->belongsTo(MediaMatrixCate::class, 'cate_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + + + + + /**得到基础条件 + * @param $status + * @param null $model + * @param string $alisa + */ + public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false) + { + + if (!$model) { + $model = new static; + if ($alisa&&!$with) $model = $model->alias($alisa); + } + if ($alisa) $alisa = $alisa . '.'; + $tableFields = (new static)->getTableFields(); + foreach ($tableFields as $fields) + { + if(in_array($fields, ['cate_id']))continue; +// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + + if (isset($whereData[$fields]) && $whereData[$fields]){ + if(is_array($whereData[$fields])){ + $model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]); + }else{ + $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + } + + } + + + } + + + + if (isset($whereData['keywords'])&&$whereData['keywords']){ + $model = $model->where("{$alisa}title", 'LIKE', "%{$whereData['keywords']}%" ); + } + + + + if (isset($whereData['cate_id'])&&$whereData['cate_id']){ + $model = $model->where("{$alisa}cate_id", 'in', $whereData['cate_id'] ); + } + + + if (isset($whereData['time'])&&$whereData['time']){ + + $model = $model->time(["{$alisa}release_time",$whereData['time']]); + } + +// if (isset($whereData['has_evaluate'])&&$whereData['has_evaluate']){ +// //1查已评价 2查未评价 +// if($whereData['has_evaluate'] == 1){ +// //1查已评价 +// $model = $model->where("{$alisa}classes_evaluate_id", '<>', 0); +// }else{ +// //2查未评价 +// $model = $model->whereExists(function ($query) use ($alisa) { +// $order_table_name = (new \app\common\model\school\classes\hourorder\Order())->getQuery()->getTable(); +// $query->table($order_table_name)->where($order_table_name . '.classes_order_id=' . $alisa . 'id')->where('status', '=', '3'); +// })->where("{$alisa}classes_evaluate_id", '=', 0); +// +// } +// } + + return $model; + } + + + + + + + public static function allList($page, $limit,$keywords,$cate_id=[],$params=[]){ + $with_field = [ + 'cate'=>['name'], + 'base'=>['*'], + ]; + + + $alisa = (new self)->getWithAlisaName(); + $sort = "{$alisa}.weigh desc,{$alisa}.id desc"; + $serch_where = ['cate_id'=>$cate_id,'keywords'=>$keywords]; + + return (new self)->getBaseList(array_merge($serch_where,$params), $page, $limit,$sort,$with_field); + } + + + +} diff --git a/application/common/model/home/MediaMatrixCate.php b/application/common/model/home/MediaMatrixCate.php new file mode 100644 index 0000000..b5d74d7 --- /dev/null +++ b/application/common/model/home/MediaMatrixCate.php @@ -0,0 +1,141 @@ +getPk(); + $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]); + } + }); + } + + + public function getStatusList() + { + return ['1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ?: ($data['status'] ?? ''); + $list = $this->getStatusList(); + return $list[$value] ?? ''; + } + + + + + + /**得到基础条件 + * @param $status + * @param null $model + * @param string $alisa + */ + public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false) + { + + if (!$model) { + $model = new static; + if ($alisa&&!$with) $model = $model->alias($alisa); + } + if ($alisa) $alisa = $alisa . '.'; + $tableFields = (new static)->getTableFields(); + foreach ($tableFields as $fields) + { + if(in_array($fields, []))continue; +// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + + if (isset($whereData[$fields]) && $whereData[$fields]){ + if(is_array($whereData[$fields])){ + $model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]); + }else{ + $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + } + + } + + + } + + + + if (isset($whereData['keywords'])&&$whereData['keywords']){ + $model = $model->where("{$alisa}name", 'LIKE', "%{$whereData['keywords']}%" ); + } + + + + if (isset($whereData['time'])&&$whereData['time']){ + + $model = $model->time(["{$alisa}createtime",$whereData['time']]); + } + +// if (isset($whereData['has_evaluate'])&&$whereData['has_evaluate']){ +// //1查已评价 2查未评价 +// if($whereData['has_evaluate'] == 1){ +// //1查已评价 +// $model = $model->where("{$alisa}classes_evaluate_id", '<>', 0); +// }else{ +// //2查未评价 +// $model = $model->whereExists(function ($query) use ($alisa) { +// $order_table_name = (new \app\common\model\school\classes\hourorder\Order())->getQuery()->getTable(); +// $query->table($order_table_name)->where($order_table_name . '.classes_order_id=' . $alisa . 'id')->where('status', '=', '3'); +// })->where("{$alisa}classes_evaluate_id", '=', 0); +// +// } +// } + + return $model; + } + + + + + + public static function allList($page, $limit,$params=[]){ + + + $sort = "weigh desc,id desc"; + if(!empty($params['status'])){ + $params['status'] = '1'; + } + return (new self)->getBaseList($params, $page, $limit,$sort); + } + + + + + +} diff --git a/public/assets/js/backend/home/media_matrix.js b/public/assets/js/backend/home/media_matrix.js new file mode 100644 index 0000000..c97a912 --- /dev/null +++ b/public/assets/js/backend/home/media_matrix.js @@ -0,0 +1,119 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'home/media_matrix/index' + location.search, + add_url: 'home/media_matrix/add', + edit_url: 'home/media_matrix/edit', + del_url: 'home/media_matrix/del', + multi_url: 'home/media_matrix/multi', + import_url: 'home/media_matrix/import', + table: 'home_media_matrix', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'weigh', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'cate_id', title: __('Cate_id')}, + {field: 'showtype', title: __('Showtype'), searchList: {"image":__('Showtype image')}, formatter: Table.api.formatter.normal}, + {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'qrimage', title: __('Qrimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'weigh', title: __('Weigh'), operate: false}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'cate.name', title: __('Cate.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + recyclebin: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + 'dragsort_url': '' + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: 'home/media_matrix/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'title', title: __('Title'), align: 'left'}, + { + field: 'deletetime', + title: __('Deletetime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'operate', + width: '140px', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + buttons: [ + { + name: 'Restore', + text: __('Restore'), + classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', + icon: 'fa fa-rotate-left', + url: 'home/media_matrix/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'home/media_matrix/destroy', + refresh: true + } + ], + formatter: Table.api.formatter.operate + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/home/media_matrix_cate.js b/public/assets/js/backend/home/media_matrix_cate.js new file mode 100644 index 0000000..3a0b8ad --- /dev/null +++ b/public/assets/js/backend/home/media_matrix_cate.js @@ -0,0 +1,116 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'home/media_matrix_cate/index' + location.search, + add_url: 'home/media_matrix_cate/add', + edit_url: 'home/media_matrix_cate/edit', + del_url: 'home/media_matrix_cate/del', + multi_url: 'home/media_matrix_cate/multi', + import_url: 'home/media_matrix_cate/import', + table: 'home_media_matrix_cate', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'weigh', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, + {field: 'weigh', title: __('Weigh'), operate: false}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + recyclebin: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + 'dragsort_url': '' + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: 'home/media_matrix_cate/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'name', title: __('Name'), align: 'left'}, + { + field: 'deletetime', + title: __('Deletetime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'operate', + width: '140px', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + buttons: [ + { + name: 'Restore', + text: __('Restore'), + classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', + icon: 'fa fa-rotate-left', + url: 'home/media_matrix_cate/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'home/media_matrix_cate/destroy', + refresh: true + } + ], + formatter: Table.api.formatter.operate + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +});