[系统用户]实现系统用户的增删改

This commit is contained in:
GoEdgeLab
2020-12-02 23:11:43 +08:00
parent 99283d9b55
commit 02f6638963
25 changed files with 621 additions and 5 deletions

View File

@@ -0,0 +1,3 @@
<first-menu>
<menu-item @click.prevent="createAdmin">创建</menu-item>
</first-menu>

View 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 */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["createPopup.less"],"names":[],"mappings":"AAAA,YACC;EACC,WAAA;EACA,WAAA;EACA,iBAAA;EACA,oBAAA","file":"createPopup.css"}

View 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>

View File

@@ -0,0 +1,8 @@
.modules-box {
.module-box {
float: left;
width: 10em;
margin-top: 0.3em;
margin-bottom: 0.3em;
}
}

View 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> &nbsp; <a href="" v-if="!admin.isSuper" @click.prevent="deleteAdmin(admin.id)">删除</a>
</td>
</tr>
</table>
<div class="page" v-html="page"></div>

View 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()
})
}
})
}
})

View 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 */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["updatePopup.less"],"names":[],"mappings":"AAAA,YACC;EACC,WAAA;EACA,WAAA;EACA,iBAAA;EACA,oBAAA","file":"updatePopup.css"}

View 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>

View File

@@ -0,0 +1,8 @@
.modules-box {
.module-box {
float: left;
width: 10em;
margin-top: 0.3em;
margin-bottom: 0.3em;
}
}