<?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>
