From d4534c231f7c25ca64d40c8bcaadf83f64b640c3 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: 星期五, 12 十二月 2025 11:05:43 +0800
Subject: [PATCH] 修改新增

---
 src/views/work/financialMng/qualityFinancialAnalysis/index.vue |  112 +++++++++++++++++++++++++++++++------------------------
 1 files changed, 63 insertions(+), 49 deletions(-)

diff --git a/src/views/work/financialMng/qualityFinancialAnalysis/index.vue b/src/views/work/financialMng/qualityFinancialAnalysis/index.vue
index 9f0f77c..c1dc649 100644
--- a/src/views/work/financialMng/qualityFinancialAnalysis/index.vue
+++ b/src/views/work/financialMng/qualityFinancialAnalysis/index.vue
@@ -8,9 +8,10 @@
               plain
               icon="Plus"
               @click="openDialog('add',{})"
+              v-hasPermi="['qualityFinancialAnalysis:list:add']"
           >新增</el-button>
         </el-form-item>
-        <el-form-item label="企业名称:" v-if="data.isAdmin" style="margin-left: 20px">
+        <el-form-item label="单位名称:" v-if="data.isAdmin" style="margin-left: 20px">
           <el-select v-model="data.queryParams.companyId" placeholder="请选择" filterable clearable>
             <el-option
                 v-for="item in data.companyList"
@@ -57,17 +58,17 @@
     <el-table v-loading="loading" :data="dataList" :border="true"  @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" />
       <el-table-column type="index" label="序号" width="80" align="center"></el-table-column>
+      <el-table-column label="单位名称" prop="companyName" align="center" v-if="data.isAdmin" />
       <el-table-column label="名称" prop="year" align="center"  >
         <template #default="scope">
-          <span>年质量经济性分析报告</span>
+          <span>{{scope.row.year}}年质量经济性分析报告</span>
         </template>
       </el-table-column>
-      <el-table-column label="目标测量方法" prop="method" align="center"  />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160" >
         <template #default="scope">
-          <el-button link type="primary"  @click="openDialog('review',scope.row)" >查看</el-button>
-          <el-button link type="primary"  @click="openDialog('edit',scope.row)" >编辑</el-button>
-          <el-button link type="danger"  @click="handleDelete(scope.row)" >删除</el-button>
+          <el-button link type="primary"  @click="openDialog('review',scope.row)">查看</el-button>
+          <el-button link type="primary"  @click="openDialog('edit',scope.row)" v-hasPermi="['qualityFinancialAnalysis:list:edit']">编辑</el-button>
+          <el-button link type="danger"  @click="handleDelete(scope.row)" v-hasPermi="['qualityFinancialAnalysis:list:del']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -93,10 +94,9 @@
 import {ElMessage, ElMessageBox} from "element-plus";
 import {getCompany} from "@/api/onlineEducation/company";
 import Cookies from "js-cookie";
-import {generateWordDocument} from "@/utils/exportWord";
-import {delObject, getObjectPage} from "@/api/qualityObjectives/object";
 import { Document, Paragraph, TextRun, Table, TableRow, TableCell,BorderStyle , Packer, AlignmentType, HeadingLevel } from "docx";
 import { saveAs } from "file-saver";
+import {delEconomy, getEconomy} from "@/api/qualityFinancialAnalysis";
 const { proxy } = getCurrentInstance();
 const loading = ref(false);
 const noticeRef = ref();
@@ -134,16 +134,6 @@
       label: '2021'
     },
   ],
-  levelList: [
-    {
-      value: 1,
-      label: '公司级'
-    },
-    {
-      value: 2,
-      label: '部门级'
-    },
-  ]
 });
 const dataList = ref([]);
 const total = ref(0);
