调整检测计划导入、导出功能适应二楼装备

This commit is contained in:
caozehui
2025-02-18 15:58:38 +08:00
parent 7d3e86a5fc
commit 4f622da52c
4 changed files with 25 additions and 20 deletions

View File

@@ -63,17 +63,17 @@ export const getPlanListByPattern = (params: Plan.ReqPlan) => {
}
// 导出检测计划
export const exportPlan = (params: Device.ReqPqDevParams) => {
return http.download(`/adPlan/export`, params)
export const exportCNPlan = (params: Device.ReqPqDevParams) => {
return http.download(`/adPlan/exportCNPlan`, params)
}
// 下载模板
export const downloadTemplate = () => {
return http.download(`/adPlan/downloadTemplate`)
export const downloadCNPlanTemplate = () => {
return http.download(`/adPlan/downloadCNPlanTemplate`)
}
// 导入检测计划
export const importPlan = (params: Device.ReqPqDevParams) => {
return http.upload(`/adPlan/import`, params)
export const importCNPlan = (params: Device.ReqPqDevParams) => {
return http.uploadExcel(`/adPlan/importCNPlan`, params)
}
// 装置检测报告生成

View File

@@ -97,6 +97,8 @@ const uploadExcel = async (param: UploadRequestOptions) => {
async function handleImportResponse(res: any) {
console.log(res)
if (res.type === 'application/json') {
const fileReader = new FileReader()
fileReader.onloadend = () => {
@@ -118,7 +120,7 @@ async function handleImportResponse(res: any) {
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '终端入网检测失败列表'
link.download = '导入失败数据'
document.body.appendChild(link)
link.click()
link.remove()

View File

@@ -320,10 +320,7 @@ watch(testStatus, function (newValue, oldValue) {
if (oldValue == 'error') {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`})
initCheckResult()
activeIndex = 0
percentage.value = 0
handleReCheck()
}
emit('update:testStatus', 'test_init')
//startTimer() // todo 可移除
@@ -1334,11 +1331,17 @@ const handleResumeTest = () => {
};
const handleReCheck = () => {
initCheckResult()
activeIndex = 0
percentage.value = 0
timeCount.value = 0
timeView.value = '00:00:00'
timeDifference.value = 0
testLogList.length = 0
errorCheckItem.length = 0
count = 0
showTestLog()
}
// 获取当前执行的大测试项序号

View File

@@ -37,7 +37,7 @@
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
<!-- 查看设备绑定
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
<ImportExcel ref='deviceImportExcel' />
<ImportExcel ref='planImportExcel' />
</template>
@@ -46,7 +46,7 @@
import ProTable from '@/components/ProTable/index.vue'
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } from '@/api/plan/plan.ts'
import {getPlanList,deletePlan,exportCNPlan,downloadCNPlanTemplate,importCNPlan } from '@/api/plan/plan.ts'
import { computed, onMounted, reactive, ref } from 'vue'
import type { Plan } from '@/api/plan/interface'
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
@@ -66,7 +66,7 @@ import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
import { useHandleData } from '@/hooks/useHandleData'
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
import {getTestSourceById} from '@/api/device/testSource/index'
import ImportExcel from "@/components/ImportExcel/index.vue";
import ImportExcel from '@/components/ImportExcel/index.vue'
import {useDownload} from "@/hooks/useDownload";
import {getTestConfig } from '@/api/system/base/index'
import {type Base } from '@/api/system/base/interface'
@@ -88,7 +88,7 @@ const planPopup = ref()
const devTransferPopup = ref()
const modeStore = useModeStore();
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
const planImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
const getTableList = async(params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
@@ -336,21 +336,21 @@ function handleFiles(event: Event) {
// 点击导入按钮
const importClick = () => {
const params = {
title: '被检设备',
title: '检测计划',
showCover: false,
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
tempApi: downloadTemplate,
importApi: importPlan,
tempApi: downloadCNPlanTemplate,
importApi: importCNPlan,
getTableList: proTable.value?.getTableList,
}
deviceImportExcel.value?.acceptParams(params)
planImportExcel.value?.acceptParams(params)
}
// 点击导出按钮
const exportClick = () => {
ElMessageBox.confirm('确认导出检测计划?', '温馨提示', { type: 'warning' }).then(() =>{
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
useDownload(exportPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
useDownload(exportCNPlan,'检测计划导出数据', {...proTable.value?.searchParam,pattern:patternId}, false,'.xlsx')
})
}