Browse Source

Merge branch 'master' of http://10.8.230.114:3000/wangbin/log-server-web

wangbin 2 years ago
parent
commit
2d50a8ad8d
3 changed files with 208 additions and 3 deletions
  1. 9 0
      src/api/ipLog.js
  2. 195 0
      src/view/ipLogList/abnormalIpList.vue
  3. 4 3
      src/view/ipLogList/gameIpList.vue

+ 9 - 0
src/api/ipLog.js

@@ -76,4 +76,13 @@ export const gameIpExport = (tableData, fileName) => {
     }).then((res) => {
         handleFileError(res, fileName)
     })
+}
+
+//获取异常ip列表
+export const getAbnormalIpLogList = (data) => {
+    return service({
+        url: '/ipLog/getAbnormalIpLogList',
+        method: 'post',
+        data
+    })
 }

+ 195 - 0
src/view/ipLogList/abnormalIpList.vue

@@ -0,0 +1,195 @@
+<template>
+    <div>
+        <div class="gva-search-box">
+            <el-form ref="searchForm" :inline="true" :model="searchInfo">
+                <el-form-item label="游戏id">
+                    <el-input v-model="searchInfo.game_id" placeholder="游戏id" />
+                </el-form-item>
+                <el-form-item label="电脑编号">
+                    <el-input v-model="searchInfo.pc_code" placeholder="电脑编号" />
+                </el-form-item>
+                <el-form-item label="日期" prop="date">
+                    <el-date-picker v-model="searchInfo.date" size="default" type="daterange" unlink-panels
+                        range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :disabled-date="disabledDate"
+                        :shortcuts="shortcuts" />
+                </el-form-item>
+                <el-form-item>
+                    <el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
+                    <el-button size="small" icon="refresh" @click="onReset">重置</el-button>
+                </el-form-item>
+            </el-form>
+        </div>
+        <div class="gva-table-box">
+            <el-table :data="tableData" @sort-change="sortChange" @selection-change="handleSelectionChange">
+                <el-table-column type="selection" width="55" />
+                <el-table-column align="left" label="电脑编号" min-width="100" prop="pc_code" />
+                <el-table-column align="left" label="ip" min-width="100" prop="ip" />
+                <el-table-column align="left" label="游戏id" min-width="150" prop="game_id" sortable="custom" />
+                <el-table-column align="left" label="ip个数" min-width="150" prop="count" sortable="custom" />
+                <el-table-column align="left" label="日期" min-width="150" prop="create_date" sortable="custom" />
+                <!-- <el-table-column align="left" fixed="right" label="操作" width="200">
+                    <template #default="scope">
+                        <el-button icon="search" size="small" type="primary" link
+                            @click="selectIpFunc(scope.row)">查看</el-button>
+                    </template>
+                </el-table-column> -->
+            </el-table>
+            <div class="gva-pagination">
+                <el-pagination :current-page="page" :page-size="pageSize" :page-sizes="[10, 30, 50, 100]" :total="total"
+                    layout="total, sizes, prev, pager, next, jumper" @current-change="handleCurrentChange"
+                    @size-change="handleSizeChange" />
+            </div>
+        </div>
+        <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="dialogTitle" width="40%">
+            <!-- <template #footer>
+                <div class="dialog-footer">
+                    <el-text class="mx-1" type="success">Success</el-text>
+                    <el-button size="small" @click="closeDialog">取 消</el-button> -->
+            <!-- </div>
+            </template> -->
+            <!-- <el-table :data="IpTableData" height="500" border>
+                <el-table-column align="center" label="ip" min-width="120" prop="ip" />
+                <el-table-column align="center" label="上报次数" min-width="120" prop="count" />
+            </el-table> -->
+        </el-dialog>
+    </div>
+</template>
+  
+<script>
+export default {
+    name: 'AbnormalIPList',
+}
+</script>
+  
+<script setup>
+import {
+    getAbnormalIpLogList
+} from '@/api/ipLog'
+import { toSQLLine } from '@/utils/stringFun'
+import { ref } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import warningBar from '@/components/warningBar/warningBar.vue'
+import dayjs from "dayjs";
+const apis = ref([])
+const page = ref(1)
+const total = ref(0)
+const pageSize = ref(10)
+const tableData = ref([])
+const IpTableData = ref([])
+const searchInfo = ref({})
+
+const onReset = () => {
+    searchInfo.value = {}
+    getTableData()
+}
+
+// 搜索
+const onSubmit = () => {
+    page.value = 1
+    pageSize.value = 10
+    searchInfo.value.game_id = Number(searchInfo.value.game_id)
+    if (typeof searchInfo.value.date != "undefined") {
+        searchInfo.value.date[0] = dayjs(searchInfo.value.date[0]).format(
+            "YYYY-MM-DD"
+        );
+        searchInfo.value.date[1] = dayjs(searchInfo.value.date[1]).format(
+            "YYYY-MM-DD"
+        );
+    }
+    getTableData()
+}
+
+// 分页
+const handleSizeChange = (val) => {
+    pageSize.value = val
+    getTableData()
+}
+
+const handleCurrentChange = (val) => {
+    page.value = val
+    getTableData()
+}
+
+// 排序
+const sortChange = ({ prop, order }) => {
+    if (prop) {
+        if (prop === 'id') {
+            prop = 'id'
+        }
+        searchInfo.value.orderKey = toSQLLine(prop)
+        searchInfo.value.desc = order === 'descending'
+    }
+    getTableData()
+}
+
+// 查询
+const getTableData = async () => {
+    const table = await getAbnormalIpLogList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
+    if (table.code === 0) {
+        tableData.value = table.data.list
+        total.value = table.data.total
+        page.value = table.data.page
+        pageSize.value = table.data.pageSize
+    }
+}
+
+getTableData()
+
+// 查看IP
+// const selectIpFunc = async (row) => {
+//     const res = await getIp({ game_id: row.game_id, pc_code: row.pc_code, create_date: row.create_date })
+//     IpTableData.value = res.data.list
+//     IpTableData.value.total = res.data.total
+//     openDialog('getIp')
+// }
+const closeDialog = () => {
+    dialogFormVisible.value = false
+}
+const dialogTitle = ref('')
+const type = ref('')
+const dialogFormVisible = ref(false)
+// const openDialog = (key) => {
+//     switch (key) {
+//         case 'getIp':
+//             dialogTitle.value = 'ip个数:' + IpTableData.value.total
+//             break
+//         default:
+//             break
+//     }
+//     type.value = key
+//     dialogFormVisible.value = true
+// }
+
+// 批量操作
+const handleSelectionChange = (val) => {
+    apis.value = val
+}
+
+
+
+// 弹窗相关
+// const apiForm = ref(null)
+// const initForm = () => {
+//     apiForm.value.resetFields()
+//     form.value = {
+//         game_name: '',
+//         game_package_name: ''
+//     }
+// }
+
+</script>
+  
+<style scoped lang="scss">
+.button-box {
+    padding: 10px 20px;
+
+    .el-button {
+        float: right;
+    }
+}
+
+.warning {
+    color: #dc143c;
+}
+</style>
+  

