ADD:添加导出子计划元信息和导入检修计划按钮逻辑
This commit is contained in:
@@ -26,21 +26,20 @@
|
||||
<ProTable ref="proTable" :columns="columns" :request-api="getTableList" type="selection">
|
||||
<!-- 表格 header 按钮 -->
|
||||
<template #tableHeader="scope">
|
||||
<el-button type="primary" :icon="CirclePlus" @click="addTab('add')" v-if="!isTabPlanFather">
|
||||
<el-button type="primary" icon="CirclePlus" @click="addTab('add')" v-if="!isTabPlanFather">
|
||||
新增子计划
|
||||
</el-button>
|
||||
<el-button type="primary" :icon="CirclePlus" @click="addTab('edit')" v-if="isTabPlanFather">
|
||||
<el-button type="primary" icon="Edit" @click="addTab('edit')" v-if="isTabPlanFather">
|
||||
编辑子计划
|
||||
</el-button>
|
||||
<!-- <el-button type="primary" :icon="Upload" >
|
||||
导出检测方案
|
||||
</el-button>
|
||||
<el-button type="primary" :icon="Download" >
|
||||
导入检测结果
|
||||
</el-button> -->
|
||||
<el-button type="primary" icon="Download" @click="exportPlan" v-if="isTabPlanFather">
|
||||
导出子计划元信息
|
||||
</el-button>
|
||||
<el-button type="primary" icon="Upload">导入检测结果</el-button>
|
||||
<el-button type="primary" icon="Box" v-if="!isTabPlanFather">数据合并</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
:icon="Delete"
|
||||
icon="Delete"
|
||||
plain
|
||||
:disabled="!scope.isSelected"
|
||||
v-if="isTabPlanFather"
|
||||
@@ -56,7 +55,7 @@
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="ScaleToOriginal"
|
||||
icon="ScaleToOriginal"
|
||||
style="margin-left: 10px"
|
||||
v-if="!isTabPlanFather"
|
||||
:disabled="!scope.isSelected"
|
||||
@@ -82,7 +81,7 @@
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
:icon="ScaleToOriginal"
|
||||
icon="ScaleToOriginal"
|
||||
style="margin-left: 10px"
|
||||
v-if="!isTabPlanFather"
|
||||
>
|
||||
@@ -106,7 +105,7 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:icon="Delete"
|
||||
icon="Delete"
|
||||
v-if="!isTabPlanFather"
|
||||
:disabled="scope.row.checkState != 0"
|
||||
@click="handleRemove(scope.row)"
|
||||
@@ -116,7 +115,7 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
:icon="Delete"
|
||||
icon="Delete"
|
||||
v-if="isTabPlanFather"
|
||||
@click="subHandleRemove(scope.row)"
|
||||
>
|
||||
@@ -133,17 +132,17 @@
|
||||
<script setup lang="tsx">
|
||||
import { ElMessage, ElMessageBox, TabPaneName } from 'element-plus'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { CirclePlus, Delete, ScaleToOriginal } from '@element-plus/icons-vue'
|
||||
import PlanPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||
import { Plan } from '@/api/plan/interface'
|
||||
import { useModeStore } from '@/stores/modules/mode' // 引入模式 store
|
||||
import { ColumnProps, ProTableInstance, SearchRenderScope } from '@/components/ProTable/interface'
|
||||
import { deletePlan, getDevListByPlanId, subPlanBindDev } from '@/api/plan/plan'
|
||||
import { deletePlan, exportSubPlan, getDevListByPlanId, subPlanBindDev } from '@/api/plan/plan'
|
||||
import { Device } from '@/api/device/interface/device'
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import DevTransfer from '@/views/plan/planList/components/devTransfer.vue'
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
import router from '@/routers'
|
||||
import { useDownload } from '@/hooks/useDownload'
|
||||
|
||||
const dictStore = useDictStore()
|
||||
const planFormContent = ref<Plan.ReqPlan>()
|
||||
@@ -499,7 +498,7 @@ const handleRemove = async (row: any) => {
|
||||
|
||||
//子计划下移除被检设备
|
||||
const subHandleRemove = async (row: any) => {
|
||||
ElMessageBox.confirm(`确定要移除计划【${row.name}】吗?`, '提示', {
|
||||
ElMessageBox.confirm(`确定要移除被检设备【${row.name}】吗?`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
@@ -554,6 +553,16 @@ const handleClose = () => {
|
||||
router.push('/plan/planList')
|
||||
}
|
||||
|
||||
const exportPlan = async () => {
|
||||
// 从 planFormContent.value?.children 中找到 id 与 item.name 匹配的子计划
|
||||
const subPlanFormContent = planFormContent.value?.children?.find(child => child.id === planId.value)
|
||||
const params = {
|
||||
id: subPlanFormContent.id
|
||||
}
|
||||
ElMessageBox.confirm(`确认导出${subPlanFormContent.name}子计划元信息?`, '温馨提示', { type: 'warning' }).then(() =>
|
||||
useDownload(exportSubPlan, `${subPlanFormContent.name}_子计划元信息`, params, false, '.zip')
|
||||
)
|
||||
}
|
||||
defineExpose({ open, handleTableDataUpdate })
|
||||
|
||||
interface ChildrenPlanProps {
|
||||
@@ -566,10 +575,10 @@ const props = withDefaults(defineProps<ChildrenPlanProps>(), {
|
||||
width: 800,
|
||||
height: 744
|
||||
})
|
||||
|
||||
// const props = defineProps<{
|
||||
// refreshTable: (() => Promise<void>) | undefined;
|
||||
// width: {
|
||||
// type: Number,
|
||||
// default: 800,
|
||||
// },
|
||||
// height: {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user