123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkAdmin
- // +----------------------------------------------------------------------
- // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
- // +----------------------------------------------------------------------
- // | 官方网站: http://demo.thinkadmin.top
- // +----------------------------------------------------------------------
- // | 开源协议 ( https://mit-license.org )
- // +----------------------------------------------------------------------
- // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
- // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
- // +----------------------------------------------------------------------
- namespace app\user\controller;
- use app\common\constant\CommonConstant;
- use library\Controller;
- use library\tools\Data;
- /**
- * 部门
- */
- class Department extends Controller
- {
- /**
- * 绑定数据表
- * @var string
- */
- protected $table = 'Department';
- /**
- * 列表
- * @auth true
- * @menu true
- * @throws \think\Exception
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function index()
- {
- $this->title = '部门列表';
- $query = $this->_query($this->table)
- ->field('dept_id as id,name,parent_id as pid')
- ->where('is_deleted',CommonConstant::IS_DELETED_0);
- $query->page(false);
- }
- /**
- * 列表数据处理
- * @param array $data
- * @throws \Exception
- */
- protected function _index_page_filter(&$data)
- {
- if($data) {
- foreach ($data as &$vo) {
- $vo['ids'] = join(',', Data::getArrSubIds($data, $vo['id']));
- }
- $data = Data::arr2table($data);
- }
- }
- }
|