59b0f22e by wang

init

1 parent 878e56db
...@@ -26,9 +26,19 @@ class Perm extends CI_Controller { ...@@ -26,9 +26,19 @@ class Perm extends CI_Controller {
26 $this->load->view('perm/staffAdd'); 26 $this->load->view('perm/staffAdd');
27 } 27 }
28 28
29 public function staffEdit() 29 public function staffEdit($id)
30 { 30 {
31 $this->load->view('perm/staffEdit'); 31 $url = $this->config->item('apiBaseUrl') . 'system/user/get/'.$id;
32 $result = file_get_contents($url);
33 $json = json_decode($result);
34 $ret = $json->data;
35 // $roles =
36
37 $data = array(
38 'item'=>$ret,
39 'id'=>$id
40 );
41 $this->load->view('perm/staffEdit',$data);
32 } 42 }
33 43
34 //重置密码 44 //重置密码
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
92 name:data['name'], 92 name:data['name'],
93 username:data['username'], 93 username:data['username'],
94 telephone:data['phone'], 94 telephone:data['phone'],
95 idcard:data['idcard'], 95 idCard:data['idcard'],
96 password:data['password'], 96 password:data['password'],
97 roleIds:rolesid, 97 roleIds:rolesid,
98 // roles:data['roles'], 98 // roles:data['roles'],
......
...@@ -4,43 +4,47 @@ ...@@ -4,43 +4,47 @@
4 <div class="panel panel-default"> 4 <div class="panel panel-default">
5 <div class="panel-body"> 5 <div class="panel-body">
6 <form action="system/user/update" id="edit"> 6 <form action="system/user/update" id="edit">
7 <input type="hidden" value="<?=$id?>" name="id">
7 <div class="row cl"> 8 <div class="row cl">
8 <div class="form-group col-sm-4 col-md-2"> 9 <div class="form-group col-sm-4 col-md-2">
9 <label>用户名</label> 10 <label>用户名</label>
10 <input type="text" class="form-control input-text" name="username" value=""> 11 <input type="text" class="form-control input-text" name="username" value="<?=$item->username?>">
11 </div> 12 </div>
12 <div class="form-group col-sm-4 col-md-2"> 13 <div class="form-group col-sm-4 col-md-2">
13 <label>真实姓名</label> 14 <label>真实姓名</label>
14 <input type="text" class="form-control input-text" name="name" value=""> 15 <input type="text" class="form-control input-text" name="name" value="<?=$item->name?>">
15 </div> 16 </div>
16 <div class="form-group col-sm-4 col-md-2"> 17 <div class="form-group col-sm-4 col-md-2">
17 <label>手机号</label> 18 <label>手机号</label>
18 <input type="text" class="form-control input-text" name="phone" value=""> 19 <input type="text" class="form-control input-text" name="phone" value="<?=$item->phone?>">
19 </div> 20 </div>
20 <div class="form-group col-sm-4 col-md-2"> 21 <div class="form-group col-sm-4 col-md-2">
21 <label>身份证号码</label> 22 <label>身份证号码</label>
22 <input type="text" class="form-control input-text" name="idcard" value=""> 23 <input type="text" class="form-control input-text" name="idCard" value="<?=$item->idCard?>">
23 </div> 24 </div>
24 </div> 25 </div>
25 <div class="row cl"> 26 <div class="row cl">
26 <div class="form-group col-sm-4 col-md-2"> 27 <div class="form-group col-sm-4 col-md-2">
27 <label>所属网点</label> 28 <label>所属网点</label>
28 <select class="select" size="5" name="children" multiple> 29 <select class="select" name="children" size="5" multiple>
29 <option selected value>请选择</option> 30 <option selected value>请选择</option>
30 <option value>请选择</option> 31 <?php foreach ($this->session->departments as $k => $v): ?>
31 <option value>请选择</option> 32 <option value="<?= $v->id ?>"><?= $v->name ?></option>
32 <option value>请选择</option> 33 <?php if ($v->children && !empty($v->children)): ?>
33 <option value>请选择</option> 34 <?php foreach ($v->children as $kk => $vv): ?>
35 <option value="<?= $vv->id ?>" <?php if($item->department_id==$v->id) echo 'selected';?> ><?= $vv->name ?></option>
36 <?php endforeach; ?>
37 <?php endif; ?>
38 <?php endforeach; ?>
34 </select> 39 </select>
35 </div> 40 </div>
36 <div class="form-group col-sm-4 col-md-2"> 41 <div class="form-group col-sm-4 col-md-2">
37 <label>角色</label> 42 <label>角色</label>
38 <select class="select" size="5" name="roles" multiple> 43 <select class="select" size="5" name="roles" multiple>
39 <option selected value>请选择</option> 44 <option selected value>请选择</option>
40 <option value>请选择</option> 45 <?php foreach ($this->session->role as $k => $v): ?>
41 <option value>请选择</option> 46 <option value="<?= $v->id ?>" <?php if($item->department_id==$v->id) echo 'selected';?> ></option><?= $v->nameZh ?></option>
42 <option value>请选择</option> 47 <?php endforeach; ?>
43 <option value>请选择</option>
44 </select> 48 </select>
45 </div> 49 </div>
46 </div> 50 </div>
...@@ -80,7 +84,7 @@ ...@@ -80,7 +84,7 @@
80 name:data['name'], 84 name:data['name'],
81 username:data['username'], 85 username:data['username'],
82 telephone:data['phone'], 86 telephone:data['phone'],
83 idcard:data['idcard'], 87 idCard:data['idCard'],
84 password:data['password'], 88 password:data['password'],
85 roleIds:rolesid, 89 roleIds:rolesid,
86 // roles:data['roles'], 90 // roles:data['roles'],
...@@ -94,7 +98,7 @@ ...@@ -94,7 +98,7 @@
94 // return false; 98 // return false;
95 $.ajax({ 99 $.ajax({
96 type: 'post', 100 type: 'post',
97 url: apiBaseUrl + targetUrl, 101 url: apiBaseUrl + targetUrl+$("input[name='id']").val(),
98 cache: false, 102 cache: false,
99 data: JSON.stringify(newData), 103 data: JSON.stringify(newData),
100 dataType: 'json', 104 dataType: 'json',
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!