diff --git a/frontend/src/api/device/interface/report.ts b/frontend/src/api/device/interface/report.ts
index eb1b8bc..3c522b1 100644
--- a/frontend/src/api/device/interface/report.ts
+++ b/frontend/src/api/device/interface/report.ts
@@ -1,4 +1,5 @@
import type { ReqPage, ResPage } from '@/api/interface'
+import type { UploadFile } from 'element-plus';
// 报告模版接口
export namespace PqReport {
@@ -19,10 +20,10 @@ export namespace PqReport {
id: string; //报告模板id
name: string;//报告模板名称
version:string;//版本号
- basePath:string;//基础模板文件路径
- detailPath:string;//检测项模版文件路径
- desc:string;//描述信息
- enable:number;//状态:8-删除 1-激活 2-未激活
+ baseFile?:string;//基础模板文件路径
+ detailFile?:string;//检测项模版文件路径
+ description:string;//描述信息
+ state:number;//状态:8-删除 1-正常
createBy?: string| null; //创建用户
createTime?: string| null; //创建时间
updateBy?: string| null; //更新用户
diff --git a/frontend/src/api/device/report/index.ts b/frontend/src/api/device/report/index.ts
new file mode 100644
index 0000000..9a64ce9
--- /dev/null
+++ b/frontend/src/api/device/report/index.ts
@@ -0,0 +1,42 @@
+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)
+}
+
+//新增报告模版
+export const addPqReport = (params: PqReport.ResReport) => {
+ return http.upload(`/report/add`, params)
+}
+
+//删除报告模版
+export const deletePqReport = (params: string[]) => {
+ return http.post(`/report/delete`, params)
+}
+
+//查询报告模板详情
+export const getPqReportById = (params: PqReport.ResReport) => {
+ return http.get(`/report/getById?id=${params.id}`)
+}
+
+//修改报告模板
+export const updatePqReport = (params: PqReport.ResReport) => {
+ return http.upload(`/report/update`, params)
+}
+
+//查询所有报告模板名称
+export const getPqReportAllName = () => {
+ return http.get(`/report/listAllName`)
+}
+
+//根据名称查询指定报告模板的所有版本
+export const getPqReportAllVersion = (params:any) => {
+ return http.get(`/report/listAllVersion?name=${params.name}`)
+}
+
diff --git a/frontend/src/api/plan/interface/index.ts b/frontend/src/api/plan/interface/index.ts
index d8bfa3d..57f1703 100644
--- a/frontend/src/api/plan/interface/index.ts
+++ b/frontend/src/api/plan/interface/index.ts
@@ -22,6 +22,10 @@ export namespace Plan {
createTime?:string; //创建时间
updateBy?:string; //更新用户
updateTime?:string; //更新时间
+
+ associateReport:number;//是否关联报告模板 0否 1是
+ reportTemplateName:string;
+ reportTemplateVersion:string
}
// 检测计划 + 分页
diff --git a/frontend/src/views/plan/planList/components/planPopup.vue b/frontend/src/views/plan/planList/components/planPopup.vue
index 34415a3..7b422eb 100644
--- a/frontend/src/views/plan/planList/components/planPopup.vue
+++ b/frontend/src/views/plan/planList/components/planPopup.vue
@@ -54,6 +54,32 @@
否
+
+
+ 是
+ 否
+
+
+
+
+
+
+
+
+
+
+
+
@@ -93,11 +119,7 @@
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 { Loading } from '@element-plus/icons-vue/dist/types';
-import { truncate } from 'lodash';
-
-
-
+ import {getPqReportAllName,getPqReportAllVersion} from '@/api/device/report/index.ts'
const dictStore = useDictStore()
// 定义弹出组件元信息
const dialogFormRef = ref()
@@ -108,6 +130,9 @@ import { truncate } from 'lodash';
const pqErrSysList=ref([])//获取指定模式下所有检测源
const pqDevList=ref([])//获取指定模式下所有检测源
+ const pqReportName = ref<{ name: string }[]>([])
+ const pqReportVersion = ref<{ version: string}[]>([])
+
const pqSourceArray = ref<{ label: string; value: string; }[]>()
const pqScriptArray = ref<{ label: string; value: string; }[]>()
const pqErrorArray = ref<{ label: string; value: string; }[]>()
@@ -164,6 +189,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
devIds:[],
sourceIds:'',
datasourceIds:'',
+ associateReport:0,
+ reportTemplateName:'',
+ reportTemplateVersion:'',
})
return { dialogVisible, titleType, formContent }
}
@@ -194,6 +222,9 @@ const filterMethod = (query: string, item: { label?: string }) => {
devIds:[],
sourceIds:'',
datasourceIds:'',
+ associateReport:0,
+ reportTemplateName:'',
+ reportTemplateVersion:'',
}
)
@@ -204,14 +235,27 @@ const filterMethod = (query: string, item: { label?: string }) => {
})
-// 定义规则
-const formRuleRef = ref()
-const rules: Ref>> = ref({
- name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
- sourceIds: [{ required: true, message: '检测源必选!', trigger: 'blur' }],
- datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
- scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
- errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'blur' }],
+
+
+// 定义表单校验规则
+const baseRules: Record> = {
+ name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
+ sourceIds: [{ required: true, message: '检测源必选!', trigger: 'change' }],
+ datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'change' }],
+ scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'change' }],
+ errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'change' }],
+};
+
+// 使用计算属性根据 scene 动态生成规则
+const rules = computed(() => {
+ const dynamicRules = { ...baseRules };
+
+ if (formContent.associateReport === 1){//只有关联报告模版时需要展示
+ dynamicRules.reportTemplateName= [{ required: true, message: '报告模版名称必选!', trigger: 'change' }];
+ dynamicRules.reportTemplateVersion= [{ required: true, message: '报告模版版本号必选!', trigger: 'change' }];
+ }
+
+ return dynamicRules;
});
// 关闭弹窗
@@ -306,13 +350,23 @@ const open = async (sign: string,
if(sign == 'add')
{
console.log('add',data)
- const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result] = await Promise.all([
+ const [pqSource_Result, PqScript_Result, PqErrSys_Result,pqDevList_Result,pqReportName_Result] = await Promise.all([
getTestSourceList(data),
getPqScriptList(data),
getPqErrSysList(),
- getUnboundPqDevList(data)
+ getUnboundPqDevList(data),
+ getPqReportAllName(),
+
]);
+
+
+ if (Array.isArray(pqReportName_Result.data)) {
+ pqReportName.value = pqReportName_Result.data.map(item => ({ name: item }));
+ } else {
+ pqReportName.value = [];
+ console.error('pqReportName_Result.data is not an array:', 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[];
@@ -321,14 +375,22 @@ const open = async (sign: string,
unboundPqDevList.value = pqDevList.value
boundPqDevList.value = [];
}else{//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
- const [pqSource_Result, PqScript_Result, PqErrSys_Result,boundPqDevList_Result, unboundPqDevList_Result] = await Promise.all([
+ const [pqSource_Result, PqScript_Result, PqErrSys_Result,boundPqDevList_Result, unboundPqDevList_Result,pqReportName_Result] = await Promise.all([
getTestSourceList(data),
getPqScriptList(data),
getPqErrSysList(),
getBoundPqDevList({ 'planId': data.id }),
- getUnboundPqDevList(data)
+ getUnboundPqDevList(data),
+ getPqReportAllName(),
]);
+ if (Array.isArray(pqReportName_Result.data)) {
+ pqReportName.value = pqReportName_Result.data.map(item => ({ name: item }));
+ } else {
+ pqReportName.value = [];
+ console.error('pqReportName_Result.data is not an array:', 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[];
@@ -400,9 +462,14 @@ const dataSourceType = computed(() => {
default:
return 'Datasource_Contrast'
}
- })
+})
+const handleReportChange = async (value: string) => {
+ formContent.reportTemplateVersion = ''
+ const response = await getPqReportAllVersion({ name: value });
+ pqReportVersion.value = response.data.map((item: { version: string }) => ({ version: item }));
+};
// 对外映射
defineExpose({ open })
diff --git a/frontend/src/views/system/template/components/reportPopup.vue b/frontend/src/views/system/template/components/reportPopup.vue
index e69de29..56c2320 100644
--- a/frontend/src/views/system/template/components/reportPopup.vue
+++ b/frontend/src/views/system/template/components/reportPopup.vue
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+
+
+
+
+
+ 选择文件
+
+
+
+
+
+ 选择文件
+
+
+
+
+
+
+
+
+ 取 消
+ 保存
+
+
+
+
+
+
+
\ 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 1f3791e..7f5eb74 100644
--- a/frontend/src/views/system/template/index.vue
+++ b/frontend/src/views/system/template/index.vue
@@ -9,13 +9,6 @@
新增
- 导出
- 导入
-
- 导入
-
删除
@@ -32,42 +25,29 @@
-
-
+
+
\ No newline at end of file