diff --git a/controllers/ApiController.php b/controllers/ApiController.php index eb3137d7..78166b18 100644 --- a/controllers/ApiController.php +++ b/controllers/ApiController.php @@ -159,7 +159,7 @@ class ApiController extends Controller { } public function actionResetData() { - return file_get_contents("https://bischool.beetai.com/view/image/5f7c1b22dfe5aaf427a6dfa1"); +// return file_get_contents("https://bischool.beetai.com/view/image/5f7c1b22dfe5aaf427a6dfa1"); \Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute(); \Yii::$app->db->createCommand()->truncateTable('list_management')->execute(); } diff --git a/controllers/CaptureLogsController.php b/controllers/CaptureLogsController.php index 731c2f9b..f3c67cb9 100644 --- a/controllers/CaptureLogsController.php +++ b/controllers/CaptureLogsController.php @@ -8,6 +8,7 @@ use app\models\CaptureLogsSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; +use app\models\ListManagement; /** * CaptureLogsController implements the CRUD actions for CaptureLogs model. @@ -43,17 +44,17 @@ class CaptureLogsController extends Controller { $dataProvider->query->andWhere(["BETWEEN", "capture_logs.time", $f, $t]); $dataProvider->query->orderBy(["time" => SORT_DESC]); - $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([ - 'http' => [ - 'header' => "Content-Type: application/json", - 'method' => "POST" - ] - ])), true); - $data = json_decode($tempConfig['data'], true); - $last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one(); - if (!is_object($last)) - $last = (object) ['id' => 0]; - $idAuto = $data['data']['box_id'] . "_" . ($last->id + 1); +// $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([ +// 'http' => [ +// 'header' => "Content-Type: application/json", +// 'method' => "POST" +// ] +// ])), true); +// $data = json_decode($tempConfig['data'], true); +// $last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one(); +// if (!is_object($last)) +// $last = (object) ['id' => 0]; +// $idAuto = $data['data']['box_id'] . "_" . ($last->id + 1); return $this->render('index', [ 'searchModel' => $searchModel, @@ -61,7 +62,8 @@ class CaptureLogsController extends Controller { 'statusArray' => CaptureLogs::$statusArray, 'f' => $f, 't' => $t, - 'idAuto' => $idAuto +// 'idAuto' => $idAuto, + "staffArray" => ListManagement::staffArray() ]); } diff --git a/controllers/ListManagementController.php b/controllers/ListManagementController.php index 3882d43a..40f4155b 100644 --- a/controllers/ListManagementController.php +++ b/controllers/ListManagementController.php @@ -50,17 +50,17 @@ class ListManagementController extends Controller { $dataProvider->query->andWhere(["gender" => $gender]); $dataProvider->query->orderBy(["time" => SORT_DESC]); - $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([ - 'http' => [ - 'header' => "Content-Type: application/json", - 'method' => "POST" - ] - ])), true); - $data = json_decode($tempConfig['data'], true); - $last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one(); - if (!is_object($last)) - $last = (object) ['id' => 0]; - $idAuto = $data['data']['box_id'] . "_" . ($last->id + 1); +// $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([ +// 'http' => [ +// 'header' => "Content-Type: application/json", +// 'method' => "POST" +// ] +// ])), true); +// $data = json_decode($tempConfig['data'], true); +// $last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one(); +// if (!is_object($last)) +// $last = (object) ['id' => 0]; +// $idAuto = $data['data']['box_id'] . "_" . ($last->id + 1); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -68,7 +68,8 @@ class ListManagementController extends Controller { 't' => $t, 'typeArray' => ListManagement::$typeArray, 'genderArray' => ListManagement::$genderArray, - 'idAuto' => $idAuto +// 'idAuto' => $idAuto, + "staffArray" => ListManagement::staffArray() ]); } @@ -382,7 +383,7 @@ class ListManagementController extends Controller { 'type' => "wl", 'name' => $data['name'], 'image' => json_encode($ft), - 'gender' => "", + 'gender' => "Male", 'birthday' => "", 'telephone' => "", 'address' => $data['department'] @@ -451,4 +452,19 @@ class ListManagementController extends Controller { } } + public function actionChooseStaff() { + if (Yii::$app->request->post()) { + $post = Yii::$app->request->post(); + $staff = ListManagement::findOne(['code' => $post['code']]); + Yii::$app->response->format = "json"; + return [ + "name" => $staff->name, + "gender" => $staff->gender, + "birthday" => date("d/m/Y", $staff->birthday), + "telephone" => $staff->telephone, + "department" => $staff->address + ]; + } + } + } diff --git a/models/ListManagement.php b/models/ListManagement.php index 85549cf0..266b5e11 100644 --- a/models/ListManagement.php +++ b/models/ListManagement.php @@ -107,4 +107,13 @@ class ListManagement extends \yii\db\ActiveRecord { return $res; } + public static function staffArray() { + $res = []; + $ls = self::find()->all(); + foreach ($ls as $key => $value) { + $res[$value->code] = $value->code . " - " . $value->name; + } + return $res; + } + } diff --git a/views/capture-logs/index.tpl b/views/capture-logs/index.tpl index bd376099..06c93831 100644 --- a/views/capture-logs/index.tpl +++ b/views/capture-logs/index.tpl @@ -14,6 +14,12 @@ .table-striped > tbody > tr:nth-of-type(odd){ background-color: rgb(210, 210, 210); } + .select2-container { + width: 100% !important; + } + .select2-container--default .select2-selection--single, .select2-selection .select2-selection--single{ + border-color: green; + }