search-template.blade.php
7.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title></title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
{!! Admin::css() !!}
<script src="{{ Admin::jQuery() }}"></script>
{!! Admin::headerJs() !!}
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="/vendor/laravel-admin/toastr/build/toastr.min.css"/>
<script src="/vendor/laravel-admin/toastr/build/toastr.min.js"></script>
<script src="/vendor/laravel-admin/jquery-pjax/jquery.pjax.js"></script>
<script src="/assets/layer-v3.1.1/layer/layer.js"></script>
<script src="/assets/layui/layui.js"></script>
<script src="/vendor/laravel-admin/sweetalert2/dist/sweetalert2.min.js"></script>
<script src="{{ admin_asset("vendor/laravel-admin/AdminLTE/plugins/iCheck/icheck.min.js")}}"></script>
<script src="/assets/admin/js/main.js"></script>
<link rel="stylesheet" type="text/css" href="/vendor/laravel-admin/AdminLTE/plugins/select2/select2.min.css" />
<script src="/vendor/laravel-admin/AdminLTE/plugins/select2/select2.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="/assets/admin/css/main.css"/>
<link type="text/css" rel="stylesheet" href="/vendor/laravel-admin/sweetalert2/dist/sweetalert2.css"/>
<link rel="stylesheet" href="{{ admin_asset("vendor/laravel-admin/AdminLTE/plugins/iCheck/square/blue.css") }}">
</head>
<body class="hold-transition">
<div class="wrapper">
@include("$temple")
</div>
<template id="nodata">
<svg t="1562312016538" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="2076" width="128" height="128" style="fill: #e9e9e9;">
<path d="M512.8 198.5c12.2 0 22-9.8 22-22v-90c0-12.2-9.8-22-22-22s-22 9.8-22 22v90c0 12.2 9.9 22 22 22zM307 247.8c8.6 8.6 22.5 8.6 31.1 0 8.6-8.6 8.6-22.5 0-31.1L274.5 153c-8.6-8.6-22.5-8.6-31.1 0-8.6 8.6-8.6 22.5 0 31.1l63.6 63.7zM683.9 247.8c8.6 8.6 22.5 8.6 31.1 0l63.6-63.6c8.6-8.6 8.6-22.5 0-31.1-8.6-8.6-22.5-8.6-31.1 0l-63.6 63.6c-8.6 8.6-8.6 22.5 0 31.1zM927 679.9l-53.9-234.2c-2.8-9.9-4.9-20-6.9-30.1-3.7-18.2-19.9-31.9-39.2-31.9H197c-19.9 0-36.4 14.5-39.5 33.5-1 6.3-2.2 12.5-3.9 18.7L97 679.9v239.6c0 22.1 17.9 40 40 40h750c22.1 0 40-17.9 40-40V679.9z m-315-40c0 55.2-44.8 100-100 100s-100-44.8-100-100H149.6l42.5-193.3c2.4-8.5 3.8-16.7 4.8-22.9h630c2.2 11 4.5 21.8 7.6 32.7l39.8 183.5H612z"
p-id="2077"></path>
</svg>
</template>
<script>
$(function () {
$('#checkAll').iCheck({checkboxClass:'icheckbox_square-blue'}).on('ifChanged', function () {
}).on('ifClicked', function () {
});
$(".btn-add").click(function () {
addData();
})
$(".btn-search").click(function () {
searchData();
});
$(".btn-reset").click(function () {
$('#form')[0].reset();
searchData();
});
})
/**
* 通用查询方法
*
* @param url
* @param data
*/
function search(url, data)
{
layer_loading()
$.ajax({
url: url,
type: "get",
data: data,
success: function (data) {
layer_loading_close();
if (data.code === 0) {
// toastr.success(data.message);
$("tbody").empty();
$(data.list).each(function (i, e) {
let template = $('template#template');
let html = template.html()
.replace(/__NO__/g, i+1)
.replace(/__ID__/g, e.id)
.replace(/__NICKNAME__/g, e.nickname)
.replace(/__AVATAR__/g, e.avatar)
.replace(/__NAME__/g, e.name)
.replace(/__MOBILE__/g, e.mobile)
.replace(/__GENDER__/g, e.gender_show)
.replace(/__FAMILY_NUMBER__/g, e.family_number)
.replace(/__FAMILY_ADDRESS__/g, e.family_address)
.replace(/__LOGIN_TIMES__/g, e.login_times)
.replace(/__LAST_LOGIN_TIME__/g, e.last_login_time)
.replace(/__CREATED_AT__/g, e.created_at)
.replace(/__USER_NAME__/g, e.user_name)
.replace(/__USER_MOBILE__/g, e.user_mobile)
.replace(/__NUMBER__/g, e.number)
.replace(/__ADDRESS__/g, e.address)
.replace(/__DESCRIPTION__/g, e.description);
$("tbody").append(html);
$("input[type='checkbox']").iCheck({
checkboxClass : 'icheckbox_square-blue'
})
var $subBox = $(".checkboxChild");
// 点击全选
$("#checkAll").on("ifChanged",function () {
if ($(this).is(":checked")) {
$subBox.iCheck("check");
} else {
$subBox.iCheck("uncheck");
}
});
});
} else {
toastr.error(data.message);
}
},
complete:function (xhr,status) {
layer_loading_close();
}
});
}
function doAdd(url, tip1, tip2)
{
let ids = "";
$(".checkboxChild").each(function(){
if(true === $(this).is(':checked')){
ids += $(this).data("id")+",";
}
});
if(ids.substr(ids.length-1) === ','){
ids = ids.substr(0,ids.length - 1);
}
if (ids === '') {
toastr.error(tip1);
return;
}
swal_confirm('温馨提示', tip2,function () {
$.ajax({
url: url,
type: "POST",
data: {
ids:ids,
_token: LA.token,
_method: 'POST'
},
success: function (data) {
console.log(data);
if (data.code === 0) {
toastr.success(data.message);
window.parent.location.reload()
} else {
toastr.error(data.message);
}
},
complete:function(xhr,status) {
// if (status == 'success') {
// // _status = xhr.responseJSON.status;
//
// }
}
});
})
}
function LA() {}
LA.token = "{{ csrf_token() }}";
</script>