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