正在显示
2 个修改的文件
包含
15 行增加
和
2 行删除
@@ -58,8 +58,14 @@ class SchoolController extends AdminBaseController{ | @@ -58,8 +58,14 @@ class SchoolController extends AdminBaseController{ | ||
58 | $this -> assign('data',$data); | 58 | $this -> assign('data',$data); |
59 | $this -> assign('grade_class_str',$grade_class_str); | 59 | $this -> assign('grade_class_str',$grade_class_str); |
60 | $this -> assign('grade_id_str',$grade_id_str); | 60 | $this -> assign('grade_id_str',$grade_id_str); |
61 | - $province = Db::name('area')->where(['pid'=>0])->select(); | 61 | + $province = Db::name('area')->where(['level'=>1])->select(); |
62 | + $data_city = Db::name('area')->where(['level'=>2,'name'=>$data['work_city']])->find(); | ||
63 | + $city = Db::name('area')->where(['pid'=>$data_city['pid'],'level'=>2])->select(); | ||
64 | + $data_county = Db::name('area')->where(['level'=>3,'name'=>$data['work_county']])->find(); | ||
65 | + $county = Db::name('area')->where(['level'=>3,'pid'=>$data_county['pid']])->select(); | ||
62 | $this->assign('province',$province); | 66 | $this->assign('province',$province); |
67 | + $this->assign('city',$city); | ||
68 | + $this->assign('county',$county); | ||
63 | return $this -> fetch(); | 69 | return $this -> fetch(); |
64 | 70 | ||
65 | } | 71 | } |
@@ -8,18 +8,25 @@ | @@ -8,18 +8,25 @@ | ||
8 | </ul> | 8 | </ul> |
9 | <form class="js-ajax-form" method="post" action="{:url('School/school_edit_post')}" role="form" style="margin-top: 20px;"> | 9 | <form class="js-ajax-form" method="post" action="{:url('School/school_edit_post')}" role="form" style="margin-top: 20px;"> |
10 | <div class="input-group"> | 10 | <div class="input-group"> |
11 | + <php>$area = explode(' ',$data['region']);</php> | ||
11 | <span class="input-group-addon">学校地区:</span> | 12 | <span class="input-group-addon">学校地区:</span> |
12 | <select class="form-control" name="province" id="province" required> | 13 | <select class="form-control" name="province" id="province" required> |
13 | <option>请选择</option> | 14 | <option>请选择</option> |
14 | <foreach name="$province" item="p"> | 15 | <foreach name="$province" item="p"> |
15 | - <option value="{$p.name}">{$p.name}</option> | 16 | + <option value="{$p.name}" <eq name="$area[0]" value="$p.name}">selected</eq> >{$p.name}</option> |
16 | </foreach> | 17 | </foreach> |
17 | </select> | 18 | </select> |
18 | <select class="form-control" name="city" id="city" required> | 19 | <select class="form-control" name="city" id="city" required> |
19 | <option>请选择</option> | 20 | <option>请选择</option> |
21 | + <foreach name="$city" item="c"> | ||
22 | + <option value="{$c.name}" <eq name="$area[1]" value="$c.name}">selected</eq> >{$c.name}</option> | ||
23 | + </foreach> | ||
20 | </select> | 24 | </select> |
21 | <select class="form-control" name="county" id="county" required> | 25 | <select class="form-control" name="county" id="county" required> |
22 | <option>请选择</option> | 26 | <option>请选择</option> |
27 | + <foreach name="$county" item="co"> | ||
28 | + <option value="{$co.name}" <eq name="$area[2]" value="$co.name}">selected</eq> >{$co.name}</option> | ||
29 | + </foreach> | ||
23 | </select> | 30 | </select> |
24 | <input type="text" class="form-control" name="region" value="{$data.region}" > | 31 | <input type="text" class="form-control" name="region" value="{$data.region}" > |
25 | </div> | 32 | </div> |
-
请 注册 或 登录 后发表评论