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

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

@@ -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')
})
}