This commit is contained in:
guanj
2025-09-01 08:36:25 +08:00
5 changed files with 75 additions and 63 deletions

View File

@@ -35,6 +35,7 @@ export namespace Plan {
progress?: number; // 进度百分比,例如 75 progress?: number; // 进度百分比,例如 75
children?: ResPlan[]; children?: ResPlan[];
testConfig?: PlanTestConfig; testConfig?: PlanTestConfig;
importFlag?: number; // 导入标识0-否1-是
} }
// 检测计划 + 分页 // 检测计划 + 分页

View File

@@ -136,8 +136,8 @@ export const importSubPlan = (params: Plan.ResPlan) => {
// 导出计划检测结果数据 // 导出计划检测结果数据
export const exportPlanCheckData = (params: Plan.ResPlan) => { export const exportPlanCheckData = (params: any) => {
return http.download(`/adPlan/exportPlanCheckData?planId=${params.id}&report=1`) return http.download(`/adPlan/exportPlanCheckData?planId=${params.id}&devIds=${params.devIds}&report=${params.report}`)
} }
// 导入子检测计划检测结果数据 // 导入子检测计划检测结果数据

View File

@@ -57,9 +57,10 @@
type="primary" type="primary"
icon="Download" icon="Download"
v-auth.plan="'import_subplan'" v-auth.plan="'import_subplan'"
@click="exportPlanCheckResultData" @click="exportPlanCheckResultData(scope.selectedListIds)"
:disabled="!scope.isSelected"
> >
导出检测结果 数据下载
</el-button> </el-button>
<el-button <el-button
v-auth.plan="'add_subplan'" v-auth.plan="'add_subplan'"
@@ -626,12 +627,16 @@ const exportPlan = async () => {
useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip') useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip')
) )
} }
const exportPlanCheckResultData = async () => { const exportPlanCheckResultData = async (selectedListIds: string[]) => {
const params = { const params = {
id: planFormContent.value.id id: planFormContent.value.id,
report: 1,
devIds: selectedListIds.join(',')
} }
ElMessageBox.confirm(`确认导出${planFormContent.value.name}计划检测结果`, '温馨提示', { type: 'warning' }).then( ElMessageBox.confirm(`确认下载【${planFormContent.value.name}】勾选的被检设备等信息`, '温馨提示', {
() => useDownload(exportPlanCheckData, `${planFormContent.value.name}_计划检测结果`, params, false, '.zip') type: 'warning'
}).then(() =>
useDownload(exportPlanCheckData, `${planFormContent.value.name}_检测计划检测数据包`, params, false, '.zip')
) )
} }

View File

