fix(项目设置): 修改环境设置中前后置脚本查看历史数据不对的问题

--bug=1018234 --user=宋天阳 【接口测试】环境配置-全局前后置脚本-变更记录为空
https://www.tapd.cn/55049933/s/1280770
This commit is contained in:
song-tianyang 2022-10-27 17:27:57 +08:00 committed by 建国
parent 6faf9ba9db
commit 22fcbcbbe5
5 changed files with 27 additions and 26 deletions

View File

@ -53,7 +53,7 @@
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.all_pre_script')" name="prescript">
<div style="padding-bottom: 20px;" v-if="!ifCreate">
<el-link style="float: right;" type="primary" @click="openHis">
<el-link style="float: right;" type="primary" @click="openHis('preScript')">
{{ $t('operating_log.change_history') }}
</el-link>
</div>
@ -71,7 +71,7 @@
</el-tab-pane>
<el-tab-pane :label="$t('api_test.definition.request.all_post_script')" name="postscript">
<div style="padding-bottom: 20px;" v-if="!ifCreate">
<el-link style="float: right;" type="primary" @click="openHis">
<el-link style="float: right;" type="primary" @click="openHis('postScript')">
{{ $t('operating_log.change_history') }}
</el-link>
</div>
@ -354,8 +354,8 @@ export default {
}
});
},
openHis() {
this.$refs.changeHistory.open(this.environment.id, ["项目-环境设置", "項目-環境設置", "Project environment setting"]);
openHis(logType) {
this.$refs.changeHistory.open(this.environment.id, ["项目-环境设置", "項目-環境設置", "Project environment setting"], logType);
},
validate() {
let isValidate = false;

View File

@ -17,7 +17,7 @@
</div>
</template>
</el-table-column>
<el-table-column prop="originalValue" :label="$t('operating_log.before_change')">
<el-table-column prop="originalValue" :label="$t('operating_log.change_field')">
<template v-slot:default="scope">
<div v-if="scope.row.details && scope.row.details.columns">
<div v-for="detail in scope.row.details.columns" :key="detail.id">
@ -34,23 +34,6 @@
</div>
</template>
</el-table-column>
<el-table-column prop="newValue" :label="$t('operating_log.after_change')">
<template v-slot:default="scope">
<div v-if="scope.row.details && scope.row.details.columns">
<div v-for="detail in scope.row.details.columns" :key="detail.id">
<div v-if="linkDatas.indexOf(detail.columnName)!== -1">
<el-link style="color: #409EFF" @click="openDetail(scope.row,detail)">{{
$t('operating_log.info')
}}
</el-link>
</div>
<el-tooltip :content="detail.newValue" v-else>
<div class="current-value">{{ detail.newValue ? detail.newValue : "空值" }}</div>
</el-tooltip>
</div>
</div>
</template>
</el-table-column>
</el-table>
<ms-table-pagination :change="getDetails" :current-page.sync="goPage" :page-size.sync="pageSize"
:total="totalCount"/>
@ -83,7 +66,8 @@ export default {
goPage: 1,
totalCount: 0,
id: String,
module: String
module: String,
logType: String,
}
},
methods: {
@ -94,7 +78,7 @@ export default {
id = this.id;
modules = this.module;
this.loading = true;
getOperatingLogForResource(this.goPage, this.pageSize, {sourceId: id, modules: modules})
getOperatingLogForResource(this.goPage, this.pageSize, {sourceId: id, modules: modules, logType: this.logType})
.then(response => {
this.loading = false;
let data = response.data.listObject;
@ -138,10 +122,11 @@ export default {
}
})
},
open(id, modules) {
open(id, modules, logType) {
this.infoVisible = true;
this.id = id;
this.module = modules;
this.logType = logType;
this.getDetails(id, modules);
},
openDetail(row, value) {

View File

@ -1,6 +1,6 @@
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
<!-- 全局前后置脚本 -->
<div style="border:1px #DCDFE6 solid;" v-if="!loading">
<div class="env-history" style="border:1px #DCDFE6 solid;" v-if="!loading">
<el-tabs v-model="activeName" class="request-tabs">
<!--全局前置脚本-->
<el-tab-pane :label="$t('api_test.definition.request.all_pre_script')" name="allPreScript" v-if="showPre">
@ -169,4 +169,8 @@ export default {
<style scoped>
@import "~jsondiffpatch/dist/formatters-styles/html.css";
@import "~jsondiffpatch/dist/formatters-styles/annotated.css";
.env-history >>> pre {
white-space: normal;
}
</style>

View File

@ -102,6 +102,15 @@
<if test="request.sourceId != null and request.sourceId != ''">
AND t3.source_id = #{request.sourceId, jdbcType=VARCHAR}
</if>
<if test="request.logType != null and request.logType != ''">
AND t.oper_content like '%diffValue%'
</if>
<if test="request.logType == 'preScript' ">
AND t.oper_content REGEXP 'preProcessorRaw|preStepProcessorRaw'
</if>
<if test="request.logType == 'postScript' ">
AND t.oper_content REGEXP 'postProcessorRaw|postStepProcessorRaw'
</if>
AND JSON_UNQUOTE(JSON_EXTRACT(t.oper_content, '$.columns[*].diffValue')) IS NOT NULL
</where>
)tt

View File

@ -34,4 +34,7 @@ public class OperatingLogRequest implements Serializable {
private List<String> modules;
//要查找的日志类型
private String logType;
}