This commit is contained in:
2024-06-17 18:44:39 +08:00
parent b6f56fe5d8
commit 12f0406a48
14 changed files with 143 additions and 121 deletions

View File

@@ -23,25 +23,27 @@
</div>
<div class="ma-content-block w-full lg:w-6/12 mt-3 p-4 ml-0 lg:ml-3">
<a-tabs type="rounded">
<a-tab-pane key="login-log" title="登录日志">
<a-timeline class="pl-5 mt-3">
<a-tab-pane key="login-log" title="登录日志" v-loading="isDataLoading">
<a-timeline class="pl-5 mt-3" v-if="loginLogList.length">
<a-timeline-item
:label="`地理位置;${item.ip_location},操作系统:${item.os}`"
:label="`IP地址${item.ip},操作系统:${item.os}`"
v-for="(item, idx) in loginLogList"
:key="idx"
>
您于 {{ item.login_time }} 登录系统{{ item.message }}
您于 {{ item.create_datetime }} 登录系统浏览器{{ item.browser }}
</a-timeline-item>
</a-timeline>
</a-tab-pane>
<a-tab-pane key="operation-log" title="操作日志">
<a-tab-pane key="operation-log" title="操作日志" v-loading="isLoading">
<a-timeline class="pl-5 mt-3">
<a-timeline-item
:label="`地理位置;${item.ip_location},方式:${item.method}路由${item.router}`"
:label="`IP地址${item.request_ip},方式:${item.request_method}系统${item.request_os},浏览器:${item.request_browser}`"
v-for="(item, idx) in operationLogList"
:key="idx"
>
您于 {{ item.created_at }} 执行 {{ item.service_name }}
您于 {{ item.create_datetime }} 请求 {{ item.request_path }}状态码{{
item.response_code
}}
</a-timeline-item>
</a-timeline>
</a-tab-pane>
@@ -52,21 +54,35 @@
</template>
<script setup>
import { ref } from "vue"
import { computed, ref } from "vue"
import MaUpload from "@cps/ma-upload/index.vue"
import userInfomation from "./components/userInfo.vue"
import editpassword from "./components/editpassword.vue"
import { useUserStore } from "@/store"
import logApi from "@/api/system/log"
import useFetchData from "@/hooks/fetchData"
const { loadingData, isDataLoading } = useFetchData([], logApi.getLoginLog)
const userStore = useUserStore()
const loginLogList = ref([
{ ip_location: "成都", os: "window10", login_time: "2023-6-6", message: "更新了xxx项目" },
{ ip_location: "成都", os: "window10", login_time: "2023-6-5", message: "更新了xxx项目" }
])
const operationLogList = ref([
{ ip_location: "四川省-成都市", method: "POST", router: "/demo/update", created_at: "2023-06-06 17:05:08",service_name:"问答历史" },
{ ip_location: "四川省-成都市", method: "POST", router: "/demo/update", created_at: "2023-06-06 17:05:08",service_name:"问答历史" },
{ ip_location: "四川省-成都市", method: "POST", router: "/demo/update", created_at: "2023-06-06 17:05:08",service_name:"问答历史" },
])
const loginLogList = computed(() => {
return loadingData.value.map((item) => {
item.create_datetime = item.create_datetime.split(".")[0].replace("T", " ")
return item
})
})
// 操作日志不用hook
const isLoading = ref(true)
const data = ref([])
logApi.getOperationLog().then((res) => {
data.value = res.data
isLoading.value = false
})
const operationLogList = computed(() => {
return data.value.map((item) => {
item.create_datetime = item.create_datetime.split(".")[0].replace("T", " ")
return item
})
})
</script>
<style scoped>