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

# Conflicts:
#	frontend/src/i18n/en_US.js
#	frontend/src/i18n/zh_CN.js
This commit is contained in:
shiziyuan9527 2020-02-26 18:43:13 +08:00
commit e1d8323604
8 changed files with 54 additions and 39 deletions

View File

@ -18,6 +18,9 @@
<if test="request.workspaceId != null"> <if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId} AND project.workspace_id = #{request.workspaceId}
</if> </if>
<if test="request.projectId != null">
AND project.id = #{request.projectId}
</if>
</where> </where>
<if test="request.recent"> <if test="request.recent">
order by load_test.update_time desc order by load_test.update_time desc

View File

@ -2,6 +2,7 @@ const en_US = {
commons: { commons: {
'workspace': 'Workspace', 'workspace': 'Workspace',
'organization': 'Organization', 'organization': 'Organization',
'project': 'Project',
'name': 'Name', 'name': 'Name',
'description': 'Description', 'description': 'Description',
'save': 'Save', 'save': 'Save',
@ -21,7 +22,7 @@ const en_US = {
'input_name': 'Please enter a workspace name', 'input_name': 'Please enter a workspace name',
'input_name_2_50': '2 to 50 characters in length', 'input_name_2_50': '2 to 50 characters in length',
'search_by_name': 'Search by name', 'search_by_name': 'Search by name',
'organization_name': 'Organizationn Name', 'organization_name': 'Organization Name',
'please_choose_organization': 'Please Choose Organization', 'please_choose_organization': 'Please Choose Organization',
}, },
organization: { organization: {
@ -34,7 +35,10 @@ const en_US = {
'special_characters_are_not_supported': 'Special characters are not supported', 'special_characters_are_not_supported': 'Special characters are not supported',
}, },
project: { project: {
'recent': 'Recent Projects' 'recent': 'Recent Projects',
'create': 'Create Project',
'delete_confirm': 'Are you sure you want to delete this project?',
'search_by_name': 'Search by name',
}, },
i18n: { i18n: {
'home': 'Home', 'home': 'Home',

View File

@ -2,6 +2,7 @@ const zh_CN = {
commons: { commons: {
'workspace': '工作空间', 'workspace': '工作空间',
'organization': '组织', 'organization': '组织',
'project': '项目',
'name': '名称', 'name': '名称',
'description': '描述', 'description': '描述',
'save': '保存', 'save': '保存',
@ -34,7 +35,10 @@ const zh_CN = {
'special_characters_are_not_supported': '不支持特殊字符', 'special_characters_are_not_supported': '不支持特殊字符',
}, },
project: { project: {
'recent': '最近的项目' 'recent': '最近的项目',
'create': '创建项目',
'delete_confirm': '这个项目确定要删除吗?',
'search_by_name': '根据名称搜索',
}, },
i18n: { i18n: {
'home': '首页', 'home': '首页',

View File

@ -18,7 +18,7 @@
<template slot="title">测试</template> <template slot="title">测试</template>
<ms-recent-test-plan/> <ms-recent-test-plan/>
<el-divider/> <el-divider/>
<el-menu-item index="/allTest"> <el-menu-item index="/allTest/all">
<font-awesome-icon :icon="['fa', 'list-ul']"/> <font-awesome-icon :icon="['fa', 'list-ul']"/>
<span style="padding-left: 5px;">所有测试</span> <span style="padding-left: 5px;">所有测试</span>
</el-menu-item> </el-menu-item>

View File

@ -5,18 +5,19 @@
<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 class="title">
项目 {{$t('commons.project')}}
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
</span> </span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" :placeholder="$t('project.search_by_name')"
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>
<el-table :data="items" style="width: 100%"> <el-table :data="items" style="width: 100%">
<el-table-column prop="name" label="名称"/> <el-table-column prop="name" :label="$t('commons.name')"/>
<el-table-column prop="description" label="描述"/> <el-table-column prop="description" :label="$t('commons.description')"/>
<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/>
@ -43,17 +44,17 @@
</div> </div>
</el-card> </el-card>
<el-dialog title="创建项目" :visible.sync="createVisible"> <el-dialog :title="$t('project.create')" :visible.sync="createVisible">
<el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small"> <el-form :model="form" :rules="rules" ref="form" label-position="left" label-width="100px" size="small">
<el-form-item label="名称"> <el-form-item :label="$t('commons.name')">
<el-input v-model="form.name" autocomplete="off"></el-input> <el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="描述"> <el-form-item :label="$t('commons.description')">
<el-input type="textarea" v-model="form.description"></el-input> <el-input type="textarea" v-model="form.description"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit('form')" size="medium">创建</el-button> <el-button type="primary" @click="submit('form')" size="medium">{{$t('commons.save')}}</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -71,7 +72,7 @@
return { return {
createVisible: false, createVisible: false,
result: {}, result: {},
btnTips: "添加项目", btnTips: this.$t('project.create'),
condition: "", condition: "",
items: [], items: [],
form: {}, form: {},
@ -99,7 +100,7 @@
}, },
edit(row) { edit(row) {
this.createVisible = true; this.createVisible = true;
this.form = row; this.form = Object.assign({}, row);
}, },
submit(formName) { submit(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
@ -111,7 +112,7 @@
this.result = this.$post("/project/" + saveType, this.form, () => { this.result = this.$post("/project/" + saveType, this.form, () => {
this.createVisible = false; this.createVisible = false;
this.list(); this.list();
Message.success('保存成功'); Message.success(this.$t('commons.save_success'));
}); });
} else { } else {
return false; return false;
@ -119,17 +120,15 @@
}); });
}, },
del(row) { del(row) {
this.$confirm('这个项目确定要删除吗?', '提示', { this.$confirm(this.$t('project.delete_confirm'), this.$t('commons.prompt'), {
confirmButtonText: '确定', confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }, () => {
this.$get('/project/delete/' + row.id, () => { this.$get('/project/delete/' + row.id, () => {
Message.success('删除成功'); Message.success(this.$t('commons.delete_success'));
this.list(); this.list();
}); });
}).catch(() => {
}); });
}, },
list() { list() {

View File

@ -1,11 +1,13 @@
<template> <template>
<el-menu> <el-menu router menu-trigger="click" :default-active="$route.path">
<div class="recent-text"> <div class="recent-text">
<i class="el-icon-time"/> <i class="el-icon-time"/>
{{$t('project.recent')}} {{$t('project.recent')}}
</div> </div>
<el-menu-item :key="recentProject.id" v-for="recentProject in recentProjects" @click="goTest(recentProject)">
{{ recentProject.name }} <el-menu-item :key="p.id" v-for="p in recentProjects"
:index="'/allTest/' + p.id" :route="{name:'allTest', params:{projectId:p.id, projectName:p.name}}">
{{ p.name }}
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
</template> </template>
@ -18,12 +20,7 @@
this.recentProjects = response.data; this.recentProjects = response.data;
}); });
}, },
methods: { methods: {},
goTest(project) {
window.console.log(project);
// this.$router.push({path: '/allTest', params: {projectId: project.id, projectName: project.name}});
}
},
data() { data() {
return { return {
recentProjects: [], recentProjects: [],

View File

@ -85,11 +85,11 @@ const router = new VueRouter({
} }
}, },
{ {
path: "/allTest", path: "/allTest/:projectId",
name: "allTest",
components: { components: {
content: AllTestPlan content: AllTestPlan
}, },
props: true,
}, },
{ {
path: "/project", path: "/project",

View File

@ -80,16 +80,13 @@
<script> <script>
export default { export default {
props: {
projectId: String,
projectName: String
},
data() { data() {
return { return {
result: {}, result: {},
queryPath: "/testplan/list", queryPath: "/testplan/list",
deletePath: "/testplan/delete", deletePath: "/testplan/delete",
condition: "", condition: "",
projectId: null,
tableData: [], tableData: [],
multipleSelection: [], multipleSelection: [],
currentPage: 1, currentPage: 1,
@ -98,20 +95,31 @@
loading: false, loading: false,
} }
}, },
watch: {
'$route'(to) {
this.projectId = to.params.projectId;
this.initTableData();
}
},
created: function () { created: function () {
this.projectId = this.$route.params.projectId;
this.initTableData(); this.initTableData();
}, },
methods: { methods: {
initTableData() { initTableData() {
let param = { let param = {
name: this.condition name: this.condition,
}; };
if (this.projectId !== 'all') {
param.projectId = this.projectId;
}
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => { this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;
this.tableData = data.listObject; this.tableData = data.listObject;
}) });
}, },
search() { search() {
this.initTableData(); this.initTableData();