| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <template>
- <ele-modal v-model="visible" title="操作日志" width="860px">
- <el-table v-loading="loading" :data="tableData" border stripe>
- <el-table-column prop="operatorName" label="操作员" width="140" />
- <el-table-column prop="createTime" label="操作时间" width="180" />
- <el-table-column prop="content" label="描述" min-width="280" />
- </el-table>
- <div class="pager">
- <el-pagination
- background
- layout="total, sizes, prev, pager, next"
- :total="total"
- v-model:current-page="pageNum"
- v-model:page-size="pageSize"
- :page-sizes="[10, 20, 50]"
- @current-change="loadList"
- @size-change="handleSizeChange"
- />
- </div>
- <template #footer>
- <el-button type="primary" @click="visible = false">关闭</el-button>
- </template>
- </ele-modal>
- </template>
- <script setup>
- import { ref } from 'vue';
- import { ElMessage } from 'element-plus';
- import { getTaskLogs } from '@/api/priceWorkbench';
- const visible = ref(false);
- const loading = ref(false);
- const tableData = ref([]);
- const total = ref(0);
- const pageNum = ref(1);
- const pageSize = ref(10);
- const taskId = ref(null);
- const loadList = async () => {
- if (!taskId.value) return;
- loading.value = true;
- try {
- const res = await getTaskLogs(taskId.value, {
- pageNum: pageNum.value,
- pageSize: pageSize.value
- });
- tableData.value = res.rows || [];
- total.value = res.total || 0;
- } catch (e) {
- tableData.value = [];
- total.value = 0;
- ElMessage.error(e.message);
- } finally {
- loading.value = false;
- }
- };
- const handleSizeChange = () => {
- pageNum.value = 1;
- loadList();
- };
- const handleOpen = (row) => {
- taskId.value = row.id;
- pageNum.value = 1;
- visible.value = true;
- loadList();
- };
- defineExpose({ handleOpen });
- </script>
- <style scoped>
- .pager {
- display: flex;
- justify-content: flex-end;
- margin-top: 12px;
- }
- </style>
|