123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- namespace App\Admin\Actions\Tools;
- use App\Admin\Repositories\DistInquiry;
- use Dcat\Admin\Grid\Tools\AbstractTool;
- use Dcat\Admin\Widgets\Modal;
- use Illuminate\Http\Request;
- class InquiryHandle extends AbstractTool
- {
- protected $style = 'btn btn-success';
-
- public function title()
- {
- return admin_trans_label('process');
- }
-
- public function confirm()
- {
-
-
- $msg = admin_trans_label('confirm_process_inquiry');
- return [$msg, ''];
- }
-
- public function handle(Request $request)
- {
- $keys = $request->input('_key');
- if (is_array($keys) && count($keys) > 0) {
- $result = DistInquiry::distSetStatusProcessed($keys);
- return $this->response()->success(admin_trans_label('update_success'))->refresh();
- } else {
- return $this->response()->error('No data selected!')->refresh();
- }
-
- }
- public function actionScript(){
- $warning = admin_trans_label('no_selected_data');
- return <<<JS
- function (data, target, action) {
- try {
- var key = {$this->getSelectedKeysScript()}
- if (key.length === 0) {
- Dcat.warning('{$warning}');
- return false;
- }
- // 设置主键为复选框选中的行ID数组
- action.options.key = key;
- } catch (e) {
- Dcat.warning('{$warning}');
- return false;
- }
- }
- JS;
- }
- public function getSelectedKeysScript()
- {
- return "Dcat.grid.selected('{$this->parent->getName()}')";
- }
- }
|