User enable/disable
This commit is contained in:
parent
baeea268f7
commit
a3de4322ff
|
@ -49,7 +49,8 @@ public class UserService {
|
||||||
BeanUtils.copyProperties(userRequest, user);
|
BeanUtils.copyProperties(userRequest, user);
|
||||||
user.setCreateTime(System.currentTimeMillis());
|
user.setCreateTime(System.currentTimeMillis());
|
||||||
user.setUpdateTime(System.currentTimeMillis());
|
user.setUpdateTime(System.currentTimeMillis());
|
||||||
user.setStatus("0");
|
// 默认1:启用状态
|
||||||
|
user.setStatus("1");
|
||||||
|
|
||||||
UserExample userExample = new UserExample();
|
UserExample userExample = new UserExample();
|
||||||
UserExample.Criteria criteria = userExample.createCriteria();
|
UserExample.Criteria criteria = userExample.createCriteria();
|
||||||
|
|
|
@ -15,8 +15,18 @@
|
||||||
<el-table-column prop="name" label="用户名"/>
|
<el-table-column prop="name" label="用户名"/>
|
||||||
<el-table-column prop="email" label="邮箱"/>
|
<el-table-column prop="email" label="邮箱"/>
|
||||||
<el-table-column prop="phone" label="电话"/>
|
<el-table-column prop="phone" label="电话"/>
|
||||||
<el-table-column prop="status" label="状态"/>
|
<el-table-column prop="status" label="启用/禁用">
|
||||||
<el-table-column prop="createTime" label="创建时间"/>
|
<template slot-scope="scope">
|
||||||
|
<el-switch v-model="scope.row.status"
|
||||||
|
active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
|
@change="changeSwitch(scope.row)"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createTime" label="创建时间" :formatter="formatDate"/>
|
||||||
<el-table-column>
|
<el-table-column>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
|
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
|
||||||
|
@ -41,9 +51,6 @@
|
||||||
<el-form-item label="电话" prop="phone">
|
<el-form-item label="电话" prop="phone">
|
||||||
<el-input v-model="form.phone" autocomplete="off"/>
|
<el-input v-model="form.phone" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="启用">
|
|
||||||
<el-switch v-model="form.enable"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="createUser('createUserForm')" size="medium">创建</el-button>
|
<el-button type="primary" @click="createUser('createUserForm')" size="medium">创建</el-button>
|
||||||
|
@ -64,9 +71,6 @@
|
||||||
<el-form-item label="电话" prop="phone">
|
<el-form-item label="电话" prop="phone">
|
||||||
<el-input v-model="form.phone" autocomplete="off"/>
|
<el-input v-model="form.phone" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="启用">
|
|
||||||
<el-switch v-model="form.enable"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="updateUser('updateUserForm')" size="medium">修改</el-button>
|
<el-button type="primary" @click="updateUser('updateUserForm')" size="medium">修改</el-button>
|
||||||
|
@ -170,6 +174,24 @@
|
||||||
},
|
},
|
||||||
closeFunc() {
|
closeFunc() {
|
||||||
this.form = {};
|
this.form = {};
|
||||||
|
},
|
||||||
|
changeSwitch(row) {
|
||||||
|
this.$post('/user/update', row).then(() =>{
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '状态修改成功!'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formatDate(row) {
|
||||||
|
let date = new Date(parseInt(row.createTime));
|
||||||
|
let Y = date.getFullYear() + '-';
|
||||||
|
let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) + '-' : date.getMonth() + 1 + '-';
|
||||||
|
let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
|
||||||
|
// let h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
|
||||||
|
// let m = date.getMinutes() < 10 ? '0' + date.getMinutes() + ':' : date.getMinutes() + ':';
|
||||||
|
// let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
|
||||||
|
return Y + M + D;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
Loading…
Reference in New Issue