Browse Source

CC(抄送)功能流程组件实现。。功能优化

xianwait 2 years ago
parent
commit
1a546b5b6e

+ 30 - 28
willalp-admin/src/main/java/com/willalp/web/controller/system/SysLoginController.java

@@ -1,19 +1,5 @@
 package com.willalp.web.controller.system;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import com.willalp.common.core.domain.entity.SysRole;
-import com.willalp.system.domain.SysUserOrganization;
-import com.willalp.system.service.ISysRoleService;
-import com.willalp.system.service.ISysUserOrganizationService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RestController;
 import com.willalp.common.constant.Constants;
 import com.willalp.common.core.domain.AjaxResult;
 import com.willalp.common.core.domain.entity.SysMenu;
@@ -22,7 +8,20 @@ import com.willalp.common.core.domain.model.LoginBody;
 import com.willalp.common.utils.SecurityUtils;
 import com.willalp.framework.web.service.SysLoginService;
 import com.willalp.framework.web.service.SysPermissionService;
+import com.willalp.system.domain.SysUserOrganization;
 import com.willalp.system.service.ISysMenuService;
+import com.willalp.system.service.ISysRoleService;
+import com.willalp.system.service.ISysUserOrganizationService;
+import com.willalp.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * 登录验证
@@ -30,11 +29,13 @@ import com.willalp.system.service.ISysMenuService;
  * @author willalp
  */
 @RestController
