diff --git a/app/common.php b/app/common.php index 8ed0106..6f0e5bb 100644 --- a/app/common.php +++ b/app/common.php @@ -205,7 +205,7 @@ function check_auth($rule, $uid) //读取部门列表 function get_department() { - $department = Db::name('Department')->where(['status' => 1])->select()->toArray(); + $department = Db::name('Department')->order('sort desc,id asc')->where(['status' => 1])->select()->toArray(); return $department; } diff --git a/app/install/data/gouguoa.sql b/app/install/data/gouguoa.sql index 5325ac4..14ca144 100644 --- a/app/install/data/gouguoa.sql +++ b/app/install/data/gouguoa.sql @@ -460,6 +460,7 @@ CREATE TABLE `oa_department` ( `pid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级部门id', `leader_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '部门负责人ID', `phone` varchar(60) NOT NULL DEFAULT '' COMMENT '部门联系电话', + `sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序:越大越靠前', `remark` varchar(1000) NULL DEFAULT '' COMMENT '备注', `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态:-1删除 0禁用 1启用', `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间', diff --git a/app/user/controller/Department.php b/app/user/controller/Department.php index 5d836b9..1af3410 100644 --- a/app/user/controller/Department.php +++ b/app/user/controller/Department.php @@ -24,7 +24,7 @@ class Department extends BaseController ->field('d.*,a.name as leader') ->alias('d') ->join('Admin a', 'a.id = d.leader_id', 'LEFT') - ->order('d.id asc') + ->order('d.sort desc,d.id asc') ->select(); return to_assign(0, '', $list); } else { diff --git a/app/user/view/department/add.html b/app/user/view/department/add.html index e8d46cf..6b5b981 100644 --- a/app/user/view/department/add.html +++ b/app/user/view/department/add.html @@ -21,8 +21,12 @@