Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
haifeng414 2020-02-12 23:02:43 +08:00
commit aaf36843f2
9 changed files with 250 additions and 30 deletions

View File

@ -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();

View File

@ -17,7 +17,9 @@
"element-ui": "^2.13.0", "element-ui": "^2.13.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-i18n": "^8.15.3", "vue-i18n": "^8.15.3",
"vue-router": "^3.1.3" "vue-router": "^3.1.3",
"vuex": "^3.1.2",
"js-cookie": "^2.2.0"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0", "@vue/cli-plugin-babel": "^4.1.0",

View File

@ -5,6 +5,7 @@ import Setting from "../settings/Setting";
import Workspace from "../settings/Workspace"; import Workspace from "../settings/Workspace";
import User from "../settings/User"; import User from "../settings/User";
import CreateTestPlan from "../testPlan/CreateTestPlan"; import CreateTestPlan from "../testPlan/CreateTestPlan";
import Organization from "../settings/Organization";
Vue.use(VueRouter); Vue.use(VueRouter);
@ -18,14 +19,22 @@ const router = new VueRouter({
{ {
path: "/content", components: { path: "/content", components: {
content: Setting content: Setting
}, children: [ },
children: [
{ {
path: 'workspace', path: 'workspace',
component: Workspace component: Workspace,
meta: {
roles: ['admin']
}
}, },
{ {
path: 'user', path: 'user',
component: User component: User
},
{
path: 'organization',
component: Organization
} }
] ]
}, },
@ -33,7 +42,8 @@ const router = new VueRouter({
path: "/createTest", components: { path: "/createTest", components: {
content: CreateTestPlan content: CreateTestPlan
} }
},] },
]
}); });
export default router export default router

View File

@ -0,0 +1,175 @@
<template>
<div v-loading="loading">
<el-card>
<div slot="header">
<el-row type="flex" justify="space-between" align="middle">
<span class="title">组织</span>
<span class="search">
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
maxlength="60" v-model="condition" clearable/>
</span>
</el-row>
</div>
<el-table :data="items" style="width: 100%">
<el-table-column prop="name" label="名称"/>
<el-table-column prop="description" label="描述"/>
<el-table-column>
<template slot-scope="scope">
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
</template>
</el-table-column>
</el-table>
</el-card>
<ms-create-box :tips="btnTips" :exec="create"/>
<el-dialog title="创建组织" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createOrganization">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" autocomplete="off"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="createOrganization('createOrganization')" size="medium">创建</el-button>
</span>
</el-dialog>
<el-dialog title="修改组织" :visible.sync="updateVisible" width="30%" :destroy-on-close="true" @close="closeFunc">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="updateOrganizationForm">
<el-form-item label="用户名" prop="name">
<el-input v-model="form.name" autocomplete="off"/>
</el-form-item>
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" autocomplete="off"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="updateOrganization('updateOrganizationForm')" size="medium">修改</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import MsCreateBox from "./CreateBox";
export default {
name: "MsOrganization",
components: {MsCreateBox},
created() {
this.getOrganizationList();
},
methods: {
create() {
this.createVisible = true;
},
edit(row) {
window.console.log(row);
// this.loading = true;
this.updateVisible = true;
this.form = row;
},
del(row) {
window.console.log(row);
this.$confirm('此操作将永久删除该组织, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$get(`/organization/delete/${row.id}`).then(() => {
this.getOrganizationList()
});
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
createOrganization(createOrganizationForm) {
this.$refs[createOrganizationForm].validate( valide => {
if (valide) {
this.$post("/organization/add", this.form)
.then(() => {
this.$message({
type: 'success',
message: '添加成功!'
},
this.createVisible = false,
this.getOrganizationList())
});
} else {
return false;
}
})
},
updateOrganization(udpateOrganizationForm) {
this.$refs[udpateOrganizationForm].validate(valide => {
if (valide) {
this.$post("/organization/update", this.form)
.then(() => {
this.$message({
type: 'success',
message: '修改成功!'
},
this.updateVisible = false,
this.getOrganizationList(),
self.loading = false)
});
} else {
return false;
}
})
},
getOrganizationList() {
this.$get("/organization/list").then(response => {
this.items = response.data.data;
})
},
closeFunc() {
this.form = {};
}
},
data() {
return {
loading: false,
createVisible: false,
updateVisible: false,
btnTips: "添加组织",
condition: "",
items: [],
form: {},
rule: {
name: [
{required: true, message: '请输入姓名', trigger: 'blur'},
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' },
{
required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
message: '姓名不支持特殊字符',
trigger: 'blur'
}
],
description: [
{ max: 60, message: '最大长度 60 个字符', trigger: 'blur'}
]
}
}
}
}
</script>
<style scoped>
.search {
width: 240px;
}
</style>

