diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index 369aad4..eab6be6 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -70,6 +70,6 @@ declare global { // for type re-export declare global { // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' + export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' import('vue') } diff --git a/src/views/project/TurbineCard.vue b/src/views/project/TurbineCard.vue index 70764b9..bf02fef 100644 --- a/src/views/project/TurbineCard.vue +++ b/src/views/project/TurbineCard.vue @@ -3,22 +3,22 @@ import { computed } from 'vue' import WindTurbine from './icons/WindTurbine.vue' interface Turbine { - id: number - turbineNo: string - status: 0 | 1 | 2 // 0 待施工 1 施工中 2 已完成 - lat?: number - lng?: number + id: number + turbineNo: string + status: 0 | 1 | 2 // 0 待施工 1 施工中 2 已完成 + lat?: number + lng?: number } const props = defineProps<{ modelValue: Turbine }>() const emit = defineEmits<{ - (e: 'update:modelValue', v: Turbine): void - (e: 'map'): void + (e: 'update:modelValue', v: Turbine): void + (e: 'map'): void }>() const turbine = computed({ - get: () => props.modelValue, - set: v => emit('update:modelValue', v) + get: () => props.modelValue, + set: (v) => emit('update:modelValue', v), }) /* 状态文字 & 颜色 */ @@ -27,34 +27,36 @@ const statusColorMap = { 0: '#FF7D00', 1: '#165DFF', 2: '#00B42A' } /* 点击循环切换 */ function toggleStatus() { - const next = ((turbine.value.status + 1) % 3) as 0 | 1 | 2 - turbine.value = { ...turbine.value, status: next } + const next = ((turbine.value.status + 1) % 3) as 0 | 1 | 2 + turbine.value = { ...turbine.value, status: next } } function updateNo(val: string) { - turbine.value = { ...turbine.value, turbineNo: val } + turbine.value = { ...turbine.value, turbineNo: val } } \ No newline at end of file + diff --git a/src/views/project/index.vue b/src/views/project/index.vue index 3c7d76f..3cd052d 100644 --- a/src/views/project/index.vue +++ b/src/views/project/index.vue @@ -347,6 +347,53 @@ + + + + + + {{ detailData.projectName || '-' }} + {{ detailData.projectCode || '-' }} + + + {{ PROJECT_STATUS_MAP[detailData.status] || detailData.statusLabel || '-' }} + + + {{ detailData.projectCategory || '-' }} + + {{ detailData.inspectionUnit || '-' }} + {{ detailData.inspectionContact || '-' }} + {{ detailData.inspectionPhone || '-' }} + + {{ detailData.client || '-' }} + {{ detailData.clientContact || '-' }} + {{ detailData.clientPhone || '-' }} + + {{ detailData.farmName || '-' }} + {{ detailData.farmAddress || '-' }} + + {{ detailData.projectManagerName || '-' }} + {{ detailData.scale || detailData.projectScale || '-' }} + {{ detailData.turbineModel || '-' }} + + {{ detailData.startDate || '-' }} + {{ detailData.endDate || '-' }} + + + + {{ detailData.projectIntro || '-' }} + + + + + + @@ -412,6 +459,12 @@ const dataList = ref([]) const userLoading = ref(false) const userOptions = ref<{ label: string, value: string }[]>([]) + +// 详情弹窗状态 +const detailVisible = ref(false) +const detailLoading = ref(false) +const detailData = ref({}) + const searchForm = reactive>({ projectName: '', status: undefined, @@ -979,19 +1032,29 @@ const deleteItem = async (record: T.ProjectResp) => { } } -const viewDetail = (record: T.ProjectResp) => { +const viewDetail = async (record: T.ProjectResp) => { const projectId = record.id || record.projectId if (!projectId) { Message.error('项目ID不存在') return } - - router.push({ - name: 'ProjectDetail', - params: { - id: projectId.toString(), - }, - }) + detailVisible.value = true + detailLoading.value = true + try { + // /project/detail/{projectId} + const res = await getProjectDetail(projectId) + const data = (res as any).data || res || {} + // 若后端返回status为数字,补充状态文案 + if (typeof data.status === 'number' && !data.statusLabel) { + data.statusLabel = PROJECT_STATUS_MAP[data.status] + } + detailData.value = data + } catch (e) { + console.error('获取项目详情失败:', e) + Message.error('获取项目详情失败') + } finally { + detailLoading.value = false + } } const openImportModal = () => {