优化代码

This commit is contained in:
java110 2020-11-16 01:42:40 +08:00
parent cba06d54b4
commit 3fbf12c07b
4 changed files with 283 additions and 0 deletions

View File

@ -0,0 +1,45 @@
<div id="transactionLogMessageModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">日志报文</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">请求头</label>
<div class="col-sm-10">
<textarea v-model="transactionLogMessageInfo.requestHeader" rows="3" disabled="disabled" class="form-control"></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">请求报文</label>
<div class="col-sm-10">
<textarea v-model="transactionLogMessageInfo.requestMessage" rows="4" disabled="disabled" class="form-control"></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">返回头</label>
<div class="col-sm-10">
<textarea v-model="transactionLogMessageInfo.responseHeader" rows="3" disabled="disabled" class="form-control"></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">返回报文</label>
<div class="col-sm-10">
<textarea v-model="transactionLogMessageInfo.responseMessage" rows="4" disabled="disabled" class="form-control"></textarea>
</div>
</div>
<div class="ibox-content">
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,61 @@
(function (vc) {
vc.extends({
data: {
transactionLogMessageInfo: {
logId:'',
requestHeader:'',
responseHeader:'',
requestMessage:'',
responseMessage:''
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('transactionLogMessage', 'openModal', function (param) {
$that.transactionLogMessageInfo.logId = param.logId
$that.clearLogMessage();
$that.getLogMessage(param);
$('#transactionLogMessageModel').modal('show');
});
},
methods: {
getLogMessage: function (_param) {
let param = {
params:{
logId: _param.logId
}
}
//发送get请求
vc.http.apiGet('/transactionLog/queryTransactionLogMessage',
param,
function (json, res) {
var _transactionLogManageInfo = JSON.parse(json);
let messages = _transactionLogManageInfo.data;
if (messages.length > 0) {
vc.copyObject(messages[0], $that.transactionLogMessageInfo);
}
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
clearLogMessage: function () {
vc.component.transactionLogMessageInfo = {
logId:'',
requestHeader:'',
responseHeader:'',
requestMessage:'',
responseMessage:''
};
}
}
});
})(window.vc);

View File

@ -0,0 +1,99 @@
<div class="animated fadeInRight ecommerce">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>查询条件</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-link btn-sm" style="margin-right:10px;"
v-on:click="_moreCondition()">{{transactionLogManageInfo.moreCondition == true?'隐藏':'更多'}}
</button>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入服务编码"
v-model="transactionLogManageInfo.conditions.serviceCode" class=" form-control">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入应用编码"
v-model="transactionLogManageInfo.conditions.appId" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" placeholder="请输入流水"
v-model="transactionLogManageInfo.conditions.transactionId" class=" form-control">
</div>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryLogMethod()">
<i class="fa fa-search"></i> 查询
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>交互日志</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<!-- <th class="text-center">信息ID</th> -->
<th class="text-center">流水</th>
<th class="text-center">源IP</th>
<th class="text-center">应用编码</th>
<th class="text-center">服务编码</th>
<th class="text-center">耗时</th>
<th class="text-center">状态</th>
<th class="text-right">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="log in transactionLogManageInfo.logs">
<td class="text-center">{{log.transactionId}}</td>
<td class="text-center">{{log.srcIp}}</td>
<td class="text-center">{{log.appId}}</td>
<td class="text-center">{{log.serviceCode}}</td>
<td class="text-center">{{log.costTime}}</td>
<td class="text-center">{{log.state=='F'?'失败':'成功'}}</td>
<td class="text-right">
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="viewLogMessage(log)">查看报文
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="dev/transactionLogMessage"></vc:create>
</div>

View File

@ -0,0 +1,78 @@
/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
transactionLogManageInfo: {
logs: [],
total: 0,
records: 1,
moreCondition: false,
title: '',
typeCds: [],
conditions: {
appId: '',
serviceCode: '',
transactionId: '',
}
}
},
_initMethod: function () {
vc.component._listLogs(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('transactionLogManage', 'listLog', function (_param) {
vc.component._listLogs(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
vc.component._listLogs(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listLogs: function (_page, _rows) {
vc.component.transactionLogManageInfo.conditions.page = _page;
vc.component.transactionLogManageInfo.conditions.row = _rows;
var param = {
params: vc.component.transactionLogManageInfo.conditions
};
//发送get请求
vc.http.apiGet('/transactionLog/queryTransactionLog',
param,
function (json, res) {
var _transactionLogManageInfo = JSON.parse(json);
vc.component.transactionLogManageInfo.total = _transactionLogManageInfo.total;
vc.component.transactionLogManageInfo.records = _transactionLogManageInfo.records;
vc.component.transactionLogManageInfo.logs = _transactionLogManageInfo.data;
vc.emit('pagination', 'init', {
total: vc.component.transactionLogManageInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
viewLogMessage: function (_transactionLog) {
vc.emit('transactionLogMessage', 'openModal', _transactionLog);
},
_queryLogMethod: function () {
vc.component._listLogs(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function () {
if (vc.component.transactionLogManageInfo.moreCondition) {
vc.component.transactionLogManageInfo.moreCondition = false;
} else {
vc.component.transactionLogManageInfo.moreCondition = true;
}
}
}
});
})(window.vc);