fix(操作日志): 修复性能测试报告日志问题

This commit is contained in:
fit2-zhao 2021-05-27 09:33:03 +08:00 committed by fit2-zhao
parent 3992b12f70
commit 3f20f5e834
4 changed files with 26 additions and 11 deletions

View File

@ -55,9 +55,7 @@ public class ReflexObjectUtil {
column.setDepthDff(true); column.setDepthDff(true);
if (val != null) { if (val != null) {
try { try {
if (f.getName().equals("loadConfiguration")) { // 格式化
val = "{\"" + "压力配置" + "\":" + val.toString() + "}";
}
Gson gson = new GsonBuilder().setPrettyPrinting().create(); Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonObject jsonObject = gson.fromJson(val.toString(), JsonObject.class); JsonObject jsonObject = gson.fromJson(val.toString(), JsonObject.class);
column.setOriginalValue(gson.toJson(jsonObject)); column.setOriginalValue(gson.toJson(jsonObject));
@ -115,6 +113,9 @@ public class ReflexObjectUtil {
continue; continue;
} }
} }
if (StringUtils.isEmpty(JSON.toJSONString(originalColumns.get(i).getOriginalValue())) && StringUtils.isEmpty(JSON.toJSONString(newColumns.get(i).getOriginalValue()))) {
continue;
}
// 深度对比 // 深度对比
DetailColumn column = new DetailColumn(); DetailColumn column = new DetailColumn();
BeanUtils.copyBean(column, originalColumns.get(i)); BeanUtils.copyBean(column, originalColumns.get(i));

View File

@ -619,6 +619,11 @@ public class PerformanceTestService {
public String getLogDetails(String id) { public String getLogDetails(String id) {
LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(id); LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(id);
if (loadTest != null) { if (loadTest != null) {
String loadConfiguration = loadTest.getLoadConfiguration();
if (StringUtils.isNotEmpty(loadConfiguration)) {
loadConfiguration = "{\"" + "压力配置" + "\":" + loadConfiguration + "}";
}
loadTest.setLoadConfiguration(loadConfiguration);
List<DetailColumn> columns = ReflexObjectUtil.getColumns(loadTest, PerformanceReference.performanceColumns); List<DetailColumn> columns = ReflexObjectUtil.getColumns(loadTest, PerformanceReference.performanceColumns);
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(loadTest.getId()), loadTest.getProjectId(), loadTest.getName(), loadTest.getCreateUser(), columns); OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(loadTest.getId()), loadTest.getProjectId(), loadTest.getName(), loadTest.getCreateUser(), columns);
return JSON.toJSONString(details); return JSON.toJSONString(details);

View File

@ -7,6 +7,7 @@
<el-checkbox v-model="isSelectAll" v-if="isShowEnable === true && items.length > 1"/> <el-checkbox v-model="isSelectAll" v-if="isShowEnable === true && items.length > 1"/>
</el-row> </el-row>
<div class="kv-row item" v-for="(item, index) in items" :key="index"> <div class="kv-row item" v-for="(item, index) in items" :key="index">
<el-row type="flex" :gutter="20" justify="space-between" align="middle"> <el-row type="flex" :gutter="20" justify="space-between" align="middle">
<el-col class="kv-checkbox" v-if="isShowEnable"> <el-col class="kv-checkbox" v-if="isShowEnable">
<el-checkbox v-if="!isDisable(index)" v-model="item.enable" <el-checkbox v-if="!isDisable(index)" v-model="item.enable"
@ -42,7 +43,7 @@
:fetch-suggestions="funcSearch" :fetch-suggestions="funcSearch"
highlight-first-item highlight-first-item
show-word-limit> show-word-limit>
<i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced"></i> <i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced(item)"></i>
</el-autocomplete> </el-autocomplete>
</div> </div>
</el-col> </el-col>
@ -52,7 +53,8 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
<ms-api-variable-advance ref="variableAdvance"/> <ms-api-variable-advance :current-item="currentItem" :parameters="keyValues" ref="variableAdvance"/>
</div> </div>
</template> </template>
@ -88,6 +90,7 @@
return { return {
keyValues: [], keyValues: [],
loading: false, loading: false,
currentItem: {},
isSelectAll: true isSelectAll: true
} }
}, },
@ -109,7 +112,8 @@
} }
}, },
methods: { methods: {
advanced() { advanced(item) {
this.currentItem = item;
this.$refs.variableAdvance.open(); this.$refs.variableAdvance.open();
}, },
funcFilter(queryString) { funcFilter(queryString) {

View File

@ -355,9 +355,14 @@ export default {
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
let ids = [];
this.selectRows.forEach(row => { this.selectRows.forEach(row => {
this._handleDeleteNoMsg(row); ids.push(row.id);
}); });
this.result = this.$post("/performance/report/batch/delete",{ids:ids}, () => {
this.initTableData();
});
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
} }
}, },