diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php
index 2b35f68d..e1d54f4d 100644
--- a/application/admin/controller/Index.php
+++ b/application/admin/controller/Index.php
@@ -205,7 +205,19 @@ class Index extends Base
*/
public function delete($id)
{
- //
+ //实例化管理员数据模型类
+ $admin = new Admin();
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids/a');
+ }
+
+ $data = $admin->destroy($id);
+
+ $data = ['msg'=>'删除成功','val'=>1];
+
+ return json($data);
}
diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php
index f2798bcb..840636bf 100644
--- a/application/admin/model/Admin.php
+++ b/application/admin/model/Admin.php
@@ -3,8 +3,10 @@
namespace app\admin\model;
use think\Model;
+// 引用用户数据模型
+use app\common\model\Base;
-class Admin extends Model
+class Admin extends Base
{
// 获取密码
public function password($username)
diff --git a/application/admin/view/index/index.html b/application/admin/view/index/index.html
index 12aee47f..8d7e8d5e 100644
--- a/application/admin/view/index/index.html
+++ b/application/admin/view/index/index.html
@@ -16,7 +16,7 @@
-
+
批量删除
@@ -98,7 +98,7 @@
readbut = '';
// 编辑按钮
editbut = '';
- delbut = '';
+ delbut = '';
if(row.status == '已停用')
{
buts = startbut + readbut + editbut + delbut;
diff --git a/application/common/view/list.html b/application/common/view/list.html
index a31917b3..50fa1835 100644
--- a/application/common/view/list.html
+++ b/application/common/view/list.html
@@ -186,8 +186,8 @@ function change_password(title,url,id,w,h){
function del(obj,id){
layer.confirm('确认要删除吗?',function(index){
$.ajax({
- type: 'POST',
- url: '',
+ type: 'DELETE',
+ url: "/admin/" + id,
dataType: 'json',
success: function(data){
$(obj).parents("tr").remove();
@@ -199,6 +199,51 @@ function del(obj,id){
});
});
}
+/*批量删除*/
+function dels(){
+ //声明数组
+ var chk_value =[];
+ //获取所有被选中的值
+ $('input[name="test"]:checked').each(function(){
+ chk_value.push($(this).val());
+ });
+ //将选中的值进行排序
+ //chk_value.sort();
+
+
+ //如果有选中值则退出并提示
+ if(chk_value.length==0){
+ layer.msg('没有选择任何信息');
+ return false;
+ }
+ //将数组转换成字符串
+ // chk_value=chk_value.toString();
+ layer.confirm('确认要删除选中的内容吗?',function(index){
+ $.ajax({
+ type: 'DELETE',
+ url:'/admin/m',
+ dataType: 'json',
+ data: {
+ ids:chk_value,
+ },
+
+ success: function(data){
+ if(data.val == 1){
+ layer.alert('删除成功');
+ $('input[name="test"]:checked').each(function(){
+ $(this).parents("tr").remove();
+ });
+
+ }else{
+ layer.alert('数据处理失败');
+ }
+ },
+ error:function(data) {
+ layer.msg('删除失败');
+ },
+ });
+ });
+}