update gán lịch trình toàn bộ

This commit is contained in:
dongpd 2020-11-04 16:35:39 +07:00
parent fe639c34fc
commit a57039f7d0
7 changed files with 17 additions and 8 deletions

View File

@ -3,7 +3,7 @@
return [ return [
"hideInfomation" => false, "hideInfomation" => false,
"TCTECH" => true, "TCTECH" => true,
"CardService" => "192.168.1.245:2001", "CardService" => "192.168.10.200:2001",
"time" => 1606755599, "time" => 1606755599,
"pageSize" => 200 "pageSize" => 200
]; ];

View File

@ -48,7 +48,7 @@ $config = [
], ],
'assetManager' => [ 'assetManager' => [
'class' => 'app\\components\\AssetManager', 'class' => 'app\\components\\AssetManager',
'appendVersion' => '1.0.3', 'appendVersion' => '1.0.5',
'bundles' => [ 'bundles' => [
'dmstr\web\AdminLteAsset' => [ 'dmstr\web\AdminLteAsset' => [
'skin' => 'skin-blue', 'skin' => 'skin-blue',

View File

@ -78,7 +78,7 @@ class AssignController extends Controller {
$searchModel = new StaffSearch(); $searchModel = new StaffSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$dataProvider->query->andFilterWhere(['OR', ["LIKE", "name", $post['key']], ["LIKE", "code", $post['key']]]); $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", [ return $this->renderAjax("staff", [
'searchModel' => $searchModel, 'searchModel' => $searchModel,
@ -93,7 +93,13 @@ class AssignController extends Controller {
public function actionSetSchedule() { public function actionSetSchedule() {
if (Yii::$app->request->post()) { if (Yii::$app->request->post()) {
$post = Yii::$app->request->post(); $post = Yii::$app->request->post();
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(); $lists = Staff::find()->andWhere(["IN", "id", $post["staffs"]])->all();
}
foreach ($lists as $key => $value) { foreach ($lists as $key => $value) {
$value->schedule_id = $post["schedule"]; $value->schedule_id = $post["schedule"];
if ($value->door_access !== json_encode($post["doors"])) { if ($value->door_access !== json_encode($post["doors"])) {

View File

@ -93,7 +93,7 @@ class StaffGrid extends CommonGrid {
if (isset($array[$value])) if (isset($array[$value]))
$doors[] = $array[$value]; $doors[] = $array[$value];
} }
if (count($ls) <= 2) { if (count($doors) <= 2) {
$alert = "<div id='short-{$model->id}'>" . implode("<br>", $doors) . "</div>"; $alert = "<div id='short-{$model->id}'>" . implode("<br>", $doors) . "</div>";
} else { } else {
$alert = "<div id='short-{$model->id}'>" . $doors[0] . "<br>" . $doors[1] . "<br><a href='#' onclick='openDoorList(this, true);return false;' data='{$model->id}'><i class='fa fa-chevron-down'></i> Xem thêm</a></div>"; $alert = "<div id='short-{$model->id}'>" . $doors[0] . "<br>" . $doors[1] . "<br><a href='#' onclick='openDoorList(this, true);return false;' data='{$model->id}'><i class='fa fa-chevron-down'></i> Xem thêm</a></div>";

View File

@ -36,6 +36,7 @@
padding: 10px; padding: 10px;
} }
</style> </style>
<input type="hidden" value="" name="currentDepartment">
<div class="assign-index"> <div class="assign-index">
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
@ -43,7 +44,7 @@
<legend>Chọn phòng ban</legend> <legend>Chọn phòng ban</legend>
<div style="cursor: pointer;"> <div style="cursor: pointer;">
<i class="fa fa-minus-square-o" onclick="schedule.tree(this);" data="1" data-stt="true"></i> <i class="fa fa-minus-square-o" onclick="schedule.tree(this);" data="1" data-stt="true"></i>
<b class="department-schedule" onclick="schedule.chooseDepartment(this);" data-href='{yii\helpers\Url::to(['/assign/staff','id'=> 1])}'> <b class="department-schedule" onclick="schedule.chooseDepartment(this);" data="1" data-href='{yii\helpers\Url::to(['/assign/staff','id'=> 1])}'>
{$company->name} {$company->name}
{$staff=$company->countStaff} {$staff=$company->countStaff}
{if $staff>0} {if $staff>0}

View File

@ -22,6 +22,7 @@ schedule.chooseDepartment = function (e) {
type: 'POST', type: 'POST',
success: function (data) { success: function (data) {
common.modalBlock(false); common.modalBlock(false);
$("input[name='currentDepartment']").val($(e).attr("data"));
$("#schedule-search-staff").html(data); $("#schedule-search-staff").html(data);
$(".department-schedule").removeClass("department-schedule-active"); $(".department-schedule").removeClass("department-schedule-active");
$(e).addClass("department-schedule-active"); $(e).addClass("department-schedule-active");
@ -85,7 +86,8 @@ schedule.setSchedule = function (e) {
data: { data: {
schedule: $("select[name='ScheduleLists']").val(), schedule: $("select[name='ScheduleLists']").val(),
doors: doors, doors: doors,
staffs: staffs staffs: staffs,
currentDepartment: $("input[name='currentDepartment']").val()
}, },
success: function (data) { success: function (data) {
common.modalBlock(false); common.modalBlock(false);

View File

@ -1,7 +1,7 @@
{foreach from=$lists item=l} {foreach from=$lists item=l}
<div style="cursor: pointer;"> <div style="cursor: pointer;">
<i class="fa fa-minus-square-o" onclick="schedule.tree(this);" data="{$l->code}" data-stt="true"></i> <i class="fa fa-minus-square-o" onclick="schedule.tree(this);" data="{$l->code}" data-stt="true"></i>
<span class="department-schedule" onclick="schedule.chooseDepartment(this);" data-href='{yii\helpers\Url::to(['/assign/staff','id'=>$l->code])}'> <span class="department-schedule" onclick="schedule.chooseDepartment(this);" data="{$l->code}" data-href='{yii\helpers\Url::to(['/assign/staff','id'=>$l->code])}'>
{$l->name} {$l->name}
{$staff=$l->countStaff} {$staff=$l->countStaff}
{if $staff>0} {if $staff>0}