ADD:导入检测计划检测结果;
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type {Plan} from './interface'
|
||||
import type { Plan } from './interface'
|
||||
import http from '@/api'
|
||||
import type {ErrorSystem} from '../device/interface/error'
|
||||
import type {Device} from '../device/interface/device'
|
||||
import type { ErrorSystem } from '../device/interface/error'
|
||||
import type { Device } from '../device/interface/device'
|
||||
|
||||
/**
|
||||
* @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)
|
||||
}
|
||||
|
||||
@@ -139,3 +139,8 @@ export const importSubPlan = (params: Device.ReqPqDevParams) => {
|
||||
export const exportPlanCheckData = (params: Plan.ResPlan) => {
|
||||
return http.download(`/adPlan/exportPlanCheckData?planId=${params.id}`)
|
||||
}
|
||||
|
||||
// 导入子检测计划检测结果数据
|
||||
export const importSubPlanCheckData = (params: Plan.ResPlan) => {
|
||||
return http.upload(`/adPlan/importSubPlanCheckData`, params)
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
:title="`导入${parameter.title}`"
|
||||
:destroy-on-close="true"
|
||||
width="580px"
|
||||
draggable
|
||||
>
|
||||
<el-dialog 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-item label="文件上传:">
|
||||
<el-upload
|
||||
|
||||
@@ -61,7 +61,14 @@
|
||||
>
|
||||
导出检测结果
|
||||
</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>
|
||||
@@ -158,6 +165,7 @@
|
||||
<!-- 向计划导入/导出设备对话框 -->
|
||||
<PlanPopup :refresh-table="proTable?.getTableList" ref="planPopup" @update:tab="addNewChildTab" />
|
||||
<DevTransfer ref="devTransfer" @update:table="addNewChildTab" />
|
||||
<ImportZip ref="planCheckDataImportZip" @result="importResult" />
|
||||
</template>
|
||||
<script setup lang="tsx">
|
||||
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 { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
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 { useDictStore } from '@/stores/modules/dict'
|
||||
import DevTransfer from '@/views/plan/planList/components/devTransfer.vue'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import router from '@/routers'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import ImportZip from '@/components/ImportZip/index.vue'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const planFormContent = ref<Plan.ReqPlan>()
|
||||
@@ -191,7 +207,7 @@ const isTabPlanFather = ref(true)
|
||||
const planId = ref('')
|
||||
const planTabDevList = ref<any[]>([])
|
||||
const patternId = ref('')
|
||||
|
||||
const planCheckDataImportZip = ref<InstanceType<typeof ImportZip> | null>(null)
|
||||
const getTableList = async (params: any) => {
|
||||
if (!planFormContent.value) {
|
||||
return Promise.resolve({ data: [], total: 0 })
|
||||
@@ -601,6 +617,21 @@ const exportPlanCheckResultData = async () => {
|
||||
() => 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 })
|
||||
|
||||
interface ChildrenPlanProps {
|
||||
|
||||
@@ -641,7 +641,7 @@ const statisticalAnalysis = async (row: Partial<Plan.ReqPlan> = {}) => {
|
||||
|
||||
const importSubClick = () => {
|
||||
const params = {
|
||||
title: '检测计划',
|
||||
title: '导入检测计划',
|
||||
patternId: dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id ?? '',
|
||||
importApi: importSubPlan
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user