瀏覽代碼

导师带徒 - 师徒协议、导师带徒目标及计划和导师带徒考评表的Word模板上传、生成和下载

wangggziwen 1 年之前
父節點
當前提交
66e1fe7df2

+ 338 - 5
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsNewController.java

@@ -1,20 +1,32 @@
 package com.ruoyi.project.training.bccnew.controller;
 
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.data.*;
+import com.deepoove.poi.data.style.BorderStyle;
+import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import com.ruoyi.project.training.bccnew.domain.*;
 import com.ruoyi.project.training.bccnew.service.*;
-import com.ruoyi.project.training.newstaff.domain.TTnSchoolplan;
-import com.ruoyi.project.training.newstaff.domain.TTnTransferplan;
+import io.jsonwebtoken.lang.Assert;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -64,6 +76,18 @@ public class TTsNewController extends BaseController {
     @Autowired
     private ITTsFtplanService tTsFtplanService;
 
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Autowired
+    private ITTsYsplanService tsYsplanService;
+
+    @Autowired
+    private ITTsFlplanService tsFlplanService;
+
+    @Autowired
+    private ITTsFtplanService tsFtplanService;
+
     /**
      * 查询导师带徒列表
      */
@@ -171,8 +195,317 @@ public class TTsNewController extends BaseController {
     @PreAuthorize("@ss.hasPermi('bccnew:tsnew:add')")
     @Log(title = "导师带徒", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TTsNew tTsNew) {
-        return toAjax(tTsNewService.insertTTsNew(tTsNew));
+    public AjaxResult add(@RequestBody TTsNew tTsNew) throws IOException {
+        // 新增操作
+        int result = tTsNewService.insertTTsNew(tTsNew);
+        // 新增生成word
+        if (result != 0) {
+            this.genWordAfterInsert(tTsNew);
+        }
+        // 返回新增操作结果
+        return toAjax(result);
+    }
+
+    /**
+     * 新增生成word
+     */
+    private void genWordAfterInsert(TTsNew tTsNew) throws IOException {
+        // 生成word - Mentor Agreement
+        String mentorAgreementWordPath = this.genMentorAgreementWord(tTsNew);
+        // 生成word - Target Plan
+        String targetPlanWordPath = this.genTargetPlanWord(tTsNew);
+        // 生成word - Appraisal Form
+        String appraisalFormWordPath = this.genAppraisalFormWord(tTsNew);
+        // 更新文件地址
+        tTsNew.setMentorAgreementWordPath(mentorAgreementWordPath);
+        tTsNew.setTargetPlanWordPath(targetPlanWordPath);
+        tTsNew.setAppraisalFormWordPath(appraisalFormWordPath);
+        tTsNewService.updateTTsNew(tTsNew);
+    }
+
+    /**
+     * 生成word - Mentor Agreement
+     */
+    private String genMentorAgreementWord(TTsNew tTsNew) throws IOException {
+        //渲染文本
+        Map<String, Object> params = getMentorAgreementWordData(tTsNew);
+        // 模板路径
+        String templatePath = "static/word/training/mentorAgreement.docx";
+        // 生成word的路径
+        String fileDir = RuoYiConfig.getProfile() + "/" + "mentorAgreementWord";
+        // 生成word的文件名称
+        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
+        String fileName = time + tTsNew.getNewId() + ".docx";
+        String wordPath = this.createWord(templatePath, fileDir, fileName, params, "mentorAgreementWord");
+        return wordPath;
+    }
+
+    /**
+     * 生成word - Target Plan
+     */
+    private String genTargetPlanWord(TTsNew tTsNew) throws IOException {
+        //渲染文本
+        Map<String, Object> params = getTargetPlanWordData(tTsNew);
+        // 模板路径
+        String templatePath = "static/word/training/targetPlan.docx";
+        // 生成word的路径
+        String fileDir = RuoYiConfig.getProfile() + "/" + "targetPlanWord";
+        // 生成word的文件名称
+        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
+        String fileName = time + tTsNew.getNewId() + ".docx";
+        String wordPath = this.createWord(templatePath, fileDir, fileName, params, "targetPlanWord");
+        return wordPath;
+    }
+
+    /**
+     * 生成word - Appraisal Form
+     */
+    private String genAppraisalFormWord(TTsNew tTsNew) throws IOException {
+        //渲染文本
+        Map<String, Object> params = getAppraisalFormWordData(tTsNew);
+        // 模板路径
+        String templatePath = "static/word/training/appraisalForm.docx";
+        // 生成word的路径
+        String fileDir = RuoYiConfig.getProfile() + "/" + "appraisalFormWord";
+        // 生成word的文件名称
+        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd_HH-mm-ss"));
+        String fileName = time + tTsNew.getNewId() + ".docx";
+        String wordPath = this.createWord(templatePath, fileDir, fileName, params, "appraisalFormWord");
+        return wordPath;
+    }
+
+    /**
+     * 获取word数据 - Mentor Agreement
+     */
+    private Map<String, Object> getMentorAgreementWordData(TTsNew tTsNew) {
+        Map<String, Object> params = new HashMap<>();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        Date startDate = new Date(tTsNew.getStartdate().toString());
+        startDate.setMonth(startDate.getMonth() + 1);
+        Date endDate = tTsNew.getEnddate();
+        params.put("startDate", Texts.of(formatter.format(startDate)).create());
+        params.put("endDate", Texts.of(formatter.format(endDate)).create());
+        String mentorStaffId = tTsNew.getMentorStaffId();
+        String staffId = tTsNew.getStaffId();
+        SysUser mentor = sysUserService.selectUserByStaffId(mentorStaffId);
+        SysUser apprentice = sysUserService.selectUserByStaffId(staffId);
+        params.put("mentorSignature", Pictures.ofLocal(fileName(mentor.getSignUrl())).size(100, 40).create());
+        params.put("apprenticeSignature", Pictures.ofLocal(fileName(apprentice.getSignUrl())).size(100, 40).create());
+        String date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        params.put("date", Texts.of(date).create());
+        // 渲染文本
+        return params;
+    }
+
+    /**
+     * 获取word数据 - Target Plan
+     */
+    private Map<String, Object> getTargetPlanWordData(TTsNew tTsNew) {
+        Map<String, Object> params = new HashMap<>();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        Date startDate = new Date(tTsNew.getStartdate().toString());
+        startDate.setMonth(startDate.getMonth() + 1);
+        Date endDate = tTsNew.getEnddate();
+        params.put("startDate", Texts.of(formatter.format(startDate)).create());
+        params.put("endDate", Texts.of(formatter.format(endDate)).create());
+        String mentorStaffId = tTsNew.getMentorStaffId();
+        String staffId = tTsNew.getStaffId();
+        SysUser mentor = sysUserService.selectUserByStaffId(mentorStaffId);
+        SysUser apprentice = sysUserService.selectUserByStaffId(staffId);
+        params.put("tutorSignature", Pictures.ofLocal(fileName(mentor.getSignUrl())).size(100, 40).create());
+        params.put("traineeSignature", Pictures.ofLocal(fileName(apprentice.getSignUrl())).size(100, 40).create());
+        params.put("tutor", Texts.of(mentor.getNickName()).create());
+        params.put("trainee", Texts.of(apprentice.getNickName()).create());
+        String[][] planList = null;
+        String post = "";
+        Long planType = tTsNew.getPlanType();
+        Long newId = tTsNew.getNewId();
+        if (planType == 1L) {
+            post = "裂解";
+            TTsLjplan ljplan = new TTsLjplan();
+            ljplan.setNewId(newId);
+            List<TTsLjplan> tTsLjplans = tTsLjplanService.selectTTsLjplanListByNewId(ljplan);
+            planList = new String[tTsLjplans.size()+1][];
+            planList[0] = new String[] { "Training Plan 详细计划", "Planned Training Date 计划培训日期", "Training Topics 培训主题", "Expected Training Requirement 培训预期达到的要求" };
+            int i = 0;
+            for (TTsLjplan plan : tTsLjplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), "", plan.getTopic(), "学习结束考核,且考试成绩达到80分以上" };
+            }
+        } else if (planType == 2L) {
+            post = "压缩";
+            TTsYsplan ysplan = new TTsYsplan();
+            ysplan.setNewId(newId);
+            List<TTsYsplan> tTsYsplans = tTsYsplanService.selectTTsYsplanListByNewId(ysplan);
+            planList = new String[tTsYsplans.size()+1][];
+            planList[0] = new String[] { "Training Plan 详细计划", "Planned Training Date 计划培训日期", "Training Topics 培训主题", "Expected Training Requirement 培训预期达到的要求" };
+            int i = 0;
+            for (TTsYsplan plan : tTsYsplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), "", plan.getTopic(), "学习结束考核,且考试成绩达到80分以上" };
+            }
+        } else if (planType == 3L) {
+            post = "分离";
+            TTsFlplan flplan = new TTsFlplan();
+            flplan.setNewId(newId);
+            List<TTsFlplan> tTsFlplans = tTsFlplanService.selectTTsFlplanListByNewId(flplan);
+            planList = new String[tTsFlplans.size()+1][];
+            planList[0] = new String[] { "Training Plan 详细计划", "Planned Training Date 计划培训日期", "Training Topics 培训主题", "Expected Training Requirement 培训预期达到的要求" };
+            int i = 0;
+            for (TTsFlplan plan : tTsFlplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), "", plan.getTopic(), "学习结束考核,且考试成绩达到80分以上" };
+            }
+        } else if (planType == 4L) {
+            post = "芳烃";
+            TTsFtplan ftplan = new TTsFtplan();
+            ftplan.setNewId(newId);
+            List<TTsFtplan> tTsFtplans = tTsFtplanService.selectTTsFtplanListByNewId(ftplan);
+            planList = new String[tTsFtplans.size()+1][];
+            planList[0] = new String[] { "Training Plan 详细计划", "Planned Training Date 计划培训日期", "Training Topics 培训主题", "Expected Training Requirement 培训预期达到的要求" };
+            int i = 0;
+            for (TTsFtplan plan : tTsFtplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), "", plan.getTopic(), "学习结束考核,且考试成绩达到80分以上" };
+            }
+        }
+        params.put("tutorPost", Texts.of(post).create());
+        params.put("traineePost", Texts.of(post).create());
+        params.put("planType", Texts.of(post).create());
+        params.put("planList", Tables.of(planList).create());
+        // 渲染文本
+        return params;
+    }
+
+    /**
+     * 获取word数据 - Appraisal Form
+     */
+    private Map<String, Object> getAppraisalFormWordData(TTsNew tTsNew) {
+        Map<String, Object> params = new HashMap<>();
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+        Date startDate = new Date(tTsNew.getStartdate().toString());
+        startDate.setMonth(startDate.getMonth() + 1);
+        Date endDate = tTsNew.getEnddate();
+        params.put("startDate", Texts.of(formatter.format(startDate)).create());
+        params.put("endDate", Texts.of(formatter.format(endDate)).create());
+        String mentorStaffId = tTsNew.getMentorStaffId();
+        String staffId = tTsNew.getStaffId();
+        SysUser mentor = sysUserService.selectUserByStaffId(mentorStaffId);
+        SysUser apprentice = sysUserService.selectUserByStaffId(staffId);
+        params.put("tutorSignature", Pictures.ofLocal(fileName(mentor.getSignUrl())).size(100, 40).create());
+        params.put("traineeSignature", Pictures.ofLocal(fileName(apprentice.getSignUrl())).size(100, 40).create());
+        params.put("tutor", Texts.of(mentor.getNickName()).create());
+        params.put("trainee", Texts.of(apprentice.getNickName()).create());
+        String[][] planList = null;
+        String post = "";
+        Long planType = tTsNew.getPlanType();
+        Long newId = tTsNew.getNewId();
+        if (planType == 1L) {
+            post = "裂解";
+            TTsLjplan ljplan = new TTsLjplan();
+            ljplan.setNewId(newId);
+            List<TTsLjplan> tTsLjplans = tTsLjplanService.selectTTsLjplanListByNewId(ljplan);
+            planList = new String[tTsLjplans.size()+2][];
+            planList[0] = new String[] { "", "Training Topics 培训主题", "Training Date 培训日期", "Training Effectiveness Evaluation* 培训效果评价*", "Training Effectiveness Acknowledgement 培训效果确认", "", "Mentor comment 导师意见" };
+            planList[1] = new String[] { "", "", "", "", "Trainee 学徒", "Tutor 导师", "Proceed to next topic or not 是否转至下一主题" };
+            int i = 1;
+            for (TTsLjplan plan : tTsLjplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), plan.getTopic(), "", "", "", "", "" };
+            }
+        } else if (planType == 2L) {
+            post = "压缩";
+            TTsYsplan ysplan = new TTsYsplan();
+            ysplan.setNewId(newId);
+            List<TTsYsplan> tTsYsplans = tTsYsplanService.selectTTsYsplanListByNewId(ysplan);
+            planList = new String[tTsYsplans.size()+2][];
+            planList[0] = new String[] { "", "Training Topics 培训主题", "Training Date 培训日期", "Training Effectiveness Evaluation* 培训效果评价*", "Training Effectiveness Acknowledgement 培训效果确认", "", "Mentor comment 导师意见" };
+            planList[1] = new String[] { "", "", "", "", "Trainee 学徒", "Tutor 导师", "Proceed to next topic or not 是否转至下一主题" };
+            int i = 1;
+            for (TTsYsplan plan : tTsYsplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), plan.getTopic(), "", "", "", "", "" };
+            }
+        } else if (planType == 3L) {
+            post = "分离";
+            TTsFlplan flplan = new TTsFlplan();
+            flplan.setNewId(newId);
+            List<TTsFlplan> tTsFlplans = tTsFlplanService.selectTTsFlplanListByNewId(flplan);
+            planList = new String[tTsFlplans.size()+2][];
+            planList[0] = new String[] { "", "Training Topics 培训主题", "Training Date 培训日期", "Training Effectiveness Evaluation* 培训效果评价*", "Training Effectiveness Acknowledgement 培训效果确认", "", "Mentor comment 导师意见" };
+            planList[1] = new String[] { "", "", "", "", "Trainee 学徒", "Tutor 导师", "Proceed to next topic or not 是否转至下一主题" };
+            int i = 1;
+            for (TTsFlplan plan : tTsFlplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), plan.getTopic(), "", "", "", "", "" };
+            }
+        } else if (planType == 4L) {
+            post = "芳烃";
+            TTsFtplan ftplan = new TTsFtplan();
+            ftplan.setNewId(newId);
+            List<TTsFtplan> tTsFtplans = tTsFtplanService.selectTTsFtplanListByNewId(ftplan);
+            planList = new String[tTsFtplans.size()+2][];
+            planList[0] = new String[] { "", "Training Topics 培训主题", "Training Date 培训日期", "Training Effectiveness Evaluation* 培训效果评价*", "Training Effectiveness Acknowledgement 培训效果确认", "", "Mentor comment 导师意见" };
+            planList[1] = new String[] { "", "", "", "", "Trainee 学徒", "Tutor 导师", "Proceed to next topic or not 是否转至下一主题" };
+            int i = 1;
+            for (TTsFtplan plan : tTsFtplans) {
+                i++;
+                planList[i] = new String[] { plan.getDetailPlan(), plan.getTopic(), "", "", "", "", "" };
+            }
+        }
+        params.put("tutorPost", Texts.of(post).create());
+        params.put("traineePost", Texts.of(post).create());
+        params.put("planList", Tables.of(planList).create());
+        // 渲染文本
+        return params;
+    }
+
+    /**
+     * 生成word
+     *
+     * @param templatePath word模板文件路径
+     * @param fileDir      生成的文件存放地址
+     * @param fileName     生成的文件名
+     * @param paramMap     参数集合
+     * @return 返回word生成的路径
+     */
+    private String createWord(String templatePath, String fileDir, String fileName, Map<String, Object> paramMap, String directory) throws IOException {
+        Assert.notNull(templatePath, "word模板文件路径不能为空");
+        Assert.notNull(fileDir, "生成的文件存放地址不能为空");
+        Assert.notNull(fileName, "生成的文件名不能为空");
+        File dir = new File(fileDir);
+        if (!dir.exists()) {
+            logger.info("目录不存在,创建文件夹{}!", fileDir);
+            dir.mkdirs();
+        }
+        fileName = fileName.replaceAll("/", "_"); //替换文件中敏感字段
+        logger.info("目录文件{}!", fileName);
+        String filePath = fileDir + "/" + fileName;
+        logger.info("目录{}!", filePath);
+        // 读取模板渲染参数
+        InputStream is = getClass().getClassLoader().getResourceAsStream(templatePath);
+        XWPFTemplate template = XWPFTemplate.compile(is).render(paramMap);
+        try {
+            // 将模板参数写入路径
+            template.writeToFile(filePath);
+            template.close();
+        } catch (Exception e) {
+            logger.error("生成word异常{}", e.getMessage());
+            e.printStackTrace();
+        }
+        String pathFileName = FileUploadUtils.getPathFileName(RuoYiConfig.getFilePath("/" + directory), fileName);
+        return pathFileName;
+    }
+
+    /**
+     * @param
+     * @return 映射签名的文件名
+     * @throws IOException
+     */
+    private String fileName(String filepath) {
+        String newFilePath = filepath.replace("/profile", "");
+        String pathName = RuoYiConfig.getProfile() + newFilePath;
+        return pathName;
     }
 
     /**

+ 33 - 0
master/src/main/java/com/ruoyi/project/training/bccnew/domain/TTsNew.java

@@ -95,6 +95,39 @@ public class TTsNew extends BaseEntity
     @Excel(name = "导师")
     private String mentorStaffName;
 
+    /** 师徒协议word地址 */
+    private String mentorAgreementWordPath;
+
+    /** 导师带徒目标及计划word地址 */
+    private String targetPlanWordPath;
+
+    /** 导师带徒考评表word地址 */
+    private String appraisalFormWordPath;
+
+    public String getMentorAgreementWordPath() {
+        return mentorAgreementWordPath;
+    }
+
+    public void setMentorAgreementWordPath(String mentorAgreementWordPath) {
+        this.mentorAgreementWordPath = mentorAgreementWordPath;
+    }
+
+    public String getTargetPlanWordPath() {
+        return targetPlanWordPath;
+    }
+
+    public void setTargetPlanWordPath(String targetPlanWordPath) {
+        this.targetPlanWordPath = targetPlanWordPath;
+    }
+
+    public String getAppraisalFormWordPath() {
+        return appraisalFormWordPath;
+    }
+
+    public void setAppraisalFormWordPath(String appraisalFormWordPath) {
+        this.appraisalFormWordPath = appraisalFormWordPath;
+    }
+
     public String getMentorStaffName() {
         return mentorStaffName;
     }

