<?php
/**
 * 领导机构编辑
 * $Id: government_edit.php,v 1.1 2020/01/03 11:18:46  Exp $
 * @author lixq
 * @package manager.public_html
 **/

?>
<div id="change">
	<p class="edit_title">领导机构编辑</p>
	<div class="edit_content">
		<p>省级名称</p>
		<p class="begin_blank"><?=htmlspecialchars($government_mst->province) ?></p>
		<p>市级名称</p>
		<p class="begin_blank"><?=htmlspecialchars($government_mst->city) ?>&nbsp;</p>
		<p>区县名称</p>
		<p class="begin_blank"><?=htmlspecialchars($government_mst->district) ?>&nbsp;</p>
		<p>教育管局名称</p>
		<el-input v-model="name"  class="input_200"></el-input><br />
		<el-button type="danger" @click="edit()" class="edit_btn">编辑</el-button>
		<el-button type="danger" @click="back()" class="edit_btn">返回</el-button>
	</div>
</div>
<script type="text/javascript">
	new Vue({
		el:'#change',
		data:{
			id:<?=$id?$id:0 ?>,
			name:'<?=htmlspecialchars($government_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','government_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','title',this.name);
			form.appendChild(input1);
			form.appendChild(input2);
		},
		methods:{
			edit:function(){
				if(!this.name){
					this.$message({
		            type: 'error',
		            message: '请输入教育管局名称!'
		          });
		          return;
				}
				$('#title').val(this.name)
				$('#form').submit();
			},
			back:function(){
			  window.history.go(-1);
			}
		}
	})
</script>


