1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
/**
* 管理员管理
* $Id: account_list.inc,v 1.1 2015/10/08 11:18:50 wanggb Exp $
* @author netvillage
* @access public
* @package manager.templates
*/
?>
<style type="text/css">
.result_list{
width: 701px;
}
</style>
<div id="classSetting">
<div class="list_title">
年级设定<!-- <el-button type="primary" style="margin-right: 10px;" @click="addClass()">年级添加</el-button>-->
</div>
<br/>
<div style="text-align: right;margin-top: 10px;color: rgb(144, 147, 153);font-size: 14px;">
学校名称:
<?if(isset($school_mst)){?>
<?=$school_mst->title?>
<?}else{?>
<el-select v-model="school_id" size='medium' style="margin-right: 20px;">
<div class="el-select-dropdown__item"><input v-model="searchVal" style="border-radius: 4px;background: url(images/search_icon.png) no-repeat 150px;"type="text" autocomplete="off"></div>
<el-option
v-for="item in new_school_list"
:key="item.id"
:label="item.title"
:value="item.id">
</el-option>
</el-select>
<?}?>
</div>
<br/>
<div class="result_list">
<el-table :data="tableData" border style="width: 100%">
<el-table-column
prop="title"
label="年级名称"
width="">
</el-table-column>
<el-table-column
label="操作"
width="">
<!--<template slot-scope="scope">
<el-button @click="handleChange(scope.row)" type="text" size="small">编辑</el-button>
<el-button type="text" size="small" @click.native.prevent="deleteRow(scope.row)">删除</el-button>
</template> -->
</el-table-column>
</el-table>
</div>
</div>
<script type="text/javascript">
var list=[];
<?
foreach ($grade_list as $grade_mst) {
$school_id = isset($school_id)?$school_id:$school_list[0]->id;
if($grade_mst->school_id == $school_id){
?>
var data={
id:<?=$grade_mst->id ?>,
title:'<?=$grade_mst->title ?>'
};
list.push(data);
<?
}
}
?>
new Vue({
el:'#classSetting',
data:{
tableData: list,
school_id:'<?=isset($school_list)?$school_list[0]->id:0?>',
school_list:<?=isset($school_list)?json_encode($school_list):''?>,
grade_list:<?=json_encode($grade_list)?>,
searchVal:''
},
methods:{
handleChange(row) {
console.log(row);
window.location.href='grade_edit_input.php?action_type=edit&id='+row.id;
},
// deleteRow(rows) {
// this.$confirm('是否删除?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// this.$message({
// type: 'success',
// message: '删除成功!'
// });
// // rows.splice(index, 1);
// window.location.href='grade_delete_result.php?id='+rows.id;
// }).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
// });
// },
addClass(){
window.open('grade_edit_input.php?action_type=new','_self')
}
},
watch:{
school_id(val,oldval){
var new_list=[];
this.grade_list.map(function(item) {
if (item.school_id == val) {
new_list.push(item);
}
});
this.tableData = new_list;
}
},
computed: {
new_school_list() {
var _this = this;
var new_school_list = [];
_this.school_list.map(function(item) {
if (item.title.search(_this.searchVal) != -1) {
new_school_list.push(item);
}
});
if(new_school_list.length == 0){
new_school_list = _this.school_list;
}
return new_school_list;
}
}
})
</script>