<?php
/**
 * 系统常量定义编辑
 * $Id: system_const_edit_input.inc,v 1.1 2020/01/12 11:18:53 lixq Exp $
 * @author lixq
 * @access public
 * @package manager.templates
 **/
global $id;
global $action_type;
global $system_const_dat;
global $error_message;
?>
<div id="change">
	<p class="edit_title">系统常量定义添加</p>
	<form id="form" method="post" action="system_const_edit_result.php" enctype="multipart/form-data">
	<input type="hidden" name="action_type" value="<?=$action_type ?>"/>
	<input type="hidden" name="id" value="<?=$id ?>"/>
	<div class="edit_content">
		<p>常量定义名</p>
		<el-input v-model="name" name="name" class="input_200"></el-input> <span style="color:#FF0000">(大写英文字母、下划线)</span><br />
		<p>文字描述</p>
		<el-input v-model="title" name="title" class="input_200"></el-input><br />
		<p>值</p>
		<textarea v-model="constant_value" name="constant_value" rows="10"></textarea><br />
		<el-button type="primary" @click="edit()" class="edit_btn">编辑</el-button>
		<el-button type="primary" class="edit_btn"  @Click="window.location='./system_const_list.php'" />返回</el-button>
	</div>
	</form>
</div>


<script type="text/javascript">
	new Vue({
		el:'#change',
		data:{
			name:'<?=htmlspecialchars($system_const_dat->name) ?>',
			title:'<?=htmlspecialchars($system_const_dat->title) ?>',
			constant_value:'<?=htmlspecialchars($system_const_dat->constant_value) ?>'
				
		},
		methods:{
			edit:function(){
			  if(!this.name){
					this.$message({
		            type: 'error',
		            message: '请输入常量定义名!'
		          });
		          return;
				}
			  if(!this.name.match(/^[A-Z_]{1,}$/)){
			    this.$message({
            type: 'error',
            message: '常量定义名格式不正确!'
          });
          return;
			  }
			  if(!this.title){
					this.$message({
		            type: 'error',
		            message: '请输入文字描述!'
		          });
		          return;
				}
			  if(!this.name){
					this.$message({
		            type: 'error',
		            message: '请输入值!'
		          });
		          return;
				}
				$('#form').submit();
			}
		}
	})
$(document).ready(function () {
  if(<?=$error_message?1:0 ?>){
    vm.$message({
      type: 'error',
      message: '<?=$error_message?>'
    });
  }
})
</script>
