school_edit.html
3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('School/school_list')}">学校列表</a></li>
<li class="active"><a href="#">学校编辑</a></li>
</ul>
<form class="js-ajax-form" method="post" action="{:url('School/school_edit_post')}" role="form" style="margin-top: 20px;">
<div class="input-group">
<span class="input-group-addon">学校地区:</span>
<select class="form-control" name="province" id="province" required>
<option>请选择</option>
<foreach name="$province" item="p">
<option value="{$p.name}">{$p.name}</option>
</foreach>
</select>
<select class="form-control" name="city" id="city" required>
<option>请选择</option>
</select>
<select class="form-control" name="county" id="county" required>
<option>请选择</option>
</select>
<input type="text" class="form-control" name="region" value="{$data.region}" >
</div>
<br>
<div class="input-group">
<span class="input-group-addon">学校名称:</span>
<input type="text" class="form-control" name="school" value="{$data.school}" >
</div>
<br>
<div class="input-group">
<span class="input-group-addon">学校类型:</span>
<input type="text" class="form-control" name="type" value="{$data.type}" >
</div>
<br>
<input type="hidden" name="id" value="{$data.id}">
<div class="input-group">
<span class="input-group-addon">年级:</span>
<input type="text" class="form-control" name="grade_class_str" value="{$grade_class_str}" >
<input type="hidden" name="grade_id_str" value="{$grade_id_str}">
</div>
<br>
<button type="submit" class="btn btn-default">确定提交</button>
</form>
</div>
</body>
<script src="__STATIC__/js/admin.js"></script>
<script>
$('#province').change(function(){
var province_id = $('#province option:selected').val();
$.ajax({
url:"{:url('getArea')}",
type:"GET",
data:{'pid':province_id},
success:function(data) {
var result = data;
if(result.code==20000){
var mydata = "<option value=''>请选择</option>";
for (var i = 0; i < result.data.length; i++) {
var data = result.data[i];
mydata += '<option value="'+data.name+'">'+data.name+'</option>';
}
$('#city').html(mydata);
$('#county').html("<option value=''>请选择</option>");
}else if(result.code==40005){
alert('获取失败!');
}
}
})
})
//获取区/县
$('#city').change(function(){
var city_id = $('#city option:selected').val();
$.ajax({
url:"{:url('getArea')}",
type:"GET",
data:{'pid':city_id},
success:function(data) {
var result = data;
if(result.code==20000){
var mydata = "<option value=''>请选择</option>";
for (var i = 0; i < result.data.length; i++) {
var data = result.data[i];
mydata += '<option value="'+data.name+'">'+data.name+'</option>';
}
$('#county').html(mydata);
}else if(result.code==40005){
alert('获取失败!');
}
}
})
})
</script>
</html>