@@ -23,7 +23,7 @@
<el-form-item v-if="selectByMode" :label-width="110" label="标准设备" prop="standardDevIds"> <el-form-item v-if="selectByMode" :label-width="110" label="标准设备" prop="standardDevIds">
<el-select <el-select
v-model="formContent.standardDevIds" v-model="formContent.standardDevIds"
:disabled="planType == 2" :disabled="planType == 2 || allDisabled"
:max-collapse-tags="2" :max-collapse-tags="2"
clearable clearable
collapse-tags collapse-tags
@@ -43,7 +43,7 @@
<el-form-item v-if="selectByMode" :label-width="110" label="测试项" prop="testItems"> <el-form-item v-if="selectByMode" :label-width="110" label="测试项" prop="testItems">
<el-select <el-select
v-model="formContent.testItems" v-model="formContent.testItems"
:disabled="planType != 0" :disabled="planType != 0 || allDisabled"
:max-collapse-tags="3" :max-collapse-tags="3"
clearable clearable
collapse-tags collapse-tags
@@ -63,6 +63,7 @@
<el-select <el-select
v-model="formContent.sourceIds" v-model="formContent.sourceIds"
:multiple="selectByMode" :multiple="selectByMode"
:disabled="allDisabled"
clearable clearable
collapse-tags collapse-tags
filterable filterable
@@ -79,7 +80,7 @@
<el-form-item :label-width="110" label="数据源" prop="datasourceIds"> <el-form-item :label-width="110" label="数据源" prop="datasourceIds">
<el-select <el-select
v-model="formContent.datasourceIds" v-model="formContent.datasourceIds"
:disabled="planType != 0" :disabled="planType != 0 || allDisabled"
:max-collapse-tags="2" :max-collapse-tags="2"
:multiple="selectByMode" :multiple="selectByMode"
autocomplete="off" autocomplete="off"
@@ -100,7 +101,7 @@
<el-form-item v-if="!selectByMode" :label-width="110" label="检测脚本" prop="scriptId"> <el-form-item v-if="!selectByMode" :label-width="110" label="检测脚本" prop="scriptId">
<el-select <el-select
v-model="formContent.scriptId" v-model="formContent.scriptId"
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
autocomplete="off" autocomplete="off"
clearable clearable
placeholder="请选择检测脚本" placeholder="请选择检测脚本"
@@ -116,7 +117,7 @@
<el-form-item :label-width="110" label="误差体系" prop="errorSysId"> <el-form-item :label-width="110" label="误差体系" prop="errorSysId">
<el-select <el-select
v-model="formContent.errorSysId" v-model="formContent.errorSysId"
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
autocomplete="off" autocomplete="off"
clearable clearable
filterable filterable
@@ -133,7 +134,7 @@
<el-form-item :label-width="110" label="数据处理原则" prop="dataRule"> <el-form-item :label-width="110" label="数据处理原则" prop="dataRule">
<el-select <el-select
v-model="formContent.dataRule" v-model="formContent.dataRule"
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
autocomplete="off" autocomplete="off"
clearable clearable
placeholder="请选择数据处理原则" placeholder="请选择数据处理原则"
@@ -147,7 +148,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label-width="110" label="守时检测" prop="timeCheck"> <el-form-item :label-width="110" label="守时检测" prop="timeCheck">
<el-radio-group v-model="formContent.timeCheck" :disabled="planType != 0"> <el-radio-group v-model="formContent.timeCheck" :disabled="planType != 0 || allDisabled">
<el-radio :value="1"></el-radio> <el-radio :value="1"></el-radio>
<el-radio :value="0"></el-radio> <el-radio :value="0"></el-radio>
</el-radio-group> </el-radio-group>
@@ -166,7 +167,7 @@
> >
<el-select <el-select
v-model="formContent.reportTemplateName" v-model="formContent.reportTemplateName"
:disabled="planType != 0" :disabled="planType != 0 || allDisabled"
autocomplete="off" autocomplete="off"
placeholder="请选择报告模版" placeholder="请选择报告模版"
> >
@@ -220,7 +221,7 @@
</div> </div>
</template> </template>
<template v-if="planType === 0" #left-footer> <template v-if="planType === 0 && !allDisabled" #left-footer>
<el-button <el-button
v-if="modeStore.currentMode !== '比对式'" v-if="modeStore.currentMode !== '比对式'"
v-auth.plan="'import'" v-auth.plan="'import'"
@@ -244,7 +245,7 @@
导入被检设备 导入被检设备
</el-button> </el-button>
</template> </template>
<template v-if="planType === 0" #right-footer> <template v-if="planType === 0 && !allDisabled" #right-footer>
<el-text></el-text> <el-text></el-text>
</template> </template>
<template #left-empty> <template #left-empty>
@@ -270,7 +271,7 @@
prop="testConfig.maxTime" prop="testConfig.maxTime"
> >
<el-input-number <el-input-number
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
style="width: 240px" style="width: 240px"
v-model="formContent.testConfig.maxTime" v-model="formContent.testConfig.maxTime"
:precision="0" :precision="0"
@@ -288,7 +289,7 @@
prop="testConfig.waveRecord" prop="testConfig.waveRecord"
> >
<el-input-number <el-input-number
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
style="width: 240px" style="width: 240px"
v-model="formContent.testConfig.waveRecord" v-model="formContent.testConfig.waveRecord"
:precision="0" :precision="0"
@@ -306,7 +307,7 @@
prop="testConfig.realTime" prop="testConfig.realTime"
> >
<el-input-number <el-input-number
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
style="width: 240px" style="width: 240px"
v-model="formContent.testConfig.realTime" v-model="formContent.testConfig.realTime"
:precision="0" :precision="0"
@@ -324,7 +325,7 @@
prop="testConfig.statistics" prop="testConfig.statistics"
> >
<el-input-number <el-input-number
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
style="width: 240px" style="width: 240px"
v-model="formContent.testConfig.statistics" v-model="formContent.testConfig.statistics"
:precision="0" :precision="0"
@@ -342,7 +343,7 @@
prop="testConfig.flicker" prop="testConfig.flicker"
> >
<el-input-number <el-input-number
:disabled="isSelectDisabled" :disabled="isSelectDisabled || allDisabled"
style="width: 240px" style="width: 240px"
v-model="formContent.testConfig.flicker" v-model="formContent.testConfig.flicker"
:precision="0" :precision="0"
@@ -369,10 +370,10 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import {CascaderOption, ElMessage, type FormItemRule} from 'element-plus' import { CascaderOption, ElMessage, type FormItemRule } from 'element-plus'
import {computed, defineProps, reactive, ref} from 'vue' import { computed, defineProps, reactive, ref } from 'vue'
import {dialogBig} from '@/utils/elementBind' import { dialogBig } from '@/utils/elementBind'
import {type Plan} from '@/api/plan/interface' import { type Plan } from '@/api/plan/interface'
import { import {
addPlan, addPlan,
getBoundPqDevList, getBoundPqDevList,
@@ -383,23 +384,23 @@ import {
getUnboundPqDevList, getUnboundPqDevList,
updatePlan updatePlan
} from '@/api/plan/plan.ts' } from '@/api/plan/plan.ts'
import {useDictStore} from '@/stores/modules/dict' import { useDictStore } from '@/stores/modules/dict'
import {type TestSource} from '@/api/device/interface/testSource' import { type TestSource } from '@/api/device/interface/testSource'
import {type TestScript} from '@/api/device/interface/testScript' import { type TestScript } from '@/api/device/interface/testScript'
import {type ErrorSystem} from '@/api/device/interface/error' import { type ErrorSystem } from '@/api/device/interface/error'
import {type Device} from '@/api/device/interface/device' import { type Device } from '@/api/device/interface/device'
import {getPqReportAllName} from '@/api/device/report/index.ts' import { getPqReportAllName } from '@/api/device/report/index.ts'
import {useAppSceneStore, useModeStore} from '@/stores/modules/mode' import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'
import {Download} from '@element-plus/icons-vue' import { Download } from '@element-plus/icons-vue'
import {getAllPqStandardDev} from '@/api/device/standardDevice/index.ts' import { getAllPqStandardDev } from '@/api/device/standardDevice/index.ts'
import {StandardDevice} from '@/api/device/interface/standardDevice' import { StandardDevice } from '@/api/device/interface/standardDevice'
import {Dict} from '@/api/system/dictionary/interface' import { Dict } from '@/api/system/dictionary/interface'
import {getDictTreeByCode} from '@/api/system/dictionary/dictTree' import { getDictTreeByCode } from '@/api/system/dictionary/dictTree'
import {getAllUser} from '@/api/user/user' import { getAllUser } from '@/api/user/user'
import ImportExcel from '@/components/ImportExcel/index.vue' import ImportExcel from '@/components/ImportExcel/index.vue'
import {downloadTemplate, importPqDev} from '@/api/device/device/index' import { downloadTemplate, importPqDev } from '@/api/device/device/index'
import {getTestConfig} from '@/api/system/base' import { getTestConfig } from '@/api/system/base'
import {getRegRes} from '@/api/system/versionRegister' import { getRegRes } from '@/api/system/versionRegister'
const modeStore = useModeStore() const modeStore = useModeStore()
const AppSceneStore = useAppSceneStore() const AppSceneStore = useAppSceneStore()
@@ -432,7 +433,7 @@ const isSelectDisabled = ref(false)
const planType = ref<number>(0) const planType = ref<number>(0)
const subPlanBindStandardDev = ref<any>([]) //哪些标准设备已经被子计划绑定 const subPlanBindStandardDev = ref<any>([]) //哪些标准设备已经被子计划绑定
const activeNames = ref(['1']) const activeNames = ref(['1'])
const allDisabled = ref(false)
const generateData = () => { const generateData = () => {
const manufacturerDict = dictStore.getDictData('Dev_Manufacturers') const manufacturerDict = dictStore.getDictData('Dev_Manufacturers')
unboundPqDevList.value.forEach(i => { unboundPqDevList.value.forEach(i => {
@@ -447,8 +448,8 @@ const generateData = () => {
const unboundData = unboundPqDevList.value.map((i: Device.ResPqDev) => ({ const unboundData = unboundPqDevList.value.map((i: Device.ResPqDev) => ({
key: i.id, key: i.id,
label: JSON.stringify(i) label: JSON.stringify(i),
//tips: i.description disabled: allDisabled.value
})) }))
boundPqDevList.value.forEach(i => { boundPqDevList.value.forEach(i => {
// 确保字段不为空且字典存在再进行查找 // 确保字段不为空且字典存在再进行查找
@@ -463,7 +464,7 @@ const generateData = () => {
key: i.id, key: i.id,
label: JSON.stringify(i), label: JSON.stringify(i),
//tips: i.description //tips: i.description
disabled: i.checkState != 0 || i.assign == 1 disabled: i.checkState != 0 || i.assign == 1 || allDisabled.value
})) }))
allData.value = [...unboundData, ...boundData] allData.value = [...unboundData, ...boundData]
} }
@@ -522,7 +523,8 @@ function useMetaInfo() {
statistics: 0, statistics: 0,
flicker: 0, flicker: 0,
maxTime: 3 maxTime: 3
} },
importFlag: 0
}) })
return { dialogVisible, titleType, formContent } return { dialogVisible, titleType, formContent }
} }
@@ -569,7 +571,8 @@ const resetFormContent = () => {
statistics: 0, statistics: 0,
flicker: 0, flicker: 0,
maxTime: 3 maxTime: 3
} },
importFlag: 0
}) })
} }
@@ -736,7 +739,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
if (sign == 'add') { if (sign == 'add') {
resetFormContent() resetFormContent()
allDisabled.value = false
let pqSource_Result, let pqSource_Result,
PqScript_Result, PqScript_Result,
PqErrSys_Result, PqErrSys_Result,
@@ -818,6 +821,9 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
} else { } else {
isSelectDisabled.value = true isSelectDisabled.value = true
} }
if (data.importFlag === 1) {
allDisabled.value = true
}
} }
Object.assign(formContent, { ...data }) Object.assign(formContent, { ...data })

