From 863e009aacba6079b82a1a4bedf9ed47370b8138 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: Wed, 27 May 2026 13:48:58 +0800
Subject: [PATCH] 修改

---
 src/views/work/assetMng/toolsMonitorMeasure/annualVerificationPlan/index.vue |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 103 insertions(+), 3 deletions(-)

diff --git a/src/views/work/assetMng/toolsMonitorMeasure/annualVerificationPlan/index.vue b/src/views/work/assetMng/toolsMonitorMeasure/annualVerificationPlan/index.vue
index c09efcf..aa3243b 100644
--- a/src/views/work/assetMng/toolsMonitorMeasure/annualVerificationPlan/index.vue
+++ b/src/views/work/assetMng/toolsMonitorMeasure/annualVerificationPlan/index.vue
@@ -32,8 +32,9 @@
         <el-form-item >
           <el-button  type="primary" @click="getList">查询</el-button>
           <el-button  type="primary" plain @click="reset">重置</el-button>
-          <el-button type="primary" plain @click="openDialog('edit',dataList)" v-if="data.hasInfo" v-hasPermi="['annualVerificationPlan:list:edit']">编辑</el-button>
+          <el-button type="primary"  @click="openDialog('edit',dataList)" v-if="data.hasInfo" v-hasPermi="['annualVerificationPlan:list:edit']">编辑</el-button>
           <el-button type="primary" plain @click="downloadFile()" v-if="data.hasInfo">导出</el-button>
+          <el-button  type="primary" plain @click="copy">复制</el-button>
 <!--          <el-button type="primary">导出</el-button>-->
         </el-form-item>
       </el-form>
@@ -203,6 +204,49 @@
 <!--    />-->
 
     <edit-dialog ref="dialogRef" @getList=getList></edit-dialog>
+    <el-dialog
+        v-model="copyVisible"
+        width="500px"
+        :before-close="handleCloseCopy"
+        :close-on-press-escape="false"
+        :close-on-click-modal="false"
+    >
+      <div v-if="data.isAdmin">
+        <span style="display:block;margin-bottom: 8px">单位名称:</span>
+        <el-select
+            v-model="queryParams.companyId"
+            filterable
+            style="width: 100%;margin-bottom: 8px"
+        >
+          <el-option
+              v-for="item in data.companyList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+          />
+        </el-select>
+      </div>
+      <span style="display:block;margin-bottom: 8px">将以下年份数据:</span>
+      <el-date-picker
+          v-model="data.sourceYear"
+          type="year"
+          value-format="YYYY"
+          style="margin-bottom: 8px;width: 100%;"
+          placeholder="请选择"
+      />
+      <span style="display:block;margin-bottom: 8px">复制到:</span>
+      <el-date-picker
+          v-model="data.targetYear"
+          type="year"
+          value-format="YYYY"
+          style="margin-bottom: 8px;width: 100%"
+          placeholder="请选择"
+      />
+      <div class="dialog-footer" style="display: flex;justify-content: right">
+        <el-button @click="handleCloseCopy" size="default">取 消</el-button>
+        <el-button type="primary"  @click="onSubmitCopy" size="default" v-preReClick>确认</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -220,10 +264,12 @@
   getMaintenanceEvaluateList
 } from "@/api/infrastructureMng/ledger";
 import {
+  copyAnnualVerificationPlan,
   delAnnualVerificationPlan,
   getAnnualVerificationPlanDetail,
   getAnnualVerificationPlanList
 } from "@/api/assetManage/assetMng";
+import {copyControl} from "@/api/environment/factors";
 
 
 const userStore = useUserStore()
@@ -242,10 +288,13 @@
   companyList: [],
   isAdmin: false,
   baseUrl: import.meta.env.VITE_APP_BASE_API,
-  hasInfo: false
+  hasInfo: false,
+  copyVisible:false,
+  targetYear:'',
+  sourceYear:'',
 });
 
-const { queryParams, total, dataList,companyList, isAdmin } = toRefs(data);
+const { queryParams, total, dataList,companyList, isAdmin, copyVisible } = toRefs(data);
 const userInfo = ref()
 onMounted(async ()=>{
   data.queryParams.year = new Date().getFullYear().toString()
@@ -379,5 +428,56 @@
         }
       })
 }
+const copy = () => {
+
+  data.copyVisible = true
+}
+const onSubmitCopy = async () => {
+  if(data.isAdmin && !data.queryParams.companyId){
+    ElMessage.warning('请先选择单位')
+    return
+  }
+  if(!data.sourceYear){
+    ElMessage.warning('请先选择要复制的年份')
+    return
+  }
+  if(!data.targetYear){
+    ElMessage.warning('请选择目标年份')
+    return
+  }
+  ElMessageBox.confirm(
+      '该操作将覆盖目标年份的数据,是否继续?',
+      '提示',
+      {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+      .then( async() => {
+        const param = {
+          companyId: data.queryParams.companyId,
+          sourceYear: data.sourceYear,
+          targetYear: data.targetYear
+        }
+        const res = await copyAnnualVerificationPlan(param);
+        if(res.code === 200){
+          ElMessage({
+            type: 'success',
+            message: res.data
+          });
+          await handleCloseCopy()
+          await getList();
+
+        }else{
+          ElMessage.warning(res.message)
+        }
+      }).catch(err => {
+  })
+}
+const handleCloseCopy = () => {
+  data.targetYear=''
+  data.sourceYear=''
+  data.copyVisible = false
+}
 
 </script>

--
Gitblit v1.9.2