From 1da948c1c8808077f10e3aa32fafd30939ee5c12 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 03 十二月 2024 16:37:39 +0800
Subject: [PATCH] 新增

---
 src/views/safetyReview/expertManage/postEvaluation/components/expertList.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/src/views/safetyReview/expertManage/postEvaluation/components/expertList.vue b/src/views/safetyReview/expertManage/postEvaluation/components/expertList.vue
index d5a6e59..dc2eed4 100644
--- a/src/views/safetyReview/expertManage/postEvaluation/components/expertList.vue
+++ b/src/views/safetyReview/expertManage/postEvaluation/components/expertList.vue
@@ -41,7 +41,9 @@
             <el-table-column label="考评总分" align="center" prop="score" />
             <el-table-column v-if="title == '专家评估'" label="操作" align="center" class-name="small-padding fixed-width">
               <template #default="scope">
-                <el-button type="primary" link @click="openEvaluate(scope.row)">评分</el-button>
+                <el-button v-if="scope.row.evaluationState ==0" type="primary" link @click="openEvaluate('add',scope.row)">考评与报销</el-button>
+                <el-button v-if="scope.row.evaluationState ==1" type="primary" link @click="openEvaluate('view',scope.row)">查看</el-button>
+                <el-button v-if="scope.row.evaluationState ==1" type="success" link @click="downloadFile(scope.row)">导出考评表</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -66,8 +68,10 @@
 import {ElMessage} from "element-plus";
 import Evaluate from "./evaluate";
 import {
+  getExpertEvaDetail,
   getProjectExpertEvaluationList,
 } from "@/api/backManage/evaluate";
+import {generateWordDocument} from "@/views/safetyReview/projectManage/components/exportWord";
 const dialogVisible = ref(false);
 const evaluateRef = ref()
 const emit = defineEmits(["getList"]);
@@ -80,8 +84,15 @@
     pageSize: 10
   },
   projectName: '',
+  deptName: '',
   projectCheckTime: '',
-  title: ''
+  title: '',
+  rateList: [
+    {label: '优秀',value: 1},
+    {label: '合格',value: 2},
+    {label: '基本合格',value: 3},
+    {label: '不合格',value: 4}
+  ]
 })
 const {tableData,total,queryParams,projectName,title,projectCheckTime} = toRefs(state)
 const openDialog = async (type,value) => {
@@ -92,6 +103,7 @@
   }
   state.queryParams.id = value.id
   state.projectName = value.projectName
+  state.deptName = value.deptName
   state.projectCheckTime = value.projectCheckTime
   await getEvaluationList()
   dialogVisible.value = true;
@@ -107,8 +119,48 @@
   }
 }
 
-const openEvaluate = (value)=>{
-  evaluateRef.value.openDialog(value,state.projectName,state.projectCheckTime)
+
+const downloadFile = async (val) => {
+  const res = await getExpertEvaDetail({projectExpertId: val.id});
+  if(res.code == 200){
+    let outData = res.data
+    outData.deptName = state.deptName
+    outData.name = val.name
+    outData.sex = val.sex == 0?'男':'女'
+    outData.domain = val.domain
+    outData.professionalEthics = state.rateList.find(i=>i.value == res.data.professionalEthics)?.label
+    outData.impartialHonest = state.rateList.find(i=>i.value == res.data.impartialHonest)?.label
+    outData.comprehensiveCoordination = state.rateList.find(i=>i.value == res.data.comprehensiveCoordination)?.label
+    outData.professionalAbility = state.rateList.find(i=>i.value == res.data.professionalAbility)?.label
+    outData.expressingOpinions = state.rateList.find(i=>i.value == res.data.expressingOpinions)?.label
+    outData.comprehensiveEvaluation = state.rateList.find(i=>i.value == res.data.comprehensiveEvaluation)?.label
+    try {
+      generateWordDocument('/evaluateFile.docx',outData, outData.name + '专家考评表.docx');
+    } catch (error){
+      ElMessage({
+        type: 'warning',
+        message: '导出失败'
+      });
+    }
+  }else{
+    ElMessage.warning(res.msg)
+  }
+  // data.companyName = data.companyName != '' ? data.companyName: '-'
+  // data.projectCheckTime = data.projectCheckTime != '' ? data.projectCheckTime: '-'
+  // data.tableData = state.dataList.map(item => {
+  //   return {
+  //     ...item,
+  //     ratingLevel: item.ratingLevel == 1 ? '一级' : item.ratingLevel == 2 ? '二级':item.ratingLevel == 3 ? '三级' : '',
+  //     sex: item.sex == 0 ? '男' : '女',
+  //     selectionMode: item.selectionMode == 1 ? '固定' : '随机',
+  //     teamLeader: item.teamLeader == 1 ? '是' : '否',
+  //   }
+  // })
+
+};
+
+const openEvaluate = (type,value)=>{
+  evaluateRef.value.openDialog(type,value,state.projectName,state.projectCheckTime)
 }
 
 const closeEvaluate = ()=>{

--
Gitblit v1.9.2