From a57039f7d0773b7dec99fe2c5d53151bf1b2dad8 Mon Sep 17 00:00:00 2001 From: dongpd Date: Wed, 4 Nov 2020 16:35:39 +0700 Subject: [PATCH] =?UTF-8?q?update=20g=C3=A1n=20l=E1=BB=8Bch=20tr=C3=ACnh?= =?UTF-8?q?=20to=C3=A0n=20b=E1=BB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/params.php | 2 +- config/web.php | 2 +- controllers/AssignController.php | 10 ++++++++-- helpers/StaffGrid.php | 2 +- views/assign/index.tpl | 3 ++- web/js/assign.js | 4 +++- widgets/views/schedule-department.tpl | 2 +- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/config/params.php b/config/params.php index 035dbe6c..0f4d50fc 100644 --- a/config/params.php +++ b/config/params.php @@ -3,7 +3,7 @@ return [ "hideInfomation" => false, "TCTECH" => true, - "CardService" => "192.168.1.245:2001", + "CardService" => "192.168.10.200:2001", "time" => 1606755599, "pageSize" => 200 ]; diff --git a/config/web.php b/config/web.php index fc91d476..16d5c29b 100644 --- a/config/web.php +++ b/config/web.php @@ -48,7 +48,7 @@ $config = [ ], 'assetManager' => [ 'class' => 'app\\components\\AssetManager', - 'appendVersion' => '1.0.3', + 'appendVersion' => '1.0.5', 'bundles' => [ 'dmstr\web\AdminLteAsset' => [ 'skin' => 'skin-blue', diff --git a/controllers/AssignController.php b/controllers/AssignController.php index 03f938f7..28c98dc0 100644 --- a/controllers/AssignController.php +++ b/controllers/AssignController.php @@ -78,7 +78,7 @@ class AssignController extends Controller { $searchModel = new StaffSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->query->andFilterWhere(['OR', ["LIKE", "name", $post['key']], ["LIKE", "code", $post['key']]]); - $dataProvider->pagination->pageSize = 200; + $dataProvider->pagination->pageSize = Yii::$app->params["pageSize"]; return $this->renderAjax("staff", [ 'searchModel' => $searchModel, @@ -93,7 +93,13 @@ class AssignController extends Controller { public function actionSetSchedule() { if (Yii::$app->request->post()) { $post = Yii::$app->request->post(); - $lists = Staff::find()->andWhere(["IN", "id", $post["staffs"]])->all(); + if ($post['currentDepartment'] !== "" && count($post["staffs"]) >= Yii::$app->params["pageSize"]) { + $model = new Department(); + $childs = $model->departmentChilds($post["currentDepartment"]); + $lists = Staff::find()->andWhere(["IN", "department_id", $childs])->all(); + } else { + $lists = Staff::find()->andWhere(["IN", "id", $post["staffs"]])->all(); + } foreach ($lists as $key => $value) { $value->schedule_id = $post["schedule"]; if ($value->door_access !== json_encode($post["doors"])) { diff --git a/helpers/StaffGrid.php b/helpers/StaffGrid.php index 3fdd25f1..1f16d3fa 100644 --- a/helpers/StaffGrid.php +++ b/helpers/StaffGrid.php @@ -93,7 +93,7 @@ class StaffGrid extends CommonGrid { if (isset($array[$value])) $doors[] = $array[$value]; } - if (count($ls) <= 2) { + if (count($doors) <= 2) { $alert = "
" . implode("
", $doors) . "
"; } else { $alert = "
" . $doors[0] . "
" . $doors[1] . "
Xem thêm
"; diff --git a/views/assign/index.tpl b/views/assign/index.tpl index b7c11b38..e0369f16 100644 --- a/views/assign/index.tpl +++ b/views/assign/index.tpl @@ -36,6 +36,7 @@ padding: 10px; } +
@@ -43,7 +44,7 @@ Chọn phòng ban
- 1])}'> + 1])}'> {$company->name} {$staff=$company->countStaff} {if $staff>0} diff --git a/web/js/assign.js b/web/js/assign.js index 912cdd20..293ca3b1 100644 --- a/web/js/assign.js +++ b/web/js/assign.js @@ -22,6 +22,7 @@ schedule.chooseDepartment = function (e) { type: 'POST', success: function (data) { common.modalBlock(false); + $("input[name='currentDepartment']").val($(e).attr("data")); $("#schedule-search-staff").html(data); $(".department-schedule").removeClass("department-schedule-active"); $(e).addClass("department-schedule-active"); @@ -85,7 +86,8 @@ schedule.setSchedule = function (e) { data: { schedule: $("select[name='ScheduleLists']").val(), doors: doors, - staffs: staffs + staffs: staffs, + currentDepartment: $("input[name='currentDepartment']").val() }, success: function (data) { common.modalBlock(false); diff --git a/widgets/views/schedule-department.tpl b/widgets/views/schedule-department.tpl index f4f7a406..2beb2efe 100644 --- a/widgets/views/schedule-department.tpl +++ b/widgets/views/schedule-department.tpl @@ -1,7 +1,7 @@ {foreach from=$lists item=l}
- $l->code])}'> + $l->code])}'> {$l->name} {$staff=$l->countStaff} {if $staff>0}