-public class SysLoginController
-{
+public class SysLoginController {
     @Autowired
     private SysLoginService loginService;
 
+    @Autowired
+    private ISysUserService userService;
+
     @Autowired
     private ISysMenuService menuService;
 
@@ -54,9 +55,12 @@ public class SysLoginController
      * @return 结果
      */
     @PostMapping("/login")
-    public AjaxResult login(@RequestBody LoginBody loginBody)
-    {
+    public AjaxResult login(@RequestBody LoginBody loginBody) {
         AjaxResult ajax = AjaxResult.success();
+        SysUser info = userService.getUserByPhone(loginBody.getUsername());
+        if (info != null) {
+            loginBody.setUsername(info.getUserName());
+        }
         // 生成令牌
         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
                 loginBody.getUuid());
@@ -70,24 +74,23 @@ public class SysLoginController
      * @return 用户信息
      */
     @GetMapping("getInfo")
-    public AjaxResult getInfo()
-    {
+    public AjaxResult getInfo() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         // 角色集合
         Set<String> roles = permissionService.getRolePermission(user);
         // 权限集合
         Set<String> permissions = permissionService.getMenuPermission(user);
         AjaxResult ajax = AjaxResult.success();
-        ajax.put("user", user);
-        ajax.put("roles", roles);
-        ajax.put("permissions", permissions);
-        ajax.put("roleTypes", iSysRoleService.queryRoleTypeByLoginName(user.getUserName()));
+        ajax.put("user" , user);
+        ajax.put("roles" , roles);
+        ajax.put("permissions" , permissions);
+        ajax.put("roleTypes" , iSysRoleService.queryRoleTypeByLoginName(user.getUserName()));
         SysUserOrganization org = new SysUserOrganization();
         org.setLoginName(user.getUserName());
         List<SysUserOrganization> organizations = iSysUserOrganizationService.selectSysUserOrganizationList(org);
-        ajax.put("organizations", organizations.stream().map(SysUserOrganization::getOrganizationCode).collect(Collectors.toSet()));
+        ajax.put("organizations" , organizations.stream().map(SysUserOrganization::getOrganizationCode).collect(Collectors.toSet()));
         organizations = organizations.stream().filter(o -> o.getIsDefault() == 1).collect(Collectors.toList());
-        ajax.put("organ", organizations.get(0).getOrganizationCode());
+        ajax.put("organ" , organizations.get(0).getOrganizationCode());
         return ajax;
     }
 
@@ -97,8 +100,7 @@ public class SysLoginController
      * @return 路由信息
      */
     @GetMapping("getRouters")
-    public AjaxResult getRouters()
-    {
+    public AjaxResult getRouters() {
         Long userId = SecurityUtils.getUserId();
         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
         return AjaxResult.success(menuService.buildMenus(menus));

+ 1 - 1
willalp-admin/src/main/resources/application-dev.yml

@@ -9,7 +9,7 @@ willalp:
   # 实例演示开关
   demoEnabled: true
   # 文件路径 示例( Windows配置D:/willalp/uploadPath,Linux配置 /home/willalp/uploadPath)
-  profile: /home/willalp/uploadPath
+  profile: D:/home/willalp/uploadPath
   # 获取ip地址开关
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证

+ 52 - 38
willalp-clocking-in/src/main/java/com/willalp/flow/mapper/xml/FileApprovalMapper.xml

@@ -5,50 +5,64 @@
 <mapper namespace="com.willalp.flow.mapper.FileApprovalMapper">
 
     <resultMap type="com.willalp.flow.domain.FileApproval" id="FileApprovalResult">
-                    <result property="id" column="id"/>
-                    <result property="title" column="title"/>
-                    <result property="fileList" column="file_list"/>
-                    <result property="imgList" column="img_list"/>
-                    <result property="applyUserId" column="apply_user_id"/>
-                    <result property="applyUserName" column="apply_user_name"/>
-                    <result property="endTime" column="end_time"/>
-                    <result property="isDelete" column="is_delete"/>
-                    <result property="createBy" column="create_by"/>
-                    <result property="createTime" column="create_time"/>
-                    <result property="updateBy" column="update_by"/>
-                    <result property="updateTime" column="update_time"/>
-                    <result property="remark" column="remark"/>
-            </resultMap>
-    
+        <result property="id" column="id"/>
+        <result property="title" column="title"/>
+        <result property="fileList" column="file_list"/>
+        <result property="imgList" column="img_list"/>
+        <result property="applyUserId" column="apply_user_id"/>
+        <result property="applyUserName" column="apply_user_name"/>
+        <result property="endTime" column="end_time"/>
+        <result property="isDelete" column="is_delete"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+    </resultMap>
+
     <sql id="selectFileApprovalVo">
-        select id, title, file_list, img_list, apply_user_id, apply_user_name, end_time, is_delete, create_by, create_time, update_by, update_time, remark        from file_approval
+        select id,
+               title,
+               file_list,
+               img_list,
+               apply_user_id,
+               apply_user_name,
+               end_time,
+               is_delete,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from file_approval
     </sql>
 
     <select id="selectFileApprovalList" parameterType="FileApproval" resultMap="FileApprovalResult">
         <include refid="selectFileApprovalVo"/>
         <where>
             is_delete = 0
-                                                                                                    <if test="title != null  and title != ''">
-                            and title = #{title}
-                        </if>
-                                                                                                            <if test="fileList != null  and fileList != ''">
-                            and file_list = #{fileList}
-                        </if>
-                                                                                                            <if test="imgList != null  and imgList != ''">
-                            and img_list = #{imgList}
-                        </if>
-                                                                                                            <if test="applyUserId != null  and applyUserId != ''">
-                            and apply_user_id = #{applyUserId}
-                        </if>
-                                                                                                            <if test="applyUserName != null  and applyUserName != ''">
-                            and apply_user_name like concat('%', #{applyUserName}, '%')
-                        </if>
-                                                                                                            <if test="endTime != null ">
-                            and end_time = #{endTime}
-                        </if>
-                                                                                                            <if test="isDelete != null ">
-                            and is_delete = #{isDelete}
-                        </if>
-                                                                                                                                                                                                    </where>
+            <if test="title != null  and title != ''">
+                and title = #{title}
+            </if>
+            <if test="fileList != null  and fileList != ''">
+                and file_list = #{fileList}
+            </if>
+            <if test="imgList != null  and imgList != ''">
+                and img_list = #{imgList}
+            </if>
+            <if test="applyUserId != null  and applyUserId != ''">
+                and apply_user_id = #{applyUserId}
+            </if>
+            <if test="applyUserName != null  and applyUserName != ''">
+                and apply_user_name like concat('%', #{applyUserName}, '%')
+            </if>
+            <if test="endTime != null ">
+                and end_time = #{endTime}
+            </if>
+            <if test="isDelete != null ">
+                and is_delete = #{isDelete}
+            </if>
+        </where>
+        order by create_time desc
     </select>
 </mapper>

+ 39 - 20
willalp-clocking-in/src/main/java/com/willalp/flow/service/impl/HsFlowEngineServiceImpl.java

@@ -130,8 +130,8 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
         //启动超时删除线程
         taskService.removeWaitTimeOutTask(task);
         Map<String, Object> map = new HashMap<>(4);
-        map.put("taskId", task.getId());
-        map.put("tree", getApprovalTreePost(task.getBaseGroupId(), task.getBaseId()));
+        map.put("taskId" , task.getId());
+        map.put("tree" , getApprovalTreePost(task.getBaseGroupId(), task.getBaseId()));
         return map;
     }
 
@@ -167,7 +167,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                         "<p>申请数量:" + formData.get("apply_amount") + "</p>";
             }
             //异步生成审批消息列表
-            userMsgService.saveApprovalMsgAndPush("1",
+            userMsgService.saveApprovalMsgAndPush("1" ,
                     String.valueOf(formData.get("title")), content, taskId,
                     candidate, applyUserName, new Date());
         } catch (ParseException e) {
@@ -265,6 +265,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                 List<Operators.OperatorDto> assignedUser = operators.getAssignedUser();
                 StringBuilder sbUid = new StringBuilder();
                 StringBuilder sbUname = new StringBuilder();
+
                 if (0 != assignedUser.size()) {
                     for (int i = 0; i < assignedUser.size(); i++) {
                         if (i != (assignedUser.size() - 1)) {
@@ -277,16 +278,34 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                     }
                     cc.setUsers(sbUid.toString());
                 }
+                List<HsAppUserMsg> msgs = new ArrayList<>();
+                //先持久化抄送数据
                 flowCcService.save(cc);
-                if (StringUtils.isBlank(nextFlowBase.getDownStepId())) {
-                    if (resultTrue) {
-                        wxMsgService.sendResultMsg("审批抄送 - " + formData.get("title"), "已通过", String.valueOf(formData.get("apply_user_id")));
+                //再发送推送和生成审批结果消息列表
+                if (0 != assignedUser.size()) {
+                    for (Operators.OperatorDto operatorDto : assignedUser) {
+                        //再发送推送和生成审批结果消息列表
+                        HsAppUserMsg appUserMsg = new HsAppUserMsg();
+                        appUserMsg.setMsgContent(String.valueOf(formData.get("apply_user_name")) + "的" + formData.get("title"));
+                        appUserMsg.setMsgTitle("审批抄送");
+                        appUserMsg.setMsgIsRead("0");
+                        appUserMsg.setUserCode(operatorDto.getId());
+                        appUserMsg.setMsgType("4");
+                        appUserMsg.setRemark(hsFlowTask.getId());
+                        appUserMsg.setCreateTime(new Date());
+                        msgs.add(appUserMsg);
+                        if (StringUtils.isBlank(nextFlowBase.getDownStepId())) {
+                            if (resultTrue) {
+                                wxMsgService.sendResultMsg("审批抄送 - " + formData.get("title"), "已通过" , operatorDto.getId());
+                            }
+                        } else {
+                            stepId = nextFlowBase.getDownStepId();
+                            nextFlowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
+                            baseName = nextFlowBase.getFlowModuleName();
+                            wxMsgService.sendResultMsg("审批抄送 - " + formData.get("title"), "进行中" , operatorDto.getId());
+                        }
                     }
-                } else {
-                    stepId = nextFlowBase.getDownStepId();
-                    nextFlowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
-                    baseName = nextFlowBase.getFlowModuleName();
-                    wxMsgService.sendResultMsg("审批抄送 - " + formData.get("title"), "进行中", String.valueOf(formData.get("apply_user_id")));
+                    userMsgService.saveBatch(msgs);
                 }
                 HsFlowRunningRecord frrCc = new HsFlowRunningRecord();
                 frrCc.setBaseId(flow.getBaseId());
@@ -366,7 +385,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             appUserMsg.setCreateTime(new Date());
             userMsgService.save(appUserMsg);
             //推送微信审批结果通知
-            wxMsgService.sendResultMsg(String.valueOf(formData.get("title")), resultTrue ? "已通过" : "已拒绝", String.valueOf(formData.get("apply_user_id")));
+            wxMsgService.sendResultMsg(String.valueOf(formData.get("title")), resultTrue ? "已通过" : "已拒绝" , String.valueOf(formData.get("apply_user_id")));
         } else {
             //任务继续
             hsFlowTask.setMsgIsRead("0");
@@ -401,7 +420,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             WxMsgTemplateApproval wxMsgTemplateApproval = new WxMsgTemplateApproval();
             wxMsgTemplateApproval.setThing5(wxUtils.getFormat(String.valueOf(formData.get("title"))));
             wxMsgTemplateApproval.setThing11(wxUtils.getFormat(String.valueOf(formData.get("apply_user_name"))));
-            wxMsgTemplateApproval.setTime12(wxUtils.getFormat(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())));
+            wxMsgTemplateApproval.setTime12(wxUtils.getFormat(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss" , new Date())));
             wxMsgService.sendQRCodeMsg(hsFlowTask.getOperator(), wxMsgTemplateApproval, WxTemplateKeyEnum.APPROVAL_WAIT, true);
         }
         hsFlowTaskMapper.updateById(hsFlowTask);
@@ -439,7 +458,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                     if (conditionModelService.executeConditionJudgment(item, params.get(paramName))) {
                         //对应条件组件
                         HsFlowBase termModule = hsFlowBaseMapper.selectOne(
-                                new QueryWrapper<HsFlowBase>().eq("term_module_id", item.getId()));
+                                new QueryWrapper<HsFlowBase>().eq("term_module_id" , item.getId()));
                         if (null == termModule) {
                             throw new BaseException("流程条件配置出错");
                         }
@@ -458,7 +477,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             }
             hsFlowTaskMapper.deleteById(taskId);
             flowRunningRecordService.remove(new QueryWrapper<HsFlowRunningRecord>()
-                    .eq("task_id", taskId));
+                    .eq("task_id" , taskId));
             throw new BaseException("流程条件未满足,流程关闭,请重新发起");
         } else {
             return hsFlowBase;
@@ -471,7 +490,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             return null;
         }
         List<HsFlowTask> hsFlowTasks = hsFlowTaskMapper.selectList(new QueryWrapper<HsFlowTask>()
-                .eq("id", taskId));
+                .eq("id" , taskId));
         return getHsFlowTasks(hsFlowTasks);
     }
 
@@ -514,8 +533,8 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                                     .selectBusinessCase(example.getBusinessTableName(), businessId);
                             if (ObjectUtils.isNotNull(stringObjectMap)) {
                                 if ("biz_leave".equals(example.getBusinessTableName())) {
-                                    List<Map<String, Object>> leaveImgs = leaveImgService.getBaseMapper().selectMaps(new QueryWrapper<BizLeaveImg>().eq("biz_leave_id", businessId));
-                                    stringObjectMap.put("imgUrls", leaveImgs);
+                                    List<Map<String, Object>> leaveImgs = leaveImgService.getBaseMapper().selectMaps(new QueryWrapper<BizLeaveImg>().eq("biz_leave_id" , businessId));
+                                    stringObjectMap.put("imgUrls" , leaveImgs);
                                 }
                                 //统一时间类型字段处理
                                 Set<String> strings = stringObjectMap.keySet();
@@ -557,7 +576,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             hsFlowRunningRecord.setYesOrNo("LAUNCH");
             flowRunningRecords.add(hsFlowRunningRecord);
             List<HsFlowRunningRecord> records = flowRunningRecordService.getBaseMapper().selectList(new QueryWrapper<HsFlowRunningRecord>()
-                    .eq("task_id", taskId).last("AND yes_or_no = 'RESULT_TRUE' GROUP BY base_id"));
+                    .eq("task_id" , taskId).last("AND yes_or_no = 'RESULT_TRUE' GROUP BY base_id"));
             records.forEach(flowRunningRecord -> {
                 String comment = flowRunningRecord.getComment();
                 flowRunningRecord.setComment(comment.substring(0, comment.indexOf("-")));
@@ -572,7 +591,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
     public int revoke(String taskId) {
         if (StringUtils.isNotBlank(taskId)) {
             long selectCount = flowRunningRecordService.getBaseMapper().selectCount(new QueryWrapper<HsFlowRunningRecord>()
-                    .eq("task_id", taskId));
+                    .eq("task_id" , taskId));
             if (selectCount > 0) {
                 throw new BaseException("已有审批结果无法撤销");
             }

+ 3 - 3
willalp-common/src/main/java/com/willalp/common/core/domain/BaseEntity.java

@@ -35,7 +35,7 @@ public class BaseEntity implements Serializable {
      * 创建时间
      */
     @CreatedDate
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     @TableField(fill = FieldFill.INSERT)
     private Date createTime;
 
@@ -47,9 +47,9 @@ public class BaseEntity implements Serializable {
     /**
      * 更新时间
      */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     @TableField(fill = FieldFill.INSERT_UPDATE)
-    private Date updateTime = new Date();
+    private Date updateTime;
 
     /**
      * 备注

+ 1 - 0
willalp-framework/src/main/java/com/willalp/framework/websocket/WebSocketServer.java

@@ -89,5 +89,6 @@ public class WebSocketServer {
         String msg = message.replace("你", "我").replace("吗", "");
         WebSocketUsers.sendMessageToUserByText(session, msg);
         LOGGER.info(" 收到客户端消息 - " + msg);
+
     }
 }

+ 1 - 1
willalp-framework/src/main/java/com/willalp/framework/websocket/WebSocketUsers.java

@@ -117,7 +117,7 @@ public class WebSocketUsers
     /**
      * 发送文本消息
      *
-     * @param userName 自己的用户名
+     * @param session 自己的用户名
      * @param message 消息内容
      */
     public static void sendMessageToUserByText(Session session, String message)

+ 41 - 87
willalp-ui/src/views/files/approval/index.vue

@@ -1,71 +1,6 @@
 <template>
   <div style="padding: 10px">
     <el-row :gutter="10">
-      <el-col :span="10">
-        <el-card>
-          <div slot="header" class="clearfix">
-            <span>新增审批</span>
-          </div>
-          <el-form ref="form" :model="form">
-            <el-form-item label="审批标题" prop="title">
-              <el-input v-model="form.title" placeholder="请输入审批标题"/>
-            </el-form-item>
-            <el-form-item label="附件上传" prop="fileList">
-              <el-upload
-                class="upload-demo"
-                :action="uploadImgUrl"
-                :on-preview="handlePreview"
-                :on-remove="handleRemove"
-                :on-success="handleUploadSuccess"
-                :before-remove="beforeRemove"
-                :headers="headers"
-                drag
-                :file-list="form.fileList">
-                <i class="el-icon-upload"></i>
-                <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-                <!--          <el-button size="small" type="primary">点击上传</el-button>-->
-                <!--    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>-->
-              </el-upload>
-            </el-form-item>
-            <el-form-item label="上传图片" prop="imgList">
-              <el-upload
-                :action="uploadImgUrl"
-                list-type="picture-card"
-                :on-exceed="handleExceed"
-                :on-success="handleImgUploadSuccess"
-                :file-list="form.imgList"
-                :headers="headers">
-                <i slot="default" class="el-icon-plus"></i>
-                <div slot="file" slot-scope="{file}">
-                  <img class="el-upload-list__item-thumbnail" :src="file.url" alt="">
-                  <span class="el-upload-list__item-actions">
-                    <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
-                      <i class="el-icon-zoom-in"></i>
-                    </span>
-                    <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleDownload(file)">
-                      <i class="el-icon-download"></i>
-                    </span>
-                    <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
-                      <i class="el-icon-delete"></i>
-                    </span>
-                  </span>
-                </div>
-              </el-upload>
-            </el-form-item>
-            <el-form-item label="部门负责人审批" prop="applyUserName">
-              <el-cascader ref="apply" @change="handleChange" :options="pcTreeList"
-                           :props="{label:'text'}"
-                           :style="{width: '100%'}" v-model="applyUserName" placeholder="请选择部门负责人" clearable>
-              </el-cascader>
-            </el-form-item>
-            <div>
-              <div style="text-align: center">
-                <el-button type="primary" @click="submitForm">提交审批</el-button>
-              </div>
-            </div>
-          </el-form>
-        </el-card>
-      </el-col>
       <el-col :span="14">
         <el-card>
           <div slot="header" class="clearfix">
@@ -74,7 +9,7 @@
           <el-table v-loading="loading" :data="accessoryList" @selection-change="handleSelectionChange">
             <el-table-column type="selection" width="55" align="center"/>
             <el-table-column label="审批标题" align="center" prop="title"/>
-            <!--            <el-table-column label="附件列表" align="center" prop="fileList"/>-->
+            <el-table-column label="时间" align="center" prop="createTime"/>
             <!--            <el-table-column label="图片列表" align="center" prop="imgList"/>-->
             <el-table-column label="申请人" align="center" prop="applyUserName"/>
             <!--            <el-table-column label="结束时间" align="center" prop="endTime" width="180">-->
@@ -84,21 +19,12 @@
             <!--            </el-table-column>-->
             <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
               <template slot-scope="scope">
-<!--                <el-button-->
-<!--                  size="mini"-->
-<!--                  type="text"-->
-<!--                  icon="el-icon-edit"-->
-<!--                  @click="handleUpdate(scope.row)"-->
-<!--                  v-hasPermi="['flow:accessory:edit']"-->
-<!--                >修改-->
-<!--                </el-button>-->
                 <el-button
                   size="mini"
                   type="text"
-                  icon="el-icon-refresh-left"
-                  @click="handleDelete(scope.row)"
-                  v-hasPermi="['flow:accessory:remove']"
-                >撤销
+                  icon="el-icon-download"
+                  @click="openDownloadFile(scope.row)"
+                >下载
                 </el-button>
               </template>
             </el-table-column>
@@ -113,13 +39,30 @@
         </el-card>
       </el-col>
     </el-row>
+
+    <el-dialog title="文件下载" :visible.sync="open">
+      <el-form>
+        <el-form-item label="文件">
+          <el-button type="warning" icon="el-icon-download" v-for="item in form.fileList" @click="doDownload(item.url)">
+            {{
+              item.name
+            }}
+          </el-button>
+        </el-form-item>
+        <el-form-item label="图片">
+          <el-button type="warning" icon="el-icon-download" v-for="item in form.imgList" @click="doDownload(item.url)">
+            {{ item.name }}
+          </el-button>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
   </div>
 </template>
 <script>
-import { getToken } from '@/utils/auth'
-import { listAccessory, addAccessory, delAccessory } from '@/api/flow/accessory'
-import { pcTreeList } from '@/api/system/postConfig'
-import { delResult } from '@/api/yiqing/result'
+import {getToken} from '@/utils/auth'
+import {listAccessory, addAccessory, delAccessory} from '@/api/flow/accessory'
+import {pcTreeList} from '@/api/system/postConfig'
+import {delResult} from '@/api/yiqing/result'
 
 export default {
   data() {
@@ -130,6 +73,7 @@ export default {
       headers: {
         Authorization: 'Bearer ' + getToken()
       },
+      open: false,
       // 遮罩层
       loading: true,
       // 导出遮罩层
@@ -167,6 +111,16 @@ export default {
     this.getList()
   },
   methods: {
+    openDownloadFile(item) {
+      item.fileList = JSON.parse(item.fileList)
+      item.imgList = JSON.parse(item.imgList)
+      this.form = item
+      this.open = true
+    },
+    doDownload(url) {
+      //使用 精确 url下载
+      window.open(url, '_blank')
+    },
     getList() {
       this.getPcTreeList()
       this.loading = true
@@ -218,12 +172,12 @@ export default {
     },
     // 上传成功回调
     handleUploadSuccess(res, file) {
-      this.$message.success('上传成功')
-      this.form.fileList.push({ url: this.baseUrl + res.url, name: res.fileName })
+      this.$modal.success('上传成功')
+      this.form.fileList.push({url: this.baseUrl + res.url, name: res.fileName})
     },
     handleImgUploadSuccess(res, file) {
-      this.$message.success('上传成功')
-      this.form.imgList.push({ url: this.baseUrl + res.url, name: res.fileName })
+      this.$modal.success('上传成功')
+      this.form.imgList.push({url: this.baseUrl + res.url, name: res.fileName})
     },
     /** 提交按钮 */
     submitForm() {
@@ -253,7 +207,7 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids
-      this.$modal.confirm('是否确认撤销该文件审批流程吗?').then(function() {
+      this.$modal.confirm('是否确认撤销该文件审批流程吗?').then(function () {
         return delAccessory(ids)
       }).then(() => {
         this.getList()