Compare commits

..

2 Commits

Author SHA1 Message Date
wzt
d4cdffbaf5 Merge remote-tracking branch 'origin/master' 2026-08-05 09:17:16 +08:00
wzt
01abeb122c 解决设备维修保养记录404 2026-08-05 09:16:54 +08:00
4 changed files with 63 additions and 26 deletions

1
.gitignore vendored
View File

@ -27,3 +27,4 @@ AGENTS.md
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
/src/views/biz/tool/usage.vue

View File

@ -14,15 +14,15 @@ export interface MaintenanceRecord {
executorId?: number executorId?: number
startTime?: string startTime?: string | number
endTime?: string endTime?: string | number
recordStatus?: string recordStatus?: string
createTime?: string createTime?: string | number
updateTime?: string updateTime?: string | number
} }

View File

@ -50,7 +50,7 @@
:data="tableData" :data="tableData"
:loading="loading" :loading="loading"
:pagination="pagination" :pagination="pagination"
:row-key="(row) => row.recordId" :row-key="(row: MaintenanceRecord) => row.recordId"
:scroll-x="1200" :scroll-x="1200"
@update:page="handlePageChange" @update:page="handlePageChange"
@update:page-size="handlePageSizeChange" @update:page-size="handlePageSizeChange"
@ -60,7 +60,7 @@
<!-- 新增/编辑弹窗 --> <!-- 新增/编辑弹窗 -->
<n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px"> <n-modal v-model:show="modalVisible" preset="card" :title="modalTitle" style="width: 600px">
<n-form ref="formRef" :model="formData" label-placement="left" label-width="100px"> <n-form ref="formRef" :model="formData" :rules="formRules" label-placement="left" label-width="100px">
<n-form-item label="设备ID关联mes_equipment设备表主键" path="equipmentId"> <n-form-item label="设备ID关联mes_equipment设备表主键" path="equipmentId">
<n-input v-model:value="formData.equipmentId" placeholder="请输入设备ID关联mes_equipment设备表主键" /> <n-input v-model:value="formData.equipmentId" placeholder="请输入设备ID关联mes_equipment设备表主键" />
</n-form-item> </n-form-item>
@ -145,7 +145,7 @@ const searchForm = reactive({
// //
const tableData = ref<MaintenanceRecord[]>([]) const tableData = ref<MaintenanceRecord[]>([])
const loading = ref(false) const loading = ref(false)
const selectedIds = ref<number[]>([]) const selectedIds = ref<string[]>([])
const pagination = reactive({ const pagination = reactive({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
@ -229,8 +229,8 @@ async function loadData() {
pageSize: pagination.pageSize, pageSize: pagination.pageSize,
recordId: searchForm.recordId || undefined, recordId: searchForm.recordId || undefined,
}) })
tableData.value = res.list tableData.value = res.records || res.list || []
pagination.itemCount = res.total pagination.itemCount = res.total || 0
} finally { } finally {
loading.value = false loading.value = false
} }
@ -263,7 +263,7 @@ function handlePageSizeChange(pageSize: number) {
// //
function handleCheck(keys: Array<string | number>) { function handleCheck(keys: Array<string | number>) {
selectedIds.value = keys as number[] selectedIds.value = keys.map(String)
} }
// //
@ -439,19 +439,3 @@ onMounted(() => {
margin-bottom: 16px; margin-bottom: 16px;
} }
</style> </style>
<style scoped lang="scss">
.maintenance-page {
padding: 16px;
.search-card, .btn-card {
margin-bottom: 16px;
}
//
:deep(.el-card) {
border-radius: 8px;
}
//
:deep(.el-table__cell) {
padding: 12px 10px !important;
}
}
</style>

View File

@ -0,0 +1,52 @@
<template>
<div style="padding: 20px;">
<h2>设备维修保养记录 - 简易版</h2>
<n-button type="primary" :loading="loading" @click="loadData">加载数据</n-button>
<n-data-table :columns="columns" :data="tableData" :loading="loading" style="margin-top: 20px;" />
<pre style="margin-top: 20px; white-space: pre-wrap; background: #f5f5f5; padding: 10px; border-radius: 4px;">调试信息: {{ debug }}</pre>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { NButton, useMessage, type DataTableColumns } from 'naive-ui'
import { request } from '@/utils/request'
const message = useMessage()
const loading = ref(false)
const tableData = ref<any[]>([])
const debug = ref('')
const columns: DataTableColumns<any> = [
{ title: '记录编号', key: 'recordId' },
{ title: '设备ID', key: 'equipmentId' },
{ title: '记录类型', key: 'recordType' },
{ title: '内容', key: 'itemContent' },
{ title: '状态', key: 'recordStatus' },
{ title: '创建时间', key: 'createTime' },
]
async function loadData() {
loading.value = true
debug.value = '请求中...'
try {
const res = await request({
url: '/biz/maintenanceRecord/page',
method: 'get',
params: { page: 1, pageSize: 10 }
})
debug.value = '成功: ' + JSON.stringify(res).substring(0, 500)
tableData.value = res.records || res.list || []
message.success('加载成功')
} catch (err: any) {
debug.value = '失败: ' + (err?.message || String(err))
message.error('加载失败: ' + (err?.message || String(err)))
} finally {
loading.value = false
}
}
onMounted(() => {
loadData()
})
</script>