+ 4 - 3
src/view/ipLogList/gameIpList.vue

@@ -35,13 +35,14 @@
                 <el-table-column align="left" label="成功ip次数" min-width="100" prop="success_ip" sortable="custom" />
                 <el-table-column align="left" label="ip个数" min-width="100" prop="count_distinct_ip" sortable="custom" />
                 <el-table-column align="left" label="最大ip数" min-width="100" prop="max_count" />
-                <el-table-column align="left" label="异常ip个数" min-width="100" prop="exceed_three" />
-                <el-table-column align="left" label="ip成功率" min-width="100" prop="ip_repetition_rate">
+                <el-table-column align="left" label="异常ip个数" min-width="100" prop="exceed_three" sortable="custom" />
+                <el-table-column align="left" label="ip成功率" min-width="100" prop="ip_repetition_rate" sortable="custom">
                     <template #default="scope">
                         <span>{{ scope.row.ip_repetition_rate }}%</span>
                     </template>
                 </el-table-column>
-                <el-table-column align="left" label="平均成功率" min-width="150" prop="average_ip_repetition_rate">
+                <el-table-column align="left" label="平均成功率" min-width="150" prop="average_ip_repetition_rate"
+                    sortable="custom">
                     <template #default="scope">
                         <span>{{ scope.row.average_ip_repetition_rate }}%</span>
                     </template>