diff --git a/app/Admin/Actions/Grid/GoodsCopy.php b/app/Admin/Actions/Grid/v3/GoodsCopy.php similarity index 87% rename from app/Admin/Actions/Grid/GoodsCopy.php rename to app/Admin/Actions/Grid/v3/GoodsCopy.php index 00be8b5..21234ed 100644 --- a/app/Admin/Actions/Grid/GoodsCopy.php +++ b/app/Admin/Actions/Grid/v3/GoodsCopy.php @@ -1,10 +1,10 @@ column('id')->sortable(); + $grid->column('market_id'); + $grid->column('user_id')->display(function($userId){ + $item = UserModel::getUserInfo($userId,'real_name'); + return empty($item) ? '' : $$item['real_name']; + }); + $grid->column('store_id')->display(function($storeId){ + $item = StoreModel::getStoreInfo($storeId,'real_name'); + return empty($item) ? '' : $$item['real_name']; + }); + + $grid->column('role')->display(function($role){ + return $role; + }); + $grid->column('status')->select(EmployeesModel::$_STATUS); + + $grid->filter(function (Grid\Filter $filter) { + $filter->equal('id'); + + }); + $grid->model()->orderBy('id','desc'); + // 每页10条 + $grid->paginate(10); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return Show::make($id, new LanzuEmployees(), function (Show $show) { + $show->field('id'); + $show->field('user_id'); + $show->field('store_id'); + $show->field('market_id'); + $show->field('role'); + $show->field('status'); + $show->field('note'); + $show->field('created_at'); + $show->field('updated_at'); + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new LanzuEmployees(), function (Form $form) { + $form->display('id'); + $form->text('user_id'); + $form->text('store_id'); + $form->text('market_id'); + $form->text('role'); + $form->text('status'); + $form->text('note'); + + $form->display('created_at'); + $form->display('updated_at'); + }); + } +} diff --git a/app/Admin/Controllers/v3/StoreController.php b/app/Admin/Controllers/v3/StoreController.php index ccff02c..95e9c26 100644 --- a/app/Admin/Controllers/v3/StoreController.php +++ b/app/Admin/Controllers/v3/StoreController.php @@ -27,14 +27,19 @@ class StoreController extends AdminController protected function grid() { return Grid::make(new Store(), function (Grid $grid) { + // 查询市场 + $marketList = MarketModel::getMarketArray(); + // 查询一级分类 + // $categoryList = CategoryModel::getArray([['parent_id','=',0]]); + $grid->model()->orderBy('id','desc'); $grid->id->sortable(); $grid->logo_url->image('',50); $grid->name; - $grid->market_id->display(function ($marketId){ - $market = MarketModel::getMarketInfo($marketId,'name'); - return empty($market) ? '' : $market->name; + $grid->market_id->display(function ($marketId) use($marketList){ + // $market = MarketModel::getMarketInfo($marketId,'name'); + return isset($marketList[$marketId]) ? $marketList[$marketId] : ''; }); $grid->mm_user_id->display(function ($mmUserId){ $mmUser = MminfoModel::getMmInfo($mmUserId,'name'); @@ -65,9 +70,10 @@ class StoreController extends AdminController $grid->actions([new StoreSetTime()]); // 搜索 - $grid->filter(function (Grid\Filter $filter) { + $grid->filter(function (Grid\Filter $filter) use($marketList){ $filter->equal('id'); $filter->like('name'); + $filter->equal('market_id')->select($marketList); }); // 每页10条 diff --git a/app/Admin/Forms/GoodsNewCopyForm.php b/app/Admin/Forms/GoodsNewCopyForm.php index 8ca431c..6fda924 100644 --- a/app/Admin/Forms/GoodsNewCopyForm.php +++ b/app/Admin/Forms/GoodsNewCopyForm.php @@ -73,10 +73,12 @@ class GoodsNewCopyForm extends Form ]; GoodsBannerModel::insert($banners); } + }else{ + return $this->error('修改失败'); }; } - return $this->success('修改成功', '/goods'); + return $this->error('修改成功'); } /** diff --git a/app/Admin/Forms/CategoryTieForm.php b/app/Admin/Forms/v3/CategoryTieForm.php similarity index 98% rename from app/Admin/Forms/CategoryTieForm.php rename to app/Admin/Forms/v3/CategoryTieForm.php index 9db8732..535c308 100644 --- a/app/Admin/Forms/CategoryTieForm.php +++ b/app/Admin/Forms/v3/CategoryTieForm.php @@ -1,6 +1,6 @@ resource('/order', 'ImsCjdcOrderMainController'); $router->any('/detail', 'ImsCjdcOrderMainController@orderDetail'); - $router->resource('/horseman', 'LanzuServiceHorsemanController'); $router->any('ops/files', 'v3\FileController@handle'); - // 服务站专员 + // 服务人员 $router->resource('/service_personnel', 'v3\ServicePersonnelController'); + $router->resource('/horseman', 'LanzuServiceHorsemanController'); + + // 懒族员工 + $router->resource('/employees', 'v3\LanzuEmployeesController'); + }); diff --git a/app/Models/v3/LanzuEmployees.php b/app/Models/v3/LanzuEmployees.php new file mode 100644 index 0000000..6736577 --- /dev/null +++ b/app/Models/v3/LanzuEmployees.php @@ -0,0 +1,70 @@ +'离职',0=>'禁用',1=>'正常']; + + protected $appends = [ + 'is_rest_text', + 'is_open_text' + ]; + + public function getTypeTextAttribute($value) + { + $value = $value ? $value : $this->type; + return isset(self::$_TYPE[$value]) ? self::$_TYPE[$value] : ''; + } + public function getIsRestTextAttribute($value) + { + $value = $value ? $value : $this->status; + return isset(self::$_STATUS[$value]) ? self::$_STATUS[$value] : ''; + } + + /** + * 根据id获取单条信息 + * @param int $id + * @param string $field + * @return string + */ + public static function getInfo($id,$field = '*') + { + return self::select($field)->find($id); + } + + /** + * 获取数组 + * id为键 + * @return array + */ + public static function getArray($where = [], $options = []) + { + $model = self::whereNull('deleted_at'); + + if(!empty($where)){ + $model->where($where); + } + $list = $model->pluck('id','user_id')->toArray(); + if(!empty($options)){ + $new = array_merge($options,$list); + return array_flip($new); + }else{ + return array_flip($list); + } + } +} diff --git a/resources/lang/zh-CN/lanzu-employees.php b/resources/lang/zh-CN/lanzu-employees.php new file mode 100644 index 0000000..257958e --- /dev/null +++ b/resources/lang/zh-CN/lanzu-employees.php @@ -0,0 +1,18 @@ + [ + 'LanzuEmployees' => '懒族员工', + 'lanzuEmployees' => '懒族员工', + 'lanzu_employees' => '懒族员工', + ], + 'fields' => [ + 'user_id' => '用户懒ID', + 'store_id' => '店铺', + 'market_id' => '服务站ID', + 'role' => '用户角色', + 'status' => '状态', + 'note' => '备注', + ], + 'options' => [ + ], +];