View File

@@ -68,7 +68,7 @@
type="primary" type="primary"
v-auth.plan="'edit'" v-auth.plan="'edit'"
link link
:icon="EditPen" icon="EditPen"
@click="openDialog('edit', scope.row)" @click="openDialog('edit', scope.row)"
> >
编辑 编辑
@@ -89,12 +89,12 @@
<el-button <el-button
type="primary" type="primary"
link link
icon="View" icon="Cpu"
@click="openChildrenPlan(scope.row)" @click="openChildrenPlan(scope.row)"
v-if="modeStore.currentMode == '比对式' && scope.row.fatherPlanId == 0" v-if="modeStore.currentMode == '比对式' && scope.row.importFlag == 1"
v-auth.plan="'import_subplan'" v-auth.plan="'import_subplan'"
> >
查看 被检设备
</el-button> </el-button>
<!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> --> <!-- <el-button type='primary' link :icon='List' @click='showDeviceOpen(scope.row)'>设备绑定</el-button> -->
<el-button <el-button
@@ -146,7 +146,7 @@
<script setup lang="tsx" name="useProTable"> <script setup lang="tsx" name="useProTable">
import ProTable from '@/components/ProTable/index.vue' import ProTable from '@/components/ProTable/index.vue'
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface' import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
import { CirclePlus, Delete, Download, EditPen, List, Upload } from '@element-plus/icons-vue' import { CirclePlus, Delete, Download, List, Upload } from '@element-plus/icons-vue'
import { import {
deletePlan, deletePlan,
downloadTemplate, downloadTemplate,