下拉多选报告模版
This commit is contained in:
@@ -7,6 +7,7 @@ export namespace CheckData {
|
||||
chnNum: string
|
||||
deviceId: string
|
||||
num?: string | number
|
||||
reportTemplateName: string
|
||||
}
|
||||
|
||||
export interface PhaseCheckResult {
|
||||
|
||||
@@ -23,6 +23,7 @@ export namespace Device {
|
||||
scriptId?: string // 脚本id
|
||||
planCode?: string
|
||||
devIdList?: string[] // 装置id列表
|
||||
reportTemplateName?: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,8 +61,23 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.showDetailType === 1">
|
||||
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport">报告生成</el-button>
|
||||
<el-form-item label="检测报告" v-if="checkStore.showDetailType === 1" class="inline-form-item">
|
||||
<el-select
|
||||
:disabled="checkStore.showDetailType === 2 || checkStore.showDetailType === 0"
|
||||
v-model="formContent.reportTemplateName"
|
||||
placeholder="请选择报告模版"
|
||||
autocomplete="off"
|
||||
class="inline-select"
|
||||
@change="handleErrorSysChange('切换报告模版成功')">
|
||||
|
||||
<el-option
|
||||
v-for="item in reportTemplateList"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button type="primary" :icon="Postcard" @click="handleGenerateReport" class="inline-button">报告生成</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="checkStore.showDetailType === 0">
|
||||
<el-button type="primary" :icon="Histogram" @click="handleReCalculate">重新计算</el-button>
|
||||
@@ -172,6 +187,7 @@ import {
|
||||
getTreeData,
|
||||
reCalculate
|
||||
} from '@/api/check/test'
|
||||
import { getPqReportAllName } from '@/api/device/report'
|
||||
import { generateDevReport, getPqErrSysList } from '@/api/plan/plan'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
import { Histogram, Postcard } from '@element-plus/icons-vue'
|
||||
@@ -197,6 +213,7 @@ const visible = ref(false)
|
||||
const treeRef = ref()
|
||||
const searchValue = ref<string>('')
|
||||
const pqErrorList = reactive<{ id: string; name: string }[]>([])
|
||||
const reportTemplateList = ref<{ name: string }[]>([])
|
||||
watch(searchValue, val => {
|
||||
treeRef.value!.filter(val)
|
||||
})
|
||||
@@ -212,7 +229,8 @@ const formContent = reactive<CheckData.DataCheck>({
|
||||
errorSysId: '',
|
||||
dataRule: '',
|
||||
deviceName: '',
|
||||
chnNum: ''
|
||||
chnNum: '',
|
||||
reportTemplateName: ''
|
||||
})
|
||||
// 原始误差体系id
|
||||
let originErrorSysId: string = ''
|
||||
@@ -485,7 +503,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
||||
originScriptType = _scriptType
|
||||
scriptType = _scriptType
|
||||
|
||||
// 发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
||||
//发起后端请求,查询详细信息 当chnNum为-1时,查询所有通道号
|
||||
const { data: resFormContent }: { data: any } = await getFormData({
|
||||
planId: checkStore.plan.id,
|
||||
deviceId,
|
||||
@@ -507,19 +525,23 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
||||
|
||||
pqErrorList.length = 0
|
||||
let { data: resPqErrorList } = await getPqErrSysList()
|
||||
let { data: resReportTemplateList }=await getPqReportAllName()
|
||||
Object.assign(pqErrorList, resPqErrorList)
|
||||
reportTemplateList.value = resReportTemplateList.map((item: any) => ({ name: item }))
|
||||
|
||||
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
const handleGenerateReport = async () => {
|
||||
await generateDevReport({
|
||||
planId: checkStore.plan.id,
|
||||
devIdList: [deviceId],
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
planCode: checkStore.plan.code + (formContent.errorSysId!=checkStore.plan.errorSysId || formContent.dataRule!=checkStore.plan.dataRule? '_temp':'')
|
||||
})
|
||||
ElMessage.success({ message: `报告生成成功!` })
|
||||
await generateDevReport({
|
||||
planId: checkStore.plan.id,
|
||||
devIdList: [deviceId],
|
||||
scriptId: checkStore.plan.scriptId,
|
||||
planCode: checkStore.plan.code + (formContent.errorSysId != checkStore.plan.errorSysId || formContent.dataRule != checkStore.plan.dataRule ? '_temp' : ''),
|
||||
reportTemplateName: formContent.reportTemplateName
|
||||
})
|
||||
ElMessage.success({message: `报告生成成功!`})
|
||||
}
|
||||
|
||||
const handleReCalculate = async () => {
|
||||
@@ -548,7 +570,8 @@ const close = async () => {
|
||||
errorSysName: '',
|
||||
dataRule: '',
|
||||
deviceName: '',
|
||||
chnNum: ''
|
||||
chnNum: '',
|
||||
reportTemplateName: ''
|
||||
})
|
||||
treeDataAll.length = 0
|
||||
// harmNumList.length = 0
|
||||
@@ -825,7 +848,22 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.inline-form-item {
|
||||
.el-form-item__content {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.inline-select {
|
||||
flex: 1;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.inline-button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1087,7 +1087,7 @@ const openDrawer = async (title: string, row: any) => {
|
||||
|
||||
if (title === '检测数据查询') {
|
||||
checkStore.setShowDetailType(0)
|
||||
if (modeStore.currentMode == '模拟式') {
|
||||
if (modeStore.currentMode == '模拟式'||modeStore.currentMode == '数字式') {
|
||||
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||
} else if (modeStore.currentMode == '比对式') {
|
||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(row, null, row.id, 2)
|
||||
@@ -1095,7 +1095,7 @@ const openDrawer = async (title: string, row: any) => {
|
||||
}
|
||||
if (title === '误差体系更换') {
|
||||
checkStore.setShowDetailType(1)
|
||||
if (modeStore.currentMode == '模拟式') {
|
||||
if (modeStore.currentMode == '模拟式'||modeStore.currentMode == '数字式') {
|
||||
dataCheckPopupRef.value?.open(row.id, '-1', null)
|
||||
} else if (modeStore.currentMode == '比对式') {
|
||||
dataCheckSingleChannelSingleTestPopupRef.value?.open(row, null, row.id, 2)
|
||||
|
||||
Reference in New Issue
Block a user