181 lines
3.9 KiB
Vue
181 lines
3.9 KiB
Vue
<template>
|
|
<div class="log-container">
|
|
<el-button-group class="toolbar-btn-group">
|
|
<el-button
|
|
type="primary"
|
|
size="small"
|
|
icon="Refresh"
|
|
@click="fetchStockInfo"
|
|
title="刷新"
|
|
:loading="loading"
|
|
class="toolbar-btn"
|
|
>
|
|
刷新
|
|
</el-button>
|
|
</el-button-group>
|
|
|
|
<el-table
|
|
:data="tableData"
|
|
border
|
|
stripe
|
|
style="width: 100%"
|
|
:height="tableHeight"
|
|
v-loading="loading"
|
|
>
|
|
<el-table-column prop="created_at" label="时间" width="250" />
|
|
<el-table-column prop="operator_name" label="操作人" width="120" />
|
|
<el-table-column prop="operation_name" label="操作名称" />
|
|
<el-table-column prop="platform_name" label="操作平台" />
|
|
|
|
<el-table-column label="操作" width="150">
|
|
<template #default="scope">
|
|
<el-button
|
|
@click="viewData(scope.row)"
|
|
type="primary"
|
|
link
|
|
size="small"
|
|
v-if="scope.row.external_log_id"
|
|
>
|
|
查看报文
|
|
</el-button>
|
|
<el-button
|
|
@click="backData(scope.row)"
|
|
type="primary"
|
|
link
|
|
size="small"
|
|
v-if="scope.row.operation_code === 'UPDATE'"
|
|
>
|
|
修改前快照
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<div class="pagination-container">
|
|
<el-pagination
|
|
v-model:current-page="pagination.page"
|
|
v-model:page-size="pagination.pageSize"
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
:total="pagination.total"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
background
|
|
@size-change="handlePageSizeChange"
|
|
@current-change="handlePageChange"
|
|
/>
|
|
</div>
|
|
|
|
<el-drawer
|
|
v-model="showRequestData"
|
|
direction="rtl"
|
|
:with-header="false"
|
|
size="800px"
|
|
class="el-drawers"
|
|
>
|
|
<RequestData
|
|
v-if="showRequestData"
|
|
:id="requestId"
|
|
:type="requestType"
|
|
/>
|
|
</el-drawer>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, reactive, watch, onMounted, computed } from 'vue'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { Refresh } from '@element-plus/icons-vue'
|
|
import * as stockApi from '@/api/stock'
|
|
import RequestData from '@/components/RequestData/index.vue'
|
|
|
|
const props = defineProps<{
|
|
id?: number
|
|
}>()
|
|
|
|
const loading = ref(false)
|
|
const tableData = ref<any[]>([])
|
|
const showRequestData = ref(false)
|
|
const requestId = ref(0)
|
|
const requestType = ref('')
|
|
|
|
const pagination = reactive({
|
|
page: 1,
|
|
pageSize: 20,
|
|
total: 0
|
|
})
|
|
|
|
const tableHeight = computed(() => {
|
|
return window.innerHeight - 300 // 根据实际情况调整
|
|
})
|
|
|
|
watch(() => props.id, (newVal) => {
|
|
if (newVal) {
|
|
fetchStockInfo()
|
|
} else {
|
|
tableData.value = []
|
|
pagination.total = 0
|
|
}
|
|
})
|
|
|
|
onMounted(() => {
|
|
if (props.id) {
|
|
fetchStockInfo()
|
|
}
|
|
})
|
|
|
|
async function handlePageChange(page: number) {
|
|
pagination.page = page
|
|
await fetchStockInfo()
|
|
}
|
|
|
|
async function handlePageSizeChange(pageSize: number) {
|
|
pagination.pageSize = pageSize
|
|
pagination.page = 1
|
|
await fetchStockInfo()
|
|
}
|
|
|
|
async function fetchStockInfo() {
|
|
if (!props.id) return
|
|
|
|
}
|
|
|
|
function viewData(row: any) {
|
|
requestId.value = row.external_log_id
|
|
requestType.value = row.external_log_type
|
|
showRequestData.value = true
|
|
}
|
|
|
|
function backData(row: any) {
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.log-container {
|
|
height: 100%;
|
|
padding: 10px 20px;
|
|
overflow: hidden;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.toolbar-btn-group {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.el-table {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.pagination-container {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
align-items: center;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
:deep(.el-drawer__body) {
|
|
height: 100%;
|
|
padding: 0;
|
|
}
|
|
</style>
|