Browse Source

督办事项列表增加合并按钮

wanyuan 10 months ago
parent
commit
cffdf69621

+ 49 - 0
tc-service/tap-task/src/main/java/com/minto/app/task/manager/TaskByTypeManagerImpl.java

@@ -14897,6 +14897,55 @@ public class TaskByTypeManagerImpl implements ITaskByTypeManager{
         return res;
     }
 
+    @Override
+    public Map<String, Object> findMergeTaskInfo(List<Long> taskIds, Long taskType){
+        Map<String, Object> data = new HashMap<>();
+        data.put("taskType",taskType);
+        List<Map<String,Object>> titles = new ArrayList<>();
+        data.put("titles",titles);
+        List<Map<String,Object>> contents = new ArrayList<>();
+        data.put("contents",contents);
+        List<Map<String,Object>> types = new ArrayList<>();
+        data.put("types",types);
+        List<Map<String,Object>> directorys = new ArrayList<>();
+        data.put("directorys",directorys);
+        List<Map<String,Object>> froms = new ArrayList<>();
+        data.put("froms",froms);
+        taskIds.forEach(e -> {
+            TaskSummaryBean summary = taskSummaryDao.findTaskSummaryById(e);
+            Map<String, Object> importReportData = buildImportReportData(summary, taskType);
+            Map<String,Object> title = new HashMap<>();
+            title.put("label",importReportData.get("title"));
+            title.put("value",e);
+            titles.add(title);
+            Map<String,Object> content = new HashMap<>();
+            content.put("label",importReportData.get("content"));
+            content.put("value",e);
+            contents.add(content);
+            Map<String,Object> type = new HashMap<>();
+            type.put("label",importReportData.get("type"));
+            type.put("value",e);
+            types.add(type);
+            Map<String,Object> directory = new HashMap<>();
+            directory.put("label",importReportData.get("field_1000"));
+            directory.put("value",e);
+            directorys.add(directory);
+            Map<String,Object> from = new HashMap<>();
+            from.put("label",importReportData.get("field_51"));
+            from.put("value",e);
+            froms.add(from);
+
+        });
+        Map<String,Object> form = new HashMap<>();
+        data.put("form",form);
+        form.put("titleId",titles.get(0).get("value"));
+        form.put("contentId",contents.get(0).get("value"));
+        form.put("typeId",types.get(0).get("value"));
+        form.put("directoryId",directorys.get(0).get("value"));
+        form.put("fromId",froms.get(0).get("value"));
+        return data;
+    }
+
     private Map<String, Object> buildImportReportData(TaskSummaryBean summary, Long taskType){
         Map<String, Object> data = new HashMap<>();
         data.put("id", summary.getId());

+ 9 - 0
tip-api/src/main/java/com/minto/app/task/manager/ITaskByTypeManager.java

@@ -1569,6 +1569,15 @@ public interface ITaskByTypeManager {
      */
     List<Map<String,Object>> checkRepeatTaskByName(List<Long> taskIds, Long taskType);
 
+    /**
+     * 获取任务合并的备选信息
+     *
+     * @param taskIds
+     * @param taskType
+     * @return
+     */
+    Map<String, Object> findMergeTaskInfo(List<Long> taskIds, Long taskType);
+
     /**
      * 合并任务
      *

+ 19 - 0
tip-front/src/main/java/com/minto/app/task/controller/TaskByTypeController.java

@@ -5628,6 +5628,25 @@ public class TaskByTypeController extends BaseController{
             RespUtil.rendJson(response, dataMap);
         }
     }
+
+    @GetMapping(value = "/mergeInfo")
+    public void getTaskMergeInfo(HttpServletRequest request, HttpServletResponse response) throws Exception{
+        Map<String, Object> dataMap = new HashMap<>();
+        try{
+            Long[] idArray = ReqUtil.getLongArray(request, "ids[]");
+            Long taskType = ReqUtil.getLong(request, "taskType");
+            List<Long> collect = Arrays.stream(idArray).collect(toList());
+            Map<String, Object> map = taskByTypeManager.findMergeTaskInfo(collect, taskType);
+            dataMap.put("data", map);
+            dataMap.put("state", "success");
+            dataMap.putAll(map);
+        } catch(Exception e){
+            dataMap.put("state", "error");
+            log.error(e.getMessage(), e);
+        } finally{
+            RespUtil.rendJson(response, dataMap);
+        }
+    }
     class CountDownCreateTaskSummaryList implements CountDownLatchInterface{
 
         Long cid;

+ 87 - 0
tip-front/src/main/webapp/tc_suite/minto/task/js/newListShow.js

@@ -209,6 +209,27 @@ var TaskSummaryListBusinessEnum = {
                     TaskSummaryListStatusEnum.Goal
                 ]
             }]
+        },{
+            id:"mergeTask",
+            name:"合并",
+            serverCheck:false,
+            click:function(){
+                TC.task.table.invoke('mergeTask',this);
+            },
+            scope:[{
+                type:[
+                    TaskSummaryListBusinessEnum.Supervise,
+                ],
+                status:[
+                    TaskSummaryListStatusEnum.All,
+                    TaskSummaryListStatusEnum.Draft,
+                    TaskSummaryListStatusEnum.Plan,
+                    TaskSummaryListStatusEnum.WaitSign,
+                    TaskSummaryListStatusEnum.Do,
+                    TaskSummaryListStatusEnum.UnReport,
+                    TaskSummaryListStatusEnum.Goal
+                ]
+            }]
         },{
             id:"",
             name:$.i18n("task.settle"),//办结
@@ -2294,6 +2315,72 @@ var TaskSummaryListBusinessEnum = {
                     cancel:function(){}
                 });
             },
+            //合并任务
+            mergeTask: function(type) {
+                var ids = TC.task.table.getTableChecked();
+                if (ids.length == 0){
+                    $.alert("请选中要合并的事项!");
+                    return ;
+                }
+                if (ids.length <= 1){
+                    $.alert("请选中多条要合并的事项!");
+                    return ;
+                }
+                var taskType = TC.task.table.getTaskType();
+                $.ajax({
+                    url:TC.config.baseUrl + "/taskByType/mergeInfo",
+                    type:"get",
+                    dataType:"json",
+                    data:{
+                        "taskType": taskType,
+                        "ids": ids,
+                    },
+                    async:false,
+                    success: function(res){
+                        if(res.state == "success" && res.data){
+                            $.dialog({
+                                title :"合并",
+                                max: false,
+                                min: false,
+                                width:"800px",
+                                height:"400px",
+                                content : "url:"+TC.config.baseUrl+"/tc_suite/taskmt/byType/mergeTask.jsp",
+                                data: res.data,
+                                lock : true,
+                                button : [{
+                                    "name":"提交",// "发送",
+                                    callback:function(){
+                                    var _this = this;
+                                    this.iframe.contentWindow.mergeRequest(function(result){
+                                        if (result.state=="success") {
+                                            $.ok("合并成功!");
+                                            _this.close();
+                                            TC.task.table.changeTab({
+                                                listType: TC.task.table.currentListType,
+                                                listStatus: TC.task.table.currentListStatus,
+                                            });
+                                            TC.task.table.reloadData();
+                                        } else {
+                                            $.alert("合并失败!");
+                                        }
+                                    });
+                                    return false;
+                                    },
+                                    focus:true
+                                }],
+                                cancel:function(){
+
+                                }
+                            });
+                        }else{
+                            $.error("合并失败!");
+                        }
+                    },
+                    error: function(){
+                        $.error("合并失败!");
+                    }
+                });
+            },
             // 视频会议
             sendVedio:function(type){
                 var ids = TC.task.table.getTableChecked();