Commit b8970364c233f815cb437e0501c41658f86322b5

Authored by xu
1 parent 94d44367
Exists in master

app-ht

1. F 后台厂商,项目,型号,生产日期不能录入空格
2. F 改筛选列表各个选择的autocomplete off
app-ht/modules/device/controllers/DeviceController.php
... ... @@ -847,9 +847,9 @@ class DeviceController extends BaseController
847 847 $trans = Yii::$app->getDb()->beginTransaction();
848 848 try {
849 849 $newDeviceModel->device_id = $deviceId;
850   - $newDeviceModel->status = DeviceStatus::HAS_AUTH;
  850 + $newDeviceModel->status = DeviceStatus::NO_AUTH;
851 851 $newDeviceModel->apply_at = $tt ;
852   - $newDeviceModel->auth_at = $tt;
  852 + //$newDeviceModel->auth_at = $tt;
853 853 $newDeviceModel->save();
854 854 $deviceFailModel->is_delete = 1;
855 855 $deviceFailModel->save();
... ...
app-ht/modules/manufacturer/controllers/ManufacturerController.php
... ... @@ -103,7 +103,7 @@ class ManufacturerController extends BaseController
103 103 $request = Yii::$app->request;
104 104 $name = $request->post("name");
105 105 $phone = $request->post("phone");
106   - if (empty($name)) {
  106 + if (empty(trim($name))) {
107 107 Yii::$app->session->setFlash('error', '厂商名称不能为空');
108 108 return $this->render('create');
109 109 }
... ... @@ -156,7 +156,7 @@ class ManufacturerController extends BaseController
156 156 $params = $this->dataList(1);
157 157 return $this->render('index', $params);
158 158 }
159   - if (empty($name)) {
  159 + if (empty(trim($name))) {
160 160 Yii::$app->session->setFlash('error', '厂商名称不能为空');
161 161 return $this->render('edit', ["isCreateSuccess" => false, "info" => $manufacturer]);
162 162 }
... ...
app-ht/modules/manufacturer/views/manufacturer/create.php
... ... @@ -17,13 +17,13 @@ $this->params['breadcrumbs'][] = $this->title;
17 17 <div class="form-group col-sm-12">
18 18 <label for="skillName" class="col-sm-4 control-label text-right">厂商名称:</label>
19 19 <div class="col-sm-4 text-left">
20   - <input type="text" value="" name="name" placeholder="请填写厂商名称" class="form-control"">
  20 + <input type="text" value="" name="name" placeholder="请填写厂商名称" class="form-control"" autocomplete="off">
21 21 </div>
22 22 </div>
23 23 <div class="form-group col-sm-12">
24 24 <label for="skillName" class="col-sm-4 control-label text-right">厂商电话:</label>
25 25 <div class="col-sm-4 text-left">
26   - <input type="text" value="" name="phone" placeholder="请填写联系电话" class="form-control" >
  26 + <input type="text" value="" name="phone" placeholder="请填写联系电话" class="form-control" autocomplete="off">
27 27 </div>
28 28 </div>
29 29 </div>
... ... @@ -51,8 +51,8 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
51 51 $('#myFrom').attr('action', getUrl);
52 52 var a = $("input[name='name']").val();
53 53 var b = $("input[name='phone']").val();
54   - if (a == ""){
55   - alert("用户名称不能为空");
  54 + if ($.trim(a) == ""){
  55 + alert("厂商名称不能为空");
56 56 return false;
57 57 }
58 58 if (!new RegExp("^0?(13|15|18|14|17)[0-9]{9}$").test(b)){
... ...
app-ht/modules/manufacturer/views/manufacturer/edit.php
... ... @@ -27,19 +27,19 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
27 27 <div class="form-group col-sm-12">
28 28 <label for="skillName" class="col-sm-4 control-label text-right">厂商名称:</label>
29 29 <div class="col-sm-4 text-left">
30   - <input type="text" value="<?= isset($info["name"]) ? $info["name"] : "" ?>" name="name" placeholder="请填写厂商名称" class="form-control">
  30 + <input type="text" value="<?= isset($info["name"]) ? $info["name"] : "" ?>" name="name" placeholder="请填写厂商名称" class="form-control" autocomplete="off">
31 31 </div>
32 32 </div>
33 33 <div class="form-group col-sm-12">
34 34 <label for="skillName" class="col-sm-4 control-label text-right">厂商电话:</label>
35 35 <div class="col-sm-4 text-left">
36   - <input type="text" value="<?= isset($info["phone"]) ? $info["phone"] : "" ?>" name="phone" placeholder="请填写联系电话" class="form-control" >
  36 + <input type="text" value="<?= isset($info["phone"]) ? $info["phone"] : "" ?>" name="phone" placeholder="请填写联系电话" class="form-control" autocomplete="off">
37 37 </div>
38 38 </div>
39 39 <div class="form-group col-sm-12">
40 40 <label for="skillName" class="col-sm-4 control-label text-right">账号:</label>
41 41 <div class="col-sm-4 text-left">
42   - <input type="text" value="<?= isset($info["username"]) ? $info["username"] : "" ?>" name="username" placeholder="请填写账号名称" class="form-control" >
  42 + <input type="text" value="<?= isset($info["username"]) ? $info["username"] : "" ?>" name="username" placeholder="请填写账号名称" class="form-control" autocomplete="off">
43 43 </div>
44 44 </div>
45 45 <div class="form-group col-sm-12">
... ... @@ -76,7 +76,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
76 76 var b = $("input[name='phone']").val();
77 77 var c = $("input[name='username']").val();
78 78 var d = $("input[name='password']").val();
79   - if (a == ""){
  79 + if ($.trim(a) == ""){
80 80 alert("用户名称不能为空");
81 81 return false;
82 82 }
... ... @@ -84,12 +84,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
84 84 alert("请填写正确的手机号码");
85 85 return false;
86 86 }
87   - if (c == ""){
  87 + if ($.trim(c) == ""){
88 88 alert("账号不能为空");
89 89 $("input[name='username']").focus();
90 90 return false;
91 91 }
92   - if (d == ""){
  92 + if ($.trim(d) == ""){
93 93 alert("密码不能为空");
94 94 return false;
95 95 }
... ...
app-ht/modules/manufacturer/views/manufacturer/index.php
... ... @@ -25,11 +25,11 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
25 25 <tbody>
26 26 <tr >
27 27 <td width="10%" class="text-right">厂商名称:</td>
28   - <td width="20%" class="text-left"><input type="text" placeholder="输入厂商名称" class="form-control" name="name" id="name" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>"></td>
  28 + <td width="20%" class="text-left"><input type="text" placeholder="厂商关键字" autocomplete="off" class="form-control" name="name" id="name" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>"></td>
29 29 <td width="10%" class="text-right">联系电话:</td>
30   - <td width="20%" class="text-left"><input type="text" placeholder="输入联系电话" class="form-control" name="phone" id="phone" value="<?php if (!empty($gets['phone'])){ echo $gets['phone']; } ?>"></td>
  30 + <td width="20%" class="text-left"><input type="text" placeholder="联系电话键字" autocomplete="off" class="form-control" name="phone" id="phone" value="<?php if (!empty($gets['phone'])){ echo $gets['phone']; } ?>"></td>
31 31 <td width="10%" class="text-right">账号:</td>
32   - <td width="20%" class="text-left"><input type="text" placeholder="输入登录账号" class="form-control" name="loginName" id="loginName" value="<?php if (!empty($gets['loginName'])){ echo $gets['loginName']; } ?>"></td>
  32 + <td width="20%" class="text-left"><input type="text" placeholder="输入登录账号" autocomplete="off" class="form-control" name="loginName" id="loginName" value="<?php if (!empty($gets['loginName'])){ echo $gets['loginName']; } ?>"></td>
33 33 </tr>
34 34 <tr >
35 35 <td width="10%" class="text-right">厂商添加开始时间:</td>
... ...
app-ht/modules/model/controllers/ModelController.php
... ... @@ -91,7 +91,7 @@ class ModelController extends BaseController
91 91 {
92 92 $request = Yii::$app->request;
93 93 $name = $request->post("name"); // 机器型号
94   - if (empty($name)) {
  94 + if (empty(trim($name))) {
95 95 Yii::$app->session->setFlash('error', '机器型号不能为空');
96 96 return $this->render('create');
97 97 }
... ... @@ -140,7 +140,7 @@ class ModelController extends BaseController
140 140 $params = $this->dataList(1);
141 141 return $this->render('index', $params);
142 142 }
143   - if (empty($name)) {
  143 + if (empty(trim($name))) {
144 144 Yii::$app->session->setFlash('error', '机器型号不能为空');
145 145 return $this->render('edit', ["info" => $model]);
146 146 }
... ...
app-ht/modules/model/views/model/create.php
... ... @@ -17,7 +17,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
17 17 <div class="form-group col-sm-12">
18 18 <label for="skillName" class="col-sm-4 control-label text-right">机器型号:</label>
19 19 <div class="col-sm-4 text-left">
20   - <input type="text" value="" name="name" placeholder="请输入机器型号" style="margin-top: -6px;" class="form-control"">
  20 + <input type="text" value="" name="name" placeholder="请输入机器型号" style="margin-top: -6px;" class="form-control"" autocomplete="off">
21 21 </div>
22 22 </div>
23 23 </div>
... ... @@ -44,7 +44,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
44 44 var getUrl = '<?=Url::toRoute("/model/model/do-add")?>';
45 45 $('#myFrom').attr('action', getUrl);
46 46 var a = $("input[name='name']").val();
47   - if (a == ""){
  47 + if ($.trim(a) == ""){
48 48 alert("机器型号不能为空");
49 49 return false;
50 50 }
... ...
app-ht/modules/model/views/model/edit.php
... ... @@ -20,7 +20,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
20 20 <div class="form-group col-sm-12">
21 21 <label for="skillName" class="col-sm-4 control-label text-right">机器型号:</label>
22 22 <div class="col-sm-4 text-left">
23   - <input type="text" value="<?= isset($info["name"]) ? $info["name"] : "" ?>" style="margin-top: -6px;" name="name" placeholder="请填写机器型号" class="form-control">
  23 + <input type="text" value="<?= isset($info["name"]) ? $info["name"] : "" ?>" style="margin-top: -6px;" name="name" placeholder="请填写机器型号" class="form-control" autocomplete="off">
24 24 </div>
25 25 </div>
26 26 </div>
... ... @@ -48,7 +48,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
48 48 var getUrl = '<?=Url::toRoute("/model/model/do-edit")?>';
49 49 $('#myFrom').attr('action', getUrl);
50 50 var a = $("input[name='name']").val();
51   - if (a == ""){
  51 + if ($.trim(a) == ""){
52 52 alert("机器型号不能为空");
53 53 return false;
54 54 }
... ...
app-ht/modules/model/views/model/index.php
... ... @@ -27,7 +27,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
27 27 <td width="10%" class="text-right">机器型号</td>
28 28 <td width="35%" class="text-left">
29 29 <div class="form-inline">
30   - <input type="text" class="form-control" style="width: 150px;" name="name" placeholder="输入机器型号" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>">
  30 + <input type="text" class="form-control" style="width: 150px;" name="name" placeholder="型号关键字" autocomplete="off" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>">
31 31 </div>
32 32 </td>
33 33 <td width="10%" class="text-right">创建时间</td>
... ...
app-ht/modules/production/controllers/ProductionController.php
... ... @@ -147,7 +147,7 @@ class ProductionController extends BaseController
147 147 $params = $this->dataList(1);
148 148 return $this->render('index', $params);
149 149 }
150   - if (empty($name)) {
  150 + if (empty(trim($name))) {
151 151 Yii::$app->session->setFlash('error', '生产日期不能为空');
152 152 return $this->render('edit', ["info" => $production]);
153 153 }
... ...
app-ht/modules/production/views/production/create.php
... ... @@ -17,7 +17,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
17 17 <div class="form-group col-sm-12">
18 18 <label for="skillName" class="col-sm-4 control-label text-right">生产日期:</label>
19 19 <div class="col-sm-4 text-left">
20   - <input type="date" value="" name="name" placeholder="请输入生产日期(如:2019-10-28)" style="margin-top: -6px;" class="form-control"">
  20 + <input type="date" value="" name="name" placeholder="请输入生产日期(如:2019-10-28)" style="margin-top: -6px;" class="form-control"" autocomplete="off">
21 21 </div>
22 22 </div>
23 23 </div>
... ... @@ -44,7 +44,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
44 44 var getUrl = '<?=Url::toRoute("/production/production/do-add")?>';
45 45 $('#myFrom').attr('action', getUrl);
46 46 var a = $("input[name='name']").val();
47   - if (a == ""){
  47 + if ($.trim(a) == ""){
48 48 alert("生产日期不能为空");
49 49 return false;
50 50 }
... ...
app-ht/modules/production/views/production/edit.php
... ... @@ -48,7 +48,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
48 48 var getUrl = '<?=Url::toRoute("/production/production/do-edit")?>';
49 49 $('#myFrom').attr('action', getUrl);
50 50 var a = $("input[name='name']").val();
51   - if (a == ""){
  51 + if ($.trim(a) == ""){
52 52 alert("生产日期不能为空");
53 53 return false;
54 54 }
... ...
app-ht/modules/project/controllers/ProjectController.php
... ... @@ -140,7 +140,7 @@ class ProjectController extends BaseController
140 140 $params = $this->dataList(1);
141 141 return $this->render('index', $params);
142 142 }
143   - if (empty($name)) {
  143 + if (empty(trim($name))) {
144 144 Yii::$app->session->setFlash('error', '项目不能为空');
145 145 return $this->render('edit', ["info" => $Project]);
146 146 }
... ...
app-ht/modules/project/views/project/create.php
... ... @@ -17,7 +17,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
17 17 <div class="form-group col-sm-12">
18 18 <label for="skillName" class="col-sm-4 control-label text-right">项目名称:</label>
19 19 <div class="col-sm-4 text-left">
20   - <input type="text" value="" name="name" placeholder="请输入项目名称" style="margin-top: -6px;" class="form-control"">
  20 + <input type="text" value="" name="name" placeholder="请输入项目名称" style="margin-top: -6px;" class="form-control"" autocomplete="off">
21 21 </div>
22 22 </div>
23 23 </div>
... ... @@ -44,7 +44,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
44 44 var getUrl = '<?=Url::toRoute("/project/project/do-add")?>';
45 45 $('#myFrom').attr('action', getUrl);
46 46 var a = $("input[name='name']").val();
47   - if (a == ""){
  47 + if ($.trim(a) == ""){
48 48 alert("项目名称不能为空");
49 49 return false;
50 50 }
... ...
app-ht/modules/project/views/project/edit.php
... ... @@ -48,7 +48,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
48 48 var getUrl = '<?=Url::toRoute("/project/project/do-edit")?>';
49 49 $('#myFrom').attr('action', getUrl);
50 50 var a = $("input[name='name']").val();
51   - if (a == ""){
  51 + if ($.trim(a) == ""){
52 52 alert("项目名称不能为空");
53 53 return false;
54 54 }
... ...
app-ht/modules/project/views/project/index.php
... ... @@ -27,7 +27,7 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
27 27 <td width="10%" class="text-right">项目名称</td>
28 28 <td width="35%" class="text-left">
29 29 <div class="form-inline">
30   - <input type="text" class="form-control" style="width: 150px;" name="name" placeholder="输入项目名称" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>">
  30 + <input type="text" class="form-control" style="width: 150px;" name="name" autocomplete="off" placeholder="项目关键字" value="<?php if (!empty($gets['name'])){ echo $gets['name']; } ?>">
31 31 </div>
32 32 </td>
33 33 <td width="10%" class="text-right">创建时间</td>
... ...
domain/manufacturer/Manufacturer.php
... ... @@ -26,8 +26,8 @@ class Manufacturer
26 26 try {
27 27 $manufacturerModel = Yii::createObject(ManufacturerModel::className());
28 28 $manufacturerModel->manufacture_no = self::getManufactureNo();
29   - $manufacturerModel->name = $item["name"]; // 厂商名称
30   - $manufacturerModel->phone = $item['phone'];
  29 + $manufacturerModel->name = trim($item["name"]); // 厂商名称
  30 + $manufacturerModel->phone = trim($item['phone']);
31 31 $result = $manufacturerModel->save();
32 32 $saveResult = false;
33 33 if ($result) {
... ... @@ -87,6 +87,9 @@ class Manufacturer
87 87 if (empty($sysUserModel)) {
88 88 return false;
89 89 }
  90 + if (isset($item['name'])) {
  91 + $item['name'] = trim($item['name']);
  92 + }
90 93 if (isset($item['name']) && !empty($item['name'])) {
91 94 $manufacturerModel->name = $item['name'];
92 95 }
... ...
domain/model/Model.php
... ... @@ -20,7 +20,10 @@ class Model
20 20 static function create($item)
21 21 {
22 22 try {
23   - $findModelModel = ModelModel::findOne(['name' => $item["name"]]);
  23 + if (isset($item['name'])) {
  24 + $item['name'] = trim($item["name"]);
  25 + }
  26 + $findModelModel = ModelModel::findOne(['name' => $item['name']]);
24 27 if (!empty($findModelModel)) {
25 28 return -1;
26 29 }
... ... @@ -46,6 +49,9 @@ class Model
46 49 if (empty($modelModel)) {
47 50 return false;
48 51 }
  52 + if (isset($item['name'])) {
  53 + $item['name'] = trim($item["name"]);
  54 + }
49 55 if (isset($item['name']) && $modelModel->name != $item['name']) {
50 56 $findModelModel = ModelModel::findOne(['name' => $item["name"]]);
51 57 if (!empty($findModelModel)) {
... ...
domain/production/Production.php
... ... @@ -46,6 +46,9 @@ class Production
46 46 if (empty($productionModel)) {
47 47 return false;
48 48 }
  49 + if (isset($item['name'])) {
  50 + $item['name'] = trim($item["name"]);
  51 + }
49 52 if (isset($item['name']) && $productionModel->name != $item['name']) {
50 53 $findProductionModel = ProductionModel::findOne(['name' => $item["name"]]);
51 54 if (!empty($findProductionModel)) {
... ...
domain/project/Project.php
... ... @@ -20,6 +20,9 @@ class Project
20 20 static function create($item)
21 21 {
22 22 try {
  23 + if (isset($item['name'])) {
  24 + $item['name'] = trim($item['name']);
  25 + }
23 26 $findProjectModel = ProjectModel::findOne(['name' => $item["name"]]);
24 27 if (!empty($findProjectModel)) {
25 28 return -1;
... ... @@ -46,6 +49,9 @@ class Project
46 49 if (empty($projectModel)) {
47 50 return false;
48 51 }
  52 + if (isset($item['name'])) {
  53 + $item['name'] = trim($item['name']);
  54 + }
49 55 if (isset($item['name']) && $projectModel->name != $item['name']) {
50 56 $findProjectModel = ProjectModel::findOne(['name' => $item["name"]]);
51 57 if (!empty($findProjectModel)) {
... ...