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

This commit is contained in:
Captain.B 2020-02-13 15:41:14 +08:00
commit cf28e1013d
6 changed files with 251 additions and 10 deletions

View File

@ -10,7 +10,9 @@
</el-col>
<el-col :span="4">
<el-row type="flex" justify="center" align="middle">
<el-button type="primary" size="small" @click="createTest">创建测试</el-button>
<router-link to="/createTest">
<el-button type="primary" size="small">创建测试</el-button>
</router-link>
</el-row>
</el-col>
<el-col :span="10">
@ -49,9 +51,6 @@
},
components: {MsWebSocket, MsUser, MsMenus, MsSetting, MsView},
methods: {
createTest() {
this.$router.push({path: '/createTest'})
}
}
}
</script>

View File

@ -1,5 +1,5 @@
<template>
<el-menu class="header-menu" :unique-opened="true" mode="horizontal"
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router
menu-trigger="click">
<el-menu-item index="1"><a href="/" style="text-decoration: none;">{{ $t("i18n.home") }}</a></el-menu-item>
<el-submenu index="2" popper-class="submenu">
@ -19,10 +19,8 @@
</el-submenu>
<el-submenu index="4" popper-class="submenu">
<template slot="title">测试</template>
<el-menu-item index="4-1">测试1</el-menu-item>
<el-menu-item index="4-2">测试2</el-menu-item>
<el-menu-item index="4-3">显示全部</el-menu-item>
<el-menu-item index="create-test" route="{path:'test'}">
<recent-test-plan/>
<el-menu-item index="/createTest">
<el-button type="text">创建测试</el-button>
</el-menu-item>
</el-submenu>
@ -36,8 +34,11 @@
</template>
<script>
import RecentTestPlan from "./testPlan/RecentTestPlan";
export default {
name: "MsMenus"
name: "MsMenus",
components: {RecentTestPlan}
}
</script>

View File

@ -7,6 +7,7 @@ import User from "../settings/User";
import CreateTestPlan from "../testPlan/CreateTestPlan";
import Organization from "../settings/Organization";
import WorkspaceUser from "../settings/WorkSpcaeUser";
import TestResourcePool from "../settings/TestResourcePool";
Vue.use(VueRouter);
@ -46,6 +47,10 @@ const router = new VueRouter({
{
path: 'workspace/user',
component: WorkspaceUser
},
{
path: 'testresourcepool',
component: TestResourcePool
}
]
},

View File

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

View File

@ -0,0 +1,194 @@
<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 prop="status" 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>
<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="createTestResourcePoolForm">
<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="createTestResourcePool('createTestResourcePoolForm')" 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="updateTestResourcePoolForm">
<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="updateTestResourcePool('updateTestResourcePoolForm')" size="medium">修改</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import MsCreateBox from "./CreateBox";
export default {
name: "MsTestResourcePool",
components: {MsCreateBox},
created() {
this.getTestResourcePoolList();
},
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(`/testresourcepool/delete/${row.id}`).then(() => {
this.getTestResourcePoolList()
});
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
createTestResourcePool(createTestResourcePoolForm) {
this.$refs[createTestResourcePoolForm].validate( valide => {
if (valide) {
this.$post("/testresourcepool/add", this.form)
.then(() => {
this.$message({
type: 'success',
message: '添加成功!'
},
this.createVisible = false,
this.getTestResourcePoolList())
});
} else {
return false;
}
})
},
updateTestResourcePool(updateTestResourcePoolForm) {
this.$refs[updateTestResourcePoolForm].validate(valide => {
if (valide) {
this.$post("/testresourcepool/update", this.form)
.then(() => {
this.$message({
type: 'success',
message: '修改成功!'
},
this.updateVisible = false,
this.getOrganizationList(),
self.loading = false)
});
} else {
return false;
}
})
},
getTestResourcePoolList() {
this.$get("/testresourcepool/list").then(response => {
this.items = response.data.data;
})
},
closeFunc() {
this.form = {};
},
changeSwitch(row) {
this.$post('/testresourcepool/update', row).then(() =>{
this.$message({
type: 'success',
message: '状态修改成功!'
});
})
}
},
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

@ -0,0 +1,41 @@
<template>
<div>
<div class="recent-text">
<i class="el-icon-time"/>
最近的测试
</div>
<el-menu-item v-bind:key="recentTestPlan.id" v-for="recentTestPlan in recentTestPlans">
{{ recentTestPlan.name }}
</el-menu-item>
</div>
</template>
<script>
export default {
name: "RecentTestPlan",
data() {
return {
recentTestPlans: [{
id: 1,
name: "测试1"
}, {
id: 2,
name: "测试2"
}, {
id: 3,
name: "测试3"
}, {
id: 4,
name: "测试4"
}]
}
}
}
</script>
<style scoped>
.recent-text {
padding-left: 10%;
color: #777777;
}
</style>