<?php
/**
 * 机构账号编辑
 * $Id: org_account_edit_input.inc,v 1.1 2015/10/08 11:18:53 Exp $
 * @author lixq
 * @access public
 * @package manager.templates
 **/
global $id;
global $login;
global $password;
global $name;
global $contact;
global $comment;
global $error_message;
?>
<div id="change">
	<p class="edit_title">机构账号编辑</p>
	<div class="edit_content">
		<form id="form" method="post" action="org_account_edit_result.php" enctype="multipart/form-data">
			<input type="hidden" name="id" value="<?=$id?>"/>
			<input type="hidden" name="uid" value="<?=$uid?>"/>
			<input type="hidden" name="action_type" value="<?=$action_type?>"/>
			<p>登陆帐号</p>
			<el-input v-model="login" name="login" class="input_200"></el-input><br />
			<p>登陆密码</p>
			<el-input v-model="password" name="password" class="input_200"></el-input><br />
			<p>账户名称</p>
			<el-input v-model="name" name="name" class="input_200"></el-input><br />
			<p>联系方式</p>
			<el-input v-model="contact" name="contact" class="input_200"></el-input><br />
    	<p>备注</p>
			<textarea v-model="comment" name="comment" rows="5" class="input_200"></textarea>
			<br/><br/>
			<el-button type="danger" class="edit_btn"  @click="submitForm()">编辑</el-button>
			<el-button type="danger" class="edit_btn"  @Click="window.location='./org_account_list.php?id=<?=$uid?>'" />返回</el-button>
			<br/><br/>
		</form>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
  var vm = new Vue({
    el: '#form',
    data: {
        login: '<?=htmlspecialchars($login) ?>',
        password:'<?=htmlspecialchars($password) ?>',
        contact:'<?=htmlspecialchars($contact) ?>',
        name:'<?=htmlspecialchars($name) ?>',
        comment:'<?=htmlspecialchars($comment) ?>'
        
    },
    methods: {
        submitForm() {
          if(!this.login){
  					this.$message({
  		            type: 'error',
  		            message: '请输入登陆帐号。'
  		          });
  		          return;
  				}
          if (!isAlpaNum(this.login)) {
  					this.$message({
  		            type: 'error',
  		            message: '登陆帐号只能使用半角英文或数字。'
  		          });
  		          return;
  				}
          if (!this.password) {
  					this.$message({
  		            type: 'error',
  		            message: '请输入登陆密码。'
  		          });
  		          return;
  				}
          if (!isAlpaNum(this.password)) {
  					this.$message({
  		            type: 'error',
  		            message: '登陆密码只能使用半角英文或数字。'
  		          });
  		          return;
  				}
          if (!this.name) {
  					this.$message({
  		            type: 'error',
  		            message: '请输入账户名称。'
  		          });
  		          return;
  				}
  				$('#form').submit();
        }
    }
   
})
  if(<?=$error_message?1:0 ?>){
    vm.$message({
      type: 'error',
      message: '<?=$error_message?>'
    });
  }
})

</script>
