Commit 2e82804a authored by 张伯涛's avatar 张伯涛

网关日志模块

parent 6a8e79e8
...@@ -25,7 +25,7 @@ export function organizationUpdataApi(data, id) { ...@@ -25,7 +25,7 @@ export function organizationUpdataApi(data, id) {
}) })
} }
/** 组织结构获取详情接口*/ /** 组织结构获取详情接口*/
export function organizationGetDetailApi( id) { export function organizationGetDetailApi(id) {
return request({ return request({
url: '/iaminstitution/detail/' + id, url: '/iaminstitution/detail/' + id,
method: 'get' method: 'get'
...@@ -39,3 +39,27 @@ export function organizationGetDataListApi(data) { ...@@ -39,3 +39,27 @@ export function organizationGetDataListApi(data) {
params: data params: data
}) })
} }
/** 网关日志分页查询接口*/
export function iaminstitutionListApi(data) {
return request({
url: '/openapilog/list',
method: 'get',
params: data
})
}
/** 网关日志导出接口*/
export function iaminstitutionExportApi(query) {
return request({
url: '/openapilog/export',
method: 'get',
params: query,
responseType: 'blob'
})
}
/** 网关日志查询详情接口*/
export function openapilogDetailApi(id) {
return request({
url: '/openapilog/detail/' + id,
method: 'get'
})
}
<template>
<div class="gateWayLog_module">
<div class="search" style="border-bottom: 14px solid #f4f4f4">
<el-form ref="queryForm" style="padding: 0 0 0 10px" class="formClass" :model="queryParams" :inline="true" label-width="auto">
<el-form-item label="ip:" prop="ip">
<el-input
v-model.trim="queryParams.ip"
placeholder="请输入ip"
clearable
:maxlength="30"
size="small"
/>
</el-form-item>
<el-form-item label="机构名称:" prop="organizationalStructure">
<el-input
v-model.trim="queryParams.organizationalStructure"
placeholder="请输入机构名称"
clearable
:maxlength="30"
size="small"
/>
</el-form-item>
<el-form-item label="机构编号:" prop="InstitutionCode">
<el-input
v-model.trim="queryParams.InstitutionCode"
placeholder="请输入机构名称"
clearable
:maxlength="30"
size="small"
/>
</el-form-item>
<el-form-item label="方法名称:" prop="method">
<el-input
v-model.trim="queryParams.method"
placeholder="请输入方法名称"
clearable
:maxlength="30"
size="small"
/>
</el-form-item>
<el-form-item label="发布日期:" prop="dateRange">
<el-date-picker
v-model="dateRange"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="handleChangeTime"
/>
</el-form-item>
<el-form-item>
<!-- //查询按钮-->
<el-button
:class="commonField.queryClass"
:type="commonField.typePrimary"
:icon="commonField.queryIcon"
:size="commonField.smallSize"
@click="handleQuery"
>{{ commonField.queryName }}</el-button>
<!-- //重置按钮-->
<el-button
:class="commonField.resetClass"
:icon="commonField.resetIcon"
:size="commonField.smallSize"
@click="resetQuery"
>{{ commonField.resetName }}</el-button>
</el-form-item>
</el-form>
</div>
<div style="padding:5px 10px">
<div class="tableTitle">网关日志列表</div>
<el-table
v-loading="loading"
style="padding-right: 10px"
:data="dataList"
>
<el-table-column type="index" label="序号" width="90" />
<el-table-column label="机构名称" prop="organizationalStructure" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.organizationalStructure || '-' }}
</template>
</el-table-column>
<el-table-column label="机构编号" prop="institutionCode" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.institutionCode || '-' }}
</template>
</el-table-column>
<el-table-column label="ip" prop="ip" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.ip || '-' }}
</template>
</el-table-column>
<el-table-column label="请求方式" prop="request" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.request || '-' }}
</template>
</el-table-column>
<el-table-column label="方法名称" prop="method" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.method || '-' }}
</template>
</el-table-column>
<el-table-column label="业务类型" prop="businessType" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.businessType === '0' ? '其他' :scope.row.businessType === '1' ? '新增' :scope.row.businessType === '2' ? '修改' :scope.row.businessType === '3' ? '删除':'-' }}
</template>
</el-table-column>
<el-table-column label="模块标题" prop="title" width="130" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.title || '-' }}
</template>
</el-table-column>
<el-table-column label="状态" prop="flag" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.flag === '0' ? '停用':scope.row.flag === '1' ? '启用': '-' }}
</template>
</el-table-column>
<el-table-column label="备注" prop="remarks" :show-overflow-tooltip="true">
<template slot-scope="scope">
{{ scope.row.remarks || '-' }}
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="创建时间" prop="createDate" width="160">
<template slot-scope="scope">
<span>{{ scope.row.createDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="请求时间" prop="requestTime" width="160">
<template slot-scope="scope">
<span>{{ scope.row.requestTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
width="250"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<!-- //查看详情-->
<el-button
:class="commonField.updateClass"
:type="commonField.typeParent"
:size="commonField.size"
@click="handleDetail(scope.row)"
>{{ commonField.viewName }}</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
</div>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body class="openApiAddDialog">
<el-form ref="form" :model="form" label-width="auto">
<el-row>
<el-col :span="12">
<el-form-item label="机构名称:" prop="organizationalStructure">
<el-input v-model="form.organizationalStructure" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入机构名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="机构编号:" prop="institutionCode">
<el-input v-model="form.institutionCode" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入机构编号" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="ip:" prop="ip">
<el-input v-model="form.ip" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入ip" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="请求方式:" prop="request">
<el-input v-model="form.request" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入accessKey" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="业务类型:" prop="businessType">
<el-radio-group v-model="form.businessType" :disabled="formDisabled">
<el-radio :label="'0'">其他</el-radio>
<el-radio :label="'1'">新增</el-radio>
<el-radio :label="'2'">修改</el-radio>
<el-radio :label="'3'">删除</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="模块标题:" prop="title">
<el-input v-model="form.title" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入accessKey" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="请求参数:" prop=requestData>
<el-input v-model="form.requestData" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入ip" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="返回参数:" prop="responseData">
<el-input v-model="form.responseData" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入accessKey" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="方法名称:" prop="method">
<el-input v-model="form.method" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入apiSecretKey" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否启用:" prop="flag">
<el-radio-group v-model="form.flag" :disabled="formDisabled">
<el-radio :label="'1'">启用</el-radio>
<el-radio :label="'0'">停用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注:" prop="remarks">
<el-input v-model="form.remarks" :disabled="formDisabled" type="textarea" show-word-limit maxlength="100" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button class="cancelBtn" @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {iaminstitutionListApi, openapilogDetailApi,iaminstitutionExportApi} from '@/api/openApi'
import commonField from '@/utils/commonField'
export default {
name: 'GatewayLog',
data() {
return {
open: false,
title: '',
form: {
remarks: '',
flag: '',
method: '',
responseData: '',
requestData: '',
title: '',
businessType: '',
request: '',
ip: '',
institutionCode: '',
organizationalStructure: ''
},
formDisabled: false,
dataList: [],
// 遮罩层
loading: false,
dateRange: [],
// 总条数
total: 0,
queryParams: {
page: 1,
rows: 10,
InstitutionCode: '',
ip: '',
organizationalStructure: '',
method: '',
startTime: '',
endTime: ''
}
}
},
computed: {
commonField() {
return commonField
}
},
created() {
this.getList() // 列表查询
},
mounted() {
},
methods: {
/** 网关日志列表查询方法*/
getList() {
this.loading = true
iaminstitutionListApi(this.queryParams).then(response => {
this.dataList = response.rows
this.total = response.total
this.loading = false
}).catch(() => {
this.loading = false
})
},
handleQuery() {
this.queryParams.page = 1
this.getList()
},
resetQuery() {
this.queryParams = {
page: 1,
rows: 10,
InstitutionCode: '',
ip: '',
organizationalStructure: '',
method: '',
startTime: '',
endTime: ''
}
this.dateRange = []
this.handleQuery()
},
/** 网关日志筛选条件选择时间*/
handleChangeTime() {
if (this.dateRange && this.dateRange !== '' && this.dateRange !== undefined && this.dateRange.length > 0) {
this.queryParams.startTime = this.dateRange[0] + ' 00:00:00'
this.queryParams.endTime = this.dateRange[1] + ' 23:59:59'
} else {
this.queryParams.startTime = ''
this.queryParams.endTime = ''
}
},
/** 表单重置*/
reset() {
this.form = {
flag: '1',
apiSecretKey: '',
apiPubKey: '',
secretKey: '',
accessKey: '',
ips: '',
institutionCode: '',
organizationalStructure: '',
startTime: '',
endTime: ''
}
this.resetForm('form')
},
/** dialog取消*/
cancel() {
this.open = false
this.reset()
},
/** 查看详情*/
handleDetail(row) {
this.formDisabled = true
this.reset()
const userId = row.businessId
openapilogDetailApi(userId).then(response => {
this.open = true
this.form = response.data
this.title = '查看网关日志'
})
}
}
}
</script>
<style scoped lang="scss">
</style>
...@@ -156,7 +156,9 @@ ...@@ -156,7 +156,9 @@
/> />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="网关日志" name="second">网关日志</el-tab-pane> <el-tab-pane label="网关日志" name="second">
<gateway-log/>
</el-tab-pane>
</el-tabs> </el-tabs>
<!-- 添加或修改对话框 --> <!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body class="openApiAddDialog"> <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body class="openApiAddDialog">
...@@ -164,49 +166,49 @@ ...@@ -164,49 +166,49 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="机构名称:" prop="organizationalStructure"> <el-form-item label="机构名称:" prop="organizationalStructure">
<el-input :disabled="formDisabled" v-model="form.organizationalStructure" show-word-limit maxlength="20" placeholder="请输入机构名称" /> <el-input v-model="form.organizationalStructure" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入机构名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="机构编号:" prop="institutionCode"> <el-form-item label="机构编号:" prop="institutionCode">
<el-input :disabled="formDisabled" v-model="form.institutionCode" show-word-limit maxlength="20" placeholder="请输入机构编号" /> <el-input v-model="form.institutionCode" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入机构编号" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="ip:" prop="ips"> <el-form-item label="ip:" prop="ips">
<el-input :disabled="formDisabled" v-model="form.ips" show-word-limit maxlength="20" placeholder="请输入ip" /> <el-input v-model="form.ips" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入ip" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="accessKey:" prop="accessKey"> <el-form-item label="accessKey:" prop="accessKey">
<el-input :disabled="formDisabled" v-model="form.accessKey" show-word-limit maxlength="20" placeholder="请输入accessKey" /> <el-input v-model="form.accessKey" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入accessKey" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="secretKey:" prop="secretKey" class="secretKeyItem"> <el-form-item label="secretKey:" prop="secretKey" class="secretKeyItem">
<el-input :disabled="formDisabled" v-model="form.secretKey" show-word-limit maxlength="20" placeholder="请输入secretKey" /> <el-input v-model="form.secretKey" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入secretKey" />
<el-button v-if="formDisabled === true" class="copy-btn" type="primary" @click="handleCopy">复 制</el-button> <el-button v-if="formDisabled === true" class="copy-btn" type="primary" @click="handleCopy">复 制</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="apiPubKey:" prop="apiPubKey"> <el-form-item label="apiPubKey:" prop="apiPubKey">
<el-input :disabled="formDisabled" v-model="form.apiPubKey" show-word-limit maxlength="20" placeholder="请输入apiPubKey" /> <el-input v-model="form.apiPubKey" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入apiPubKey" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="apiSecretKey:" prop="apiSecretKey"> <el-form-item label="apiSecretKey:" prop="apiSecretKey">
<el-input :disabled="formDisabled" v-model="form.apiSecretKey" show-word-limit maxlength="20" placeholder="请输入apiSecretKey" /> <el-input v-model="form.apiSecretKey" :disabled="formDisabled" show-word-limit maxlength="20" placeholder="请输入apiSecretKey" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否启用:" prop="flag"> <el-form-item label="是否启用:" prop="flag">
<el-radio-group :disabled="formDisabled" v-model="form.flag"> <el-radio-group v-model="form.flag" :disabled="formDisabled">
<el-radio :label="'1'">启用</el-radio> <el-radio :label="'1'">启用</el-radio>
<el-radio :label="'0'">停用</el-radio> <el-radio :label="'0'">停用</el-radio>
</el-radio-group> </el-radio-group>
...@@ -215,10 +217,10 @@ ...@@ -215,10 +217,10 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="发布日期:" prop="releaseDate"> <el-form-item label="发布日期:" prop="dateRange">
<el-date-picker <el-date-picker
:disabled="formDisabled"
v-model="dateRange" v-model="dateRange"
:disabled="formDisabled"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="至" range-separator="至"
...@@ -232,7 +234,7 @@ ...@@ -232,7 +234,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注:" prop="remarks"> <el-form-item label="备注:" prop="remarks">
<el-input :disabled="formDisabled" v-model="form.remarks" type="textarea" show-word-limit maxlength="100" placeholder="请输入备注" /> <el-input v-model="form.remarks" :disabled="formDisabled" type="textarea" show-word-limit maxlength="100" placeholder="请输入备注" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -248,6 +250,7 @@ ...@@ -248,6 +250,7 @@
<script> <script>
import ClipboardJS from 'clipboard' import ClipboardJS from 'clipboard'
import commonField from '@/utils/commonField' import commonField from '@/utils/commonField'
import gatewayLog from '@/views/OpenApi/gatewayLog.vue'
import { import {
organizationAddApi, organizationDelApi, organizationAddApi, organizationDelApi,
organizationGetDataListApi, organizationGetDataListApi,
...@@ -257,6 +260,9 @@ import { ...@@ -257,6 +260,9 @@ import {
export default { export default {
name: 'Index', name: 'Index',
components: {
gatewayLog
},
data() { data() {
return { return {
formDisabled: false, formDisabled: false,
...@@ -313,8 +319,6 @@ export default { ...@@ -313,8 +319,6 @@ export default {
this.form.startTime = '' this.form.startTime = ''
this.form.endTime = '' this.form.endTime = ''
} }
console.log('this.form.startTime', this.form.startTime)
console.log('this.form.endTime', this.form.endTime)
}, },
/** tab切换*/ /** tab切换*/
handleClick(tab, event) { handleClick(tab, event) {
...@@ -368,7 +372,7 @@ export default { ...@@ -368,7 +372,7 @@ export default {
this.formDisabled = false this.formDisabled = false
this.reset() this.reset()
this.open = true this.open = true
this.title = '添加用户' this.title = '添加组织机构'
}, },
// 改变状态 // 改变状态
handleStatusChange(row) { handleStatusChange(row) {
...@@ -460,7 +464,7 @@ export default { ...@@ -460,7 +464,7 @@ export default {
} else { } else {
this.dateRange = [] this.dateRange = []
} }
this.title = '修改用户' this.title = '查看组织机构'
}) })
}, },
/** 修改*/ /** 修改*/
...@@ -476,7 +480,7 @@ export default { ...@@ -476,7 +480,7 @@ export default {
} else { } else {
this.dateRange = [] this.dateRange = []
} }
this.title = '修改用户' this.title = '修改组织机构'
}) })
}, },
/** 修改*/ /** 修改*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment