Commit 547615129fba03bb2b884574d14f33ed6a3759cd
1 parent
ff8327f6
Exists in
master
1. A 添加删除序列号列表
2. F 调整出错页面
Showing
12 changed files
with
339 additions
and
13 deletions
Show diff stats
app-ht/modules/datas/views/device/index.php
@@ -69,6 +69,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -69,6 +69,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
69 | <th width="10%">型号</th> | 69 | <th width="10%">型号</th> |
70 | <th width="10%">生产日期</th> | 70 | <th width="10%">生产日期</th> |
71 | <th width="10%">生成总数</th> | 71 | <th width="10%">生成总数</th> |
72 | + <th width="8%">删除数</th> | ||
72 | <th width="10%">授权总数</th> | 73 | <th width="10%">授权总数</th> |
73 | <th width="15%">授权失败数</th> | 74 | <th width="15%">授权失败数</th> |
74 | <th width="15%">未授权数</th> | 75 | <th width="15%">未授权数</th> |
@@ -85,6 +86,7 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -85,6 +86,7 @@ $this->params['breadcrumbs'][] = $this->title; | ||
85 | <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td> | 86 | <td style="padding:12px;"><?= (isset($item["model_name"]) ? $item["model_name"] : "") ?></td> |
86 | <td style="padding:12px;"><?= (isset($item["production_name"]) ? $item["production_name"] : "") ?></td> | 87 | <td style="padding:12px;"><?= (isset($item["production_name"]) ? $item["production_name"] : "") ?></td> |
87 | <td style="padding:12px;"><a href="<?=Url::toRoute(['device/device-list','batch_id' => $item['id']])?>"><?= (isset($item["num"]) ? $item["num"] : "0") ?></a></td> | 88 | <td style="padding:12px;"><a href="<?=Url::toRoute(['device/device-list','batch_id' => $item['id']])?>"><?= (isset($item["num"]) ? $item["num"] : "0") ?></a></td> |
89 | + <td style="padding:12px;"><?= (isset($item["del_num"]) ? $item["del_num"] : "0") ?></td> | ||
88 | <td style="padding:12px;"><?= (isset($item["has_auth_num"]) ? $item["has_auth_num"] : "0") ?></td> | 90 | <td style="padding:12px;"><?= (isset($item["has_auth_num"]) ? $item["has_auth_num"] : "0") ?></td> |
89 | <td style="padding:12px;"><?= (!empty($item["auth_fail_num"]) ? $item["auth_fail_num"] : "0") ?></td> | 91 | <td style="padding:12px;"><?= (!empty($item["auth_fail_num"]) ? $item["auth_fail_num"] : "0") ?></td> |
90 | <td style="padding:12px;"><?= (!empty($item["no_auth_num"]) ? $item["no_auth_num"] : "0") ?></td> | 92 | <td style="padding:12px;"><?= (!empty($item["no_auth_num"]) ? $item["no_auth_num"] : "0") ?></td> |
app-ht/modules/device/controllers/DeviceController.php
@@ -99,6 +99,79 @@ class DeviceController extends BaseController | @@ -99,6 +99,79 @@ class DeviceController extends BaseController | ||
99 | /** | 99 | /** |
100 | * @return string | 100 | * @return string |
101 | */ | 101 | */ |
102 | + public function actionDeleteIndex() | ||
103 | + { | ||
104 | + $request = Yii::$app->request; | ||
105 | + $serialNo = $request->get('serial_no'); | ||
106 | + $mac = $request->get('mac'); | ||
107 | + $project = $request->get('project'); | ||
108 | + $model = $request->get('model'); | ||
109 | + $production = $request->get('production'); | ||
110 | + $manufacture = $request->get('manufacture'); | ||
111 | + $deviceId = $request->get('device_id'); | ||
112 | + $status = $request->get('status'); | ||
113 | + $page = $request->get('page'); | ||
114 | + $where = [ | ||
115 | + 'and', | ||
116 | + ['=','a.is_delete', 1] | ||
117 | + ]; | ||
118 | + if (!empty($serialNo)) { | ||
119 | + $where[] = ['like', 'a.serial_no', $serialNo]; | ||
120 | + } | ||
121 | + if (!empty($project)) { | ||
122 | + $where[] = ['like', 'p.name', $project]; | ||
123 | + } | ||
124 | + if (!empty($model)) { | ||
125 | + $where[] = ['like', 'mo.name', $model]; | ||
126 | + } | ||
127 | + if (!empty($production)) { | ||
128 | + $where[] = ['like', 'pd.name', $production]; | ||
129 | + } | ||
130 | + if (!empty($mac)) { | ||
131 | + $where[] = ['like', 'a.mac', $mac]; | ||
132 | + } | ||
133 | + if (!empty($manufacture)) { | ||
134 | + $where[] = ['like', 'm.name', $manufacture]; | ||
135 | + } | ||
136 | + if (!empty($deviceId)) { | ||
137 | + $where[] = ['like', 'a.device_id', $deviceId]; | ||
138 | + } | ||
139 | + if (isset($_GET['status']) && -1 != $status) { | ||
140 | + $where[] = ['=', 'a.status', $status]; | ||
141 | + } else { | ||
142 | + $status = -1; | ||
143 | + } | ||
144 | + | ||
145 | + if (0 >= $page) { | ||
146 | + $page = 1; | ||
147 | + } | ||
148 | + $pageSize = 20; | ||
149 | + $page = ($page -1) * $pageSize; | ||
150 | + // DeviceRepository::getList($where, $pageSize, $page); | ||
151 | + $deviceData = DeviceRepository::getList($where, $pageSize, $page); | ||
152 | + $pages = new Pagination(['totalCount' => DeviceRepository::getListCount($where), 'pageSize' => $pageSize]); | ||
153 | + $statusList = DeviceStatus::statusLabels(); // | ||
154 | + | ||
155 | + $params['statusList'] = $statusList; | ||
156 | + $params['deviceList'] = $deviceData; | ||
157 | + $params['pages'] = $pages; | ||
158 | + $params["gets"] = [ | ||
159 | + 'serial_no' => $serialNo, | ||
160 | + 'mac' => $mac, | ||
161 | + 'project' => $project, | ||
162 | + 'model' => $model, | ||
163 | + 'device_id' => $deviceId, | ||
164 | + 'production' => $production, | ||
165 | + 'manufacture' => $manufacture, | ||
166 | + 'status' => $status | ||
167 | + ]; | ||
168 | + | ||
169 | + return $this->render('delete-index', $params); | ||
170 | + } | ||
171 | + | ||
172 | + /** | ||
173 | + * @return string | ||
174 | + */ | ||
102 | public function actionCreateDevice() | 175 | public function actionCreateDevice() |
103 | { | 176 | { |
104 | return $this->render('createDevice'); | 177 | return $this->render('createDevice'); |
app-ht/modules/device/views/device/createDevice.php
@@ -23,14 +23,14 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); | @@ -23,14 +23,14 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); | ||
23 | <div class="col-sm-4 form-inline"> | 23 | <div class="col-sm-4 form-inline"> |
24 | <input type="text" class="form-control full-width searchInput" id="manufacture" name="manufacture" value="" autocomplete="off"> | 24 | <input type="text" class="form-control full-width searchInput" id="manufacture" name="manufacture" value="" autocomplete="off"> |
25 | </div> | 25 | </div> |
26 | - <div class="col-sm-4"><a href="javascript:void(0)">+创建厂商</a></div> | 26 | + <div class="col-sm-4"><a href="<?=Url::toRoute('/manufacturer/manufacturer/create')?>">+创建厂商</a></div> |
27 | </div> | 27 | </div> |
28 | <div class="form-group col-sm-12"> | 28 | <div class="form-group col-sm-12"> |
29 | <label for="project" class="col-sm-4 control-label text-right">项目名:</label> | 29 | <label for="project" class="col-sm-4 control-label text-right">项目名:</label> |
30 | <div class="col-sm-4 form-inline"> | 30 | <div class="col-sm-4 form-inline"> |
31 | <input type="text" class="form-control full-width searchInput" id="project" name="project" value="" autocomplete="off"> | 31 | <input type="text" class="form-control full-width searchInput" id="project" name="project" value="" autocomplete="off"> |
32 | </div> | 32 | </div> |
33 | - <div class="col-sm-4"><a href="javascript:void(0)">+创建项目</a></div> | 33 | + <div class="col-sm-4"><a href="<?=Url::toRoute('/project/project/create')?>">+创建项目</a></div> |
34 | 34 | ||
35 | </div> | 35 | </div> |
36 | <div class="form-group col-sm-12"> | 36 | <div class="form-group col-sm-12"> |
@@ -38,14 +38,14 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); | @@ -38,14 +38,14 @@ CssFiles::register($this, 'exts/showimg/css/showimg.css'); | ||
38 | <div class="col-sm-4 form-inline"> | 38 | <div class="col-sm-4 form-inline"> |
39 | <input type="text" class="form-control full-width searchInput" id="model" name="model" value="" autocomplete="off"> | 39 | <input type="text" class="form-control full-width searchInput" id="model" name="model" value="" autocomplete="off"> |
40 | </div> | 40 | </div> |
41 | - <div class="col-sm-4"><a href="javascript:void(0)">+创建型号</a></div> | 41 | + <div class="col-sm-4"><a href="<?=Url::toRoute('/model/model/create')?>">+创建型号</a></div> |
42 | </div> | 42 | </div> |
43 | <div class="form-group col-sm-12"> | 43 | <div class="form-group col-sm-12"> |
44 | <label for="production" class="col-sm-4 control-label text-right">生产日期:</label> | 44 | <label for="production" class="col-sm-4 control-label text-right">生产日期:</label> |
45 | <div class="col-sm-4 form-inline"> | 45 | <div class="col-sm-4 form-inline"> |
46 | <input type="text" class="form-control full-width searchInput" id="production" name="production" value="" autocomplete="off"> | 46 | <input type="text" class="form-control full-width searchInput" id="production" name="production" value="" autocomplete="off"> |
47 | </div> | 47 | </div> |
48 | - <div class="col-sm-4"><a href="javascript:void(0)">+生产日期</a></div> | 48 | + <div class="col-sm-4"><a href="<?=Url::toRoute('/production/production/create')?>">+生产日期</a></div> |
49 | </div> | 49 | </div> |
50 | 50 | ||
51 | <div class="form-group col-sm-12"> | 51 | <div class="form-group col-sm-12"> |
@@ -0,0 +1,229 @@ | @@ -0,0 +1,229 @@ | ||
1 | +<?php | ||
2 | +use yii\helpers\Url; | ||
3 | +use app\ht\widgets\LinkPager; | ||
4 | +use domain\device\DeviceStatus; | ||
5 | + | ||
6 | +$this->title = '删除序列号管理'; | ||
7 | +$this->params['breadcrumbs'][] = '序列号管理'; | ||
8 | +$this->params['breadcrumbs'][] = $this->title; | ||
9 | +?> | ||
10 | +<style> | ||
11 | + .cell-cls{width:60%;word-wrap: break-word} | ||
12 | + .td-cls{padding:8px 0} | ||
13 | +</style> | ||
14 | +<div class="panel panel-default"> | ||
15 | + <div class="panel-body"> | ||
16 | + <form action="" method="get" id="search-form" class="filter-form"> | ||
17 | + <div class="form-group col-sm-12"> | ||
18 | + <label for="serial_no" class="col-sm-1 control-label text-right">序列号:</label> | ||
19 | + <div class="col-sm-2 form-inline"> | ||
20 | + <input type="text" class="form-control" id="serial_no" name="serial_no" value="<?php if (!empty($gets['serial_no'])){ echo $gets['serial_no'];} ?>" autocomplete="off"> | ||
21 | + </div> | ||
22 | + <label for="project" class="col-sm-1 control-label text-right">项目名:</label> | ||
23 | + <div class="col-sm-2 form-inline"> | ||
24 | + <input type="text" class="form-control" id="project" name="project" value="<?php if (!empty($gets['project'])){ echo $gets['project'];} ?>" autocomplete="off"> | ||
25 | + </div> | ||
26 | + <label for="model" class="col-sm-1 control-label text-right">型号:</label> | ||
27 | + <div class="col-sm-2 form-inline"> | ||
28 | + <input type="text" class="form-control" id="model" name="model" value="<?php if (!empty($gets['model'])){ echo $gets['model'];} ?>" autocomplete="off"> | ||
29 | + </div> | ||
30 | + <label for="status" class="col-sm-1 control-label text-right">状态:</label> | ||
31 | + <div class="col-sm-2 form-inline"> | ||
32 | + <select id="status" class="form-control" name="status"> | ||
33 | + <option value="-1">全部</option> | ||
34 | + <?php foreach($statusList as $k => $v):?> | ||
35 | + <option value="<?=$k?>" <?php if($k == $gets['status']): ?>selected<?php endif; ?>><?=$v?></option> | ||
36 | + <?php endforeach;?> | ||
37 | + </select> | ||
38 | + | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + | ||
42 | + <div class="form-group col-sm-12"> | ||
43 | + <label for="production" class="col-sm-1 control-label text-right">生产日期:</label> | ||
44 | + <div class="col-sm-2 form-inline"> | ||
45 | + <input type="text" class="form-control" id="production" name="production" value="<?php if (!empty($gets['production'])){ echo $gets['production'];} ?>" autocomplete="off"> | ||
46 | + </div> | ||
47 | + <label for="manufacture" class="col-sm-1 control-label text-right">厂商:</label> | ||
48 | + <div class="col-sm-2 form-inline"> | ||
49 | + <input type="text" class="form-control" id="manufacture" name="manufacture" value="<?php if (!empty($gets['manufacture'])){ echo $gets['manufacture'];} ?>" autocomplete="off"> | ||
50 | + </div> | ||
51 | + <label for="apply_at" class="col-sm-1 control-label text-right">申请时间:</label> | ||
52 | + <div class="col-sm-2 form-inline"> | ||
53 | + <input type="text" class="form-control" id="apply_at" name="apply_at" value="<?php if (!empty($gets['apply_at'])){ echo $gets['apply_at'];} ?>" autocomplete="off"> | ||
54 | + </div> | ||
55 | + <label for="auth_at" class="col-sm-1 control-label text-right">授权时间:</label> | ||
56 | + <div class="col-sm-2 form-inline"> | ||
57 | + <input type="text" class="form-control" id="auth_at" name="auth_at" value="<?php if (!empty($gets['auth_at'])){ echo $gets['auth_at'];} ?>" autocomplete="off"> | ||
58 | + </div> | ||
59 | + </div> | ||
60 | + | ||
61 | + <div class="form-group col-sm-12"> | ||
62 | + <label for="mac" class="col-sm-1 control-label text-right">MAC地址:</label> | ||
63 | + <div class="col-sm-2 form-inline"> | ||
64 | + <input type="text" class="form-control" id="mac" name="mac" value="<?php if (!empty($gets['mac'])){ echo $gets['mac'];} ?>" autocomplete="off"> | ||
65 | + </div> | ||
66 | + <label for="device_id" class="col-sm-1 control-label text-right">设备ID:</label> | ||
67 | + <div class="col-sm-2 form-inline"> | ||
68 | + <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"> | ||
69 | + </div> | ||
70 | + <label for="handel" class="col-sm-1 control-label text-right">处理状态:</label> | ||
71 | + <div class="col-sm-2 form-inline"> | ||
72 | + <input type="text" class="form-control" id="handel" name="handel" value="<?php if (!empty($gets['handel'])){ echo $gets['handel'];} ?>" autocomplete="off"> | ||
73 | + </div> | ||
74 | + <label for="empty_serial" class="col-sm-1 control-label text-right">空序列号:</label> | ||
75 | + <div class="col-sm-2 form-inline"> | ||
76 | + <input type="text" class="form-control" id="empty_serial" name="empty_serial" value="<?php if (!empty($gets['empty_serial'])){ echo $gets['empty_serial'];} ?>" autocomplete="off"> | ||
77 | + </div> | ||
78 | + </div> | ||
79 | + | ||
80 | + <div class="form-group col-sm-12" style="text-align: center;"> | ||
81 | + <button type="submit" class="btn btn-primary font-1" id="submitFilterBtn">查询</button> | ||
82 | + </div> | ||
83 | + </form> | ||
84 | + </div> | ||
85 | +</div> | ||
86 | + | ||
87 | +<div class="panel panel-default"> | ||
88 | + <div class="panel-body"> | ||
89 | + <ul id="countryTab" class="nav nav-tabs" style="margin-bottom: 20px"> | ||
90 | + <li ><a style="padding: 10px 20px;" href="<?=Url::toRoute('/device/device/index')?>" >全部序列号</a></li> | ||
91 | + <li class="active" ><a style="padding: 10px 12px;" href="<?=Url::toRoute('/device/device/delete-index')?>" >删除序列号</a></li> | ||
92 | + </ul> | ||
93 | + </div> | ||
94 | + <table class="table table-striped table-bordered" id="brand-table"> | ||
95 | + <thead> | ||
96 | + <tr> | ||
97 | + <th width="6%">ID</th> | ||
98 | + <th width="6%">序列号</th> | ||
99 | + <th width="8%">厂商</th> | ||
100 | + <th width="6%">项目</th> | ||
101 | + <th width="8%">设备型号</th> | ||
102 | + <th width="6%">生产日期</th> | ||
103 | + <th>MAC地址</th> | ||
104 | + <th width="7%">设备ID</th> | ||
105 | + <th width="7%">申请时间</th> | ||
106 | + <th width="7%">授权时间</th> | ||
107 | + <th width="7%">状态</th> | ||
108 | + <th >操作</th> | ||
109 | + </tr> | ||
110 | + </thead> | ||
111 | + | ||
112 | + <tbody> | ||
113 | + <?php if ($deviceList) { ?> | ||
114 | + <?php foreach ($deviceList as $item) : ?> | ||
115 | + <tr> | ||
116 | + <td class="td-cls"> | ||
117 | + <?= $item['id'] ?> | ||
118 | + </td> | ||
119 | + <td class="td-cls"> | ||
120 | + <div class="cell-cls"><?= $item['serial_no'] ?></div> | ||
121 | + </td> | ||
122 | + <td class="td-cls"> | ||
123 | + <?= $item['manufacture'] ?> | ||
124 | + </td> | ||
125 | + <td class="td-cls"> | ||
126 | + <?= $item['project'] ?> | ||
127 | + </td> | ||
128 | + <td class="td-cls"> | ||
129 | + <?= $item['model'] ?> | ||
130 | + </td> | ||
131 | + <td class="td-cls"> | ||
132 | + <?= $item['production'] ?> | ||
133 | + </td> | ||
134 | + <td class="td-cls"> | ||
135 | + <div class="cell-cls edit_mac edit_mac_<?=$item['id']?>" data-id="<?=$item['id']?>" data="<?= $item['mac'] ?>"><?= $item['mac'] ?></div> | ||
136 | + </td> | ||
137 | + <td class="td-cls"> | ||
138 | + <div class="edit_device edit_device_<?=$item['id']?>" data-id="<?=$item['id']?>" data="<?=$item['device_id']?>"><?= $item['device_id']? $item['device_id']:'暂无'?></div> | ||
139 | + </td> | ||
140 | + <td class="td-cls"> | ||
141 | + <?= $item['apply_at']?date('Y-m-d H:i:s', $item['apply_at']):'暂无' ?> | ||
142 | + </td> | ||
143 | + <td class="td-cls"> | ||
144 | + <?= $item['auth_at']? date('Y-m-d H:i:s', $item['auth_at']):'暂无' ?> | ||
145 | + </td> | ||
146 | + <td class="td-cls"> | ||
147 | + <?= $statusList[$item['status']] ?> | ||
148 | + </td> | ||
149 | + <td class="td-cls"> | ||
150 | + <button class="btn btn-info btn-sm btn_edit" aid="<?=$item['id'] ?>" data-action="edit">编辑</button> | ||
151 | + </td> | ||
152 | + </tr> | ||
153 | + <?php endforeach; ?> | ||
154 | + <?php } else { ?> | ||
155 | + <tr> | ||
156 | + <td colspan="12"> | ||
157 | + <center>暂无记录</center> | ||
158 | + </td> | ||
159 | + </tr> | ||
160 | + <?php } ?> | ||
161 | + </tbody> | ||
162 | + </table> | ||
163 | + </div> | ||
164 | + | ||
165 | + <div class="panel-footer"> | ||
166 | + <div class="hqy-panel-pager"> | ||
167 | + <?= LinkPager::widget([ | ||
168 | + 'pagination' => $pages, | ||
169 | + ]); ?> | ||
170 | + <div class="clearfix"></div> | ||
171 | + </div> | ||
172 | + </div> | ||
173 | +</div> | ||
174 | + | ||
175 | +<script> | ||
176 | + var authURL = "<?=Url::toRoute('/device/device/auth-device')?>"; | ||
177 | + var delURL = "<?=Url::toRoute('/device/device/del-device')?>"; | ||
178 | + var doEditURL = "<?=Url::toRoute('/device/device/do-edit')?>"; | ||
179 | + $(function () { | ||
180 | + | ||
181 | + | ||
182 | + $('.btn_edit').click(function(e) { | ||
183 | + var editThis = $(this); | ||
184 | + var action = editThis.attr('data-action') | ||
185 | + var id = editThis.attr('aid'); | ||
186 | + var editMac = $('.edit_mac_'+id); | ||
187 | + var editDevice = $('.edit_device_'+id); | ||
188 | + | ||
189 | + if ('edit' == action ) { | ||
190 | + var editMacs = $('.edit_mac'); | ||
191 | + $.each(editMacs, function(i,n){ | ||
192 | + $(n).html($(n).attr('data')); | ||
193 | + }) | ||
194 | + var editDevices = $('.edit_device'); | ||
195 | + $.each(editDevices, function(i,n){ | ||
196 | + $(n).html($(n).attr('data')); | ||
197 | + }) | ||
198 | + var btnEdits = $('.btn_edit'); | ||
199 | + $.each(btnEdits, function(i,n){ | ||
200 | + $(n).html('编辑').attr('data-action','edit'); | ||
201 | + }) | ||
202 | + editThis.html('保存').attr('data-action','save'); | ||
203 | + | ||
204 | + var editMacVal = editMac.attr('data'); | ||
205 | + var editDeviceVal = editDevice.attr('data'); | ||
206 | + editMac.html('<input type="text" class="mac_edit" value="'+editMacVal+'">'); | ||
207 | + editDevice.html('<input type="text" class="device_edit" value="'+editDeviceVal+'">'); | ||
208 | + } else { | ||
209 | + var newMAc = editMac.find('.mac_edit').val(); | ||
210 | + var newDevice = editDevice.find('.device_edit').val(); | ||
211 | + // 请求之后保存 | ||
212 | + $.post(doEditURL, {id:id, mac: newMAc, deviceId: newDevice}, function(res){ | ||
213 | + if (res.success) { | ||
214 | + editMac.html(newMAc).attr('data', newMAc); | ||
215 | + editDevice.html(newDevice).attr('data', newDevice); | ||
216 | + editThis.html('编辑').attr('data-action','edit'); | ||
217 | + } else { | ||
218 | + alert(res.message); | ||
219 | + } | ||
220 | + | ||
221 | + }, 'json') | ||
222 | + | ||
223 | + } | ||
224 | + | ||
225 | + }) | ||
226 | + | ||
227 | + | ||
228 | + }); | ||
229 | +</script> | ||
0 | \ No newline at end of file | 230 | \ No newline at end of file |
app-ht/modules/device/views/device/index.php
@@ -86,6 +86,11 @@ $this->params['breadcrumbs'][] = $this->title; | @@ -86,6 +86,11 @@ $this->params['breadcrumbs'][] = $this->title; | ||
86 | 86 | ||
87 | <div class="panel panel-default"> | 87 | <div class="panel panel-default"> |
88 | <div class="panel-body"> | 88 | <div class="panel-body"> |
89 | + <ul id="countryTab" class="nav nav-tabs" style="margin-bottom: 20px"> | ||
90 | + <li class="active" ><a style="padding: 10px 20px;" href="<?=Url::toRoute('/device/device/index')?>" >全部序列号</a></li> | ||
91 | + <li ><a style="padding: 10px 12px;" href="<?=Url::toRoute('/device/device/delete-index')?>" >删除序列号</a></li> | ||
92 | + </ul> | ||
93 | + </div> | ||
89 | <table class="table table-striped table-bordered" id="brand-table"> | 94 | <table class="table table-striped table-bordered" id="brand-table"> |
90 | <thead> | 95 | <thead> |
91 | <tr> | 96 | <tr> |
app-ht/modules/upgrade/controllers/UpgradeController.php
@@ -4,12 +4,12 @@ namespace app\ht\modules\upgrade\controllers; | @@ -4,12 +4,12 @@ namespace app\ht\modules\upgrade\controllers; | ||
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | use yii\data\Pagination; | 6 | use yii\data\Pagination; |
7 | +use app\ht\controllers\BaseController; | ||
7 | use common\components\adminlog\AdminLogs; | 8 | use common\components\adminlog\AdminLogs; |
8 | use domain\manufacturer\ManufacturerRepository; | 9 | use domain\manufacturer\ManufacturerRepository; |
9 | use domain\upgrade\Upgrade; | 10 | use domain\upgrade\Upgrade; |
10 | use domain\upgrade\UpgradeRepository; | 11 | use domain\upgrade\UpgradeRepository; |
11 | use domain\upgrade\UpgradeStatus; | 12 | use domain\upgrade\UpgradeStatus; |
12 | -use app\ht\controllers\BaseController; | ||
13 | 13 | ||
14 | use stdClass; | 14 | use stdClass; |
15 | 15 | ||
@@ -156,11 +156,25 @@ class UpgradeController extends BaseController | @@ -156,11 +156,25 @@ class UpgradeController extends BaseController | ||
156 | $request = Yii::$app->request; | 156 | $request = Yii::$app->request; |
157 | $id = $request->post("id"); // | 157 | $id = $request->post("id"); // |
158 | $e = new stdClass(); | 158 | $e = new stdClass(); |
159 | + $e->success = false; | ||
160 | + $e->message = 'fail'; | ||
159 | if (empty($id)) { | 161 | if (empty($id)) { |
160 | - | 162 | + $e->message = 'ID为空'; |
163 | + return $this->renderJson($e); | ||
164 | + } | ||
165 | + $upgradeModel = UpgradeRepository::findOne(['id' => $id]); | ||
166 | + if (empty($upgradeModel)) { | ||
167 | + $e->message = '未找到版本记录'; | ||
161 | return $this->renderJson($e); | 168 | return $this->renderJson($e); |
162 | } | 169 | } |
170 | + $upgradeModel->status = UpgradeStatus::STATUS_WAIT; | ||
171 | + if ($upgradeModel->save()) { | ||
172 | + $e->success = true; | ||
173 | + } else { | ||
174 | + $e->message = '取消失败'; | ||
175 | + } | ||
163 | 176 | ||
177 | + return $this->renderJson($e); | ||
164 | } | 178 | } |
165 | 179 | ||
166 | /** | 180 | /** |
@@ -606,6 +620,7 @@ class UpgradeController extends BaseController | @@ -606,6 +620,7 @@ class UpgradeController extends BaseController | ||
606 | } else { | 620 | } else { |
607 | Yii::$app->session->setFlash('error', '发布失败'); | 621 | Yii::$app->session->setFlash('error', '发布失败'); |
608 | } | 622 | } |
623 | + | ||
609 | return $this->redirect('index?type=' . (!empty($request->post("type")) ? $request->post("type") : UpgradeStatus::TYPE_APP)); | 624 | return $this->redirect('index?type=' . (!empty($request->post("type")) ? $request->post("type") : UpgradeStatus::TYPE_APP)); |
610 | } | 625 | } |
611 | } | 626 | } |
612 | \ No newline at end of file | 627 | \ No newline at end of file |
app-ht/views/site/error/400.php
@@ -19,7 +19,7 @@ use yii\helpers\Url; | @@ -19,7 +19,7 @@ use yii\helpers\Url; | ||
19 | 19 | ||
20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> | 20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> |
21 | 21 | ||
22 | - <p style="margin-bottom: 30px"> 邮箱:tech@jiwork.com</p> | 22 | + <p style="margin-bottom: 30px"> 邮箱:tech@szboardtek.com</p> |
23 | 23 | ||
24 | ---- 400 OTA技术部(求约) | 24 | ---- 400 OTA技术部(求约) |
25 | </div> | 25 | </div> |
app-ht/views/site/error/403.php
@@ -19,7 +19,7 @@ use yii\helpers\Url; | @@ -19,7 +19,7 @@ use yii\helpers\Url; | ||
19 | 19 | ||
20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> | 20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> |
21 | 21 | ||
22 | - <p style="margin-bottom: 30px"> 邮箱:tech@jiwork.com</p> | 22 | + <p style="margin-bottom: 30px"> 邮箱:tech@szboardtek.com</p> |
23 | 23 | ||
24 | ----OTA技术部(求约) | 24 | ----OTA技术部(求约) |
25 | </div> | 25 | </div> |
app-ht/views/site/error/404.php
@@ -19,7 +19,7 @@ use yii\helpers\Url; | @@ -19,7 +19,7 @@ use yii\helpers\Url; | ||
19 | 19 | ||
20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> | 20 | <p style="margin-bottom:60px">请一定告诉我们,我们深宅多年练就的功力,就是为了化问题为神奇。</p> |
21 | 21 | ||
22 | - <p style="margin-bottom: 30px"> 邮箱:tech@jiwork.com</p> | 22 | + <p style="margin-bottom: 30px"> 邮箱:tech@szboardtek.com</p> |
23 | 23 | ||
24 | ---- 404(求约) | 24 | ---- 404(求约) |
25 | </div> | 25 | </div> |
domain/device/CreateBatchRepository.php
@@ -81,11 +81,13 @@ class CreateBatchRepository | @@ -81,11 +81,13 @@ class CreateBatchRepository | ||
81 | static function getPageList($where, $offset = 0, $limit = 0) | 81 | static function getPageList($where, $offset = 0, $limit = 0) |
82 | { | 82 | { |
83 | $hasAuthNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.status =".DeviceStatus::HAS_AUTH.' and dd.batch_id = a.id and dd.is_delete = 0) as has_auth_num'); | 83 | $hasAuthNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.status =".DeviceStatus::HAS_AUTH.' and dd.batch_id = a.id and dd.is_delete = 0) as has_auth_num'); |
84 | - $noAuthNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.status =".DeviceStatus::NO_AUTH.' and dd.batch_id = a.id and dd.is_delete = 0) as no_auth_num'); | 84 | + $noAuthNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.status =".DeviceStatus::NO_AUTH.' and dd.batch_id = a.id and dd.is_delete = 0) as del_num'); |
85 | + | ||
86 | + $delNumExpress = new Expression("(select count(*) from ".DeviceModel::tableName(). "as dd where dd.is_delete = 1 and dd.batch_id = a.id) as del_num"); | ||
85 | 87 | ||
86 | $batchModelFind = CreateBatchModel::find(); | 88 | $batchModelFind = CreateBatchModel::find(); |
87 | $batchModelFind->alias('a'); | 89 | $batchModelFind->alias('a'); |
88 | - $batchModelFind->select(['a.*','m.name as manufacture_name','pro.name as project_name','mo.name as model_name','prod.name as production_name', $hasAuthNumExpress, $noAuthNumExpress]); | 90 | + $batchModelFind->select(['a.*','m.name as manufacture_name','pro.name as project_name','mo.name as model_name','prod.name as production_name', $hasAuthNumExpress, $noAuthNumExpress, $delNumExpress]); |
89 | $batchModelFind->leftJoin(ManufacturerModel::tableName(). ' m', 'm.id = a.manufacture_id'); | 91 | $batchModelFind->leftJoin(ManufacturerModel::tableName(). ' m', 'm.id = a.manufacture_id'); |
90 | $batchModelFind->leftJoin(ProjectModel::tableName(). ' pro', 'pro.id = a.project_id'); | 92 | $batchModelFind->leftJoin(ProjectModel::tableName(). ' pro', 'pro.id = a.project_id'); |
91 | $batchModelFind->leftJoin(ModelModel::tableName(). ' mo', 'mo.id = a.model_id'); | 93 | $batchModelFind->leftJoin(ModelModel::tableName(). ' mo', 'mo.id = a.model_id'); |
domain/upgrade/Upgrade.php
@@ -84,7 +84,7 @@ class Upgrade | @@ -84,7 +84,7 @@ class Upgrade | ||
84 | $upgradeModel->start_version = $item['start_version']; | 84 | $upgradeModel->start_version = $item['start_version']; |
85 | } | 85 | } |
86 | // 增量允许的结束版本号 | 86 | // 增量允许的结束版本号 |
87 | - if (isset($item['end_version']) && !empty($item['end_version'])) { | 87 | + if (isset($item['end_version'])) { |
88 | $upgradeModel->end_version = $item['end_version']; | 88 | $upgradeModel->end_version = $item['end_version']; |
89 | } | 89 | } |
90 | if (isset($item['size']) && !empty($item['size'])) { | 90 | if (isset($item['size']) && !empty($item['size'])) { |
domain/upgrade/UpgradeStatus.php
@@ -60,7 +60,7 @@ class UpgradeStatus | @@ -60,7 +60,7 @@ class UpgradeStatus | ||
60 | public static function focuseLabels() | 60 | public static function focuseLabels() |
61 | { | 61 | { |
62 | return [ | 62 | return [ |
63 | - self::FOCUSE_NO => '不强制升级', | 63 | + self::FOCUSE_NO => '正常升级', |
64 | self::FOCUSE_YES => '强制升级' | 64 | self::FOCUSE_YES => '强制升级' |
65 | ]; | 65 | ]; |
66 | } | 66 | } |