祖安之光
2025-06-27 b609f77709c4646daf155341475ae14fc0c7943d
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,37 @@
    pageSize: 10
  },
  projectName: '',
  deptName: '',
  projectCheckTime: '',
  title: ''
  title: '',
  rateList: [
    {label: '优秀',value: 1},
    {label: '合格',value: 2},
    {label: '基本合格',value: 3},
    {label: '不合格',value: 4}
  ],
  directionList: [
    {
      value: '1',
      label: '现场检查'
    },
    {
      value: '2',
      label: '调查评估'
    },
    {
      value: '3',
      label: '咨询服务'
    },
    {
      value: '4',
      label: '教育培训'
    },
    {
      value: '5',
      label: '其他'
    }
  ]
})
const {tableData,total,queryParams,projectName,title,projectCheckTime} = toRefs(state)
const openDialog = async (type,value) => {
@@ -92,6 +125,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 +141,49 @@
  }
}
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.jobCategory = res.data.jobCategory?res.data.jobCategory.split(',').map(item=>{ return state.directionList.find(i=>i.value == item)?.label}):'暂无'
    outData.professionalEthicsList = state.rateList.map(i => ({...i, checked: i.value !== res.data.professionalEthics}))
    outData.impartialHonestList = state.rateList.map(i=> ({...i, checked: i.value !== res.data.impartialHonest}))
    outData.comprehensiveCoordinationList = state.rateList.map(i=> ({...i, checked: i.value !== res.data.comprehensiveCoordination}))
    outData.professionalAbilityList = state.rateList.map(i=> ({...i, checked: i.value !== res.data.professionalAbility}))
    outData.expressingOpinionsList = state.rateList.map(i=> ({...i, checked: i.value !== res.data.expressingOpinions}))
    outData.comprehensiveEvaluationList = state.rateList.map(i=> ({...i, checked: i.value !== res.data.comprehensiveEvaluation}))
    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 = ()=>{