feat 联调历史报告表

This commit is contained in:
Ironsp
2026-09-17 11:12:53 +08:00
parent 0399e8ede4
commit 449cf1f6c7
9 changed files with 266 additions and 11 deletions

View File

@@ -1,10 +1,13 @@
<script setup lang="ts">
import type { Project } from '@/service/project'
import { useProjectLifecycle } from '@/composables/useProjectLifecycle'
const props = defineProps<{
item: Project
}>()
const { startProject, pauseProject, endProject } = useProjectLifecycle()
const statusMap: Record<number, string> = {
0: '已暂停',
1: '已结束',
@@ -30,6 +33,21 @@ function formatArea(value?: number) {
const text = Number.isInteger(area) ? String(area) : String(area)
return `${text}m²`
}
function onStart() {
if (props.item.id)
startProject(props.item.id)
}
function onPause() {
if (props.item.id)
pauseProject(props.item.id)
}
function onEnd() {
if (props.item.id)
endProject(props.item.id)
}
</script>
<template>
@@ -74,14 +92,14 @@ function formatArea(value?: number) {
</text>
</view>
</view>
<view v-if="item.status !== 1" class="project-actions">
<wd-button size="large" round>
<view v-if="item.status !== 1" class="project-actions" @tap.stop>
<wd-button size="large" round @tap.stop="onStart">
开始项目
</wd-button>
<wd-button type="warning" size="large" round>
<wd-button type="warning" size="large" round @tap.stop="onPause">
暂停项目
</wd-button>
<wd-button type="danger" size="large" round>
<wd-button type="danger" size="large" round @tap.stop="onEnd">
结束项目
</wd-button>
</view>

View File

@@ -1,5 +1,8 @@
<script setup lang="ts">
defineProps<{
import { useProjectLifecycle } from '@/composables/useProjectLifecycle'
const props = defineProps<{
id: number
projectName: string
stakeRange: string
status: number
@@ -8,6 +11,8 @@ defineProps<{
rollerCount: string
}>()
const { startProject, pauseProject, endProject } = useProjectLifecycle()
function getStatusText(status: number) {
const map: Record<number, string> = {
0: '已暂停',
@@ -25,6 +30,21 @@ function getStatusColor(status: number) {
}
return map[status] || '#999999'
}
function onStart() {
if (props.id)
startProject(props.id)
}
function onPause() {
if (props.id)
pauseProject(props.id)
}
function onEnd() {
if (props.id)
endProject(props.id)
}
</script>
<template>
@@ -80,13 +100,13 @@ function getStatusColor(status: number) {
<!-- 操作按钮 -->
<view v-if="status !== 1" class="btn-row">
<wd-button size="large" type="primary" round>
<wd-button size="large" type="primary" round @tap="onStart">
开始项目
</wd-button>
<wd-button size="large" type="warning" round>
<wd-button size="large" type="warning" round @tap="onPause">
暂停项目
</wd-button>
<wd-button size="large" type="danger" round>
<wd-button size="large" type="danger" round @tap="onEnd">
结束项目
</wd-button>
</view>