+ 10 - 2
master/src/main/resources/mybatis/training/bccnew/TTsNewMapper.xml

@@ -24,10 +24,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptName" column="dept_name" />
         <result property="staffName"    column="staffName"    />
         <result property="mentorStaffName"    column="mentorStaffName"    />
+        <result property="mentorAgreementWordPath"    column="mentor_agreement_word_path"    />
+        <result property="targetPlanWordPath"    column="target_plan_word_path"    />
+        <result property="appraisalFormWordPath"    column="appraisal_form_word_path"    />
     </resultMap>
 
     <sql id="selectTTsNewVo">
-        select d.new_id, d.staff_id, d.name,u.name as staffName,u2.name as mentorStaffName, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.plan_status, d.plan_year, d.startdate, d.enddate, d.mentor_staff_id, d.plan_type, d.remarks ,s.dept_name from t_ts_new d
+        select d.new_id, d.staff_id, d.name,u.name as staffName,u2.name as mentorStaffName, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.plan_status, d.plan_year, d.startdate, d.enddate, d.mentor_staff_id, d.plan_type, d.remarks ,s.dept_name,
+        d.mentor_agreement_word_path, d.target_plan_word_path, appraisal_form_word_path
+        from t_ts_new d
       left join sys_dept s on s.dept_id = d.dept_id
       left join t_staffmgr u on d.staff_id = u.staffid and u.del_flag = 0
       left join t_staffmgr u2 on d.mentor_staff_id = u2.staffid and u2.del_flag = 0
