ADD:数据合并按钮操作

This commit is contained in:
贾同学
2025-08-29 09:54:19 +08:00
parent 6e979c5dcb
commit a32ca3c849
2 changed files with 32 additions and 2 deletions

View File

@@ -137,10 +137,15 @@ export const importSubPlan = (params: Plan.ResPlan) => {
// 导出计划检测结果数据
export const exportPlanCheckData = (params: Plan.ResPlan) => {
return http.download(`/adPlan/exportPlanCheckData?planId=${params.id}`)
return http.download(`/adPlan/exportPlanCheckData?planId=${params.id}&report=1`)
}
// 导入子检测计划检测结果数据
export const importSubPlanCheckData = (params: Plan.ResPlan) => {
return http.upload(`/adPlan/importSubPlanCheckData`, params)
}
// 合并子检测计划检测结果数据
export const mergeSubPlanCheckData = (params: Plan.ResPlan) => {
return http.upload(`/adPlan/mergePlanCheckData?planId=${params.id}`)
}

View File

@@ -66,10 +66,17 @@
type="primary"
icon="Upload"
@click="importSubCheckDataClick"
v-if="planFormContent && planFormContent?.children.length > 0"
>
导入检测结果
</el-button>
<el-button type="primary" icon="Box" v-auth.plan="'add_subplan'" v-if="!isTabPlanFather">
<el-button
type="primary"
icon="Box"
v-auth.plan="'add_subplan'"
v-if="!isTabPlanFather && planFormContent && planFormContent?.children.length > 0"
@click="mergeSubCheckDataClick"
>
数据合并
</el-button>
<el-button
@@ -180,6 +187,7 @@ import {
exportSubPlan,
getDevListByPlanId,
importSubPlanCheckData,
mergeSubPlanCheckData,
subPlanBindDev
} from '@/api/plan/plan'
import { Device } from '@/api/device/interface/device'
@@ -641,6 +649,23 @@ const importResult = async (success: boolean | undefined) => {
await props.refreshTable!()
}
}
const mergeSubCheckDataClick = () => {
ElMessageBox.confirm(`确定合并【${planFormContent.value?.name}】的检测数据吗`, '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
const params = {
id: planFormContent.value?.id
}
mergeSubPlanCheckData(params).then(res => {
ElMessage.success('合并成功')
})
})
.catch(() => {})
}
defineExpose({ open, handleTableDataUpdate })
interface ChildrenPlanProps {