FalconSSO/FAuth/Views/User/Index.cshtml

75 lines
2.6 KiB
Plaintext
Raw Normal View History

<div id="user_index">
<fieldset>
<legend>用户查询</legend>
<label>登录名:<input type="text" v-model="userName" /></label>
<label>用户名:<input type="text" v-model="name" /></label>
<input type="button" v-on:click="userSearch" value="查询" />
<input type="button" v-on:click="clear" value="清空" />
<input type="button" v-on:click="addNew" value="新增" />
</fieldset>
<table class="table" v-if="tableShow">
<thead>
<tr>
<th>用户编号</th>
<th>用户登录名</th>
<th>用户姓名</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
2020-05-20 15:07:05 +08:00
<tr v-for="(u,index) in users">
<td>{{u.Id}}</td>
<td>{{u.UserName}}</td>
<td>{{u.Name}}</td>
<td>{{u.Status}}</td>
2020-05-20 15:07:05 +08:00
<td><input type="button" value="删除" v-on:click="removeUser(u.Id,index)" /></td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
var userIndex = new Vue({
el: "#user_index",
data: {
userName: "",
name: "",
tableShow: false,
users: [],
ticket: myJs.getTicket(),
},
methods: {
userSearch() {
myJs.get(myJs.url.user.GetUsers, { userName: this.userName, name: this.name, }, function (d) {
userIndex.users = d;
userIndex.tableShow = true;
}, function (s, i, m) {
myJs.msg(m);
});
},
clear() {
this.userName = "";
this.name = "";
this.tableShow = false;
this.users = [];
},
addNew() {
debugger;
myJs.post(myJs.url.user.AddNewUser, {
adminTicket: this.ticket,
userName: this.userName,
name: this.name,
password: this.userName,
}, function (d) {
userIndex.users.push(d);
userIndex.tableShow = true;
});
},
2020-05-20 15:07:05 +08:00
removeUser(id, index) {
myJs.post(myJs.url.user.RemoveUser, { adminTicket: this.ticket, id: id }, function (d) {
2020-05-20 15:07:05 +08:00
userIndex.users.splice(index, 1);
});
},
}
});
</script>