@@ -62,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where new_id = #{newId}
     </select>
 
-    <insert id="insertTTsNew" parameterType="TTsNew">
+    <insert id="insertTTsNew" parameterType="TTsNew" useGeneratedKeys="true" keyProperty="newId">
         <selectKey keyProperty="newId" resultType="long" order="BEFORE">
             SELECT seq_t_ts_new.NEXTVAL as newId FROM DUAL
         </selectKey>
@@ -123,6 +128,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="mentorStaffId != null">mentor_staff_id = #{mentorStaffId},</if>
             <if test="planType != null">plan_type = #{planType},</if>
             <if test="remarks != null">remarks = #{remarks},</if>
+            <if test="mentorAgreementWordPath != null">mentor_agreement_word_path = #{mentorAgreementWordPath},</if>
+            <if test="targetPlanWordPath != null">target_plan_word_path = #{targetPlanWordPath},</if>
+            <if test="appraisalFormWordPath != null">appraisal_form_word_path = #{appraisalFormWordPath},</if>
         </trim>
         where new_id = #{newId}
     </update>

二進制
master/src/main/resources/static/word/training/appraisalForm.docx


二進制
master/src/main/resources/static/word/training/mentorAgreement.docx


二進制
master/src/main/resources/static/word/training/targetPlan.docx


