fix: 修复改了资源池之后资源池ID变了的问题

This commit is contained in:
Captain.B 2020-10-28 12:19:19 +08:00
parent d26c05a306
commit 9a34a5f27f
2 changed files with 206 additions and 203 deletions

View File

@ -210,7 +210,6 @@ public class TestResourcePoolService {
private void updateTestResource(TestResource testResource) { private void updateTestResource(TestResource testResource) {
testResource.setUpdateTime(System.currentTimeMillis()); testResource.setUpdateTime(System.currentTimeMillis());
testResource.setCreateTime(System.currentTimeMillis()); testResource.setCreateTime(System.currentTimeMillis());
testResource.setId(UUID.randomUUID().toString());
testResourceMapper.insertSelective(testResource); testResourceMapper.insertSelective(testResource);
} }

View File

@ -3,7 +3,8 @@
<el-card class="table-card" v-loading="result.loading"> <el-card class="table-card" v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" @create="create" <ms-table-header :condition.sync="condition" @search="search" @create="create"
:create-tip="$t('test_resource_pool.create_resource_pool')" :title="$t('commons.test_resource_pool')"/> :create-tip="$t('test_resource_pool.create_resource_pool')"
:title="$t('commons.test_resource_pool')"/>
</template> </template>
<el-table border class="adjust-table" :data="items" style="width: 100%"> <el-table border class="adjust-table" :data="items" style="width: 100%">
<el-table-column prop="name" :label="$t('commons.name')"/> <el-table-column prop="name" :label="$t('commons.name')"/>
@ -174,14 +175,14 @@
</template> </template>
<script> <script>
import MsCreateBox from "../CreateBox"; import MsCreateBox from "../CreateBox";
import MsTablePagination from "../../common/pagination/TablePagination"; import MsTablePagination from "../../common/pagination/TablePagination";
import MsTableHeader from "../../common/components/MsTableHeader"; import MsTableHeader from "../../common/components/MsTableHeader";
import MsTableOperator from "../../common/components/MsTableOperator"; import MsTableOperator from "../../common/components/MsTableOperator";
import MsDialogFooter from "../../common/components/MsDialogFooter"; import MsDialogFooter from "../../common/components/MsDialogFooter";
import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils"; import {listenGoBack, removeGoBackListener} from "../../../../common/js/utils";
export default { export default {
name: "MsTestResourcePool", name: "MsTestResourcePool",
components: {MsCreateBox, MsTablePagination, MsTableHeader, MsTableOperator, MsDialogFooter}, components: {MsCreateBox, MsTablePagination, MsTableHeader, MsTableOperator, MsDialogFooter},
data() { data() {
@ -286,7 +287,9 @@
let resources = []; let resources = [];
if (this.form.resources) { if (this.form.resources) {
this.form.resources.forEach(function (resource) { this.form.resources.forEach(function (resource) {
resources.push(JSON.parse(resource.configuration)); let configuration = JSON.parse(resource.configuration);
configuration.id = resource.id
resources.push(configuration);
}) })
} }
this.infoList = resources; this.infoList = resources;
@ -298,7 +301,7 @@
cancelButtonText: this.$t('commons.cancel'), cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.result = this.$get(`/testresourcepool/delete/${row.id}`,() => { this.result = this.$get(`/testresourcepool/delete/${row.id}`, () => {
this.initTableData(); this.initTableData();
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
}); });
@ -334,7 +337,8 @@
let resources = []; let resources = [];
let poolId = this.form.id; let poolId = this.form.id;
this.infoList.forEach(function (info) { this.infoList.forEach(function (info) {
let resource = {"configuration": JSON.stringify(info)}; let configuration = JSON.stringify(info);
let resource = {"configuration": configuration, id: info.id};
if (poolId) { if (poolId) {
resource.testResourcePoolId = poolId; resource.testResourcePoolId = poolId;
} }
@ -386,13 +390,13 @@
}) })
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.box { .box {
padding-left: 5px; padding-left: 5px;
} }
</style> </style>