<?php
/**
 * 用户列表
 * $Id: user_list.php,v 1.1 2020/2/28 11:18:46 wanggb Exp $
 * @author lixq
 * @access public
 * @package manager.templates
 */


?>

<style type="text/css">
	.result_list{
		width: 701px;
	}
</style>
<div id="classSetting">
	<div class="list_title">
		用户列表
	</div>
	<br/>
	<form id="search_form" action="user_list.php" method="post">
	<input type="hidden"  name="role" value="<?=$role?>"/>
	用户角色:
	<template>
	<el-select v-model="role" clearable size='medium' >
      <el-option
          v-for="item in user_role_list"
          :key="item.id"
          :label="item.title"
          :value="item.id">
      </el-option>
  	</el-select>
  </template>
  	<el-button type="primary" @click="search()" class="edit_btn search_btn">检索</el-button>
  </form>
	<br/>
	<div class="result_list">
		<el-table :data="tableData"  border >
		    <el-table-column  prop="name"  label="姓名" ></el-table-column>
		    <el-table-column  prop="role"  label="身份" ></el-table-column>
		    <el-table-column  prop="school"  label="学校" ></el-table-column>
		    <el-table-column  prop="grade"  label="年级" ></el-table-column>
		    <el-table-column  prop="ability_point" sortable label="能力分" ></el-table-column>
		    <el-table-column  prop="service_point" sortable label="服务分" ></el-table-column>
		</el-table>
	</div>
</div>
<?
if ($user_count > 0) {
?>
<!--page begin-->
<?
require_once("page_common.inc");
?>
<!--page end-->
<?
}
?>
<script type="text/javascript">
	var list=[];
<?
foreach ($user_list as $tmp) {
  ?>
		var data={
			id:<?=$tmp->id ?>,
			name:'<?=$tmp->name?>',
			role:'<?=UserRole::getTitleById($tmp->role)?>',
			school:'待修改',
			grade:'待修改',
			ability_point:<?=$tmp->ability_point?>,
			service_point:<?=$tmp->service_point?>,
		};
		list.push(data);
	<?
	}
	?>

	new Vue({
		el:'#classSetting',
		data:{
			tableData: list,
			user_role_list:<?=json_encode($user_role_list)?>,
			role:<?=!empty($role)?$role:0?>,
		},
		methods:{
		  search(){
			  $("input[name='role']").val(this.role);
				$("#search_form").submit();
			},
		},
	})
</script>