+ 53 - 1
ui/src/views/training/bccnew/tsnew/index.vue

@@ -170,7 +170,7 @@
         </template>
       </el-table-column>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="100"/>
-      <el-table-column label="操作" align="center" fixed="right"  class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" fixed="right"  class-name="small-padding fixed-width" width="150">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -185,6 +185,37 @@
             @click="handleUpdate(scope.row)"
             v-hasPermi="['newstaff:tnNew:edit']"
           >修改</el-button>
+          <el-dropdown  size="mini">
+            <span class="el-dropdown-link">
+              <el-button
+                type="text"
+                size="mini"
+              >下载<i class="el-icon-arrow-down"></i></el-button>
+            </span>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item>
+                <el-button
+                  size="mini"
+                  type="text"
+                  @click="handleDownloadWord(scope.row, 'mentorAgreement')"
+                >师徒协议</el-button>
+              </el-dropdown-item>
+              <el-dropdown-item>
+                <el-button
+                  size="mini"
+                  type="text"
+                  @click="handleDownloadWord(scope.row, 'targetPlan')"
+                >导师带徒目标及计划</el-button>
+              </el-dropdown-item>
+              <el-dropdown-item>
+                <el-button
+                  size="mini"
+                  type="text"
+                  @click="handleDownloadWord(scope.row, 'appraisalForm')"
+                >导师带徒考评表</el-button>
+              </el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
         </template>
       </el-table-column>
     </el-table>
@@ -531,6 +562,27 @@ export default {
     });
   },
   methods: {
+    // 文件下载处理
+    handleDownloadWord(row, type) {
+      console.log(row)
+      if (type == 'mentorAgreement') {
+        var name = row.mentorAgreementWordPath;
+        var url = row.mentorAgreementWordPath;
+      } else if (type == 'targetPlan') {
+        var name = row.targetPlanWordPath;
+        var url = row.targetPlanWordPath;
+      } else if (type == 'appraisalForm') {
+        var name = row.appraisalFormWordPath;
+        var url = row.appraisalFormWordPath;
+      }
+      var suffix = url.substring(url.lastIndexOf("."), url.length);
+      console.log(url)
+      const a = document.createElement('a')
+      a.setAttribute('download', name)
+      a.setAttribute('target', '_blank')
+      a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
+      a.click()
+    },
     /** 查询新员工培训列表 */
     getList() {
       this.loading = true;