View File

@ -6,6 +6,7 @@
<span>账号</span> <span>账号</span>
</template> </template>
<el-menu-item index="/content/user">用户</el-menu-item> <el-menu-item index="/content/user">用户</el-menu-item>
<el-menu-item index="/content/organization">组织</el-menu-item>
<el-menu-item index="/content/workspace">工作空间</el-menu-item> <el-menu-item index="/content/workspace">工作空间</el-menu-item>
<el-menu-item>API Keys</el-menu-item> <el-menu-item>API Keys</el-menu-item>
</el-submenu> </el-submenu>

View File

@ -1,12 +1,12 @@
<template> <template>
<div v-loading="loading"> <div v-loading="loading">
<el-card> <el-card>
<div slot="header"> <div slot="header">
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
<span class="title">用户</span> <span class="title">用户</span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据ID名称搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" placeholder="根据ID名称搜索" prefix-icon="el-icon-search" maxlength="60" v-model="condition" clearable/>
maxlength="60" v-model="condition" clearable/>
</span> </span>
</el-row> </el-row>
</div> </div>
@ -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/>
@ -25,6 +35,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
<el-dialog title="创建用户" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true"> <el-dialog title="创建用户" :visible.sync="createVisible" width="30%" @closed="closeFunc" :destroy-on-close="true">
<el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createUserForm"> <el-form :model="form" label-position="left" label-width="100px" size="small" :rules="rule" ref="createUserForm">
@ -40,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>
@ -63,14 +71,12 @@
<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>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -114,7 +120,7 @@
}).then(() => { }).then(() => {
this.$get(`/user/delete/${row.id}`).then(() => { this.$get(`/user/delete/${row.id}`).then(() => {
this.getUserList() this.getUserList()
}), });
this.$message({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
@ -126,7 +132,7 @@
}); });
}); });
}, },
createUser: function (createUserForm) { createUser(createUserForm) {
this.$refs[createUserForm].validate(valide => { this.$refs[createUserForm].validate(valide => {
if (valide) { if (valide) {
this.$post("/user/add", this.form) this.$post("/user/add", this.form)
@ -154,8 +160,7 @@
}, },
this.updateVisible = false, this.updateVisible = false,
this.getUserList(), this.getUserList(),
self.loading = false self.loading = false)
)
}); });
} else { } else {
return false; return false;
@ -167,8 +172,26 @@
this.items = response.data.data; this.items = response.data.data;
}) })
}, },
closeFunc: function () { 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() {
@ -208,7 +231,6 @@
message: '手机号码格式不正确!', message: '手机号码格式不正确!',
trigger: 'blur' trigger: 'blur'
} }
], ],
email: [ email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' }, { required: true, message: '请输入邮箱', trigger: 'blur' },
@ -219,7 +241,6 @@
trigger: 'blur' trigger: 'blur'
} }
] ]
} }
} }
} }

View File

@ -6,6 +6,7 @@ import filters from "../common/filter";
import ajax from "../common/ajax"; import ajax from "../common/ajax";
import App from './App.vue'; import App from './App.vue';
import router from "./components/router/router"; import router from "./components/router/router";
import store from './store'
import i18n from "../i18n/i18n"; import i18n from "../i18n/i18n";
import timestampFormatDate from "./components/common/filter/TimestampFormatDateFilter"; import timestampFormatDate from "./components/common/filter/TimestampFormatDateFilter";
@ -23,6 +24,7 @@ Vue.filter('timestampFormatDate', timestampFormatDate);
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,
store,
i18n, i18n,
render: h => h(App) render: h => h(App)
}); });

View File

@ -0,0 +1,8 @@
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex);
export default new Vuex.Store({})