From 7b40ccf7afca3382a84fc2905078cec44aa5de7d Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期四, 31 七月 2025 16:51:32 +0800 Subject: [PATCH] art: 第三方接口查询提交 --- src/views/system/SysApiLogList.vue | 198 ++++++++++++++++++++++++++++ src/views/system/modules/SysApiLogModal.vue | 189 +++++++++++++++++++++++++++ 2 files changed, 387 insertions(+), 0 deletions(-) diff --git a/src/views/system/SysApiLogList.vue b/src/views/system/SysApiLogList.vue new file mode 100644 index 0000000..bfe102b --- /dev/null +++ b/src/views/system/SysApiLogList.vue @@ -0,0 +1,198 @@ +<template> + <a-card :bordered="false"> + + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="API鍒嗙被"> + <j-search-select-tag + placeholder="璇烽�夋嫨API鍒嗙被" + v-model="queryParam.apiCategory" + dict="api_log_category" + /> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="鎺ュ彛鍚嶇О"> + <j-input placeholder="璇疯緭鍏ユ帴鍙e悕绉�" v-model="queryParam.apiName"></j-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </span> + </a-col> + + </a-row> + </a-form> + </div> + + <!-- table鍖哄煙-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a + style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤� + <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a> + </div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :scroll="{ x: 200 }" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + @change="handleTableChange"> + <span slot="action" slot-scope="text, record"> + <a @click="handleDetail(record)">璇︽儏</a> + </span> + </a-table> + </div> + <!-- table鍖哄煙-end --> + + <!-- 琛ㄥ崟鍖哄煙 --> + <sysApiLog-modal ref="modalForm" @ok="modalFormOk"></sysApiLog-modal> + </a-card> +</template> + +<script> +import '@/assets/less/TableExpand.less' +import SysApiLogModal from './modules/SysApiLogModal' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' + +export default { + name: 'SysApiLogList', + mixins: [JeecgListMixin], + components: { + SysApiLogModal + }, + data() { + return { + description: '绯荤粺绗笁鏂归泦鎴愭帴鍙f棩蹇楃鐞嗛〉闈�', + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 + }, + fixed: 'left', + }, + { + title: 'API鍒嗙被', + align: 'center', + dataIndex: 'apiCategory', + fixed: 'left', + width: 100, + }, + { + title: '鎺ュ彛鍚嶇О', + align: 'center', + dataIndex: 'apiName', + fixed: 'left', + width: 200, + ellipsis: true, + }, + { + title: '璇锋眰鏃堕棿', + align: 'center', + dataIndex: 'requestTime', + width: 150, + }, + { + title: '鍝嶅簲鏃堕棿', + align: 'center', + dataIndex: 'responseTime', + width: 150, + }, + { + title: '璇锋眰鏂瑰紡', + align: 'center', + dataIndex: 'requestMethod', + width: 100, + }, + { + title: '璇锋眰URL', + align: 'center', + dataIndex: 'requestUrl', + width: 200, + ellipsis: true, + }, + { + title: '璇锋眰澶�', + align: 'center', + dataIndex: 'requestHeaders', + width: 200, + ellipsis: true, + }, + { + title: '璇锋眰浣�', + align: 'center', + dataIndex: 'requestBody', + width: 200, + ellipsis: true, + }, + { + title: '鍝嶅簲缂栫爜', + align: 'center', + dataIndex: 'responseCode', + width: 100, + }, + { + title: '鍝嶅簲娑堟伅', + align: 'center', + dataIndex: 'responseMessage', + width: 200, + }, + { + title: '鍝嶅簲浣�', + align: 'center', + dataIndex: 'responseBody', + width: 200, + ellipsis: true, + }, + { + title: '鐘舵��', + align: 'center', + dataIndex: 'requestStatus', + width: 100, + }, + { + title: '璋冪敤鏂规硶', + align: 'center', + dataIndex: 'method', + width: 200, + ellipsis: true, + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' }, + fixed: 'right', + } + ], + url: { + list: '/system/sysApiLog/list', + } + } + }, + computed: { + }, + methods: {} +} +</script> +<style scoped> +@import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/src/views/system/modules/SysApiLogModal.vue b/src/views/system/modules/SysApiLogModal.vue new file mode 100644 index 0000000..7e18dfd --- /dev/null +++ b/src/views/system/modules/SysApiLogModal.vue @@ -0,0 +1,189 @@ +<template> + <j-modal + :title="title" + :width="800" + :visible="visible" + :confirmLoading="confirmLoading" + fullscreen + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-row> + <a-col :span="12"> + <a-form-model-item prop="apiCategory" label="API鍒嗙被"> + <a-input v-model="model.apiCategory" readonly /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item prop="apiName" label="鎺ュ彛鍚嶇О"> + <a-input v-model="model.apiName" readonly /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item prop="requestTime" label="璇锋眰鏃堕棿"> + <a-input v-model="model.requestTime" readonly /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item prop="responseTime" label="鍝嶅簲鏃堕棿"> + <a-input v-model="model.responseTime" readonly /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item prop="requestMethod" label="璇锋眰鏂瑰紡"> + <a-input v-model="model.requestMethod" readonly /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item prop="requestStatus" label="璇锋眰鐘舵��"> + <a-input v-model="model.requestStatus" readonly /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item prop="responseCode" label="鍝嶅簲缂栫爜"> + <a-input v-model="model.responseCode" readonly /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item prop="responseMessage" label="鍝嶅簲娑堟伅"> + <a-input v-model="model.responseMessage" readonly /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="requestUrl" + label="璇锋眰URL"> + <a-textarea v-model="model.requestUrl" :rows="1" readonly /> + </a-form-model-item> + </a-row> + <a-row> + <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="requestHeaders" label="璇锋眰澶�"> + <a-textarea v-model="model.requestHeaders" :rows="2" readonly /> + </a-form-model-item> + </a-row> + <a-row> + <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="requestBody" label="璇锋眰浣�"> + <a-textarea v-model="model.requestBody" :rows="4" readonly /> + </a-form-model-item> + </a-row> + <a-row> + <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="responseBody" label="鍝嶅簲浣�"> + <a-textarea v-model="model.responseBody" :rows="4" readonly /> + </a-form-model-item> + </a-row> + <a-row> + <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="method" + label="璋冪敤鏂规硶"> + <a-textarea v-model="model.method" :rows="1" readonly /> + </a-form-model-item> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> +import { httpAction } from '@/api/manage' +import moment from 'moment' + +export default { + name: 'SysApiLogModal', + data() { + return { + title: '鎿嶄綔', + visible: false, + disableSubmit: true, + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + }, + labelColLong: { + xs: { span: 24 }, + sm: { span: 3 } + }, + wrapperColLong: { + xs: { span: 24 }, + sm: { span: 20 } + }, + confirmLoading: false, + validatorRules: {}, + url: { + add: '/system/sysApiLog/add', + edit: '/system/sysApiLog/edit' + } + } + }, + created() { + }, + methods: { + add() { + //鍒濆鍖栭粯璁ゅ�� + this.edit({}) + }, + edit(record) { + this.model = Object.assign({}, record) + this.visible = true + }, + close() { + this.$emit('close') + this.visible = false + this.$refs.form.clearValidate() + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true + let httpurl = '' + let method = '' + if (!this.model.id) { + httpurl += this.url.add + method = 'post' + } else { + httpurl += this.url.edit + method = 'put' + } + httpAction(httpurl, this.model, method).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } else { + return false + } + }) + }, + handleCancel() { + this.close() + } + + + } +} +</script> + +<style lang="less" scoped> + +</style> \ No newline at end of file -- Gitblit v1.9.3