Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
beb69cec
authored
Dec 09, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除功能
parent
1a28510f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
app/Admin/Controllers/DrugController.php
+12
-2
app/Admin/Controllers/PharmacyDrugController.php
+1
-1
No files found.
app/Admin/Controllers/DrugController.php
View file @
beb69cec
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
use
App\Models\DrugModel
;
use
App\Models\DrugModel
;
use
App\Models\DrugTagModel
;
use
App\Models\DrugTagModel
;
use
App\Models\DrugUnitModel
;
use
App\Models\DrugUnitModel
;
use
App\Models\PharmacyDrugModel
;
use
Box\Spout\Common\Entity\Style\Color
;
use
Box\Spout\Common\Entity\Style\Color
;
use
Box\Spout\Writer\Common\Creator\Style\StyleBuilder
;
use
Box\Spout\Writer\Common\Creator\Style\StyleBuilder
;
use
Box\Spout\Writer\Common\Creator\WriterEntityFactory
;
use
Box\Spout\Writer\Common\Creator\WriterEntityFactory
;
...
@@ -82,9 +83,8 @@ protected function grid()
...
@@ -82,9 +83,8 @@ protected function grid()
$filter
->
in
(
'is_si'
)
->
checkbox
(
DrugModel
::
SI_MAP
)
->
width
(
3
);
$filter
->
in
(
'is_si'
)
->
checkbox
(
DrugModel
::
SI_MAP
)
->
width
(
3
);
});
});
$grid
->
setActionClass
(
Grid\Displayers\Actions
::
class
);
// 行按钮控制
// 行按钮控制
$grid
->
disableDeleteButton
();
// 禁用删除按钮
//
$grid->disableDeleteButton(); // 禁用删除按钮
$grid
->
disableViewButton
();
// 禁用详情按钮
$grid
->
disableViewButton
();
// 禁用详情按钮
// 工具栏按钮控制
// 工具栏按钮控制
...
@@ -157,6 +157,16 @@ protected function form()
...
@@ -157,6 +157,16 @@ protected function form()
$form
->
display
(
'created_at'
);
$form
->
display
(
'created_at'
);
$form
->
display
(
'updated_at'
);
$form
->
display
(
'updated_at'
);
});
});
$form
->
deleting
(
function
(
Form
$form
)
{
// 获取待删除行数据,这里获取的是一个二维数组
$drugId
=
$form
->
getKey
();
$num
=
PharmacyDrugModel
::
where
(
'drug_id'
,
$drugId
)
->
count
();
if
(
$num
>=
1
)
{
return
$form
->
response
()
->
error
(
'该药品已经被也药店导入,暂时不能删除~'
);
}
});
// 右上角按钮控制
// 右上角按钮控制
$form
->
disableDeleteButton
();
// 去掉删除按钮
$form
->
disableDeleteButton
();
// 去掉删除按钮
$form
->
disableViewButton
();
// 去掉跳转详情页按钮
$form
->
disableViewButton
();
// 去掉跳转详情页按钮
...
...
app/Admin/Controllers/PharmacyDrugController.php
View file @
beb69cec
...
@@ -71,7 +71,7 @@ protected function grid()
...
@@ -71,7 +71,7 @@ protected function grid()
$grid
->
disableViewButton
();
// 禁用详情按钮
$grid
->
disableViewButton
();
// 禁用详情按钮
// 工具栏按钮控制
// 工具栏按钮控制
$grid
->
disableBatchDelete
();
// 禁用批量删除
//
$grid->disableBatchDelete(); // 禁用批量删除
});
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment