作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

@@ -92,7 +92,14 @@ class AdminEquipmentController extends AdminBaseController{ @@ -92,7 +92,14 @@ class AdminEquipmentController extends AdminBaseController{
92 } 92 }
93 93
94 public function editPost(){ 94 public function editPost(){
95 - 95 + $data=$this->request->post();
  96 + $Equipment=new EquipmentModel();
  97 + $res=$Equipment->save($data);
  98 + if ($res){
  99 + $this->apiResponse(200,'保存成功');
  100 + }else{
  101 + $this->apiResponse(301,'error');
  102 + }
96 } 103 }
97 104
98 //批量导入设备信息 105 //批量导入设备信息
@@ -29,10 +29,10 @@ @@ -29,10 +29,10 @@
29 <body> 29 <body>
30 <div class="wrap js-check-wrap"> 30 <div class="wrap js-check-wrap">
31 <ul class="nav nav-tabs"> 31 <ul class="nav nav-tabs">
32 - <li class="active"><a>添加设备信息</a></li> 32 + <li class="active"><a>编辑设备信息</a></li>
33 </ul> 33 </ul>
34 <!--js-ajax-form margin-top-20--> 34 <!--js-ajax-form margin-top-20-->
35 - <form action="{:url('AdminTestInfo/addPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20"> 35 + <form action="" method="post" class="form-horizontal js-ajax-form margin-top-20">
36 <div class="row"> 36 <div class="row">
37 <div class="col-md-2"></div> 37 <div class="col-md-2"></div>
38 <div class="col-md-8"> 38 <div class="col-md-8">
@@ -41,35 +41,30 @@ @@ -41,35 +41,30 @@
41 <th width="80">设备锁编号<span class="form-required">*</span></th> 41 <th width="80">设备锁编号<span class="form-required">*</span></th>
42 <td> 42 <td>
43 <input class="form-control" type="text" name="serial_number" 43 <input class="form-control" type="text" name="serial_number"
44 - id="serial_number" required value="" placeholder="请输入设备锁编号"/> 44 + id="serial_number" required value="{$data.serial_number}" placeholder="请输入设备锁编号"/>
45 </td> 45 </td>
46 <th width="80">设备MAC地址<span class="form-required">*</span></th> 46 <th width="80">设备MAC地址<span class="form-required">*</span></th>
47 - <td><input class="form-control" type="text" name="mac_address" id="mac_address" value="" 47 + <td><input class="form-control" type="text" name="mac_address" id="mac_address" value="{$data.mac_address}"
48 placeholder="请输入设备MAC地址" required></td> 48 placeholder="请输入设备MAC地址" required></td>
49 </tr> 49 </tr>
50 <tr> 50 <tr>
51 <th width="80">设备锁名称<span class="form-required">*</span></th> 51 <th width="80">设备锁名称<span class="form-required">*</span></th>
52 <td> 52 <td>
53 - <input class="form-control" type="text" name="name" id="name" value="" 53 + <input class="form-control" type="text" name="name" id="name" value="{$data.name}"
54 placeholder="请输入设备锁名称" required> 54 placeholder="请输入设备锁名称" required>
55 </td> 55 </td>
56 - <th width="80">所属医院</th> 56 + <th width="80">所属医院<span class="form-required">*</span></th>
57 <td> 57 <td>
58 - <input class="form-control" type="text" name="hospital" id="hospital" value=""  
59 - placeholder="请输入所属医院"> 58 + <input class="form-control" type="text" name="hospital" id="hospital" value="{$data.hospital}"
  59 + placeholder="请输入所属医院" required>
60 </td> 60 </td>
61 </tr> 61 </tr>
62 <tr> 62 <tr>
63 <th width="80">备注<span class="form-required">*</span></th> 63 <th width="80">备注<span class="form-required">*</span></th>
64 - <td>  
65 - <input class="form-control" type="text" name="note" id="note" 64 + <td colspan="3">
  65 + <input class="form-control" type="text" name="note" id="note" value="{$data.note}"
66 placeholder="请填写备注" required> 66 placeholder="请填写备注" required>
67 </td> 67 </td>
68 - <th width="80">导入时间<span class="form-required">*</span></th>  
69 - <td>  
70 - <input class="form-control" name="create_time" id="create_time"  
71 - value="{:date('Y-m-d H:i:s',time())}" required>  
72 - </td>  
73 </tr> 68 </tr>
74 69
75 </table> 70 </table>
@@ -84,19 +79,17 @@ @@ -84,19 +79,17 @@
84 <script type="text/javascript"> 79 <script type="text/javascript">
85 function confirm() { 80 function confirm() {
86 var serial_number = $('#serial_number').val(); 81 var serial_number = $('#serial_number').val();
87 - var mac_address = $('#mac_address').val();  
88 - var name = $('#name').val(); 82 +// var mac_address = $('#mac_address').val();
  83 +// var name = $('#name').val();
89 var hospital = $('#hospital').val(); 84 var hospital = $('#hospital').val();
90 var note = $('#note').val(); 85 var note = $('#note').val();
91 - var create_time = $('#create_time').val();  
92 86
93 return { 87 return {
94 serial_number:serial_number, 88 serial_number:serial_number,
95 - mac_address :mac_address,  
96 - name :name, 89 +// mac_address :mac_address,
  90 +// name :name,
97 hospital :hospital, 91 hospital :hospital,
98 - note :note,  
99 - create_time :create_time 92 + note :note
100 }; 93 };
101 } 94 }
102 </script> 95 </script>
@@ -204,15 +204,14 @@ @@ -204,15 +204,14 @@
204 var iframeWin = window[layero.find('iframe')[0]['name']]; 204 var iframeWin = window[layero.find('iframe')[0]['name']];
205 var data = iframeWin.confirm(); 205 var data = iframeWin.confirm();
206 $.ajax({ 206 $.ajax({
207 - url:"{:url('AdminEquipment/addPost')}", 207 + url:"{:url('AdminEquipment/editPost')}",
208 type:"POST", 208 type:"POST",
209 data:{ 209 data:{
210 serial_number:data.serial_number, 210 serial_number:data.serial_number,
211 - mac_address:data.mac_address,  
212 - name:data.name, 211 +// mac_address:data.mac_address,
  212 +// name:data.name,
213 hospital:data.hospital, 213 hospital:data.hospital,
214 - note:data.note,  
215 - create_time:data.create_time 214 + note:data.note
216 }, 215 },
217 dataType:"JSON", 216 dataType:"JSON",
218 success:function (data) { 217 success:function (data) {