以API模塊分組管理為例
~~~
<?php
namespace app\api\admin;
use app\testing\admin\Base;
class ApiGroup extends Base
{
/**
* 分組列表
* 2017-12-7 下午9:50:09
* qw_xingzhe <qwei2013@gmail.com>
*/
public function index()
{
$list = DBuilder('ApiGroup')->quickEdit() // 允許快虛編輯
->filter([ // 設置過濾字段
['keyword','%%','title|simp_desc'],
])
->rememberUri() // 記住當前頁面地址,當下一個頁面操作后需要跳轉上一個頁面時,將使用此地址
->setOrder('id desc') // 指定排序規則
->getLists(); // 指定查詢條件,獲取列表結果
return TBuilder('table')->setRowList($list) // 設置表格數據
->addFilters([ // 添加文本輸入篩選篩選
['keyword|input','請輸入關鍵詞'],
])
->addTopButton([
'type' => 'add',
'popup' => true,
'attr' => ['modal-wh'=>'480|300'],
])
->addTopButton([
'type' => 'del',
])
->setColumns([ // 批量設置數據列
['id', 'ID'],
['title.text', '名稱'],
['simp_desc.textarea', '描述'],
['', '操作', ['type'=>'btn']]
])
->addListButton([
'type' => 'edit',
'popup' => true,
'attr' => ['modal-wh'=>'480|300'],
])
->addListButton([
'type' => 'del',
])
->fetch();
}
/**
* 編輯分組
* 2017-12-7 下午8:25:12
* qw_xingzhe <qwei2013@gmail.com>
*/
public function edit($id)
{
return $this->add( $id );
}
/**
* 新增分組
* 2017-12-7 下午8:25:05
* qw_xingzhe <qwei2013@gmail.com>
*/
public function add( $id=0 )
{
$info = DBuilder('ApiGroup')->setEdit()->getInfo( $id );
return TBuilder('form',$this) ->addWidgets([
['title|text', '分組名稱|分組名稱必須'],
['simp_desc|textarea', '描述'],
['id|hidden'],
])
->hideWidgetsDesc()
->setWidgetsValues( $info )
->fetch();
}
/**
* 刪除分組
* 2017-12-7 下午9:45:14
* qw_xingzhe <qwei2013@gmail.com>
*/
public function del($id){
// 物理刪除
// DBuilder('ApiGroup')->deleteTrue($id);
// 邏輯刪除
DBuilder('ApiGroup')->deleteSoft($id);
}
}
~~~
- 序言
- 環境搭建
- 下載及安裝
- 構建器
- 構建器概述
- 模版構建器(TBuilder)
- Tab組件
- Topbar組件
- 按鈕
- 頂部按鈕配置
- 按鈕配置明細
- 表格(table)
- Table案例
- 「方法」加載數據
- 「方法」設置數據列
- 「方法」列排序
- 「組件」檢索過濾器
- 「組件」頂部按鈕
- 「組件」列表按鈕
- 「配置」列快速編輯
- 「配置」列附加內容
- 「配置」顯隱列表復選框
- 「配置」自定義樣式
- 表單(form)
- Form案例
- 「方法」添加組件(addWidgets)
- 「方法」數據檢索過濾(filter)
- 「組件」富文本編輯器(kindeditor|editormd)
- 「組件」圖片組件(images|cropper)
- 「組件」select listbox組件(listbox)
- 「組件」顏色選擇器(button_color)
- 「組件」自定義內容
- 「配置」顯隱字段關聯(open_by)
- 「配置」form布局(layoutView)
- 「配置」隱藏描述區(hideWidgetsDesc)
- 「配置」數據驗證(validate)
- 「配置」隱藏表單底部按鈕(hideFormButton)
- 「配置」字段tip提示(tip)
- 自定義頁面(custom)
- Custom案例
- 「組件」echart
- 「組件」Tile Widgets
- 「配置」custom布局
- 「配置」自定義html內容
- 「配置」自定義提醒頁面
- 樹形(tree)
- Tree案例
- 左側菜單區配置
- 關閉左側菜單(hideLeftMenu)
- 頂部按鈕配置
- 自定義菜單配置
- 展現方式配置
- 表內增刪改(Tabullet)
- 通用設置
- 依賴文件加載(插件/js/css)
- 指定布局/模版
- 內容定位欄(setTrayMenu)
- 設置內容區側欄
- 模態框打開頁面
- 組件構建器(TWidget)
- echarts
- table
- form組件
- Tabs組件
- builder構建
- titleLine
- 數據構建器(DBuilder)
- 概述(案例)
- 「方法」獲取單條記錄詳情
- 「方法」獲取分頁列表數據
- 「方法」排序
- 「方法」設置查詢字段
- 「方法」快速編輯
- 「方法」數據導出
- 「方法」聯表查詢
- 「方法」查詢數據再處理
- 「配置」回調處理
- 「配置」設置過濾字段
- 「配置」指定過濾字段匹配值
- 「配置」增加編輯支持
- 「配置」查詢出全部數據
- 輔助類
- Excle
- 模塊開發
- 插件開發
- 擴展
- 行為擴展
- 行為日志
- 雜項
- 圖片異步加載
- jquery插件zeroModal
- 提示
- form表單驗證
- ajax相關
- 展開收起
- 常用函數
- 其他插件
- DEMO
- 增刪改查
- 安全
- XSS 攻擊
- 注入攻擊
- CSRF 攻擊
- 其他攻擊和漏洞
- 開發
- TBuilder組件開發
- 更新日志
- 關于文檔