ADD:导入检测计划检测结果;

This commit is contained in:
贾同学
2025-08-25 11:02:07 +08:00
parent 0985cc5d7c
commit a19a20ddd8
4 changed files with 45 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
import type {Plan} from './interface' import type { Plan } from './interface'
import http from '@/api' import http from '@/api'
import type {ErrorSystem} from '../device/interface/error' import type { ErrorSystem } from '../device/interface/error'
import type {Device} from '../device/interface/device' import type { Device } from '../device/interface/device'
/** /**
* @name 检测计划管理模块 * @name 检测计划管理模块
@@ -130,7 +130,7 @@ export const exportSubPlan = (params: Plan.ResPlan) => {
} }
// 导入子检测计划 // 导入子检测计划
export const importSubPlan = (params: Device.ReqPqDevParams) => { export const importSubPlan = (params: Plan.ResPlan) => {
return http.upload(`/adPlan/importSubPlan`, params) return http.upload(`/adPlan/importSubPlan`, params)
} }
@@ -139,3 +139,8 @@ export const importSubPlan = (params: Device.ReqPqDevParams) => {
export const exportPlanCheckData = (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}`)
} }
// 导入子检测计划检测结果数据
export const importSubPlanCheckData = (params: Plan.ResPlan) => {
return http.upload(`/adPlan/importSubPlanCheckData`, params)
}

View File

@@ -1,11 +1,5 @@
<template> <template>
<el-dialog <el-dialog v-model="dialogVisible" :title="parameter.title" :destroy-on-close="true" width="580px" draggable>
v-model="dialogVisible"
:title="`导入${parameter.title}`"
:destroy-on-close="true"
width="580px"
draggable
>
<el-form class="drawer-multiColumn-form" style="margin-top: 10px" label-width="100px"> <el-form class="drawer-multiColumn-form" style="margin-top: 10px" label-width="100px">
<el-form-item label="文件上传:"> <el-form-item label="文件上传:">
<el-upload <el-upload

View File

@@ -61,7 +61,14 @@
> >
导出检测结果 导出检测结果
</el-button> </el-button>
<el-button type="primary" icon="Upload" v-auth.plan="'add_subplan'">导入检测结果</el-button> <el-button
v-auth.plan="'add_subplan'"
type="primary"
icon="Upload"
@click="importSubCheckDataClick"
>
导入检测结果
</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">
数据合并 数据合并
</el-button> </el-button>
@@ -158,6 +165,7 @@
<!-- 向计划导入/导出设备对话框 --> <!-- 向计划导入/导出设备对话框 -->
<PlanPopup :refresh-table="proTable?.getTableList" ref="planPopup" @update:tab="addNewChildTab" /> <PlanPopup :refresh-table="proTable?.getTableList" ref="planPopup" @update:tab="addNewChildTab" />
<DevTransfer ref="devTransfer" @update:table="addNewChildTab" /> <DevTransfer ref="devTransfer" @update:table="addNewChildTab" />
<ImportZip ref="planCheckDataImportZip" @result="importResult" />
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { ElMessage, ElMessageBox, TabPaneName } from 'element-plus' import { ElMessage, ElMessageBox, TabPaneName } from 'element-plus'
@@ -166,13 +174,21 @@ import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入
import { Plan } from '@/api/plan/interface' import { Plan } from '@/api/plan/interface'
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
import { ColumnProps, ProTableInstance, SearchRenderScope } from '@/components/ProTable/interface' import { ColumnProps, ProTableInstance, SearchRenderScope } from '@/components/ProTable/interface'
import { deletePlan, exportPlanCheckData, exportSubPlan, getDevListByPlanId, subPlanBindDev } from '@/api/plan/plan' import {
deletePlan,
exportPlanCheckData,
exportSubPlan,
getDevListByPlanId,
importSubPlanCheckData,
subPlanBindDev
} from '@/api/plan/plan'
import { Device } from '@/api/device/interface/device' import { Device } from '@/api/device/interface/device'
import { useDictStore } from '@/stores/modules/dict' import { useDictStore } from '@/stores/modules/dict'
import DevTransfer from '@/views/plan/planList/components/devTransfer.vue' import DevTransfer from '@/views/plan/planList/components/devTransfer.vue'
import { useHandleData } from '@/hooks/useHandleData' import { useHandleData } from '@/hooks/useHandleData'
import router from '@/routers' import router from '@/routers'
import { useDownload } from '@/hooks/useDownload' import { useDownload } from '@/hooks/useDownload'
import ImportZip from '@/components/ImportZip/index.vue'
const dictStore = useDictStore() const dictStore = useDictStore()
const planFormContent = ref<Plan.ReqPlan>() const planFormContent = ref<Plan.ReqPlan>()
@@ -191,7 +207,7 @@ const isTabPlanFather = ref(true)
const planId = ref('') const planId = ref('')
const planTabDevList = ref<any[]>([]) const planTabDevList = ref<any[]>([])
const patternId = ref('') const patternId = ref('')
const planCheckDataImportZip = ref<InstanceType<typeof ImportZip> | null>(null)
const getTableList = async (params: any) => { const getTableList = async (params: any) => {
if (!planFormContent.value) { if (!planFormContent.value) {
return Promise.resolve({ data: [], total: 0 }) return Promise.resolve({ data: [], total: 0 })
@@ -601,6 +617,21 @@ const exportPlanCheckResultData = async () => {
() => useDownload(exportPlanCheckData, `${planFormContent.value.name}_计划检测结果`, params, false, '.zip') () => useDownload(exportPlanCheckData, `${planFormContent.value.name}_计划检测结果`, params, false, '.zip')
) )
} }
const importSubCheckDataClick = () => {
const params = {
title: '导入计划检测结果',
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
importApi: importSubPlanCheckData
}
planCheckDataImportZip.value?.acceptParams(params)
}
const importResult = async (success: boolean | undefined) => {
if (success) {
await props.refreshTable!()
}
}
defineExpose({ open, handleTableDataUpdate }) defineExpose({ open, handleTableDataUpdate })
interface ChildrenPlanProps { interface ChildrenPlanProps {

View File

@@ -641,7 +641,7 @@ const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
const importSubClick = () => { const importSubClick = () => {
const params = { const params = {
title: '检测计划', title: '导入检测计划',
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '', patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
importApi: importSubPlan importApi: importSubPlan
} }