zhangherong
2025-07-31 7b40ccf7afca3382a84fc2905078cec44aa5de7d
art: 第三方接口查询提交
已添加2个文件
387 ■■■■■ 文件已修改
src/views/system/SysApiLogList.vue 198 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/modules/SysApiLogModal.vue 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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="请输入接口名称" 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: '系统第三方集成接口日志管理页面',
      // è¡¨å¤´
      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>
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>