fix: 适配 7 个 Vue 组件至 ApiResponse<T> 泛型格式 (120处修复)
This commit is contained in:
parent
367d638f58
commit
a5e3011d5a
|
|
@ -1,8 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { Descriptions, DescriptionsItem, Tag, message, Spin, Button, Modal, Card } from 'ant-design-vue'
|
import { Descriptions, DescriptionsItem, Tag, message, Spin, Button, Modal } from 'ant-design-vue'
|
||||||
import { ArrowLeftOutlined, UploadOutlined, FilePdfOutlined, FileImageOutlined, FileOutlined, EyeOutlined } from '@ant-design/icons-vue'
|
import { ArrowLeftOutlined, UploadOutlined, FilePdfOutlined, FileImageOutlined, FileOutlined } from '@ant-design/icons-vue'
|
||||||
import { getEquipmentDetail, type Equipment, EQUIPMENT_TYPE_OPTIONS, OWNERSHIP_TYPE_OPTIONS, uploadFile, type EquipmentPhoto, type EquipmentDocument } from '@/api/equipment'
|
import { getEquipmentDetail, type Equipment, EQUIPMENT_TYPE_OPTIONS, OWNERSHIP_TYPE_OPTIONS, uploadFile, type EquipmentPhoto, type EquipmentDocument } from '@/api/equipment'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
@ -29,8 +29,8 @@ const fetchEquipmentDetail = async () => {
|
||||||
|
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentDetail(id)
|
const response = await getEquipmentDetail(id)
|
||||||
equipment.value = res.data
|
equipment.value = response.data.data
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取设备详情失败')
|
message.error('获取设备详情失败')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -106,9 +106,9 @@ const renderHealthChart = () => {
|
||||||
const fetchEquipmentList = async (pId: string) => {
|
const fetchEquipmentList = async (pId: string) => {
|
||||||
if (!pId) return
|
if (!pId) return
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentList(pId)
|
const response = await getEquipmentList(pId)
|
||||||
const data = res.data
|
const equipmentList = response.data.data || []
|
||||||
equipmentOptions.value = (data || []).map((item: Equipment) => ({
|
equipmentOptions.value = equipmentList.map((item: Equipment) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: `${item.equipmentName} (${item.equipmentCode})`
|
label: `${item.equipmentName} (${item.equipmentCode})`
|
||||||
}))
|
}))
|
||||||
|
|
@ -133,11 +133,11 @@ const fetchHealthData = async () => {
|
||||||
getEquipmentMTTR(selectedEquipmentId.value)
|
getEquipmentMTTR(selectedEquipmentId.value)
|
||||||
])
|
])
|
||||||
|
|
||||||
healthData.value = healthRes.data
|
healthData.value = healthRes.data.data
|
||||||
healthHistory.value = historyRes.data || []
|
healthHistory.value = historyRes.data.data || []
|
||||||
failureHistory.value = failureRes.data || []
|
failureHistory.value = failureRes.data.data || []
|
||||||
mtbfData.value = mtbfRes.data
|
mtbfData.value = mtbfRes.data.data
|
||||||
mttrData.value = mttrRes.data
|
mttrData.value = mttrRes.data.data
|
||||||
|
|
||||||
// 渲染图表
|
// 渲染图表
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
|
import type { PaginationInfo } from '@/types'
|
||||||
|
import { getErrorMessage, isValidationError } from '@/utils/error-handler'
|
||||||
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, TreeSelect, Popconfirm, Statistic, Row, Col, Card, Modal, Upload } from 'ant-design-vue'
|
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, TreeSelect, Popconfirm, Statistic, Row, Col, Card, Modal, Upload } from 'ant-design-vue'
|
||||||
import type { ColumnsType } from 'ant-design-vue/es/table'
|
import type { ColumnsType } from 'ant-design-vue/es/table'
|
||||||
import type { UploadProps } from 'ant-design-vue'
|
import type { UploadProps } from 'ant-design-vue'
|
||||||
|
|
@ -43,11 +45,8 @@ import {
|
||||||
type EquipmentType,
|
type EquipmentType,
|
||||||
type OwnershipType,
|
type OwnershipType,
|
||||||
type SystemType,
|
type SystemType,
|
||||||
type OwnershipEntity,
|
|
||||||
type EquipmentStatsByType,
|
type EquipmentStatsByType,
|
||||||
type EquipmentStatsByOwnership,
|
type EquipmentStatsByOwnership
|
||||||
type EquipmentPhoto,
|
|
||||||
type EquipmentDocument
|
|
||||||
} from '@/api/equipment'
|
} from '@/api/equipment'
|
||||||
import PhotoManager from './components/PhotoManager.vue'
|
import PhotoManager from './components/PhotoManager.vue'
|
||||||
import DocumentManager from './components/DocumentManager.vue'
|
import DocumentManager from './components/DocumentManager.vue'
|
||||||
|
|
@ -141,30 +140,30 @@ const rowSelection = {
|
||||||
// 获取项目列表
|
// 获取项目列表
|
||||||
const fetchProjects = async () => {
|
const fetchProjects = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getProjectSelectorList()
|
const response = await getProjectSelectorList()
|
||||||
const list = (res as any)?.data?.data || []
|
const res = response.data
|
||||||
|
const list = res.data || []
|
||||||
projectOptions.value = list.map((item: any) => ({
|
projectOptions.value = list.map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name
|
label: item.name
|
||||||
}))
|
}))
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
console.error('获取项目列表失败:', error)
|
message.error(getErrorMessage(error))
|
||||||
message.error('获取项目列表失败')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取归属主体列表
|
// 获取归属主体列表
|
||||||
const fetchOwnershipEntityList = async () => {
|
const fetchOwnershipEntityList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getOwnershipEntityList()
|
const response = await getOwnershipEntityList()
|
||||||
const list = (res as any)?.data?.data || []
|
const res = response.data
|
||||||
|
const list = res.data || []
|
||||||
ownershipEntityOptions.value = list.map((item: any) => ({
|
ownershipEntityOptions.value = list.map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.entityName || item.name
|
label: item.entityName || item.name
|
||||||
}))
|
}))
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
console.error('获取归属主体列表失败:', error)
|
message.error(getErrorMessage(error))
|
||||||
message.error('获取归属主体列表失败')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,15 +175,17 @@ const fetchEquipmentList = async () => {
|
||||||
}
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
let res
|
let response
|
||||||
if (queryParams.equipmentType) {
|
if (queryParams.equipmentType) {
|
||||||
res = await getEquipmentByType(queryParams.projectId, queryParams.equipmentType)
|
response = await getEquipmentByType(queryParams.projectId, queryParams.equipmentType)
|
||||||
} else if (queryParams.ownershipType) {
|
} else if (queryParams.ownershipType) {
|
||||||
res = await getEquipmentByOwnership(queryParams.projectId, queryParams.ownershipType)
|
response = await getEquipmentByOwnership(queryParams.projectId, queryParams.ownershipType)
|
||||||
} else {
|
} else {
|
||||||
res = await getEquipmentList(queryParams.projectId)
|
response = await getEquipmentList(queryParams.projectId)
|
||||||
}
|
}
|
||||||
let data = res.data || []
|
const res = response.data
|
||||||
|
// 处理不同的返回格式:可能是 ApiResponse<Equipment[]> 或直接的 Equipment[]
|
||||||
|
let data: Equipment[] = Array.isArray(res) ? res : (res as any)?.data || (res as any)?.content || []
|
||||||
// 按系统类型筛选
|
// 按系统类型筛选
|
||||||
if (queryParams.systemType) {
|
if (queryParams.systemType) {
|
||||||
data = data.filter((item: Equipment) => item.systemType === queryParams.systemType)
|
data = data.filter((item: Equipment) => item.systemType === queryParams.systemType)
|
||||||
|
|
@ -203,14 +204,15 @@ const fetchEquipmentStats = async () => {
|
||||||
if (!queryParams.projectId) return
|
if (!queryParams.projectId) return
|
||||||
statsLoading.value = true
|
statsLoading.value = true
|
||||||
try {
|
try {
|
||||||
const [countRes, typeRes, ownershipRes] = await Promise.all([
|
const [countResponse, typeResponse, ownershipResponse] = await Promise.all([
|
||||||
getEquipmentCountStats(queryParams.projectId),
|
getEquipmentCountStats(queryParams.projectId),
|
||||||
getEquipmentStatsByType(queryParams.projectId),
|
getEquipmentStatsByType(queryParams.projectId),
|
||||||
getEquipmentStatsByOwnership(queryParams.projectId)
|
getEquipmentStatsByOwnership(queryParams.projectId)
|
||||||
])
|
])
|
||||||
countStats.value = countRes.data || { total: 0, normal: 0, warning: 0, abnormal: 0 }
|
// getEquipmentCountStats 返回的是 EquipmentCountStats 对象,不是 ApiResponse 包装
|
||||||
statsByType.value = typeRes.data || []
|
countStats.value = countResponse.data || { total: 0, normal: 0, warning: 0, abnormal: 0 }
|
||||||
statsByOwnership.value = ownershipRes.data || []
|
statsByType.value = typeResponse.data.data || []
|
||||||
|
statsByOwnership.value = ownershipResponse.data.data || []
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取设备统计失败')
|
message.error('获取设备统计失败')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -326,7 +328,8 @@ const openAddModal = () => {
|
||||||
const fetchSpaceTree = async () => {
|
const fetchSpaceTree = async () => {
|
||||||
if (!queryParams.projectId) return
|
if (!queryParams.projectId) return
|
||||||
try {
|
try {
|
||||||
const res = await getSpaceTree(queryParams.projectId)
|
const response = await getSpaceTree(queryParams.projectId)
|
||||||
|
const res = response.data
|
||||||
spaceTreeData.value = transformToTreeData(res.data || [])
|
spaceTreeData.value = transformToTreeData(res.data || [])
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取空间节点树失败')
|
message.error('获取空间节点树失败')
|
||||||
|
|
@ -350,11 +353,11 @@ const handleAddSubmit = async () => {
|
||||||
addDrawerVisible.value = false
|
addDrawerVisible.value = false
|
||||||
fetchEquipmentList()
|
fetchEquipmentList()
|
||||||
fetchEquipmentStats()
|
fetchEquipmentStats()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '添加失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
addDrawerLoading.value = false
|
addDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -366,8 +369,9 @@ const viewEquipment = ref<Equipment | null>(null)
|
||||||
|
|
||||||
const openViewDrawer = async (record: Equipment) => {
|
const openViewDrawer = async (record: Equipment) => {
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentDetail(record.id)
|
const response = await getEquipmentDetail(record.id)
|
||||||
viewEquipment.value = res.data
|
const res = response.data
|
||||||
|
viewEquipment.value = res.data || res
|
||||||
viewDrawerVisible.value = true
|
viewDrawerVisible.value = true
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取设备详情失败')
|
message.error('获取设备详情失败')
|
||||||
|
|
@ -418,8 +422,9 @@ const editFormState = reactive<EquipmentForm>({
|
||||||
|
|
||||||
const openEditDrawer = async (record: Equipment) => {
|
const openEditDrawer = async (record: Equipment) => {
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentDetail(record.id)
|
const response = await getEquipmentDetail(record.id)
|
||||||
const data = res.data
|
const res = response.data
|
||||||
|
const data = res.data || res
|
||||||
editFormState.id = data.id
|
editFormState.id = data.id
|
||||||
editFormState.equipmentCode = data.equipmentCode || ''
|
editFormState.equipmentCode = data.equipmentCode || ''
|
||||||
editFormState.equipmentName = data.equipmentName
|
editFormState.equipmentName = data.equipmentName
|
||||||
|
|
@ -474,11 +479,11 @@ const handleEditSubmit = async () => {
|
||||||
editDrawerVisible.value = false
|
editDrawerVisible.value = false
|
||||||
fetchEquipmentList()
|
fetchEquipmentList()
|
||||||
fetchEquipmentStats()
|
fetchEquipmentStats()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '修改失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
editDrawerLoading.value = false
|
editDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -491,8 +496,8 @@ const handleDelete = async (record: Equipment) => {
|
||||||
message.success('删除成功')
|
message.success('删除成功')
|
||||||
fetchEquipmentList()
|
fetchEquipmentList()
|
||||||
fetchEquipmentStats()
|
fetchEquipmentStats()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '删除失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -504,7 +509,7 @@ const handleBatchDelete = async () => {
|
||||||
}
|
}
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '确认删除',
|
title: '确认删除',
|
||||||
icon: ExclamationCircleOutlined,
|
icon: ExclamationCircleOutlined as any,
|
||||||
content: `确定删除选中的 ${selectedRowKeys.value.length} 台设备吗?`,
|
content: `确定删除选中的 ${selectedRowKeys.value.length} 台设备吗?`,
|
||||||
async onOk() {
|
async onOk() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -514,8 +519,8 @@ const handleBatchDelete = async () => {
|
||||||
selectedRows.value = []
|
selectedRows.value = []
|
||||||
fetchEquipmentList()
|
fetchEquipmentList()
|
||||||
fetchEquipmentStats()
|
fetchEquipmentStats()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '批量删除失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -530,7 +535,7 @@ const importUploadProps: UploadProps = {
|
||||||
name: 'file',
|
name: 'file',
|
||||||
multiple: false,
|
multiple: false,
|
||||||
accept: '.xlsx,.xls',
|
accept: '.xlsx,.xls',
|
||||||
fileList: importFileList,
|
fileList: importFileList as any,
|
||||||
beforeUpload: (file: any) => {
|
beforeUpload: (file: any) => {
|
||||||
importFileList.value = [file]
|
importFileList.value = [file]
|
||||||
return false
|
return false
|
||||||
|
|
@ -552,11 +557,11 @@ const handleImport = async () => {
|
||||||
importing.value = true
|
importing.value = true
|
||||||
try {
|
try {
|
||||||
const file = importFileList.value[0].originFileObj || importFileList.value[0]
|
const file = importFileList.value[0].originFileObj || importFileList.value[0]
|
||||||
const res = await importEquipment(file, queryParams.projectId)
|
const response = await importEquipment(file, queryParams.projectId)
|
||||||
const data = res.data
|
const res = response.data
|
||||||
|
const data = res.data || res
|
||||||
if (data.failCount > 0) {
|
if (data.failCount > 0) {
|
||||||
message.warning(`导入完成:成功 ${data.successCount} 条,失败 ${data.failCount} 条`)
|
message.warning(`导入完成:成功 ${data.successCount} 条,失败 ${data.failCount} 条`)
|
||||||
console.warn('导入失败详情:', data.failDetails)
|
|
||||||
} else {
|
} else {
|
||||||
message.success(`导入成功:${data.successCount} 条`)
|
message.success(`导入成功:${data.successCount} 条`)
|
||||||
}
|
}
|
||||||
|
|
@ -564,8 +569,8 @@ const handleImport = async () => {
|
||||||
importFileList.value = []
|
importFileList.value = []
|
||||||
fetchEquipmentList()
|
fetchEquipmentList()
|
||||||
fetchEquipmentStats()
|
fetchEquipmentStats()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '导入失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
importing.value = false
|
importing.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -581,8 +586,8 @@ const handleExport = async () => {
|
||||||
}
|
}
|
||||||
exporting.value = true
|
exporting.value = true
|
||||||
try {
|
try {
|
||||||
const res = await exportEquipment(queryParams.projectId)
|
const response = await exportEquipment(queryParams.projectId)
|
||||||
const blob = new Blob([res.data as unknown as BlobPart], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
const blob = new Blob([response.data as unknown as BlobPart], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
|
||||||
const url = window.URL.createObjectURL(blob)
|
const url = window.URL.createObjectURL(blob)
|
||||||
const link = document.createElement('a')
|
const link = document.createElement('a')
|
||||||
link.href = url
|
link.href = url
|
||||||
|
|
@ -590,8 +595,8 @@ const handleExport = async () => {
|
||||||
link.click()
|
link.click()
|
||||||
window.URL.revokeObjectURL(url)
|
window.URL.revokeObjectURL(url)
|
||||||
message.success('导出成功')
|
message.success('导出成功')
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '导出失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
exporting.value = false
|
exporting.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -743,7 +748,7 @@ onMounted(() => {
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
showTotal: (total: number) => `共 ${total} 条`
|
showTotal: (total: number) => `共 ${total} 条`
|
||||||
}"
|
}"
|
||||||
@change="(pag: any) => handlePageChange(pag.current, pag.pageSize)"
|
@change="(pag: PaginationInfo) => handlePageChange(pag.current, pag.pageSize)"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'systemType'">
|
<template v-if="column.key === 'systemType'">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { Button, Select, Space, message, Drawer, Tabs, TabPane, Table, Popconfirm, Tag, Form, DatePicker } from 'ant-design-vue'
|
import { getErrorMessage, isValidationError } from '@/utils/error-handler'
|
||||||
|
import { Button, Select, Space, message, Drawer, Popconfirm, Tag, DatePicker } from 'ant-design-vue'
|
||||||
import type { ColumnsType } from 'ant-design-vue/es/table'
|
import type { ColumnsType } from 'ant-design-vue/es/table'
|
||||||
import {
|
import {
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
|
|
@ -73,9 +74,11 @@ const itemPagination = reactive({
|
||||||
const fetchInspectionItems = async () => {
|
const fetchInspectionItems = async () => {
|
||||||
itemLoading.value = true
|
itemLoading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await getInspectionItems()
|
const response = await getInspectionItems()
|
||||||
itemData.value = res.data || []
|
const apiRes = response.data
|
||||||
itemPagination.total = res.data?.length || 0
|
const data = apiRes.data || []
|
||||||
|
itemData.value = data
|
||||||
|
itemPagination.total = data.length || 0
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取巡检标准项列表失败')
|
message.error('获取巡检标准项列表失败')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -134,7 +137,7 @@ const recordPagination = reactive({
|
||||||
const fetchProjects = async () => {
|
const fetchProjects = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getProjectSelectorList()
|
const res = await getProjectSelectorList()
|
||||||
projectOptions.value = (res.data || []).map((item: any) => ({
|
projectOptions.value = (res.data.data || []).map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name
|
label: item.name
|
||||||
}))
|
}))
|
||||||
|
|
@ -146,8 +149,10 @@ const fetchProjects = async () => {
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
const fetchEquipments = async (projectId: string) => {
|
const fetchEquipments = async (projectId: string) => {
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentList(projectId)
|
const response = await getEquipmentList(projectId)
|
||||||
equipmentOptions.value = (res.data || []).map((item: any) => ({
|
const apiRes = response.data
|
||||||
|
const data = apiRes.data || []
|
||||||
|
equipmentOptions.value = data.map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.equipmentName
|
label: item.equipmentName
|
||||||
}))
|
}))
|
||||||
|
|
@ -164,9 +169,11 @@ const fetchInspectionRecords = async () => {
|
||||||
}
|
}
|
||||||
recordLoading.value = true
|
recordLoading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await getInspectionRecords(queryParams.projectId, queryParams.equipmentId)
|
const response = await getInspectionRecords(queryParams.projectId, queryParams.equipmentId)
|
||||||
recordData.value = res.data || []
|
const apiRes = response.data
|
||||||
recordPagination.total = res.data?.length || 0
|
const data = apiRes.data || []
|
||||||
|
recordData.value = data
|
||||||
|
recordPagination.total = data.length || 0
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取巡检记录列表失败')
|
message.error('获取巡检记录列表失败')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -240,11 +247,11 @@ const handleAddItemSubmit = async () => {
|
||||||
message.success('添加成功')
|
message.success('添加成功')
|
||||||
addItemDrawerVisible.value = false
|
addItemDrawerVisible.value = false
|
||||||
fetchInspectionItems()
|
fetchInspectionItems()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '添加失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
addItemDrawerLoading.value = false
|
addItemDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -291,11 +298,11 @@ const handleEditItemSubmit = async () => {
|
||||||
message.success('修改成功')
|
message.success('修改成功')
|
||||||
editItemDrawerVisible.value = false
|
editItemDrawerVisible.value = false
|
||||||
fetchInspectionItems()
|
fetchInspectionItems()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '修改失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
editItemDrawerLoading.value = false
|
editItemDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -307,8 +314,8 @@ const handleDeleteItem = async (record: InspectionItem) => {
|
||||||
await deleteInspectionItem(record.id!)
|
await deleteInspectionItem(record.id!)
|
||||||
message.success('删除成功')
|
message.success('删除成功')
|
||||||
fetchInspectionItems()
|
fetchInspectionItems()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '删除失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -350,11 +357,11 @@ const handleAddRecordSubmit = async () => {
|
||||||
message.success('添加成功')
|
message.success('添加成功')
|
||||||
addRecordDrawerVisible.value = false
|
addRecordDrawerVisible.value = false
|
||||||
fetchInspectionRecords()
|
fetchInspectionRecords()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '添加失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
addRecordDrawerLoading.value = false
|
addRecordDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -375,8 +382,9 @@ const editRecordFormState = reactive<InspectionRecordForm>({
|
||||||
|
|
||||||
const openEditRecordDrawer = async (record: InspectionRecord) => {
|
const openEditRecordDrawer = async (record: InspectionRecord) => {
|
||||||
try {
|
try {
|
||||||
const res = await getInspectionRecord(record.id!)
|
const response = await getInspectionRecord(record.id!)
|
||||||
const data = res.data
|
const apiRes = response.data
|
||||||
|
const data = apiRes.data || apiRes
|
||||||
editRecordFormState.id = data.id
|
editRecordFormState.id = data.id
|
||||||
editRecordFormState.equipmentId = data.equipmentId
|
editRecordFormState.equipmentId = data.equipmentId
|
||||||
editRecordFormState.inspectionDate = data.inspectionDate
|
editRecordFormState.inspectionDate = data.inspectionDate
|
||||||
|
|
@ -397,11 +405,11 @@ const handleEditRecordSubmit = async () => {
|
||||||
message.success('修改成功')
|
message.success('修改成功')
|
||||||
editRecordDrawerVisible.value = false
|
editRecordDrawerVisible.value = false
|
||||||
fetchInspectionRecords()
|
fetchInspectionRecords()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '修改失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
editRecordDrawerLoading.value = false
|
editRecordDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -413,8 +421,8 @@ const handleCompleteRecord = async (record: InspectionRecord) => {
|
||||||
await completeInspectionRecord(record.id!)
|
await completeInspectionRecord(record.id!)
|
||||||
message.success('巡检已完成')
|
message.success('巡检已完成')
|
||||||
fetchInspectionRecords()
|
fetchInspectionRecords()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '操作失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
|
import type { PaginationInfo } from '@/types'
|
||||||
|
import { getErrorMessage, isValidationError } from '@/utils/error-handler'
|
||||||
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, Popconfirm, Tag } from 'ant-design-vue'
|
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, Popconfirm, Tag } from 'ant-design-vue'
|
||||||
import type { ColumnsType } from 'ant-design-vue/es/table'
|
import type { ColumnsType } from 'ant-design-vue/es/table'
|
||||||
import {
|
import {
|
||||||
|
|
@ -90,7 +92,7 @@ const pagination = reactive({
|
||||||
const fetchProjects = async () => {
|
const fetchProjects = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getProjectSelectorList()
|
const res = await getProjectSelectorList()
|
||||||
projectOptions.value = (res.data || []).map((item: any) => ({
|
projectOptions.value = (res.data.data || []).map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name
|
label: item.name
|
||||||
}))
|
}))
|
||||||
|
|
@ -102,8 +104,10 @@ const fetchProjects = async () => {
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
const fetchEquipments = async (projectId: string) => {
|
const fetchEquipments = async (projectId: string) => {
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentList(projectId)
|
const response = await getEquipmentList(projectId)
|
||||||
equipmentOptions.value = (res.data || []).map((item: any) => ({
|
const apiRes = response.data
|
||||||
|
const data = apiRes.data || []
|
||||||
|
equipmentOptions.value = data.map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.equipmentName
|
label: item.equipmentName
|
||||||
}))
|
}))
|
||||||
|
|
@ -120,9 +124,11 @@ const fetchMaintenancePlans = async () => {
|
||||||
}
|
}
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await getMaintenancePlans(queryParams.projectId)
|
const response = await getMaintenancePlans(queryParams.projectId)
|
||||||
tableData.value = res.data || []
|
const apiRes = response.data
|
||||||
pagination.total = res.data?.length || 0
|
const data = apiRes.data || []
|
||||||
|
tableData.value = data
|
||||||
|
pagination.total = data.length || 0
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取维保计划列表失败')
|
message.error('获取维保计划列表失败')
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -207,11 +213,11 @@ const handleAddSubmit = async () => {
|
||||||
message.success('添加成功')
|
message.success('添加成功')
|
||||||
addDrawerVisible.value = false
|
addDrawerVisible.value = false
|
||||||
fetchMaintenancePlans()
|
fetchMaintenancePlans()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '添加失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
addDrawerLoading.value = false
|
addDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -236,8 +242,9 @@ const editFormState = reactive<MaintenancePlanForm>({
|
||||||
|
|
||||||
const openEditDrawer = async (record: MaintenancePlan) => {
|
const openEditDrawer = async (record: MaintenancePlan) => {
|
||||||
try {
|
try {
|
||||||
const res = await getMaintenancePlan(record.id!)
|
const response = await getMaintenancePlan(record.id!)
|
||||||
const data = res.data
|
const apiRes = response.data
|
||||||
|
const data = apiRes.data || apiRes
|
||||||
editFormState.id = data.id
|
editFormState.id = data.id
|
||||||
editFormState.equipmentId = data.equipmentId
|
editFormState.equipmentId = data.equipmentId
|
||||||
editFormState.planName = data.planName
|
editFormState.planName = data.planName
|
||||||
|
|
@ -262,11 +269,11 @@ const handleEditSubmit = async () => {
|
||||||
message.success('修改成功')
|
message.success('修改成功')
|
||||||
editDrawerVisible.value = false
|
editDrawerVisible.value = false
|
||||||
fetchMaintenancePlans()
|
fetchMaintenancePlans()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) {
|
if (isValidationError(error)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
message.error(error?.message || '修改失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
editDrawerLoading.value = false
|
editDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -278,8 +285,8 @@ const handleDelete = async (record: MaintenancePlan) => {
|
||||||
await deleteMaintenancePlan(record.id!)
|
await deleteMaintenancePlan(record.id!)
|
||||||
message.success('删除成功')
|
message.success('删除成功')
|
||||||
fetchMaintenancePlans()
|
fetchMaintenancePlans()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '删除失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,7 +341,7 @@ onMounted(() => {
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
showTotal: (total: number) => `共 ${total} 条`
|
showTotal: (total: number) => `共 ${total} 条`
|
||||||
}"
|
}"
|
||||||
@change="(pag: any) => handlePageChange(pag.current, pag.pageSize)"
|
@change="(pag: PaginationInfo) => handlePageChange(pag.current, pag.pageSize)"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'planType'">
|
<template v-if="column.key === 'planType'">
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, Popconfirm, Tag, Modal, Card, Statistic, Row, Col, Form, Input, Table } from 'ant-design-vue'
|
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, Popconfirm, Tag, Modal, Card, Statistic, Row, Col, Input } from 'ant-design-vue'
|
||||||
import type { ColumnsType } from 'ant-design-vue/es/table'
|
import type { ColumnsType } from 'ant-design-vue/es/table'
|
||||||
import {
|
import {
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
|
|
@ -13,9 +13,7 @@ import {
|
||||||
PlayCircleOutlined,
|
PlayCircleOutlined,
|
||||||
SendOutlined,
|
SendOutlined,
|
||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
SafetyCertificateOutlined,
|
SafetyCertificateOutlined
|
||||||
ClockCircleOutlined,
|
|
||||||
ToolOutlined
|
|
||||||
} from '@ant-design/icons-vue'
|
} from '@ant-design/icons-vue'
|
||||||
import {
|
import {
|
||||||
getMaintenanceTasks,
|
getMaintenanceTasks,
|
||||||
|
|
@ -40,11 +38,12 @@ import {
|
||||||
type TaskType,
|
type TaskType,
|
||||||
type TaskPriority,
|
type TaskPriority,
|
||||||
type TaskStatus,
|
type TaskStatus,
|
||||||
type TriggerType,
|
|
||||||
type PartsUsed
|
type PartsUsed
|
||||||
} from '@/api/maintenance-task'
|
} from '@/api/maintenance-task'
|
||||||
import { getProjectSelectorList } from '@/api/project'
|
import { getProjectSelectorList } from '@/api/project'
|
||||||
import { getEquipmentList } from '@/api/equipment'
|
import { getEquipmentList } from '@/api/equipment'
|
||||||
|
import type { PaginationInfo } from '@/types'
|
||||||
|
import { getErrorMessage, isValidationError } from '@/utils/error-handler'
|
||||||
|
|
||||||
// 格式化日期
|
// 格式化日期
|
||||||
const formatDate = (date: string | Date | undefined) => {
|
const formatDate = (date: string | Date | undefined) => {
|
||||||
|
|
@ -152,7 +151,7 @@ const fetchStats = async () => {
|
||||||
const fetchProjects = async () => {
|
const fetchProjects = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getProjectSelectorList()
|
const res = await getProjectSelectorList()
|
||||||
projectOptions.value = (res.data || []).map((item: any) => ({
|
projectOptions.value = (res.data.data || []).map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name
|
label: item.name
|
||||||
}))
|
}))
|
||||||
|
|
@ -164,8 +163,9 @@ const fetchProjects = async () => {
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
const fetchEquipments = async (projectId: string) => {
|
const fetchEquipments = async (projectId: string) => {
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentList(projectId)
|
const response = await getEquipmentList(projectId)
|
||||||
equipmentOptions.value = (res.data || []).map((item: any) => ({
|
const apiRes = response.data
|
||||||
|
equipmentOptions.value = (apiRes.data || []).map((item: any) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.equipmentName
|
label: item.equipmentName
|
||||||
}))
|
}))
|
||||||
|
|
@ -178,9 +178,10 @@ const fetchEquipments = async (projectId: string) => {
|
||||||
const fetchMaintenanceTasks = async () => {
|
const fetchMaintenanceTasks = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await getMaintenanceTasks(queryParams.projectId)
|
const response = await getMaintenanceTasks(queryParams.projectId)
|
||||||
let data = res.data || []
|
const apiRes = response.data
|
||||||
|
let data: MaintenanceTask[] = apiRes.data || []
|
||||||
|
|
||||||
// 前端筛选
|
// 前端筛选
|
||||||
if (queryParams.status) {
|
if (queryParams.status) {
|
||||||
data = data.filter(t => t.status === queryParams.status)
|
data = data.filter(t => t.status === queryParams.status)
|
||||||
|
|
@ -193,13 +194,13 @@ const fetchMaintenanceTasks = async () => {
|
||||||
}
|
}
|
||||||
if (queryParams.keyword) {
|
if (queryParams.keyword) {
|
||||||
const kw = queryParams.keyword.toLowerCase()
|
const kw = queryParams.keyword.toLowerCase()
|
||||||
data = data.filter(t =>
|
data = data.filter(t =>
|
||||||
t.taskNo?.toLowerCase().includes(kw) ||
|
t.taskNo?.toLowerCase().includes(kw) ||
|
||||||
t.title?.toLowerCase().includes(kw) ||
|
t.title?.toLowerCase().includes(kw) ||
|
||||||
t.equipmentName?.toLowerCase().includes(kw)
|
t.equipmentName?.toLowerCase().includes(kw)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
tableData.value = data
|
tableData.value = data
|
||||||
pagination.total = data.length
|
pagination.total = data.length
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -233,7 +234,7 @@ const handlePageChange = (page: number, pageSize: number) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 项目变化时重新加载设备列表
|
// 项目变化时重新加载设备列表
|
||||||
const handleProjectChange = (val: string) => {
|
const handleProjectChange = (val: any) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
fetchEquipments(val)
|
fetchEquipments(val)
|
||||||
}
|
}
|
||||||
|
|
@ -246,8 +247,9 @@ const detailData = ref<MaintenanceTask | null>(null)
|
||||||
|
|
||||||
const openDetailDrawer = async (record: MaintenanceTask) => {
|
const openDetailDrawer = async (record: MaintenanceTask) => {
|
||||||
try {
|
try {
|
||||||
const res = await getMaintenanceTask(record.id!)
|
const response = await getMaintenanceTask(record.id!)
|
||||||
detailData.value = res.data
|
const apiRes = response.data
|
||||||
|
detailData.value = apiRes.data || apiRes
|
||||||
detailDrawerVisible.value = true
|
detailDrawerVisible.value = true
|
||||||
} catch {
|
} catch {
|
||||||
message.error('获取工单详情失败')
|
message.error('获取工单详情失败')
|
||||||
|
|
@ -304,9 +306,9 @@ const handleAddSubmit = async () => {
|
||||||
message.success('创建成功')
|
message.success('创建成功')
|
||||||
addDrawerVisible.value = false
|
addDrawerVisible.value = false
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '创建失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
addDrawerLoading.value = false
|
addDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -330,8 +332,9 @@ const editFormState = reactive<MaintenanceTaskForm & { id?: string }>({
|
||||||
|
|
||||||
const openEditDrawer = async (record: MaintenanceTask) => {
|
const openEditDrawer = async (record: MaintenanceTask) => {
|
||||||
try {
|
try {
|
||||||
const res = await getMaintenanceTask(record.id!)
|
const response = await getMaintenanceTask(record.id!)
|
||||||
const data = res.data
|
const apiRes = response.data
|
||||||
|
const data = apiRes.data || apiRes
|
||||||
editFormState.id = data.id
|
editFormState.id = data.id
|
||||||
editFormState.equipmentId = data.equipmentId
|
editFormState.equipmentId = data.equipmentId
|
||||||
editFormState.taskType = data.taskType
|
editFormState.taskType = data.taskType
|
||||||
|
|
@ -355,9 +358,9 @@ const handleEditSubmit = async () => {
|
||||||
message.success('修改成功')
|
message.success('修改成功')
|
||||||
editDrawerVisible.value = false
|
editDrawerVisible.value = false
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '修改失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
editDrawerLoading.value = false
|
editDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -369,8 +372,8 @@ const handleDelete = async (record: MaintenanceTask) => {
|
||||||
await deleteMaintenanceTask(record.id!)
|
await deleteMaintenanceTask(record.id!)
|
||||||
message.success('删除成功')
|
message.success('删除成功')
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '删除失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -401,9 +404,9 @@ const handleAssignSubmit = async () => {
|
||||||
message.success('派单成功')
|
message.success('派单成功')
|
||||||
assignDrawerVisible.value = false
|
assignDrawerVisible.value = false
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '派单失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
assignLoading.value = false
|
assignLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -419,8 +422,8 @@ const handleStart = async (record: MaintenanceTask) => {
|
||||||
await startTask(record.id!)
|
await startTask(record.id!)
|
||||||
message.success('已开始执行')
|
message.success('已开始执行')
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '操作失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -498,9 +501,9 @@ const handleCompleteSubmit = async () => {
|
||||||
message.success('工单已完成')
|
message.success('工单已完成')
|
||||||
completeDrawerVisible.value = false
|
completeDrawerVisible.value = false
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '操作失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
completeLoading.value = false
|
completeLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -537,9 +540,9 @@ const handleVerifySubmit = async () => {
|
||||||
message.success('验收成功')
|
message.success('验收成功')
|
||||||
verifyDrawerVisible.value = false
|
verifyDrawerVisible.value = false
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '验收失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
verifyLoading.value = false
|
verifyLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -557,8 +560,8 @@ const handleCancel = (record: MaintenanceTask) => {
|
||||||
await cancelTask(record.id!)
|
await cancelTask(record.id!)
|
||||||
message.success('工单已取消')
|
message.success('工单已取消')
|
||||||
fetchMaintenanceTasks()
|
fetchMaintenanceTasks()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '操作失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -592,22 +595,22 @@ onMounted(() => {
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-pending">
|
<Card class="stat-card stat-pending">
|
||||||
<Statistic title="待分配" :value="stats.pending" value-style="color: #8c8c8c" />
|
<Statistic title="待分配" :value="stats.pending" :value-style="{ color: '#8c8c8c' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-progress">
|
<Card class="stat-card stat-progress">
|
||||||
<Statistic title="执行中" :value="stats.inProgress" value-style="color: #fa8c16" />
|
<Statistic title="执行中" :value="stats.inProgress" :value-style="{ color: '#fa8c16' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-completed">
|
<Card class="stat-card stat-completed">
|
||||||
<Statistic title="今日完成" :value="stats.completedToday" value-style="color: #52c41a" />
|
<Statistic title="今日完成" :value="stats.completedToday" :value-style="{ color: '#52c41a' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-verified">
|
<Card class="stat-card stat-verified">
|
||||||
<Statistic title="逾期工单" :value="stats.overdue" value-style="color: #ff4d4f" />
|
<Statistic title="逾期工单" :value="stats.overdue" :value-style="{ color: '#ff4d4f' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
|
|
@ -683,7 +686,7 @@ onMounted(() => {
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
showTotal: (total: number) => `共 ${total} 条`
|
showTotal: (total: number) => `共 ${total} 条`
|
||||||
}"
|
}"
|
||||||
@change="(pag: any) => handlePageChange(pag.current, pag.pageSize)"
|
@change="(pag: PaginationInfo) => handlePageChange(pag.current, pag.pageSize)"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'taskType'">
|
<template v-if="column.key === 'taskType'">
|
||||||
|
|
@ -693,12 +696,12 @@ onMounted(() => {
|
||||||
{{ getLabel(TRIGGER_TYPE_OPTIONS, record.triggerType) }}
|
{{ getLabel(TRIGGER_TYPE_OPTIONS, record.triggerType) }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'priority'">
|
<template v-else-if="column.key === 'priority'">
|
||||||
<Tag :color="PRIORITY_COLOR_MAP[record.priority]">
|
<Tag :color="PRIORITY_COLOR_MAP[record.priority as TaskPriority]">
|
||||||
{{ getLabel(TASK_PRIORITY_OPTIONS, record.priority) }}
|
{{ getLabel(TASK_PRIORITY_OPTIONS, record.priority) }}
|
||||||
</Tag>
|
</Tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'status'">
|
<template v-else-if="column.key === 'status'">
|
||||||
<Tag :color="STATUS_COLOR_MAP[record.status]">
|
<Tag :color="STATUS_COLOR_MAP[record.status as TaskStatus]">
|
||||||
{{ getLabel(TASK_STATUS_OPTIONS, record.status) }}
|
{{ getLabel(TASK_STATUS_OPTIONS, record.status) }}
|
||||||
</Tag>
|
</Tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted } from 'vue'
|
||||||
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, Popconfirm, Tag, Modal, Card, Statistic, Row, Col, Form, Input, Table } from 'ant-design-vue'
|
import type { PaginationInfo } from '@/types'
|
||||||
|
import { Button, Select, Space, message, Drawer, InputNumber, DatePicker, Popconfirm, Tag, Modal, Card, Statistic, Row, Col, Input } from 'ant-design-vue'
|
||||||
import type { ColumnsType } from 'ant-design-vue/es/table'
|
import type { ColumnsType } from 'ant-design-vue/es/table'
|
||||||
import {
|
import {
|
||||||
SearchOutlined,
|
SearchOutlined,
|
||||||
|
|
@ -13,9 +14,7 @@ import {
|
||||||
PlayCircleOutlined,
|
PlayCircleOutlined,
|
||||||
SendOutlined,
|
SendOutlined,
|
||||||
EyeOutlined,
|
EyeOutlined,
|
||||||
SafetyCertificateOutlined,
|
SafetyCertificateOutlined
|
||||||
ClockCircleOutlined,
|
|
||||||
ToolOutlined
|
|
||||||
} from '@ant-design/icons-vue'
|
} from '@ant-design/icons-vue'
|
||||||
import {
|
import {
|
||||||
getWorkOrders,
|
getWorkOrders,
|
||||||
|
|
@ -47,6 +46,7 @@ import {
|
||||||
} from '@/api/work-order'
|
} from '@/api/work-order'
|
||||||
import { getProjectSelectorList } from '@/api/project'
|
import { getProjectSelectorList } from '@/api/project'
|
||||||
import { getEquipmentList } from '@/api/equipment'
|
import { getEquipmentList } from '@/api/equipment'
|
||||||
|
import { getErrorMessage, isValidationError } from '@/utils/error-handler'
|
||||||
|
|
||||||
// 格式化日期
|
// 格式化日期
|
||||||
const formatDate = (date: string | Date | undefined) => {
|
const formatDate = (date: string | Date | undefined) => {
|
||||||
|
|
@ -130,8 +130,9 @@ const stats = reactive({
|
||||||
// 获取统计数据
|
// 获取统计数据
|
||||||
const fetchStats = async () => {
|
const fetchStats = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getWorkOrderStats()
|
const response = await getWorkOrderStats()
|
||||||
const data = res.data
|
const apiRes = response.data
|
||||||
|
const data = apiRes.data || apiRes
|
||||||
if (data) {
|
if (data) {
|
||||||
stats.total = data.total || 0
|
stats.total = data.total || 0
|
||||||
stats.pending = data.pending || 0
|
stats.pending = data.pending || 0
|
||||||
|
|
@ -154,8 +155,10 @@ const fetchStats = async () => {
|
||||||
// 获取项目列表
|
// 获取项目列表
|
||||||
const fetchProjects = async () => {
|
const fetchProjects = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getProjectSelectorList()
|
const response = await getProjectSelectorList()
|
||||||
projectOptions.value = (res.data || []).map((item: any) => ({
|
const apiRes = response.data
|
||||||
|
const projectList = apiRes.data || apiRes || []
|
||||||
|
projectOptions.value = projectList.map((item: { id: string; name: string }) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.name
|
label: item.name
|
||||||
}))
|
}))
|
||||||
|
|
@ -167,8 +170,10 @@ const fetchProjects = async () => {
|
||||||
// 获取设备列表
|
// 获取设备列表
|
||||||
const fetchEquipments = async (projectId: string) => {
|
const fetchEquipments = async (projectId: string) => {
|
||||||
try {
|
try {
|
||||||
const res = await getEquipmentList(projectId)
|
const response = await getEquipmentList(projectId)
|
||||||
equipmentOptions.value = (res.data || []).map((item: any) => ({
|
const apiRes = response.data
|
||||||
|
const equipmentList = apiRes.data || apiRes || []
|
||||||
|
equipmentOptions.value = equipmentList.map((item: { id: string; equipmentName: string }) => ({
|
||||||
value: item.id,
|
value: item.id,
|
||||||
label: item.equipmentName
|
label: item.equipmentName
|
||||||
}))
|
}))
|
||||||
|
|
@ -181,25 +186,31 @@ const fetchEquipments = async (projectId: string) => {
|
||||||
const fetchWorkOrders = async () => {
|
const fetchWorkOrders = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const res = await getWorkOrders(queryParams.projectId)
|
const response = await getWorkOrders({
|
||||||
let data = res.data || []
|
projectId: queryParams.projectId,
|
||||||
|
source: queryParams.source,
|
||||||
|
type: queryParams.type,
|
||||||
|
status: queryParams.status
|
||||||
|
})
|
||||||
|
const apiRes = response.data
|
||||||
|
let data: WorkOrder[] = apiRes.data || apiRes || []
|
||||||
|
|
||||||
// 前端筛选
|
// 前端筛选
|
||||||
if (queryParams.source) {
|
if (queryParams.source) {
|
||||||
data = data.filter(t => t.source === queryParams.source)
|
data = data.filter((t: WorkOrder) => t.source === queryParams.source)
|
||||||
}
|
}
|
||||||
if (queryParams.type) {
|
if (queryParams.type) {
|
||||||
data = data.filter(t => t.type === queryParams.type)
|
data = data.filter((t: WorkOrder) => t.type === queryParams.type)
|
||||||
}
|
}
|
||||||
if (queryParams.status) {
|
if (queryParams.status) {
|
||||||
data = data.filter(t => t.status === queryParams.status)
|
data = data.filter((t: WorkOrder) => t.status === queryParams.status)
|
||||||
}
|
}
|
||||||
if (queryParams.priority) {
|
if (queryParams.priority) {
|
||||||
data = data.filter(t => t.priority === queryParams.priority)
|
data = data.filter((t: WorkOrder) => t.priority === queryParams.priority)
|
||||||
}
|
}
|
||||||
if (queryParams.keyword) {
|
if (queryParams.keyword) {
|
||||||
const kw = queryParams.keyword.toLowerCase()
|
const kw = queryParams.keyword.toLowerCase()
|
||||||
data = data.filter(t =>
|
data = data.filter((t: WorkOrder) =>
|
||||||
t.workNo?.toLowerCase().includes(kw) ||
|
t.workNo?.toLowerCase().includes(kw) ||
|
||||||
t.title?.toLowerCase().includes(kw)
|
t.title?.toLowerCase().includes(kw)
|
||||||
)
|
)
|
||||||
|
|
@ -253,13 +264,15 @@ const detailItems = ref<WorkOrderItem[]>([])
|
||||||
|
|
||||||
const openDetailDrawer = async (record: WorkOrder) => {
|
const openDetailDrawer = async (record: WorkOrder) => {
|
||||||
try {
|
try {
|
||||||
const res = await getWorkOrder(record.id!)
|
const response = await getWorkOrder(record.id!)
|
||||||
detailData.value = res.data
|
const apiRes = response.data
|
||||||
|
detailData.value = apiRes.data || apiRes
|
||||||
detailDrawerVisible.value = true
|
detailDrawerVisible.value = true
|
||||||
// 获取工单项
|
// 获取工单项
|
||||||
try {
|
try {
|
||||||
const itemsRes = await getWorkOrderItems(record.id!)
|
const itemsResponse = await getWorkOrderItems(record.id!)
|
||||||
detailItems.value = itemsRes.data || []
|
const itemsApiRes = itemsResponse.data
|
||||||
|
detailItems.value = itemsApiRes.data || itemsApiRes || []
|
||||||
} catch {
|
} catch {
|
||||||
detailItems.value = []
|
detailItems.value = []
|
||||||
}
|
}
|
||||||
|
|
@ -321,9 +334,9 @@ const handleAddSubmit = async () => {
|
||||||
message.success('创建成功')
|
message.success('创建成功')
|
||||||
addDrawerVisible.value = false
|
addDrawerVisible.value = false
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '创建失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
addDrawerLoading.value = false
|
addDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -349,8 +362,9 @@ const editFormState = reactive<Partial<WorkOrder>>({
|
||||||
|
|
||||||
const openEditDrawer = async (record: WorkOrder) => {
|
const openEditDrawer = async (record: WorkOrder) => {
|
||||||
try {
|
try {
|
||||||
const res = await getWorkOrder(record.id!)
|
const response = await getWorkOrder(record.id!)
|
||||||
const data = res.data
|
const apiRes = response.data
|
||||||
|
const data = apiRes.data || apiRes
|
||||||
editFormState.id = data.id
|
editFormState.id = data.id
|
||||||
editFormState.source = data.source
|
editFormState.source = data.source
|
||||||
editFormState.type = data.type
|
editFormState.type = data.type
|
||||||
|
|
@ -375,9 +389,9 @@ const handleEditSubmit = async () => {
|
||||||
message.success('修改成功')
|
message.success('修改成功')
|
||||||
editDrawerVisible.value = false
|
editDrawerVisible.value = false
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '修改失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
editDrawerLoading.value = false
|
editDrawerLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -389,8 +403,8 @@ const handleDelete = async (record: WorkOrder) => {
|
||||||
await deleteWorkOrder(record.id!)
|
await deleteWorkOrder(record.id!)
|
||||||
message.success('删除成功')
|
message.success('删除成功')
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '删除失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -425,9 +439,9 @@ const handleAssignSubmit = async () => {
|
||||||
message.success('派单成功')
|
message.success('派单成功')
|
||||||
assignDrawerVisible.value = false
|
assignDrawerVisible.value = false
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '派单失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
assignLoading.value = false
|
assignLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -443,8 +457,8 @@ const handleStart = async (record: WorkOrder) => {
|
||||||
await startWorkOrder(record.id!)
|
await startWorkOrder(record.id!)
|
||||||
message.success('已开始执行')
|
message.success('已开始执行')
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '操作失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -534,9 +548,9 @@ const handleCompleteSubmit = async () => {
|
||||||
message.success('工单已完成')
|
message.success('工单已完成')
|
||||||
completeDrawerVisible.value = false
|
completeDrawerVisible.value = false
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '操作失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
completeLoading.value = false
|
completeLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -573,9 +587,9 @@ const handleVerifySubmit = async () => {
|
||||||
message.success('验收成功')
|
message.success('验收成功')
|
||||||
verifyDrawerVisible.value = false
|
verifyDrawerVisible.value = false
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
if (error?.errorFields) return
|
if (isValidationError(error)) return
|
||||||
message.error(error?.message || '验收失败')
|
message.error(getErrorMessage(error))
|
||||||
} finally {
|
} finally {
|
||||||
verifyLoading.value = false
|
verifyLoading.value = false
|
||||||
}
|
}
|
||||||
|
|
@ -593,8 +607,8 @@ const handleCancel = (record: WorkOrder) => {
|
||||||
await cancelWorkOrder(record.id!)
|
await cancelWorkOrder(record.id!)
|
||||||
message.success('工单已取消')
|
message.success('工单已取消')
|
||||||
fetchWorkOrders()
|
fetchWorkOrders()
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
message.error(error?.message || '操作失败')
|
message.error(getErrorMessage(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -628,22 +642,22 @@ onMounted(() => {
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-pending">
|
<Card class="stat-card stat-pending">
|
||||||
<Statistic title="待分配" :value="stats.pending" value-style="color: #8c8c8c" />
|
<Statistic title="待分配" :value="stats.pending" :value-style="{ color: '#8c8c8c' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-progress">
|
<Card class="stat-card stat-progress">
|
||||||
<Statistic title="执行中" :value="stats.inProgress" value-style="color: #fa8c16" />
|
<Statistic title="执行中" :value="stats.inProgress" :value-style="{ color: '#fa8c16' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-completed">
|
<Card class="stat-card stat-completed">
|
||||||
<Statistic title="今日完成" :value="stats.completedToday" value-style="color: #52c41a" />
|
<Statistic title="今日完成" :value="stats.completedToday" :value-style="{ color: '#52c41a' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
<Card class="stat-card stat-verified">
|
<Card class="stat-card stat-verified">
|
||||||
<Statistic title="逾期工单" :value="stats.overdue" value-style="color: #ff4d4f" />
|
<Statistic title="逾期工单" :value="stats.overdue" :value-style="{ color: '#ff4d4f' }" />
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
<Col :span="4">
|
<Col :span="4">
|
||||||
|
|
@ -662,7 +676,7 @@ onMounted(() => {
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
:options="projectOptions"
|
:options="projectOptions"
|
||||||
allow-clear
|
allow-clear
|
||||||
@change="handleProjectChange"
|
@change="(val) => handleProjectChange(val as string)"
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
v-model:value="queryParams.source"
|
v-model:value="queryParams.source"
|
||||||
|
|
@ -670,7 +684,7 @@ onMounted(() => {
|
||||||
style="width: 140px"
|
style="width: 140px"
|
||||||
:options="SOURCE_OPTIONS"
|
:options="SOURCE_OPTIONS"
|
||||||
allow-clear
|
allow-clear
|
||||||
@change="handleSearch"
|
@change="() => handleSearch()"
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
v-model:value="queryParams.type"
|
v-model:value="queryParams.type"
|
||||||
|
|
@ -678,7 +692,7 @@ onMounted(() => {
|
||||||
style="width: 120px"
|
style="width: 120px"
|
||||||
:options="TYPE_OPTIONS"
|
:options="TYPE_OPTIONS"
|
||||||
allow-clear
|
allow-clear
|
||||||
@change="handleSearch"
|
@change="() => handleSearch()"
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
v-model:value="queryParams.status"
|
v-model:value="queryParams.status"
|
||||||
|
|
@ -686,7 +700,7 @@ onMounted(() => {
|
||||||
style="width: 140px"
|
style="width: 140px"
|
||||||
:options="STATUS_OPTIONS"
|
:options="STATUS_OPTIONS"
|
||||||
allow-clear
|
allow-clear
|
||||||
@change="handleSearch"
|
@change="() => handleSearch()"
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
v-model:value="queryParams.priority"
|
v-model:value="queryParams.priority"
|
||||||
|
|
@ -694,7 +708,7 @@ onMounted(() => {
|
||||||
style="width: 120px"
|
style="width: 120px"
|
||||||
:options="PRIORITY_OPTIONS"
|
:options="PRIORITY_OPTIONS"
|
||||||
allow-clear
|
allow-clear
|
||||||
@change="handleSearch"
|
@change="() => handleSearch()"
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
v-model:value="queryParams.keyword"
|
v-model:value="queryParams.keyword"
|
||||||
|
|
@ -727,11 +741,11 @@ onMounted(() => {
|
||||||
showQuickJumper: true,
|
showQuickJumper: true,
|
||||||
showTotal: (total: number) => `共 ${total} 条`
|
showTotal: (total: number) => `共 ${total} 条`
|
||||||
}"
|
}"
|
||||||
@change="(pag: any) => handlePageChange(pag.current, pag.pageSize)"
|
@change="(pag: PaginationInfo) => handlePageChange(pag.current, pag.pageSize)"
|
||||||
>
|
>
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'source'">
|
<template v-if="column.key === 'source'">
|
||||||
<Tag :color="SOURCE_COLOR_MAP[record.source]">
|
<Tag :color="SOURCE_COLOR_MAP[record.source as WorkOrderSource]">
|
||||||
{{ getLabel(SOURCE_OPTIONS, record.source) }}
|
{{ getLabel(SOURCE_OPTIONS, record.source) }}
|
||||||
</Tag>
|
</Tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -739,12 +753,12 @@ onMounted(() => {
|
||||||
{{ getLabel(TYPE_OPTIONS, record.type) }}
|
{{ getLabel(TYPE_OPTIONS, record.type) }}
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'priority'">
|
<template v-else-if="column.key === 'priority'">
|
||||||
<Tag :color="PRIORITY_COLOR_MAP[record.priority]">
|
<Tag :color="PRIORITY_COLOR_MAP[record.priority as WorkOrderPriority]">
|
||||||
{{ getLabel(PRIORITY_OPTIONS, record.priority) }}
|
{{ getLabel(PRIORITY_OPTIONS, record.priority) }}
|
||||||
</Tag>
|
</Tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.key === 'status'">
|
<template v-else-if="column.key === 'status'">
|
||||||
<Tag :color="STATUS_COLOR_MAP[record.status]">
|
<Tag :color="STATUS_COLOR_MAP[record.status as WorkOrderStatus]">
|
||||||
{{ getLabel(STATUS_OPTIONS, record.status) }}
|
{{ getLabel(STATUS_OPTIONS, record.status) }}
|
||||||
</Tag>
|
</Tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue