From f0dfa7c5a0a19b60cbd832ebe10fa57a9686b0af Mon Sep 17 00:00:00 2001 From: lemon <15040771@qq.com> Date: Wed, 8 Sep 2021 20:34:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=9C=B0=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/WorkorderController.php | 5 +- .../Controllers/WorkorderController.php | 242 ++++++++++++++++++ app/AdminGuide/routes.php | 8 + .../Controllers/WorkorderController.php | 15 +- .../views/admin/pages/guide-index.blade.php | 241 +++++++++++++++++ 5 files changed, 501 insertions(+), 10 deletions(-) create mode 100755 app/AdminGuide/Controllers/WorkorderController.php create mode 100644 resources/views/admin/pages/guide-index.blade.php diff --git a/app/AdminAgent/Controllers/WorkorderController.php b/app/AdminAgent/Controllers/WorkorderController.php index 0999571..c1dedfa 100755 --- a/app/AdminAgent/Controllers/WorkorderController.php +++ b/app/AdminAgent/Controllers/WorkorderController.php @@ -33,7 +33,10 @@ class WorkorderController extends AdminController $workorder = \App\Models\Workorder::query() ->with(['point','publisher']) ->where(['publisher_id' => Admin::user()->id,'publisher_type' => DemandTraits::$col[0]]) - ->orWhere(['point_id' => Admin::user()->id,'point_type' => DemandTraits::$col[0]]) + ->orWhere(function ($query) { + $query->where('point_id',Admin::user()->id) + ->where('point_type',DemandTraits::$col[0]); + }) ->orderByDesc('updated_at') ->get(); diff --git a/app/AdminGuide/Controllers/WorkorderController.php b/app/AdminGuide/Controllers/WorkorderController.php new file mode 100755 index 0000000..af59d57 --- /dev/null +++ b/app/AdminGuide/Controllers/WorkorderController.php @@ -0,0 +1,242 @@ +with(['point','publisher']) + ->where(['publisher_id' => Admin::user()->id,'publisher_type' => DemandTraits::$col[2]]) + ->orWhere(function ($query) { + $query->where('point_id',Admin::user()->id) + ->where('point_type',DemandTraits::$col[2]); + }) + ->orderByDesc('updated_at') + ->get(); + foreach ($workorder as $v) { + $item = WorkorderItem::query()->where('workorder_id',$v->id)->orderByDesc('updated_at')->first(); + $arr = [ + 'workorder_id' => $v->id, + 'unread' => true, + 'avatar' => $v->publisher_type == DemandTraits::$col[2] ? $v->point->avatar : $v->publisher->avatar, + 'name' => $v->publisher_type == DemandTraits::$col[2] ? $v->point->name : $v->publisher->name, + 'content' => $v->title, + 'last_message' => $item ? ($item->type == 1 ? $item->content : '【 图片 】') : '', + 'last_message_time' => $item->created_at ?? '', + ]; + $userList [] = $arr; + } + + $workorderItem = WorkorderItem::query() + ->with(['publisher']) + ->where('workorder_id',$workorderId) + ->get(); + + foreach ($workorderItem as $v) { + $arr = [ + 'type' => $v->publisher_type == DemandTraits::$col[2] ? 'my' : 'op', + 'it_type' => $v->type, + 'avatar' => $v->publisher->avatar, + 'name' => $v->publisher->name, + 'content' => $v->content, + ]; + $msgList [] = $arr; + } + + $data = [ + 'user_list' => $userList, + 'msg_list' => $msgList, + 'user' => Admin::user(), + 'workorder' => [ + 'workorder_id' => $workorderId + ], + ]; + + return $content + ->header('工单') + ->description('列表') + ->body(admin_view('admin.pages.supplier-index',$data)); + } + + ///** + // * Make a grid builder. + // * + // * @return Grid + // */ + //protected function grid() + //{ + // return Grid::make(new Workorder(['publisher','point']), function (Grid $grid) { + // $grid->model() + // ->where(['publisher_id' => Admin::user()->id,'publisher_type' => DemandTraits::$col[2]]) + // ->orWhere(['point_id' => Admin::user()->id,'point_type' => DemandTraits::$col[2]]); + // $grid->column('id')->sortable(); + // $grid->column('title'); + // $grid->column('content_modal','内容')->modal('详情',function ($modal) { + // $modal->xl(); + // return $this->content; + // }); + // $grid->column('publisher_type')->using(DemandTraits::$polymorphic); + // $grid->column('publisher.name','发布人'); + // $grid->column('point_type')->using(DemandTraits::$polymorphic); + // $grid->column('point.name','接收人'); + // $grid->column('status') + // ->using(WorkorderTraits::$stateText) + // ->dot( + // [ + // 1 => 'yellow', + // 2 => 'danger', + // 3 => 'success', + // ]); + // $grid->column('close_time'); + // $grid->column('created_at'); + // $grid->column('updated_at')->sortable(); + // $grid->disableActions(); + // $grid->filter(function (Grid\Filter $filter) { + // $filter->equal('id'); + // + // }); + // }); + //} + // + ///** + // * Make a show builder. + // * + // * @param mixed $id + // * + // * @return Show + // */ + //protected function detail($id) + //{ + // return Show::make($id, new Workorder(), function (Show $show) { + // $show->field('id'); + // $show->field('title'); + // $show->field('content'); + // $show->field('publisher_type'); + // $show->field('publisher_id'); + // $show->field('point_type'); + // $show->field('point_id'); + // $show->field('status'); + // $show->field('close_time'); + // $show->field('created_at'); + // $show->field('updated_at'); + // }); + //} + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new Workorder(), function (Form $form) { + $form->display('id'); + $form->text('title'); + $form->textarea('content'); + $form->select('point_type') + ->options([ + 0 => '代理商', + ]) + ->default(0); + $form->select('point_id', '代理商')->options(function () { + return Agent::query()->where('type',AgentType::CLUSTER)->pluck('name','id'); + }); + $form->hidden('publisher_type'); + $form->hidden('publisher_id'); + $form->saving(function (Form $form) { + // 判断是否是新增操作 + if ($form->isCreating()) { + $form->point_type = DemandTraits::$col[$form->point_type]; + //发布人身份 + $form->publisher_type = DemandTraits::$col[2]; + $form->publisher_id = Admin::user()->id; + } + }); + }); + } + + public function sendImage(Request $request) + { + $validator = Validator::make(request()->all(), [ + 'workorder_id' => 'required|int', + ], [ + '*' => '参数异常', + ]); + + if ($validator->fails()) { + return $this->jsonFailValidated('数据不全:'.$validator->errors()->first()); + } + + $image = $request->file('image'); + if (empty($image) || !$image->isValid()) { + return $this->error('您未上传任何文件'); + } + + $mime = $image->getMimeType(); + if (!in_array($mime, ['image/jpeg', 'image/png', 'image/gif', 'image/pjpeg'])) { + return $this->error('上传图片格式错误'); + } + + $path = $request->image->store('public/images/workorder'); + $path = (Storage::url($path)); + $item = new WorkorderItem(); + $item->workorder_id = request('workorder_id',0); + $item->content = $path; + $item->type = 2; + $item->publisher_type = DemandTraits::$col[2]; + $item->publisher_id = Admin::user()->id; + $item->save(); + return $this->jsonSuccess($item); + } + + public function sendText(Request $request) + { + $validator = Validator::make(request()->all(), [ + 'workorder_id' => 'required|int', + 'content' => 'required', + ], [ + '*' => '参数异常', + ]); + + if ($validator->fails()) { + return $this->jsonFailValidated('数据不全:'.$validator->errors()->first()); + } + + $item = new WorkorderItem(); + $item->workorder_id = request('workorder_id',0); + $item->content = request('content',''); + $item->type = 1; + $item->publisher_type = DemandTraits::$col[2]; + $item->publisher_id = Admin::user()->id; + $item->save(); + return $this->jsonSuccess($item); + } +} diff --git a/app/AdminGuide/routes.php b/app/AdminGuide/routes.php index 5eb9d79..2038891 100644 --- a/app/AdminGuide/routes.php +++ b/app/AdminGuide/routes.php @@ -19,4 +19,12 @@ Route::group([ $router->resource('demand', 'DemandController'); $router->resource('demand_bidding', 'DemandBiddingController'); $router->resource('my_demand_product', 'MyDemandProductController'); + + $router->resource('workorder', 'WorkorderController'); + + //api + $router->any('send_text', 'WorkorderController@sendText'); + $router->any('send_image', 'WorkorderController@sendImage'); + + $router->any('workorder_item', 'WorkorderController@index'); }); diff --git a/app/AdminSupplier/Controllers/WorkorderController.php b/app/AdminSupplier/Controllers/WorkorderController.php index d5d8458..cf6d678 100755 --- a/app/AdminSupplier/Controllers/WorkorderController.php +++ b/app/AdminSupplier/Controllers/WorkorderController.php @@ -34,7 +34,10 @@ class WorkorderController extends AdminController $workorder = \App\Models\Workorder::query() ->with(['point','publisher']) ->where(['publisher_id' => Admin::user()->id,'publisher_type' => DemandTraits::$col[1]]) - ->orWhere(['point_id' => Admin::user()->id,'point_type' => DemandTraits::$col[1]]) + ->orWhere(function ($query) { + $query->where('point_id',Admin::user()->id) + ->where('point_type',DemandTraits::$col[1]); + }) ->orderByDesc('updated_at') ->get(); @@ -160,24 +163,18 @@ class WorkorderController extends AdminController $form->textarea('content'); $form->select('point_type') ->options([ - 1 => '代理商', + 0 => '代理商', ]) ->default(1); - $form->select('supplier_id', '代理商')->options(function () { + $form->select('point_id', '代理商')->options(function () { $agentIds = AgentProductItem::query()->where('supplier_id',Admin::user()->id)->distinct()->pluck('agent_id'); return Agent::query()->whereIn('id',$agentIds)->pluck('name','id'); }); - $form->hidden('point_id'); $form->hidden('publisher_type'); $form->hidden('publisher_id'); $form->saving(function (Form $form) { // 判断是否是新增操作 if ($form->isCreating()) { - if ($form->point_type == 1) { - $form->point_id = $form->supplier_id; - } elseif ($form->point_type == 2) { - $form->point_id = $form->guide_id; - } $form->deleteInput('supplier_id'); $form->deleteInput('guide_id'); $form->point_type = DemandTraits::$col[$form->point_type]; diff --git a/resources/views/admin/pages/guide-index.blade.php b/resources/views/admin/pages/guide-index.blade.php new file mode 100644 index 0000000..fccf251 --- /dev/null +++ b/resources/views/admin/pages/guide-index.blade.php @@ -0,0 +1,241 @@ + + +
+
+ @foreach($user_list as $key => $item) +
+
+
+ 头像 +
+
+ {{$item['name']}} +
+
+
+ {{$item['content']}} +
+
+ {{$item['last_message']}} +
+
+ {{$item['last_message_time']}} +
+ @if($item['unread'] == true) +
+ @else +
+ @endif +
+ @endforeach +
+ +
+ +
+ +
+
发送
+ +
+
+ @foreach($msg_list as $key => $item) + + @if($item['type'] == 'op') +
+
+
+
+ 头像 +
+
+ + {{$item['name']}} +
+
+
+ @if($item['it_type'] == 1) + {{$item['content']}} + @elseif($item['it_type'] == 2) + 图片 + @endif +
+ +
+ 2021-01-01 12:02:03 +
+
+
+ @elseif($item['type'] == 'my') +
+
+
+
+ {{$item['name']}} +
+
+ 头像 +
+
+ +
+ @if($item['it_type'] == 1) + {{$item['content']}} + @elseif($item['it_type'] == 2) + 图片 + @endif +
+ +
+ 2021-01-01 12:02:03 +
+
+
+ @endif + @endforeach +
+ +
+ +
+ +
+
+ + + + + + + From 1fa746faef7fd3f985c32a25edb76ded6c99155a Mon Sep 17 00:00:00 2001 From: lemon <15040771@qq.com> Date: Wed, 8 Sep 2021 20:39:06 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/WorkorderController.php | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/app/AdminAgent/Controllers/WorkorderController.php b/app/AdminAgent/Controllers/WorkorderController.php index c1dedfa..fb8ce32 100755 --- a/app/AdminAgent/Controllers/WorkorderController.php +++ b/app/AdminAgent/Controllers/WorkorderController.php @@ -3,6 +3,7 @@ namespace App\AdminAgent\Controllers; use App\AdminAgent\Repositories\Workorder; +use App\Common\AgentType; use App\Http\Controllers\Controller; use App\Models\AgentProductItem; use App\Models\Guide; @@ -160,25 +161,37 @@ class WorkorderController extends AdminController $form->display('id'); $form->text('title'); $form->textarea('content'); - $form->select('point_type') - ->when([1],function (Form $form) { - $form->select('supplier_id', '供应商')->options(function () { - $supplierIds = AgentProductItem::query()->where('agent_id',Admin::user()->id)->distinct()->pluck('supplier_id'); - return Supplier::query()->whereIn('id',$supplierIds)->pluck('name','id'); - }); + if (Admin::user()->type == AgentType::CLUSTER) { + $form->select('point_type') + ->when([1], function (Form $form) { + $form->select('supplier_id', '供应商')->options(function () { + $supplierIds = AgentProductItem::query()->where('agent_id', Admin::user()->id)->distinct()->pluck('supplier_id'); + return Supplier::query()->whereIn('id', $supplierIds)->pluck('name', 'id'); + }); - }) - ->when([2],function (Form $form) { - $form->select('guide_id', '地接')->options(function () { - return Guide::query()->pluck('name','id'); - }); + }) + ->when([2], function (Form $form) { + $form->select('guide_id', '地接')->options(function () { + return Guide::query()->pluck('name', 'id'); + }); - }) - ->options([ - 1 => '供应商', - 2 => '地接' - ]) - ->default(1); + }) + ->options([ + 1 => '供应商', + 2 => '地接' + ]) + ->default(1); + } else { + $form->select('point_type') + ->options([ + 1 => '供应商', + ]) + ->default(1); + $form->select('supplier_id', '供应商')->options(function () { + $supplierIds = AgentProductItem::query()->where('agent_id', Admin::user()->id)->distinct()->pluck('supplier_id'); + return Supplier::query()->whereIn('id', $supplierIds)->pluck('name', 'id'); + }); + } $form->hidden('point_id'); $form->hidden('publisher_type'); $form->hidden('publisher_id'); From 54d308fcb2bef48e5a4e09eaacc19bf1c7c771e6 Mon Sep 17 00:00:00 2001 From: lemon <15040771@qq.com> Date: Wed, 8 Sep 2021 20:51:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=B8=82=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DemandBiddingController.php | 4 ++-- app/AdminAgent/Controllers/DemandController.php | 14 ++++++++------ .../Controllers/DemandBiddingController.php | 4 ++-- app/AdminGuide/Controllers/DemandController.php | 17 +++++++++-------- .../Controllers/DemandBiddingController.php | 9 +++++---- .../Controllers/DemandController.php | 9 +++++---- 6 files changed, 31 insertions(+), 26 deletions(-) diff --git a/app/AdminAgent/Controllers/DemandBiddingController.php b/app/AdminAgent/Controllers/DemandBiddingController.php index 5d40948..84b1379 100755 --- a/app/AdminAgent/Controllers/DemandBiddingController.php +++ b/app/AdminAgent/Controllers/DemandBiddingController.php @@ -86,8 +86,8 @@ class DemandBiddingController extends AdminController $form->disableCreatingCheck(); $form->disableViewCheck(); $form->display('id'); - $form->text('price'); - $form->textarea('comment'); + $form->text('price')->required(); + $form->textarea('comment')->required(); $form->hidden('demand_id')->value(request('demand_id',0)); $form->hidden('bidding_user_type'); $form->hidden('bidding_user_id'); diff --git a/app/AdminAgent/Controllers/DemandController.php b/app/AdminAgent/Controllers/DemandController.php index cca7f80..518f701 100755 --- a/app/AdminAgent/Controllers/DemandController.php +++ b/app/AdminAgent/Controllers/DemandController.php @@ -142,8 +142,8 @@ class DemandController extends AdminController $form->disableCreatingCheck(); $form->disableViewCheck(); $form->display('id'); - $form->text('title'); - $form->textarea('comment'); + $form->text('title')->required(); + $form->textarea('comment')->required(); $form->multipleImage('images','图片')->limit(5)->saving(function ($path) { return json_encode($path); }); @@ -159,16 +159,18 @@ class DemandController extends AdminController 1 => '供应商', 2 => '地接' ]) - ->default(1); + ->default(1) + ->required(); }else{ $form->select('bidding_user_type', '竞标用户类型') ->options([ 1 => '供应商', ]) - ->default(1); + ->default(1) + ->required(); } - $form->decimal('price'); - $form->number('stock'); + $form->decimal('price')->required(); + $form->number('stock')->required(); $form->hidden('publisher_type'); $form->hidden('publisher_id'); $form->saving(function (Form $form) { diff --git a/app/AdminGuide/Controllers/DemandBiddingController.php b/app/AdminGuide/Controllers/DemandBiddingController.php index 39ee223..43fa4e2 100755 --- a/app/AdminGuide/Controllers/DemandBiddingController.php +++ b/app/AdminGuide/Controllers/DemandBiddingController.php @@ -86,8 +86,8 @@ class DemandBiddingController extends AdminController $form->disableCreatingCheck(); $form->disableViewCheck(); $form->display('id'); - $form->text('price'); - $form->textarea('comment'); + $form->text('price')->required(); + $form->textarea('comment')->required(); $form->hidden('demand_id')->value(request('demand_id',0)); $form->hidden('bidding_user_type'); $form->hidden('bidding_user_id'); diff --git a/app/AdminGuide/Controllers/DemandController.php b/app/AdminGuide/Controllers/DemandController.php index 428edaa..20739a7 100755 --- a/app/AdminGuide/Controllers/DemandController.php +++ b/app/AdminGuide/Controllers/DemandController.php @@ -141,12 +141,12 @@ class DemandController extends AdminController $form->disableCreatingCheck(); $form->disableViewCheck(); $form->display('id'); - $form->text('title'); - $form->textarea('comment'); + $form->text('title')->required(); + $form->textarea('comment')->required(); $form->multipleImage('images','图片')->limit(5)->saving(function ($path) { return json_encode($path); }); - $form->hidden('deadline'); + $form->hidden('deadline')->required(); $form->select('bidding_user_type','竞标用户类型') ->when([2],function (Form $form){ $form->select('demand_product_id','产品')->options(function (){ @@ -157,11 +157,12 @@ class DemandController extends AdminController 1 => '供应商', 2 => '地接' ]) - ->default(1); - $form->decimal('price'); - $form->number('stock'); - $form->hidden('publisher_type'); - $form->hidden('publisher_id'); + ->default(1) + ->required(); + $form->decimal('price')->required(); + $form->number('stock')->required(); + $form->hidden('publisher_type')->required(); + $form->hidden('publisher_id')->required(); $form->saving(function (Form $form) { // 判断是否是新增操作 if ($form->isCreating()) { diff --git a/app/AdminSupplier/Controllers/DemandBiddingController.php b/app/AdminSupplier/Controllers/DemandBiddingController.php index 9e16d35..66b832d 100755 --- a/app/AdminSupplier/Controllers/DemandBiddingController.php +++ b/app/AdminSupplier/Controllers/DemandBiddingController.php @@ -115,15 +115,16 @@ class DemandBiddingController extends AdminController $form->display('id')->disable(); if(request('is_bidding',0)) { - $form->textarea('comment')->disable(); + $form->textarea('comment')->disable()->required(); $form->selectTable('demand_product_id', '产品') ->title('选择产品') ->dialogWidth('50%;min-width:600px;') //不起作用 ->from(SelectProduct::make()) - ->model(DemandProduct::class); + ->model(DemandProduct::class) + ->required(); }else{ - $form->text('price'); - $form->textarea('comment'); + $form->text('price')->required(); + $form->textarea('comment')->required(); } $form->hidden('demand_id')->value(request('demand_id',0)); $form->hidden('bidding_user_type')->disable(); diff --git a/app/AdminSupplier/Controllers/DemandController.php b/app/AdminSupplier/Controllers/DemandController.php index 538b2e4..2b090a6 100755 --- a/app/AdminSupplier/Controllers/DemandController.php +++ b/app/AdminSupplier/Controllers/DemandController.php @@ -130,8 +130,8 @@ class DemandController extends AdminController $form->disableCreatingCheck(); $form->disableViewCheck(); $form->display('id'); - $form->text('title'); - $form->textarea('comment'); + $form->text('title')->required(); + $form->textarea('comment')->required(); $form->multipleImage('images','图片')->limit(5)->saving(function ($path) { return json_encode($path); }); @@ -145,9 +145,10 @@ class DemandController extends AdminController ->options([ '代理商' ]) - ->default(0); + ->default(0) + ->required(); $form->decimal('price')->required(); - $form->number('stock'); + $form->number('stock')->required(); $form->hidden('publisher_type'); $form->hidden('publisher_id'); $form->saving(function (Form $form) { From ba31a64ec334923559eb43da5bb62e337ca50197 Mon Sep 17 00:00:00 2001 From: lemon <15040771@qq.com> Date: Wed, 8 Sep 2021 20:55:00 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=B7=A5=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/AdminAgent/Controllers/WorkorderController.php | 10 +++++----- app/AdminGuide/Controllers/WorkorderController.php | 10 ++++++---- app/AdminSupplier/Controllers/WorkorderController.php | 9 +++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/AdminAgent/Controllers/WorkorderController.php b/app/AdminAgent/Controllers/WorkorderController.php index fb8ce32..7d7591d 100755 --- a/app/AdminAgent/Controllers/WorkorderController.php +++ b/app/AdminAgent/Controllers/WorkorderController.php @@ -159,8 +159,8 @@ class WorkorderController extends AdminController { return Form::make(new Workorder(), function (Form $form) { $form->display('id'); - $form->text('title'); - $form->textarea('content'); + $form->text('title')->required(); + $form->textarea('content')->required(); if (Admin::user()->type == AgentType::CLUSTER) { $form->select('point_type') ->when([1], function (Form $form) { @@ -180,17 +180,17 @@ class WorkorderController extends AdminController 1 => '供应商', 2 => '地接' ]) - ->default(1); + ->default(1)->required(); } else { $form->select('point_type') ->options([ 1 => '供应商', ]) - ->default(1); + ->default(1)->required(); $form->select('supplier_id', '供应商')->options(function () { $supplierIds = AgentProductItem::query()->where('agent_id', Admin::user()->id)->distinct()->pluck('supplier_id'); return Supplier::query()->whereIn('id', $supplierIds)->pluck('name', 'id'); - }); + })->required(); } $form->hidden('point_id'); $form->hidden('publisher_type'); diff --git a/app/AdminGuide/Controllers/WorkorderController.php b/app/AdminGuide/Controllers/WorkorderController.php index af59d57..8aa5b5c 100755 --- a/app/AdminGuide/Controllers/WorkorderController.php +++ b/app/AdminGuide/Controllers/WorkorderController.php @@ -159,16 +159,18 @@ class WorkorderController extends AdminController { return Form::make(new Workorder(), function (Form $form) { $form->display('id'); - $form->text('title'); - $form->textarea('content'); + $form->text('title')->required(); + $form->textarea('content')->required(); $form->select('point_type') ->options([ 0 => '代理商', ]) - ->default(0); + ->default(0) + ->required(); $form->select('point_id', '代理商')->options(function () { return Agent::query()->where('type',AgentType::CLUSTER)->pluck('name','id'); - }); + }) + ->required(); $form->hidden('publisher_type'); $form->hidden('publisher_id'); $form->saving(function (Form $form) { diff --git a/app/AdminSupplier/Controllers/WorkorderController.php b/app/AdminSupplier/Controllers/WorkorderController.php index cf6d678..3c5c692 100755 --- a/app/AdminSupplier/Controllers/WorkorderController.php +++ b/app/AdminSupplier/Controllers/WorkorderController.php @@ -159,17 +159,18 @@ class WorkorderController extends AdminController { return Form::make(new Workorder(), function (Form $form) { $form->display('id'); - $form->text('title'); - $form->textarea('content'); + $form->text('title')->required(); + $form->textarea('content')->required(); $form->select('point_type') ->options([ 0 => '代理商', ]) - ->default(1); + ->default(1) + ->required(); $form->select('point_id', '代理商')->options(function () { $agentIds = AgentProductItem::query()->where('supplier_id',Admin::user()->id)->distinct()->pluck('agent_id'); return Agent::query()->whereIn('id',$agentIds)->pluck('name','id'); - }); + })->required(); $form->hidden('publisher_type'); $form->hidden('publisher_id'); $form->saving(function (Form $form) {