mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-25 11:10:29 +08:00
[系统用户]实现系统用户的增删改
This commit is contained in:
3
web/views/@default/admins/@menu.html
Normal file
3
web/views/@default/admins/@menu.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<first-menu>
|
||||
<menu-item @click.prevent="createAdmin">创建</menu-item>
|
||||
</first-menu>
|
||||
7
web/views/@default/admins/createPopup.css
Normal file
7
web/views/@default/admins/createPopup.css
Normal file
@@ -0,0 +1,7 @@
|
||||
.modules-box .module-box {
|
||||
float: left;
|
||||
width: 10em;
|
||||
margin-top: 0.3em;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
/*# sourceMappingURL=createPopup.css.map */
|
||||
1
web/views/@default/admins/createPopup.css.map
Normal file
1
web/views/@default/admins/createPopup.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["createPopup.less"],"names":[],"mappings":"AAAA,YACC;EACC,WAAA;EACA,WAAA;EACA,iBAAA;EACA,oBAAA","file":"createPopup.css"}
|
||||
48
web/views/@default/admins/createPopup.html
Normal file
48
web/views/@default/admins/createPopup.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>创建系统用户</h3>
|
||||
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">全名 *</td>
|
||||
<td>
|
||||
<input type="text" name="fullname" maxlength="100" ref="focus"/>
|
||||
<p class="comment">可以输入姓名、公司名等容易识别的名称。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>登录用户名 *</td>
|
||||
<td>
|
||||
<input type="text" name="username" maxlength="100"/>
|
||||
<p class="comment">用户名只能英文、数字、下划线的组合。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>登录密码 *</td>
|
||||
<td>
|
||||
<input type="password" name="pass1" maxlength="100"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>确认登录密码 *</td>
|
||||
<td>
|
||||
<input type="password" name="pass2" maxlength="100"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>权限</td>
|
||||
<td>
|
||||
<div class="modules-box">
|
||||
<div class="module-box" v-for="module in modules">
|
||||
<checkbox name="moduleCodes" :v-value="module.code">{{module.name}}</checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
8
web/views/@default/admins/createPopup.less
Normal file
8
web/views/@default/admins/createPopup.less
Normal file
@@ -0,0 +1,8 @@
|
||||
.modules-box {
|
||||
.module-box {
|
||||
float: left;
|
||||
width: 10em;
|
||||
margin-top: 0.3em;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
}
|
||||
31
web/views/@default/admins/index.html
Normal file
31
web/views/@default/admins/index.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
|
||||
<table class="ui table selectable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户名</th>
|
||||
<th>全名</th>
|
||||
<th>创建时间</th>
|
||||
<th class="center width10">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="admin in admins">
|
||||
<td>{{admin.username}}
|
||||
<div v-if="admin.isSuper" style="margin-top: 0.5em">
|
||||
<tiny-basic-label class="olive">超级管理员</tiny-basic-label>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{admin.fullname}}</td>
|
||||
<td>{{admin.createdTime}}</td>
|
||||
<td class="center">
|
||||
<label-on :v-is-on="admin.isOn"></label-on>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" @click.prevent="updateAdmin(admin.id)">修改</a> <a href="" v-if="!admin.isSuper" @click.prevent="deleteAdmin(admin.id)">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="page" v-html="page"></div>
|
||||
35
web/views/@default/admins/index.js
Normal file
35
web/views/@default/admins/index.js
Normal file
@@ -0,0 +1,35 @@
|
||||
Tea.context(function () {
|
||||
this.createAdmin = function () {
|
||||
teaweb.popup("/admins/createPopup", {
|
||||
height: "22em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteAdmin = function (adminId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此系统用户吗?", function () {
|
||||
that.$post(".delete")
|
||||
.params({
|
||||
adminId: adminId
|
||||
})
|
||||
.post()
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
this.updateAdmin = function (adminId) {
|
||||
teaweb.popup("/admins/updatePopup?adminId=" + adminId, {
|
||||
height: "22em",
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
7
web/views/@default/admins/updatePopup.css
Normal file
7
web/views/@default/admins/updatePopup.css
Normal file
@@ -0,0 +1,7 @@
|
||||
.modules-box .module-box {
|
||||
float: left;
|
||||
width: 10em;
|
||||
margin-top: 0.3em;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
/*# sourceMappingURL=updatePopup.css.map */
|
||||
1
web/views/@default/admins/updatePopup.css.map
Normal file
1
web/views/@default/admins/updatePopup.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["updatePopup.less"],"names":[],"mappings":"AAAA,YACC;EACC,WAAA;EACA,WAAA;EACA,iBAAA;EACA,oBAAA","file":"updatePopup.css"}
|
||||
51
web/views/@default/admins/updatePopup.html
Normal file
51
web/views/@default/admins/updatePopup.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>修改系统用户</h3>
|
||||
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
|
||||
<input type="hidden" name="adminId" :value="admin.id"/>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">全名 *</td>
|
||||
<td>
|
||||
<input type="text" name="fullname" maxlength="100" ref="focus" v-model="admin.fullname"/>
|
||||
<p class="comment">可以输入姓名、公司名等容易识别的名称。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>登录用户名 *</td>
|
||||
<td>
|
||||
<input type="text" name="username" maxlength="100" v-model="admin.username"/>
|
||||
<p class="comment">用户名只能英文、数字、下划线的组合。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>登录密码</td>
|
||||
<td>
|
||||
<input type="password" name="pass1" maxlength="100"/>
|
||||
<p class="comment">留空表示不修改。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>确认登录密码</td>
|
||||
<td>
|
||||
<input type="password" name="pass2" maxlength="100"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>权限</td>
|
||||
<td>
|
||||
<div class="modules-box">
|
||||
<div class="module-box" v-for="module in modules">
|
||||
<checkbox name="moduleCodes" :v-value="module.code" v-model="module.isChecked">{{module.name}}</checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
8
web/views/@default/admins/updatePopup.less
Normal file
8
web/views/@default/admins/updatePopup.less
Normal file
@@ -0,0 +1,8 @@
|
||||
.modules-box {
|
||||
.module-box {
|
||||
float: left;
|
||||
width: 10em;
|
||||
margin-top: 0.3em;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user