|
@@ -1,99 +1,90 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
-import { deleteApiReqById, getApiReqByPage } from '@/api/api/apiLogApi'
|
|
|
|
|
-import { getModuleByList } from '@/api/api/apiModuleApi'
|
|
|
|
|
|
|
+import { deleteApiLogById, getApiLogByPage } from '@/api/api/apiLogApi'
|
|
|
const { pagination, getParams, onSizeChange, onCurrentChange } = usePagination()
|
|
const { pagination, getParams, onSizeChange, onCurrentChange } = usePagination()
|
|
|
|
|
|
|
|
interface TreeNode {
|
|
interface TreeNode {
|
|
|
label: string
|
|
label: string
|
|
|
isLeaf: boolean
|
|
isLeaf: boolean
|
|
|
- moduleId: number
|
|
|
|
|
|
|
+ value: number
|
|
|
|
|
+ bizId: number
|
|
|
|
|
+ objectId: number
|
|
|
children?: TreeNode[]
|
|
children?: TreeNode[]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+interface ApiLog {
|
|
|
|
|
+ bizId: number
|
|
|
|
|
+ objectId: number
|
|
|
|
|
+ oamId: number
|
|
|
|
|
+ apiId: number
|
|
|
|
|
+ apiMethod: number
|
|
|
|
|
+ apiType: number
|
|
|
|
|
+ apiTitle: string
|
|
|
|
|
+ apiCode: string
|
|
|
|
|
+ apiDesc: string
|
|
|
|
|
+ apiParams: string
|
|
|
|
|
+ status: number
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
|
loading: false,
|
|
loading: false,
|
|
|
- curModuleId: 0,
|
|
|
|
|
|
|
+ keywords: '',
|
|
|
treeData: [] as TreeNode[],
|
|
treeData: [] as TreeNode[],
|
|
|
- reqList: [],
|
|
|
|
|
|
|
+ curBizId: 0,
|
|
|
|
|
+ curObjectId: 0,
|
|
|
|
|
+ apiList: [] as ApiLog[],
|
|
|
|
|
+ dialogState: 1,
|
|
|
search: {
|
|
search: {
|
|
|
|
|
+ bizId: 0,
|
|
|
|
|
+ objectId: 0,
|
|
|
keywords: '',
|
|
keywords: '',
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const leftTreeRef = ref()
|
|
|
|
|
-const ModuleRef = ref()
|
|
|
|
|
-
|
|
|
|
|
// 查询日志列表
|
|
// 查询日志列表
|
|
|
-const getReqData = async () => {
|
|
|
|
|
- const params = getParams()
|
|
|
|
|
- params.moduleId = state.curModuleId
|
|
|
|
|
- params.keywords = state.search.keywords
|
|
|
|
|
- state.loading = true
|
|
|
|
|
- const { data } = await getApiReqByPage(params)
|
|
|
|
|
- state.reqList = data.data
|
|
|
|
|
- state.loading = false
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-const getModuleData = async () => {
|
|
|
|
|
- const { data } = await getModuleByList('')
|
|
|
|
|
- const children: TreeNode[] = []
|
|
|
|
|
- data.forEach((item: any) => {
|
|
|
|
|
- return children.push({
|
|
|
|
|
- label: item.moduleTitle,
|
|
|
|
|
- moduleId: item.moduleId,
|
|
|
|
|
- isLeaf: true,
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- state.treeData = [
|
|
|
|
|
- {
|
|
|
|
|
- label: '功能模块',
|
|
|
|
|
- isLeaf: false,
|
|
|
|
|
- moduleId: -1,
|
|
|
|
|
- children,
|
|
|
|
|
- },
|
|
|
|
|
- ]
|
|
|
|
|
-
|
|
|
|
|
- if (data && data.length > 0) {
|
|
|
|
|
- state.curModuleId = data[0].moduleId
|
|
|
|
|
- nextTick(() => {
|
|
|
|
|
- leftTreeRef.value.setCurrentKey(data[0].moduleId)
|
|
|
|
|
- })
|
|
|
|
|
- await getReqData()
|
|
|
|
|
|
|
+const leftTreeRef = ref()
|
|
|
|
|
+const getApiLogData = async () => {
|
|
|
|
|
+ const curBizId = state.curBizId
|
|
|
|
|
+ const curObjectId = state.curObjectId
|
|
|
|
|
+ if (curBizId > 0 && curObjectId > 0) {
|
|
|
|
|
+ state.loading = true
|
|
|
|
|
+ const { data } = await getApiLogByPage(state.search)
|
|
|
|
|
+ state.apiList = data
|
|
|
|
|
+ state.loading = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 每页数量切换
|
|
// 每页数量切换
|
|
|
function sizeChange(size: number) {
|
|
function sizeChange(size: number) {
|
|
|
- onSizeChange(size).then(() => getReqData())
|
|
|
|
|
|
|
+ onSizeChange(size).then(() => getApiLogData())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 当前页码切换(翻页)
|
|
// 当前页码切换(翻页)
|
|
|
function currentChange(page = 1) {
|
|
function currentChange(page = 1) {
|
|
|
- onCurrentChange(page).then(() => getReqData())
|
|
|
|
|
|
|
+ onCurrentChange(page).then(() => getApiLogData())
|
|
|
}
|
|
}
|
|
|
// 查询
|
|
// 查询
|
|
|
const onSearch = () => {
|
|
const onSearch = () => {
|
|
|
- getReqData()
|
|
|
|
|
|
|
+ getApiLogData()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- getModuleData()
|
|
|
|
|
|
|
+ getApiLogData()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 模块选择
|
|
// 模块选择
|
|
|
const onTreeNodeClick = (node: TreeNode) => {
|
|
const onTreeNodeClick = (node: TreeNode) => {
|
|
|
if (node.isLeaf) {
|
|
if (node.isLeaf) {
|
|
|
- state.curModuleId = node.moduleId
|
|
|
|
|
- getReqData()
|
|
|
|
|
|
|
+ state.search.objectId = node.objectId
|
|
|
|
|
+ getApiLogData()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 删除日志
|
|
// 删除日志
|
|
|
const onReqDel = async (data: { apiTitle: any; reqId: number }) => {
|
|
const onReqDel = async (data: { apiTitle: any; reqId: number }) => {
|
|
|
ElMessageBox.confirm('确认删除吗?', '确认信息').then(async () => {
|
|
ElMessageBox.confirm('确认删除吗?', '确认信息').then(async () => {
|
|
|
- await deleteApiReqById(data.reqId)
|
|
|
|
|
- await getReqData()
|
|
|
|
|
|
|
+ await deleteApiLogById(data.reqId)
|
|
|
|
|
+ await getApiLogData()
|
|
|
ElMessage.success({
|
|
ElMessage.success({
|
|
|
message: '删除成功',
|
|
message: '删除成功',
|
|
|
center: true,
|
|
center: true,
|
|
@@ -141,7 +132,7 @@ const onReqDel = async (data: { apiTitle: any; reqId: number }) => {
|
|
|
</template>
|
|
</template>
|
|
|
</tool-bar>
|
|
</tool-bar>
|
|
|
|
|
|
|
|
- <el-table ref="apiReqTableRef" v-loading="state.loading" class="list-table" :data="state.reqList" border stripe highlight-current-row>
|
|
|
|
|
|
|
+ <el-table ref="apiReqTableRef" v-loading="state.loading" class="list-table" :data="state.dataList" border stripe highlight-current-row>
|
|
|
<el-table-column type="index" align="center" label="序号" width="60" />
|
|
<el-table-column type="index" align="center" label="序号" width="60" />
|
|
|
|
|
|
|
|
<el-table-column align="center" width="100" label="接口名称" prop="apiTitle" />
|
|
<el-table-column align="center" width="100" label="接口名称" prop="apiTitle" />
|