@@ -165,17 +155,15 @@
   }
 });
 const getList = async () => {
-  // loading.value = true;
-  // const res = await getObjectPage(data.queryParams);
-  // if(res.code === 200){
-  //   dataList.value = res.data.list
-  //   total.value = res.data.total
-  // }else{
-  //   ElMessage.warning(res.message)
-  // }
-  // loading.value = false;
-  dataList.value = [{}]
-
+  loading.value = true;
+  const res = await getEconomy(data.queryParams);
+  if(res.code === 200){
+    dataList.value = res.data.list
+    total.value = res.data.total
+  }else{
+    ElMessage.warning(res.message)
+  }
+  loading.value = false;
 }
 
 const searchClick = () => {
@@ -270,7 +258,7 @@
         type: 'warning',
       })
       .then( async() => {
-        const res = await delObject(val.id);
+        const res = await delEconomy(val.id);
         if(res.code === 200){
           ElMessage({
             type: 'success',
@@ -377,10 +365,7 @@
 `;
 // 3. 创建完整报告文档
 async function createQualityEconomicReport(data) {
-  data = {
-    time: 'xx',
-    basicInfo: 'x'
-  }
+
   const doc = new Document({
     sections: [{
       properties: {},
@@ -401,13 +386,13 @@
           spacing: { after: 300 }
         }),
 
-        // 报告时间范围
-        new Paragraph({
-          text: data.time,
-          alignment: AlignmentType.CENTER,
-          indent: { left: 3700 },
-          spacing: { after: 500 }
-        }),
+        // // 报告时间范围
+        // new Paragraph({
+        //   text: data.dutyTime,
+        //   alignment: AlignmentType.CENTER,
+        //   indent: { left: 3700 },
+        //   spacing: { after: 500 }
+        // }),
 
         // 1. 基本情况
         new Paragraph({
@@ -428,7 +413,7 @@
         new Paragraph({
           children: [
             new TextRun({
-              text: data.basicInfo, // 替换为实际内容
+              text: data.basic, // 替换为实际内容
               font: "宋体", // 与标题一致
               size: 20, // 小四号(20 half-points)
               bold: false, // 常规
@@ -454,7 +439,7 @@
           spacing: { after: 100 }
         }),
         // 二、综合分析内容
-        ...convertHtmlToDocx(data.sampleTableHTML),
+        ...convertHtmlToDocx(data.synthesize),
         new Paragraph({
           children: [
           ],
@@ -483,7 +468,7 @@
         new Paragraph({
           children: [
             new TextRun({
-              text: data.lose, // 替换为实际内容
+              text: data.damage, // 替换为实际内容
               font: "宋体", // 与标题一致
               size: 20, // 小四号(20 half-points)
               bold: false, // 常规
@@ -513,7 +498,36 @@
         new Paragraph({
           children: [
             new TextRun({
-              text: data.action, // 替换为实际内容
+              text: data.measure, // 替换为实际内容
+              font: "宋体", // 与标题一致
+              size: 20, // 小四号(20 half-points)
+              bold: false, // 常规
+              color: "000000" // 纯黑
+            })
+          ],
+          alignment: AlignmentType.LEFT,
+          spacing: { after: 300 } // 和下一段的间距
+        }),
+          //五、分析结果
+        new Paragraph({
+          children: [
+            new TextRun({
+              text: "六、分析结果",
+              font: "宋体",
+              size: 22,
+              bold: true,
+              color: "000000"
+            })
+          ],
+          heading: HeadingLevel.HEADING_1,
+          alignment: AlignmentType.LEFT,
+          spacing: { after: 100 }
+        }),
+        //分析结果内容
+        new Paragraph({
+          children: [
+            new TextRun({
+              text: data.suggest, // 替换为实际内容
               font: "宋体", // 与标题一致
               size: 20, // 小四号(20 half-points)
               bold: false, // 常规
@@ -528,7 +542,7 @@
         new Paragraph({
           children: [
             new TextRun({
-              text: "五、改进建议",
+              text: "六、改进建议",
               font: "宋体",
               size: 22,
               bold: true,
@@ -556,14 +570,14 @@
 
         // 10. 综合部落款
         new Paragraph({
-          text: data.deptName,
+          text: data.dutyName,
           alignment: AlignmentType.RIGHT,
           spacing: { before: 1200 }
         }),
 
         // 11. 日期落款
         new Paragraph({
-          text: data.lastTime,
+          text: data.dutyTime,
           alignment: AlignmentType.RIGHT,
           spacing: { before: 200 }
         })
@@ -572,7 +586,7 @@
   });
   // 导出文件
   const blob = await Packer.toBlob(doc);
-  saveAs(blob, "质量经济性分析报告.docx");
+  saveAs(blob, data.companyName + "_质量经济性分析报告.docx");
 }
 
 

--
Gitblit v1.9.2