From d44c79f7b84df4ef5bf33d1a865577738f602b92 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Fri, 12 Jun 2026 13:30:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=91=8A=E6=A8=A1=E7=89=88=E6=96=B0?= =?UTF-8?q?=E5=A2=9Epattern=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/device/interface/report.ts | 53 ++- frontend/src/api/device/report/index.ts | 28 +- .../plan/planList/components/planPopup.vue | 33 +- .../template/components/reportPopup.vue | 335 +++++++++--------- frontend/src/views/system/template/index.vue | 253 ++++++------- 5 files changed, 338 insertions(+), 364 deletions(-) diff --git a/frontend/src/api/device/interface/report.ts b/frontend/src/api/device/interface/report.ts index 3c522b1..fdcaaab 100644 --- a/frontend/src/api/device/interface/report.ts +++ b/frontend/src/api/device/interface/report.ts @@ -1,39 +1,34 @@ import type { ReqPage, ResPage } from '@/api/interface' -import type { UploadFile } from 'element-plus'; -// 报告模版接口 export namespace PqReport { - - /** - * 报告模版表格分页查询参数 - */ export interface ReqReportParams extends ReqPage { - id: string; // 装置序号id 必填 - name?: string; // 设备名称 - createTime?: string; //创建时间 + id: string + name?: string + createTime?: string + pattern: string } - /** - * 报告模版新增、修改、根据id查询返回的对象 - */ export interface ResReport { - id: string; //报告模板id - name: string;//报告模板名称 - version:string;//版本号 - baseFile?:string;//基础模板文件路径 - detailFile?:string;//检测项模版文件路径 - description:string;//描述信息 - state:number;//状态:8-删除 1-正常 - createBy?: string| null; //创建用户 - createTime?: string| null; //创建时间 - updateBy?: string| null; //更新用户 - updateTime?: string| null; //更新时间 + id: string + name: string + version: string + pattern: string + baseFile?: string + detailFile?: string + description: string + state: number + createBy?: string | null + createTime?: string | null + updateBy?: string | null + updateTime?: string | null } - /** - * 报告模版表格查询分页返回的对象; - */ - export interface ResReportPage extends ResPage { - + export interface ResReportOption { + id: string + name: string + version: string + displayName: string } -} \ No newline at end of file + + export interface ResReportPage extends ResPage {} +} diff --git a/frontend/src/api/device/report/index.ts b/frontend/src/api/device/report/index.ts index b6e6da4..2cff83c 100644 --- a/frontend/src/api/device/report/index.ts +++ b/frontend/src/api/device/report/index.ts @@ -1,51 +1,49 @@ -import type {PqReport} from '@/api/device/interface/report' +import type { PqReport } from '@/api/device/interface/report' import http from '@/api' - /** * @name 报告模版模块 */ //获取报告模版 export const getPqReportList = (params: PqReport.ReqReportParams) => { - return http.post(`/report/list`, params) + return http.post(`/report/list`, params) } //新增报告模版 export const addPqReport = (params: PqReport.ResReport) => { - return http.upload(`/report/add`, params) + return http.upload(`/report/add`, params) } //删除报告模版 export const deletePqReport = (params: string[]) => { - return http.post(`/report/delete`, params) + return http.post(`/report/delete`, params) } //查询报告模板详情 export const getPqReportById = (params: PqReport.ResReport) => { - return http.get(`/report/getById?id=${params.id}`) + return http.get(`/report/getById?id=${params.id}`) } //修改报告模板 export const updatePqReport = (params: PqReport.ResReport) => { - return http.upload(`/report/update`, params) + return http.upload(`/report/update`, params) } -//查询所有报告模板名称 -export const getPqReportAllName = () => { - return http.get(`/report/listAllName`) +export const getPqReportOptions = (params: { pattern: string }) => { + return http.get(`/report/listOptions?pattern=${params.pattern}`) } //根据名称查询指定报告模板的所有版本 -export const getPqReportAllVersion = (params:any) => { - return http.get(`/report/listAllVersion?name=${params.name}`) +export const getPqReportAllVersion = (params: any) => { + return http.get(`/report/listAllVersion?name=${params.name}`) } //被检设备归档 export const documentedPqDev = (ids: string[]) => { - return http.post(`/report/documented`, ids) + return http.post(`/report/documented`, ids) } //上传报告到云端 export const uploadReportToCloud = (deviceIds: string[]) => { - return http.post(`/report/uploadReportToCloud`, deviceIds) -} \ No newline at end of file + return http.post(`/report/uploadReportToCloud`, deviceIds) +} diff --git a/frontend/src/views/plan/planList/components/planPopup.vue b/frontend/src/views/plan/planList/components/planPopup.vue index f5b5b2b..cb48b40 100644 --- a/frontend/src/views/plan/planList/components/planPopup.vue +++ b/frontend/src/views/plan/planList/components/planPopup.vue @@ -200,10 +200,10 @@ placeholder="请选择报告模版" > @@ -454,7 +454,8 @@ import { type TestSource } from '@/api/device/interface/testSource' import { type TestScript } from '@/api/device/interface/testScript' import { type ErrorSystem } from '@/api/device/interface/error' import { type Device } from '@/api/device/interface/device' -import { getPqReportAllName } from '@/api/device/report' +import { type PqReport } from '@/api/device/interface/report' +import { getPqReportOptions } from '@/api/device/report' import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' import { canBindingList, getAllPqStandardDev } from '@/api/device/standardDevice' import { type StandardDevice } from '@/api/device/interface/standardDevice' @@ -482,7 +483,7 @@ const pqErrSysList = ref([]) //获取指定模式 const pqDevList = ref([]) //获取指定模式下所有被检设备 const pqStandardDevList = ref([]) //获取指定模式下所有标准设备 -const pqReportName = ref<{ name: string }[]>([]) +const pqReportName = ref([]) const pqSourceArray = ref<{ label: string; value: string }[]>() const pqScriptArray = ref<{ label: string; value: string,fluke?:number|boolean}[]>() @@ -864,7 +865,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan: ] = await Promise.all([ getPqErrSysList(), getUnboundPqDevList({ pattern: data.pattern }), - getPqReportAllName(), + getPqReportOptions({ pattern: data.pattern || patternId }), canBindingList(), getTestConfig(), getRegRes({ type: patternId }), @@ -904,15 +905,11 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan: getPqScriptList(data), getPqErrSysList(), getUnboundPqDevList({ pattern: data.pattern }), - getPqReportAllName() + getPqReportOptions({ pattern: data.pattern || patternId }) ]) } - if (Array.isArray(pqReportName_Result.data)) { - pqReportName.value = pqReportName_Result.data.map((item: any) => ({ name: item })) - } else { - pqReportName.value = [] - } + pqReportName.value = Array.isArray(pqReportName_Result.data) ? pqReportName_Result.data : [] pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[] pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[] pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[] @@ -978,7 +975,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan: getPqErrSysList(), getBoundPqDevList({ planIdList: [data.id] }), getUnboundPqDevList({ pattern: data.pattern }), - getPqReportAllName(), + getPqReportOptions({ pattern: data.pattern || patternId }), getAllPqStandardDev(), getAllUser() ]) @@ -1027,15 +1024,11 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan: getPqErrSysList(), getBoundPqDevList({ planIdList: [data.id] }), getUnboundPqDevList({ pattern: data.pattern }), - getPqReportAllName() + getPqReportOptions({ pattern: data.pattern || patternId }) ]) } - if (Array.isArray(pqReportName_Result.data)) { - pqReportName.value = pqReportName_Result.data.map((item: any) => ({ name: item })) - } else { - pqReportName.value = [] - } + pqReportName.value = Array.isArray(pqReportName_Result.data) ? pqReportName_Result.data : [] pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[] pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[] diff --git a/frontend/src/views/system/template/components/reportPopup.vue b/frontend/src/views/system/template/components/reportPopup.vue index 195d5dd..d3d8bad 100644 --- a/frontend/src/views/system/template/components/reportPopup.vue +++ b/frontend/src/views/system/template/components/reportPopup.vue @@ -3,53 +3,53 @@
- + - + 选择文件 仅支持上传大小不超过5MB的.docx文件 - + 选择文件 仅支持上传大小不超过5MB的.docx文件 - +
@@ -57,71 +57,72 @@ + \ No newline at end of file + diff --git a/frontend/src/views/system/template/index.vue b/frontend/src/views/system/template/index.vue index 7dc94df..2c1a578 100644 --- a/frontend/src/views/system/template/index.vue +++ b/frontend/src/views/system/template/index.vue @@ -1,137 +1,142 @@ - - - \ No newline at end of file +const batchDelete = async (id: string[]) => { + await useHandleData(deletePqReport, id, '删除所选报告模板') + proTable.value?.clearSelection() + proTable.value?.getTableList() +} + +const handleDelete = async (params: PqReport.ResReport) => { + await useHandleData(deletePqReport, [params.id], `删除【${params.name}】报告模板`) + proTable.value?.getTableList() +} +