diff --git a/frontend/src/api/plan/plan.ts b/frontend/src/api/plan/plan.ts index 6e0c566..2963502 100644 --- a/frontend/src/api/plan/plan.ts +++ b/frontend/src/api/plan/plan.ts @@ -62,4 +62,18 @@ export const BindPqDevList = (params: any) => { // 按照模式查询检测计划(用于首页展示) export const getPlanListByPattern = (params:Plan.ReqPlan) => { return http.get(`/adPlan/listByPattern?pattern=${params.pattern}`) +} + +// 导出检测计划 +export const exportPlan=(params: Device.ReqPqDevParams)=>{ + return http.download(`/adPlan/export`, params) +} + +// 下载模板 +export const downloadTemplate = () => { + return http.download(`/adPlan/downloadTemplate`) +} +// 导入检测计划 +export const importPlan=(params: Device.ReqPqDevParams)=>{ + return http.upload(`/adPlan/import`, params) } \ No newline at end of file diff --git a/frontend/src/components/ImportExcel/index.vue b/frontend/src/components/ImportExcel/index.vue index 2ed414e..e25061b 100644 --- a/frontend/src/components/ImportExcel/index.vue +++ b/frontend/src/components/ImportExcel/index.vue @@ -48,6 +48,7 @@ import { ElNotification, UploadRequestOptions, UploadRawFile } from "element-plu export interface ExcelParameterProps { title: string; // 标题 showCover?: boolean; // 是否显示”数据覆盖“选项 + patternId?: string; // 模式ID fileSize?: number; // 上传文件的大小 fileType?: File.ExcelMimeType[]; // 上传文件的类型 tempApi?: (params: any) => Promise; // 下载模板的Api @@ -84,6 +85,9 @@ const downloadTemp = () => { const uploadExcel = async (param: UploadRequestOptions) => { let excelFormData = new FormData(); excelFormData.append("file", param.file); + if(parameter.value.patternId){ + excelFormData.append("patternId",parameter.value.patternId) + } isCover.value && excelFormData.append("isCover", isCover.value as unknown as Blob); await parameter.value.importApi!(excelFormData); parameter.value.getTableList && parameter.value.getTableList(); diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index 08e5d0b..09aa846 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -385,9 +385,12 @@ const tableList = ref([]); const boundPqDevList=ref([])//根据检测计划id查询出所有已绑定的设备 const getTableList = async (params: any) => { - const pqDevList_Result2 = await getBoundPqDevList({'planId': props.id, 'checkStateList':[0,1,2]}); - boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[]; - return getBoundPqDevList({'planId': props.id, 'checkStateList':[0,1,2]}); + debugger + if(props.id) { + // const pqDevList_Result2 = await getBoundPqDevList({'planId': props.id,'checkStateList':[0,1,2]}); + // boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[]; + return getBoundPqDevList({'planId': props.id,'checkStateList':[0,1,2]}); + } }; diff --git a/frontend/src/views/home/tabs/dashboard.vue b/frontend/src/views/home/tabs/dashboard.vue index dc4674f..49d7ec6 100644 --- a/frontend/src/views/home/tabs/dashboard.vue +++ b/frontend/src/views/home/tabs/dashboard.vue @@ -96,12 +96,12 @@ - - -
-
-
-
+ + + + + + @@ -271,7 +271,7 @@ const getPieData = async (id: string) => { handleCheckFunction(0)//切换左侧树,默认css功能是设备检测 const boundPqDevList=ref([])//根据检测计划id查询出所有已绑定的设备 - const pqDevList_Result2 = await getBoundPqDevList({'planId': id, 'checkStateList':[0,1,2]}); + const pqDevList_Result2 = await getBoundPqDevList({'planId': id,'checkStateList':[0,1,2]}); boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[]; // 初始化计数对象 @@ -392,7 +392,7 @@ const resizeObserver = new ResizeObserver(entries => { } }); -onMounted(async () => { +onBeforeMount(async () => { const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id const reqPlan: Plan.ReqPlan = { pattern: patternId, @@ -415,7 +415,11 @@ onMounted(async () => { code: 0, state: 0 }; + // debugger; const planList = await getPlanListByPattern(reqPlan); + if (planList.data[0].children[0]) { + currentId.value = planList.data[0].children[0].id; + } if (chartsInfoRef.value) { resizeObserver.observe(chartsInfoRef.value); } diff --git a/frontend/src/views/home/tabs/model.vue b/frontend/src/views/home/tabs/model.vue index 3773a4b..2bfbc96 100644 --- a/frontend/src/views/home/tabs/model.vue +++ b/frontend/src/views/home/tabs/model.vue @@ -62,18 +62,17 @@ const modeList = [ }, ]; const handelOpen = async (item: any) => { - - await authStore.setShowMenu(); modeStore.setCurrentMode(item.code); // 将模式code存入 store + await authStore.setShowMenu(); return; - if (isActive) { - router.push({ path: "/static" }); - } else { - ElMessage({ - message: "当前模式未配置", - type: "warning", - }); - } + // if (isActive) { + // router.push({ path: "/static" }); + // } else { + // ElMessage({ + // message: "当前模式未配置", + // type: "warning", + // }); + // } }; const handleSelect = (key: string, keyPath: string[]) => { console.log(key, keyPath); diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue index 7c9bc97..93ce83c 100644 --- a/frontend/src/views/plan/planList/index.vue +++ b/frontend/src/views/plan/planList/index.vue @@ -34,14 +34,14 @@ - +