mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 13:09:28 +08:00
资源池表增加 type、info 字段 和 资源池 table 分页
This commit is contained in:
parent
b6e3b104f3
commit
3805e40f72
@ -7,10 +7,14 @@ public class TestResourcePool implements Serializable {
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
|
||||
private String description;
|
||||
|
||||
private String status;
|
||||
|
||||
private String info;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
@ -33,6 +37,14 @@ public class TestResourcePool implements Serializable {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type == null ? null : type.trim();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
@ -49,6 +61,14 @@ public class TestResourcePool implements Serializable {
|
||||
this.status = status == null ? null : status.trim();
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(String info) {
|
||||
this.info = info == null ? null : info.trim();
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
@ -244,6 +244,76 @@ public class TestResourcePoolExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNull() {
|
||||
addCriterion("type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNotNull() {
|
||||
addCriterion("type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeEqualTo(String value) {
|
||||
addCriterion("type =", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotEqualTo(String value) {
|
||||
addCriterion("type <>", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThan(String value) {
|
||||
addCriterion("type >", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("type >=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThan(String value) {
|
||||
addCriterion("type <", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("type <=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLike(String value) {
|
||||
addCriterion("type like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotLike(String value) {
|
||||
addCriterion("type not like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIn(List<String> values) {
|
||||
addCriterion("type in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotIn(List<String> values) {
|
||||
addCriterion("type not in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeBetween(String value1, String value2) {
|
||||
addCriterion("type between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("type not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
@ -384,6 +454,76 @@ public class TestResourcePoolExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoIsNull() {
|
||||
addCriterion("info is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoIsNotNull() {
|
||||
addCriterion("info is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoEqualTo(String value) {
|
||||
addCriterion("info =", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotEqualTo(String value) {
|
||||
addCriterion("info <>", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoGreaterThan(String value) {
|
||||
addCriterion("info >", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("info >=", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoLessThan(String value) {
|
||||
addCriterion("info <", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoLessThanOrEqualTo(String value) {
|
||||
addCriterion("info <=", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoLike(String value) {
|
||||
addCriterion("info like", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotLike(String value) {
|
||||
addCriterion("info not like", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoIn(List<String> values) {
|
||||
addCriterion("info in", values, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotIn(List<String> values) {
|
||||
addCriterion("info not in", values, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoBetween(String value1, String value2) {
|
||||
addCriterion("info between", value1, value2, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotBetween(String value1, String value2) {
|
||||
addCriterion("info not between", value1, value2, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
|
@ -4,8 +4,10 @@
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestResourcePool">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="info" jdbcType="VARCHAR" property="info" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
</resultMap>
|
||||
@ -68,7 +70,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, name, description, status, create_time, update_time
|
||||
id, name, type, description, status, info, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestResourcePoolExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -101,12 +103,12 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestResourcePool">
|
||||
insert into test_resource_pool (id, name, description,
|
||||
status, create_time, update_time
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
|
||||
)
|
||||
insert into test_resource_pool (id, name, type,
|
||||
description, status, info,
|
||||
create_time, update_time)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{info,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestResourcePool">
|
||||
insert into test_resource_pool
|
||||
@ -117,12 +119,18 @@
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="info != null">
|
||||
info,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
@ -137,12 +145,18 @@
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
#{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="info != null">
|
||||
#{info,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -166,12 +180,18 @@
|
||||
<if test="record.name != null">
|
||||
name = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
type = #{record.type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.status != null">
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.info != null">
|
||||
info = #{record.info,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -187,8 +207,10 @@
|
||||
update test_resource_pool
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
name = #{record.name,jdbcType=VARCHAR},
|
||||
type = #{record.type,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
info = #{record.info,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
@ -201,12 +223,18 @@
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="info != null">
|
||||
info = #{info,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
@ -219,8 +247,10 @@
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestResourcePool">
|
||||
update test_resource_pool
|
||||
set name = #{name,jdbcType=VARCHAR},
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
info = #{info,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum ResourceTypeEnum {
|
||||
/**
|
||||
* k8s 资源池
|
||||
*/
|
||||
K8S,
|
||||
/**
|
||||
* node controller 资源池
|
||||
*/
|
||||
NODE
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
package io.metersphere.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.base.domain.TestResourcePool;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||
import io.metersphere.service.TestResourcePoolService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@ -28,6 +34,9 @@ public class TestResourcePoolController {
|
||||
testResourcePoolService.updateTestResourcePool(testResourcePool);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public List<TestResourcePool> getTestResourcePoolList() { return testResourcePoolService.getTestResourcePoolList(); }
|
||||
@PostMapping("list/{goPage}/{pageSize}")
|
||||
public Pager<List<TestResourcePool>> listResourcePools(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryResourcePoolRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, testResourcePoolService.listResourcePools(request));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
package io.metersphere.controller.request.resourcepool;
|
||||
|
||||
public class QueryResourcePoolRequest {
|
||||
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
@ -1,13 +1,20 @@
|
||||
package io.metersphere.service;
|
||||
|
||||
import io.metersphere.base.domain.TestResourcePool;
|
||||
import io.metersphere.base.domain.TestResourcePoolExample;
|
||||
import io.metersphere.base.mapper.TestResourcePoolMapper;
|
||||
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author dongbin
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TestResourcePoolService {
|
||||
@ -33,7 +40,11 @@ public class TestResourcePoolService {
|
||||
testResourcePoolMapper.updateByPrimaryKeySelective(testResourcePool);
|
||||
}
|
||||
|
||||
public List<TestResourcePool> getTestResourcePoolList() {
|
||||
return testResourcePoolMapper.selectByExample(null);
|
||||
public List<TestResourcePool> listResourcePools(QueryResourcePoolRequest request) {
|
||||
TestResourcePoolExample example = new TestResourcePoolExample();
|
||||
if (!StringUtils.isEmpty(request.getName())) {
|
||||
example.createCriteria().andNameLike("%" + request.getName() + "%");
|
||||
}
|
||||
return testResourcePoolMapper.selectByExample(example);
|
||||
}
|
||||
}
|
||||
|
@ -45,19 +45,19 @@
|
||||
</javaClientGenerator>
|
||||
|
||||
<!--要生成的数据库表 -->
|
||||
<table tableName="user"/>
|
||||
<table tableName="user_role"/>
|
||||
<table tableName="workspace"/>
|
||||
<!-- <table tableName="user"/>-->
|
||||
<!-- <table tableName="user_role"/>-->
|
||||
<!-- <table tableName="workspace"/>-->
|
||||
<table tableName="test_resource_pool"/>
|
||||
<table tableName="test_resource"/>
|
||||
<table tableName="system_parameter"/>
|
||||
<table tableName="role"/>
|
||||
<table tableName="project"/>
|
||||
<table tableName="organization"/>
|
||||
<table tableName="load_test_report"/>
|
||||
<table tableName="load_test"/>
|
||||
<table tableName="file_content"/>
|
||||
<table tableName="file_metadata"/>
|
||||
<table tableName="load_test_file"/>
|
||||
<!-- <table tableName="test_resource"/>-->
|
||||
<!-- <table tableName="system_parameter"/>-->
|
||||
<!-- <table tableName="role"/>-->
|
||||
<!-- <table tableName="project"/>-->
|
||||
<!-- <table tableName="organization"/>-->
|
||||
<!-- <table tableName="load_test_report"/>-->
|
||||
<!-- <table tableName="load_test"/>-->
|
||||
<!-- <table tableName="file_content"/>-->
|
||||
<!-- <table tableName="file_metadata"/>-->
|
||||
<!-- <table tableName="load_test_file"/>-->
|
||||
</context>
|
||||
</generatorConfiguration>
|
@ -9,13 +9,19 @@
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition" clearable/>
|
||||
maxlength="60" v-model="condition" @change="search" 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="type" label="类型">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.type === 'NODE'">独立节点</span>
|
||||
<span v-if="scope.row.type === 'K8S'">Kubernetes</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="启用/禁用">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.status"
|
||||
@ -27,6 +33,16 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="updateTime" label="更新时间" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
|
||||
</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/>
|
||||
@ -34,24 +50,47 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="22" :offset="1">
|
||||
<div class="table-page">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page.sync="currentPage"
|
||||
:page-sizes="[5, 10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<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 :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="type">
|
||||
<el-input v-model="form.type" 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>
|
||||
<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 :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>
|
||||
@ -60,7 +99,8 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')" size="medium">修改</el-button>
|
||||
<el-button type="primary" @click="updateTestResourcePool('updateTestResourcePoolForm')"
|
||||
size="medium">修改</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
@ -73,10 +113,66 @@
|
||||
export default {
|
||||
name: "MsTestResourcePool",
|
||||
components: {MsCreateBox},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
createVisible: false,
|
||||
updateVisible: false,
|
||||
btnTips: "添加资源池",
|
||||
queryPath:"testresourcepool/list",
|
||||
condition: "",
|
||||
items: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
total: 0,
|
||||
form: {},
|
||||
rule: {
|
||||
name: [
|
||||
{required: true, message: '请输入资源池名称', trigger: 'blur'},
|
||||
{min: 2, max: 10, message: this.$t('commons.input_limit', [2, 10]), trigger: 'blur'},
|
||||
{
|
||||
required: true,
|
||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||
message: '资源池名称不支持特殊字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
description: [
|
||||
{max: 60, message: '最大长度 60 个字符', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTestResourcePoolList();
|
||||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
this.loading = true;
|
||||
let param = {
|
||||
name: this.condition
|
||||
};
|
||||
|
||||
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
|
||||
let data = response.data;
|
||||
this.items = data.listObject;
|
||||
this.total = data.itemCount;
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
handleSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
},
|
||||
handleCurrentChange(current) {
|
||||
this.currentPage = current;
|
||||
},
|
||||
create() {
|
||||
this.createVisible = true;
|
||||
},
|
||||
@ -108,7 +204,7 @@
|
||||
});
|
||||
},
|
||||
createTestResourcePool(createTestResourcePoolForm) {
|
||||
this.$refs[createTestResourcePoolForm].validate( valide => {
|
||||
this.$refs[createTestResourcePoolForm].validate(valide => {
|
||||
if (valide) {
|
||||
this.$post("/testresourcepool/add", this.form)
|
||||
.then(() => {
|
||||
@ -151,39 +247,13 @@
|
||||
this.form = {};
|
||||
},
|
||||
changeSwitch(row) {
|
||||
this.$post('/testresourcepool/update', row).then(() =>{
|
||||
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: this.$t('commons.input_limit', [2, 10]), trigger: 'blur' },
|
||||
{
|
||||
required: true,
|
||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||
message: '资源池名称不支持特殊字符',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
description: [
|
||||
{ max: 60, message: '最大长度 60 个字符', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -192,4 +262,9 @@
|
||||
.search {
|
||||
width: 240px;
|
||||
}
|
||||
.table-page {
|
||||
padding-top: 20px;
|
||||
margin-right: -9px;
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user