解决设备维修保养记录404
This commit is contained in:
parent
174f8454c3
commit
01abeb122c
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,3 +27,4 @@ AGENTS.md
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
/src/views/biz/tool/usage.vue
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增
|
// 新增
|
||||||
@ -438,20 +438,4 @@ onMounted(() => {
|
|||||||
.table-toolbar {
|
.table-toolbar {
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
</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>
|
</style>
|
||||||
52
src/views/biz/maintenanceRecord/simple.vue
Normal file
52
src/views/biz/maintenanceRecord/simple.vue
Normal 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>
|
||||||
Loading…
Reference in New Issue
Block a user