Compare commits
2 Commits
6d65a183d5
...
d4cdffbaf5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4cdffbaf5 | ||
|
|
01abeb122c |
1
.gitignore
vendored
1
.gitignore
vendored
@ -27,3 +27,4 @@ AGENTS.md
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
/src/views/biz/tool/usage.vue
|
||||
|
||||
@ -14,15 +14,15 @@ export interface MaintenanceRecord {
|
||||
|
||||
executorId?: number
|
||||
|
||||
startTime?: string
|
||||
startTime?: string | number
|
||||
|
||||
endTime?: string
|
||||
endTime?: string | number
|
||||
|
||||
recordStatus?: string
|
||||
|
||||
createTime?: string
|
||||
createTime?: string | number
|
||||
|
||||
updateTime?: string
|
||||
updateTime?: string | number
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
:data="tableData"
|
||||
:loading="loading"
|
||||
:pagination="pagination"
|
||||
:row-key="(row) => row.recordId"
|
||||
:row-key="(row: MaintenanceRecord) => row.recordId"
|
||||
:scroll-x="1200"
|
||||
@update:page="handlePageChange"
|
||||
@update:page-size="handlePageSizeChange"
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<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-input v-model:value="formData.equipmentId" placeholder="请输入设备ID,关联mes_equipment设备表主键" />
|
||||
</n-form-item>
|
||||
@ -145,7 +145,7 @@ const searchForm = reactive({
|
||||
// 表格数据
|
||||
const tableData = ref<MaintenanceRecord[]>([])
|
||||
const loading = ref(false)
|
||||
const selectedIds = ref<number[]>([])
|
||||
const selectedIds = ref<string[]>([])
|
||||
const pagination = reactive({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
@ -229,8 +229,8 @@ async function loadData() {
|
||||
pageSize: pagination.pageSize,
|
||||
recordId: searchForm.recordId || undefined,
|
||||
})
|
||||
tableData.value = res.list
|
||||
pagination.itemCount = res.total
|
||||
tableData.value = res.records || res.list || []
|
||||
pagination.itemCount = res.total || 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@ -263,7 +263,7 @@ function handlePageSizeChange(pageSize: 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;
|
||||
}
|
||||
</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>
|
||||
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