title = '列表'; $query = $this->_query($this->table) ->where('is_deleted',0) ->where('template_id',$template) ->order('id asc')->page(); } /** * 数据列表处理 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ protected function _index_page_filter(&$data) { } /** * 添加 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function add() { $this->title = '添加'; $this->_form($this->table, 'form'); } /** * 编辑 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function edit() { $this->title = '编辑'; $this->_form($this->table, 'form'); } /** * 表单数据处理 * @param array $vo * @throws \ReflectionException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ protected function _form_filter(&$vo) { if($this->request->isGet()) { $this->param_set = !empty($vo['extend']) ? json_decode($vo['extend'],true) : [['title'=>'']]; } if($this->request->isPost()) { list($post,$item_arr) = [$this->request->post(),[]]; foreach ($post['item_title'] as $v) { $item_arr[] = [ 'item_title'=>$v, 'value'=>0, ]; } $vo['extend'] = $vo['type'] == 3 ? json_encode($item_arr) : null; } } /** * 启用 * @auth true * @menu true * @throws \think\Exception * @throws \think\exception\PDOException */ public function resume() { $this->_save($this->table, ['status' => '1']); } /** * 禁用 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function forbid() { $this->_save($this->table, ['status' => '0']); } /** * 删除 * @auth true * @menu true * @throws \think\Exception * @throws \think\exception\PDOException */ public function remove() { $this->_save($this->table, ['is_deleted' => 1]); } }