auth-fail-index.php
9.5 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
use yii\helpers\Url;
use app\ht\widgets\LinkPager;
use domain\device\Device;
$this->title = '授权失败管理';
$this->params['breadcrumbs'][] = '失败序列号管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<style>
.cell-cls{width:60%;word-wrap: break-word}
.td-cls{padding:8px 0}
</style>
<div class="panel panel-default">
<div class="panel-body">
<form action="" method="get" id="search-form" class="filter-form">
<div class="form-group col-sm-12">
<label for="manufacture" class="col-sm-1 control-label text-right">厂商:</label>
<div class="col-sm-2 form-inline">
<input type="text" class="form-control" id="manufacture" name="manufacture" value="<?php if (!empty($gets['manufacture'])){ echo $gets['manufacture'];} ?>" autocomplete="off">
</div>
<label for="project" class="col-sm-1 control-label text-right">项目名:</label>
<div class="col-sm-2 form-inline">
<input type="text" class="form-control" id="project" name="project" value="<?php if (!empty($gets['project'])){ echo $gets['project'];} ?>" autocomplete="off">
</div>
<label for="model" class="col-sm-1 control-label text-right">型号:</label>
<div class="col-sm-2 form-inline">
<input type="text" class="form-control" id="model" name="model" value="<?php if (!empty($gets['model'])){ echo $gets['model'];} ?>" autocomplete="off">
</div>
<label for="production" class="col-sm-1 control-label text-right">生产日期:</label>
<div class="col-sm-2 form-inline">
<input type="text" class="form-control" id="production" name="production" value="<?php if (!empty($gets['production'])){ echo $gets['production'];} ?>" autocomplete="off">
</div>
</div>
<div class="form-group col-sm-12">
<label for="device_id" class="col-sm-1 control-label text-right">设备ID:</label>
<div class="col-sm-2 form-inline">
<input type="text" class="form-control" id="device_id" name="device_id" value="<?php if (!empty($gets['device_id'])){ echo $gets['device_id'];} ?>" autocomplete="off">
</div>
<label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label>
<div class="col-sm-5 form-inline">
<input type="date" class="form-control" id="start_apply_at" name="start_apply_at" value="<?php if (!empty($gets['start_apply_at'])){ echo $gets['start_apply_at'];} ?>" autocomplete="off"> - <input type="date" class="form-control" id="end_apply_at" name="end_apply_at" value="<?php if (!empty($gets['end_apply_at'])){ echo $gets['end_apply_at'];} ?>" autocomplete="off">
</div>
</div>
<div class="form-group col-sm-12" style="text-align: center;">
<button type="submit" class="btn btn-primary font-1" id="submitFilterBtn">查询</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<table class="table table-striped table-bordered" id="brand-table">
<thead>
<tr>
<th width="4%"></th>
<th width="5%">ID</th>
<th width="10%">批次编码</th>
<th width="10%">厂商</th>
<th width="6%">项目</th>
<th width="8%">设备型号</th>
<th width="8%">生产日期</th>
<th width="10%">设备ID</th>
<th width="10%">申请时间</th>
<th width="20%">操作</th>
</tr>
</thead>
<tbody>
<?php if ($deviceList) { ?>
<?php foreach ($deviceList as $item) : ?>
<tr>
<td><input type="checkbox" class="check-cls check-item" value="<?= $item['id'] ?>"/></td>
<td class="td-cls">
<?= $item['id'] ?>
</td>
<td class="td-cls">
<?= Device::getBatchNo($item['manufacture_no'], $item['project_no'], $item['model_no'], $item['production_no']) ?>
</td>
<td class="td-cls">
<?= $item['manufacture'] ?>
</td>
<td class="td-cls">
<?= $item['project'] ?>
</td>
<td class="td-cls">
<?= $item['model'] ?>
</td>
<td class="td-cls">
<?= $item['production'] ?>
</td>
<td class="td-cls">
<div class="edit_device edit_device_<?=$item['id']?>" data-id="<?=$item['id']?>" data="<?=$item['device_id']?>"><?= $item['device_id']? $item['device_id']:'暂无'?></div>
</td>
<td class="td-cls">
<?= $item['apply_at']?date('Y-m-d H:i:s', $item['apply_at']):'暂无' ?>
</td>
<td class="td-cls">
<button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> |
<button class="btn btn-primary btn-sm btn_re_auth" aid="<?=$item['id'] ?>">处理</button>
</td>
</tr>
<?php endforeach; ?>
<?php } else { ?>
<tr>
<td colspan="12">
<center>暂无记录</center>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="action-box">
<label><input type="checkbox" class="check-all" value="all" /> 本页全选 </label> <button class="btn btn-primary btn-sm btn_batch_auth" >批量处理</button>
</div>
</div>
<div class="panel-footer">
<div class="hqy-panel-pager">
<?= LinkPager::widget([
'pagination' => $pages,
]); ?>
<div class="clearfix"></div>
</div>
</div>
</div>
<script>
var authURL = "<?=Url::toRoute('/device/device/re-auth')?>";
var batchReAuthURL = "<?=Url::toRoute('/device/device/batch-re-auth')?>";
var delURL = "<?=Url::toRoute('/device/device/del-device')?>";
var doEditURL = "<?=Url::toRoute('/device/device/do-edit-fail')?>";
$(function () {
$('.btn_re_auth').click(function(e) {
var aid = $(this).attr('aid');
$.post(authURL, {id:aid}, function(res) {
if (!res.success) {
alert(res.message);
return false;
}
window.location.reload();
}, 'json')
})
$('.btn_edit').click(function(e) {
var editThis = $(this);
var action = editThis.attr('data-action')
var id = editThis.attr('aid');
var editDevice = $('.edit_device_'+id);
if ('edit' == action ) {
var editDevices = $('.edit_device');
$.each(editDevices, function(i,n){
$(n).html($(n).attr('data'));
})
var btnEdits = $('.btn_edit');
$.each(btnEdits, function(i,n){
$(n).html('编辑').attr('data-action','edit');
})
editThis.html('保存').attr('data-action','save');
var editDeviceVal = editDevice.attr('data');
editDevice.html('<input type="text" class="device_edit" value="'+editDeviceVal+'">');
} else {
var newDevice = editDevice.find('.device_edit').val();
// 请求之后保存
$.post(doEditURL, {id:id, deviceId: newDevice}, function(res){
if (res.success) {
editDevice.html(newDevice).attr('data', newDevice);
editThis.html('编辑').attr('data-action','edit');
} else {
alert(res.message);
}
}, 'json')
}
})
$('.check-all').click(function(e) {
var checkVal = $(this).prop('checked');
$('.check-item').prop('checked', checkVal)
})
$('.btn_batch_auth').click(function(e) {
var checkItems = $('.check-item:checked');
if ( 0 == checkItems.length) {
alert('请选择要操作的行');
return false;
}
var ids = [];
$.each(checkItems, function(i,n){
var id = $(n).val();
if ('' != id && 0 != id) {
ids.push(id);
}
})
ids = ids.join(',');
$.post(batchReAuthURL,{ids:ids},function(res){
if (res.success) {
alert(res.message);
var _body = window.parent;
var _iframe1=_body.document.getElementById('x-iframe');
_iframe1.contentWindow.location.reload(true);
} else {
alert(res.message);
}
}, 'json')
})
});
</script>