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
<?php
/**
* 年级管理
* $Id: grade_edit_input.inc,v 1.1 2015/10/08 11:18:53 wanggb Exp $
* @author wanggb
* @access public
* @package manager.templates
**/
global $id;
global $title;
global $school_id;
?>
<!--<b>年级添加</b><br />
<br />-->
<!--<form id="form" name="grade_edit_input" action="grade_edit_result.php" method="post" style="display: none;">
<input type="hidden" name="id" value="<?=$id ?>" />
<input type="hidden" name="action_type" value="<?=$action_type ?>" />
<table>
<tr>
<td>年级名称</td>
</tr>
<tr>
<td class="begin_blank"><input type="text" name="title" value="<?=htmlspecialchars($grade_mst->title) ?>" /></td>
</tr>
</table>
<br />
<input type="button" value="编辑" class="button_width_normal" onClick="doCheck();" />
</form>-->
<style type="text/css">
.el-input__inner{
height: 30px!important;
line-height: 30px;
text-align: center;
}
</style>
<div id="change">
<p class="edit_title">年级添加</p>
<div class="edit_content">
<p>年级名称</p>
<el-input v-model="name" class="input_100"></el-input><br />
<el-button type="primary" @click="edit()" class="edit_btn">编辑</el-button>
</div>
</div>
<script type="text/javascript">
new Vue({
el:'#change',
data:{
id:<?=$id?$id:0 ?>,
action_type:'<?=$action_type ?>',
name:'<?=htmlspecialchars($grade_mst->title) ?>'
},
mounted:function(){
var form = document.createElement("form");
document.getElementById('change').appendChild(form);
form.setAttribute('id','form');
form.setAttribute('method','post');
form.setAttribute('action','grade_edit_result.php');
form.style.display='none';
var generateHideElement = function (type,name, value) {
var tempInput = document.createElement("input");
tempInput.id=name;
tempInput.type = type;
tempInput.name = name;
tempInput.value = value;
return tempInput;
}
var input1 = generateHideElement('hidden','id',this.id);
var input2 = generateHideElement('hidden','action_type',this.action_type);
var input3 = generateHideElement('hidden','title',this.name);
form.appendChild(input1);
form.appendChild(input2);
form.appendChild(input3);
},
methods:{
edit:function(){
if(!this.name){
this.$message({
type: 'error',
message: '请输入年级名称!'
});
return;
}
$('#title').val(this.name)
$('#form').submit();
}
}
})
</script>