ADD: 是否下载检测报告选择

This commit is contained in:
贾同学
2025-09-01 09:36:32 +08:00
parent 4364f88526
commit f5f7d259a9

View File

@@ -1,108 +1,108 @@
<!--单列--> <!--单列-->
<template> <template>
<el-dialog <el-dialog
class="table-box"
v-model="dialogVisible" v-model="dialogVisible"
top="114px" :modal="false"
:style="{ height: height + 'px', maxHeight: height + 'px', overflow: 'hidden' }" :style="{ height: height + 'px', maxHeight: height + 'px', overflow: 'hidden' }"
:title="title" :title="title"
:width="width" :width="width"
:modal="false" class="table-box"
top="114px"
@close="handleClose" @close="handleClose"
> >
<div <div
class="table-box"
:style="{ height: height - 64 + 'px', maxHeight: height - 64 + 'px', overflow: 'hidden' }" :style="{ height: height - 64 + 'px', maxHeight: height - 64 + 'px', overflow: 'hidden' }"
class="table-box"
> >
<el-tabs v-model="editableTabsValue" type="card" @tab-remove="removeTab" @tab-click="handleTabClick"> <el-tabs v-model="editableTabsValue" type="card" @tab-remove="removeTab" @tab-click="handleTabClick">
<el-tab-pane <el-tab-pane
v-for="item in editableTabs" v-for="item in editableTabs"
:key="item.name" :key="item.name"
:closable="item.closable"
:label="item.title" :label="item.title"
:name="item.name" :name="item.name"
:closable="item.closable"
></el-tab-pane> ></el-tab-pane>
</el-tabs> </el-tabs>
<ProTable :key="planId" ref="proTable" :columns="columns" :request-api="getTableList" type="selection"> <ProTable :key="planId" ref="proTable" :columns="columns" :request-api="getTableList" type="selection">
<!-- 表格 header 按钮 --> <!-- 表格 header 按钮 -->
<template #tableHeader="scope"> <template #tableHeader="scope">
<el-button <el-button
v-auth.plan="'add_subplan'"
type="primary"
icon="CirclePlus"
@click="addTab('add')"
v-if="!isTabPlanFather" v-if="!isTabPlanFather"
v-auth.plan="'add_subplan'"
icon="CirclePlus"
type="primary"
@click="addTab('add')"
> >
新增子计划 新增子计划
</el-button> </el-button>
<el-button <el-button
v-auth.plan="'add_subplan'"
type="primary"
icon="Edit"
@click="addTab('edit')"
v-if="isTabPlanFather" v-if="isTabPlanFather"
v-auth.plan="'add_subplan'"
icon="Edit"
type="primary"
@click="addTab('edit')"
> >
编辑子计划 编辑子计划
</el-button> </el-button>
<el-button <el-button
type="primary" v-if="isTabPlanFather"
v-auth.plan="'export_subplan'" v-auth.plan="'export_subplan'"
icon="Download" icon="Download"
type="primary"
@click="exportPlan" @click="exportPlan"
v-if="isTabPlanFather"
> >
导出子计划元信息 导出子计划元信息
</el-button> </el-button>
<el-button <el-button
type="primary"
icon="Download"
v-auth.plan="'import_subplan'" v-auth.plan="'import_subplan'"
@click="exportPlanCheckResultData(scope.selectedListIds)"
:disabled="!scope.isSelected" :disabled="!scope.isSelected"
icon="Download"
type="primary"
@click="exportPlanCheckResultData(scope.selectedListIds)"
> >
数据下载 数据下载
</el-button> </el-button>
<el-button <el-button
v-auth.plan="'add_subplan'"
type="primary"
icon="Upload"
@click="importSubCheckDataClick"
v-if="planFormContent && planFormContent?.children.length > 0" v-if="planFormContent && planFormContent?.children.length > 0"
v-auth.plan="'add_subplan'"
icon="Upload"
type="primary"
@click="importSubCheckDataClick"
> >
导入检测结果 导入检测结果
</el-button> </el-button>
<el-button <el-button
type="primary"
icon="Box"
v-auth.plan="'add_subplan'"
v-if="!isTabPlanFather && planFormContent && planFormContent?.children.length > 0" v-if="!isTabPlanFather && planFormContent && planFormContent?.children.length > 0"
v-auth.plan="'add_subplan'"
icon="Box"
type="primary"
@click="mergeSubCheckDataClick" @click="mergeSubCheckDataClick"
> >
数据合并 数据合并
</el-button> </el-button>
<el-button <el-button
type="danger" v-if="isTabPlanFather"
:disabled="!scope.isSelected"
icon="Delete" icon="Delete"
plain plain
:disabled="!scope.isSelected" type="danger"
v-if="isTabPlanFather"
@click="subBatchRemove(scope.selectedListIds)" @click="subBatchRemove(scope.selectedListIds)"
> >
批量移除 批量移除
</el-button> </el-button>
<el-dropdown <el-dropdown
v-auth.plan="'add_subplan'"
v-if="planFormContent && planFormContent?.children.length > 0" v-if="planFormContent && planFormContent?.children.length > 0"
trigger="hover" v-auth.plan="'add_subplan'"
placement="right-start"
:disabled="!scope.isSelected" :disabled="!scope.isSelected"
placement="right-start"
trigger="hover"
> >
<el-button <el-button
type="primary"
icon="ScaleToOriginal"
style="margin-left: 10px"
v-if="!isTabPlanFather" v-if="!isTabPlanFather"
:disabled="!scope.isSelected" :disabled="!scope.isSelected"
icon="ScaleToOriginal"
style="margin-left: 10px"
type="primary"
> >
分配被检设备 分配被检设备
</el-button> </el-button>
@@ -119,16 +119,16 @@
</template> </template>
</el-dropdown> </el-dropdown>
<el-dropdown <el-dropdown
v-auth.plan="'add_subplan'"
v-if="planFormContent && planFormContent?.children.length > 0" v-if="planFormContent && planFormContent?.children.length > 0"
trigger="hover" v-auth.plan="'add_subplan'"
placement="right-start" placement="right-start"
trigger="hover"
> >
<el-button <el-button
type="primary" v-if="!isTabPlanFather"
icon="ScaleToOriginal" icon="ScaleToOriginal"
style="margin-left: 10px" style="margin-left: 10px"
v-if="!isTabPlanFather" type="primary"
> >
标准设备管理 标准设备管理
</el-button> </el-button>
@@ -148,20 +148,20 @@
<!-- 表格操作 --> <!-- 表格操作 -->
<template #operation="scope"> <template #operation="scope">
<el-button <el-button
type="primary"
link
icon="Delete"
v-if="!isTabPlanFather" v-if="!isTabPlanFather"
:disabled="scope.row.checkState != 0" :disabled="scope.row.checkState != 0"
icon="Delete"
link
type="primary"
@click="handleRemove(scope.row)" @click="handleRemove(scope.row)"
> >
删除 删除
</el-button> </el-button>
<el-button <el-button
type="primary"
link
icon="Delete"
v-if="isTabPlanFather" v-if="isTabPlanFather"
icon="Delete"
link
type="primary"
@click="subHandleRemove(scope.row)" @click="subHandleRemove(scope.row)"
> >
移除 移除
@@ -171,12 +171,12 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 向计划导入/导出设备对话框 --> <!-- 向计划导入/导出设备对话框 -->
<PlanPopup :refresh-table="proTable?.getTableList" ref="planPopup" @update:tab="addNewChildTab" /> <PlanPopup ref="planPopup" :refresh-table="proTable?.getTableList" @update:tab="addNewChildTab" />
<DevTransfer ref="devTransfer" @update:table="addNewChildTab" /> <DevTransfer ref="devTransfer" @update:table="addNewChildTab" />
<ImportZip ref="planCheckDataImportZip" @result="importResult" /> <ImportZip ref="planCheckDataImportZip" @result="importResult" />
</template> </template>
<script setup lang="tsx"> <script lang="tsx" setup>
import { ElMessage, ElMessageBox, TabPaneName } from 'element-plus' import { ElFormItem, ElMessage, ElMessageBox, ElSwitch, TabPaneName } from 'element-plus'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件 import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
import { Plan } from '@/api/plan/interface' import { Plan } from '@/api/plan/interface'
@@ -342,7 +342,25 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
{ prop: 'operation', label: '操作', fixed: 'right', width: 100 } { prop: 'operation', label: '操作', fixed: 'right', width: 100 }
]) ])
const editableTabs = ref<any[]>([]) const editableTabs = ref<any[]>([])
const downloadReport = ref(0)
// 创建包含开关的VNode优化表单结构
const vnode = h('div', { style: { padding: '10px 0', margin: '0 60px' } }, [
h(ElForm, { labelWidth: '140px', inline: true }, () => [
h(ElFormItem, { label: '是否下载检测报告' }, () => [
h(ElSwitch, {
modelValue: downloadReport.value,
'onUpdate:modelValue': (val: number) => {
downloadReport.value = val
},
activeValue: 1,
inactiveValue: 0,
activeText: '是',
inactiveText: '否'
})
])
])
])
const renderTabs = () => { const renderTabs = () => {
const tabs = [] const tabs = []
// 主计划 tab // 主计划 tab
@@ -630,14 +648,23 @@ const exportPlan = async () => {
const exportPlanCheckResultData = async (selectedListIds: string[]) => { const exportPlanCheckResultData = async (selectedListIds: string[]) => {
const params = { const params = {
id: planFormContent.value.id, id: planFormContent.value.id,
report: 1, report: downloadReport.value,
devIds: selectedListIds.join(',') devIds: selectedListIds.join(',')
} }
ElMessageBox.confirm(`确认下载【${planFormContent.value.name}】勾选的被检设备等信息?`, '温馨提示', { ElMessageBox.confirm(vnode, '温馨提示', {
type: 'warning' type: '',
}).then(() => distinguishCancelAndClose: true,
useDownload(exportPlanCheckData, `${planFormContent.value.name}_检测计划检测数据包`, params, false, '.zip') confirmButtonText: '确定',
) cancelButtonText: '取消'
})
.then(() => {
params.report = downloadReport.value
useDownload(exportPlanCheckData, `${planFormContent.value.name}_检测计划检测数据包`, params, false, '.zip')
})
.catch(action => {
// 用户取消或关闭对话框
console.log('用户取消操作: ', action)
})
} }
const importSubCheckDataClick = () => { const importSubCheckDataClick = () => {