set_role.php
2.56 KB
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
<?php
use yii\helpers\Url;
use app\ht\helpers\CssFiles;
$this->title = "设置角色";
$this->params['breadcrumbs'][] = '系统管理';
$this->params['breadcrumbs'][] = ['label' => '账号管理', 'url' => Url::toRoute(['/system/account/index'])];
$this->params['breadcrumbs'][] = $this->title;
CssFiles::register($this, 'exts/base/1.0.0/ui/select2/select2-1.0.0.css');
CssFiles::register($this, 'exts/base/1.0.0/ui/select2/select2-bootstrap-1.0.0.css');
?>
<form action="<?php echo Url::toRoute(['/system/account/do-set-role', 'id' => $model->id]); ?>" name="userForm" id="userForm" method="post">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><?= $model->username ?></h3>
</div>
<div class="panel-body">
<table class="panel-box-tb">
<thead>
<tr>
<th width="20%"></th>
<th width="30%"></th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-right">
<b>角色分配:</b>
</td>
<td>
<select name="roles[]" id="role-select" class="form-control" multiple class="required">
<?php foreach ($roles as $roleId => $r) : ?>
<option value="<?= $r->roleId ?>" <?php if (array_key_exists($roleId, $selectedRoles)) echo 'selected' ?> ><?= $r->name ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td>
<button type="submit" class="btn btn-primary" id="save">提 交</button>
<a class="btn btn-default" href="<?php echo Url::toRoute(['/system/account/set-role', 'id' => $model->id]); ?>">重 置</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</form>
<script>
seajs.use("base/1.0.0/ui/select2/select2-1.0.0",function () {
$( "#role-select" ).select2({
theme: "bootstrap"
});
});
// 表单提交验证
seajs.use("base/1.0.0/unit/validate/custom-1.0.0",function () {
var validator = $("#userForm").validate({
});
});
</script>