Commit 49374f28 by 汪伟伟

1

parent 066314f5
...@@ -5,8 +5,13 @@ namespace App\Admin\Controllers; ...@@ -5,8 +5,13 @@ namespace App\Admin\Controllers;
use App\Admin\Repositories\Task; use App\Admin\Repositories\Task;
use Dcat\Admin\Form; use Dcat\Admin\Form;
use Dcat\Admin\Grid; use Dcat\Admin\Grid;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Show; use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Layout\Row;
use Illuminate\Http\Request;
class TaskController extends AdminController class TaskController extends AdminController
{ {
...@@ -25,12 +30,13 @@ class TaskController extends AdminController ...@@ -25,12 +30,13 @@ class TaskController extends AdminController
$grid->column('year'); $grid->column('year');
$grid->column('refer'); $grid->column('refer');
$grid->column('guide'); $grid->column('guide');
$grid->column('status'); // $grid->column('status');
$grid->column('created_at'); $grid->column('created_at');
$grid->column('updated_at')->sortable(); $grid->column('updated_at')->sortable();
$grid->filter(function (Grid\Filter $filter) { $grid->filter(function (Grid\Filter $filter) {
$filter->equal('id'); // $filter->equal('id');
$filter->like('name');
}); });
}); });
...@@ -53,7 +59,7 @@ class TaskController extends AdminController ...@@ -53,7 +59,7 @@ class TaskController extends AdminController
$show->field('year'); $show->field('year');
$show->field('refer'); $show->field('refer');
$show->field('guide'); $show->field('guide');
$show->field('status'); // $show->field('status');
$show->field('created_at'); $show->field('created_at');
$show->field('updated_at'); $show->field('updated_at');
}); });
...@@ -66,18 +72,50 @@ class TaskController extends AdminController ...@@ -66,18 +72,50 @@ class TaskController extends AdminController
*/ */
protected function form() protected function form()
{ {
return Form::make(new Task(), function (Form $form) { $data = json_decode(file_get_contents(base_path('app/china_all_area.json')),true);
foreach ($data as $datum){
foreach ($datum as $k=>$d){
$arr[$k]=$d;
}
}
// dd(array_values($data));
return Form::make(new Task(), function (Form $form)use ($arr) {
$form->display('id'); $form->display('id');
$form->text('name'); $form->text('name');
$form->text('level'); $form->select('level')->options([1=>1,2=>2,3=>3,4=>4,5=>5]);
$form->text('area'); $form->multipleSelect('area','选择地区')->options($arr);
$form->text('year'); // $form->distpicker([
$form->text('refer'); // 'province_id' => '省',
$form->text('guide'); // ],'地区');
$form->text('status'); // $form->timeRange('year','year','选择时间');
$form->multipleSelect('year','选择时间')->options(function (){
$year=(int)date('Y');
for ($i=$year;$i>1900;$i--){
$years[$i]=$i;
}
return $years;
});
$form->text('refer','参考信源');
$form->editor('guide','收集指南');
// $form->text('status');
$form->display('created_at'); $form->display('created_at');
$form->display('updated_at'); $form->display('updated_at');
}); });
} }
/**
* 新增数据保存
* @return mixed|void
*/
public function store()
{
$request = \request();
dd($request->input());
}
} }
...@@ -14,4 +14,6 @@ Route::group([ ...@@ -14,4 +14,6 @@ Route::group([
$router->get('/dashboard', 'HomeController@index'); $router->get('/dashboard', 'HomeController@index');
$router->resource('tasks', 'TaskController'); $router->resource('tasks', 'TaskController');
// $router->get('/api/city', 'TaskController@city');
}); });
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
"laravel/tinker": "^2.5", "laravel/tinker": "^2.5",
"mosiboom/dcat-iframe-tab": "^1.2", "mosiboom/dcat-iframe-tab": "^1.2",
"orangehill/iseed": "^3.0", "orangehill/iseed": "^3.0",
"w7corp/easywechat": "~5.0", "super-eggs/dcat-distpicker": "^2.0",
"tymon/jwt-auth": "^1.0.2" "tymon/jwt-auth": "^1.0.2",
"w7corp/easywechat": "~5.0"
}, },
"require-dev": { "require-dev": {
"spatie/laravel-ignition": "^1.0", "spatie/laravel-ignition": "^1.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment