update autocomplete choose staff
This commit is contained in:
@@ -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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user