默认选中第一条检测计划

This commit is contained in:
caozehui
2024-12-17 11:12:21 +08:00
parent a027dc75c3
commit 07d02307e2
6 changed files with 66 additions and 31 deletions

View File

@@ -34,14 +34,14 @@
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
<!-- 查看设备绑定
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/> -->
<ImportExcel ref='deviceImportExcel' />
</template>
<script setup lang='tsx' name='useProTable'>
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 } from '@/api/plan/plan.ts'
import {getPlanList,deletePlan,exportPlan,downloadTemplate,importPlan } 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' // 导入子组件
@@ -61,6 +61,9 @@ 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 {useDownload} from "@/hooks/useDownload";
import {exportPqDev} from "@/api/device/device";
const dictStore = useDictStore()
const openDeviceView = ref()
const openSourceView = ref()
@@ -73,7 +76,8 @@ const testSourcePopup = ref()
const planPopup = ref()
const devTransferPopup = ref()
const modeStore = useModeStore();
const fileInput = ref<HTMLInputElement | null>(null) // 声明 fileInput
const deviceImportExcel = ref<InstanceType<typeof ImportExcel> | null>(null)
const getTableList = async(params: any) => {
let newParams = JSON.parse(JSON.stringify(params))
@@ -232,11 +236,6 @@ const handleSourceClicked = (id: string) => {
};
function openFileDialog() {
if (fileInput.value) {
fileInput.value.click()
}
}
function isVisible(row: Plan.ReqPlan) {
@@ -312,11 +311,23 @@ function handleFiles(event: Event) {
// 点击导入按钮
const importClick = () => {
openFileDialog()
const params = {
title: '被检设备',
showCover: false,
patternId: dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? '',
tempApi: downloadTemplate,
importApi: importPlan,
getTableList: proTable.value?.getTableList,
}
deviceImportExcel.value?.acceptParams(params)
}
// 点击导出按钮
const exportClick = () => {
openFileDialog()
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')
})
}
// 点击合并按钮