Kaynağa Gözat

归档批次-树形添加附件

[user3] 4 yıl önce
ebeveyn
işleme
17b178439d

+ 13 - 0
src/main/java/com/jeeplus/modules/projectFilingBatch/web/ProjectFilingBatchController.java

@@ -15,7 +15,9 @@ import com.jeeplus.modules.projectrecord.entity.ProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.entity.RuralProjectRecords;
 import com.jeeplus.modules.ruralprojectrecords.enums.ProjectStatusEnum;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
+import com.jeeplus.modules.sys.dao.WorkattachmentDao;
 import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.UserService;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.workengineeringproject.entity.WorkEngineeringProject;
@@ -50,6 +52,8 @@ public class ProjectFilingBatchController extends BaseController {
     private ActTaskService actTaskService;
     @Autowired
     private UserService userService;
+    @Autowired
+    private WorkattachmentDao workattachmentDao;
     @ModelAttribute
     public ProjectFilingBatch get(@RequestParam(required = false) String id) {
         ProjectFilingBatch entity = null;
@@ -239,6 +243,15 @@ public class ProjectFilingBatchController extends BaseController {
         RuralProjectRecords projectRecords = ruralProjectRecordsService.findUseableByProjectId(projectId);
         return projectRecords;
     }
+    @ResponseBody
+    @RequestMapping(value = "updateByType")
+    public Integer updateByType(@RequestParam("id") String id,@RequestParam("remarks") String remarks) {
+        Workattachment workattachment=new Workattachment();
+        workattachment.setId(id);
+        workattachment.setRemarks(remarks);
+        Integer i= workattachmentDao.updateByRemarks(workattachment);
+        return i;
+    }
 
     /**
      * 送审归档批次项目

+ 7 - 0
src/main/java/com/jeeplus/modules/sys/dao/WorkattachmentDao.java

@@ -55,4 +55,11 @@ public interface WorkattachmentDao extends CrudDao<Workattachment> {
      * @return
      */
     Integer deleteByAttachmentId(String attachmentId);
+
+    /**
+     * 修改备注
+     * @param workattachment
+     * @return
+     */
+    Integer updateByRemarks(Workattachment workattachment);
 }

+ 6 - 1
src/main/resources/mappings/modules/sys/WorkattachmentDao.xml

@@ -300,7 +300,12 @@
 			attachment_flag = #{attachmentFlag}
 		WHERE id = #{id}
 	</update>
-	
+
+	<update id="updateByRemarks">
+		UPDATE work_attachment SET
+		   remarks = #{remarks}
+		WHERE id = #{id}
+	</update>
 	
 	<!--物理删除-->
 	<update id="delete">

+ 67 - 2
src/main/webapp/static/bos/bosupload.js

@@ -88,11 +88,76 @@ function multitestFlag (storeAs, file,attachmentId,attachmentFlag,uploadPath,div
                             $(prefix+"_fileUrl").val(data.url);
                             $(prefix+"_fileAttachmentFlag").val(data.attachmentFlag);
                             $(prefix+"_fileAttachmentId").val(data.attachmentId);
-                            var result = '<a href="javascript:location.href=\''+realPath+'/a/workfullmanage/workFullManage/downLoadAttach?file=\'+encodeURIComponent(\''+data.url+'\');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
+                            var result = '<a style="margin-top: 10px;" href="javascript:location.href=\''+realPath+'/a/workfullmanage/workFullManage/downLoadAttach?file=\'+encodeURIComponent(\''+data.url+'\');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
                             var delResult =
                                 '<a href="javascript:void(0)" onclick="accordingBtn(this,\''+prefix+'\')" class=\"op-btn op-btn-edit" ><i class="fa fa-edit"></i>&nbsp;修改</a>';
                             $(prefix+"_operation").empty();
-                            $(prefix+"_operation").append(delResult);
+                            // $(prefix+"_operation").append(delResult);
+                        }else {
+                            parent.layer.msg("上传失败!",{icon:2});
+                        }
+                    }
+                })
+            }else {
+                parent.layer.msg("上传失败!",{icon:2});
+            }
+        }
+    })
+};
+
+function fBmultipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt,idx,prefix,currentUser) {
+    console.log("-----------------------start");
+    if(cpt == 1)
+        fBmultitestFlag(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt,idx,prefix,currentUser);
+    else
+        multitest(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt,idx,prefix,currentUser);
+};
+function fBmultitestFlag (storeAs, file,attachmentId,attachmentFlag,uploadPath,divId, size,cpt,idx,prefix,currentUser) {
+    var formdata = new FormData();
+    formdata.append("storeAs",storeAs);
+    formdata.append("file",file);
+    var names =  storeAs.split("/");
+    var name = names[names.length-1];
+    $.ajax({
+        type:'post',
+        url:realPath+"/bos/upload",
+        data:formdata,
+        contentType: false,
+        processData: false,
+        success:function (data1) {
+            if(data1.code==='1'){
+                returnUrl = realPath+"/sys/workattachment/saveAttachment";
+                $.ajax({
+                    type:'post',
+                    url:returnUrl,
+                    data:{
+                        "attachmentName":file['name'],
+                        "attachmentId":attachmentId,
+                        "attachmentFlag":attachmentFlag,
+                        "url":data1.url,
+                        "divIdType":divId
+                    },
+                    success:function(data){
+                        console.log('url : ' + data.url);
+                        if(data.status=="Success"){
+                            parent.layer.msg("上传成功!",{icon:1});
+                            var str = '' ;
+                            var addFile = prefix+divId;
+                            if (isContains("jpg,png,gif,bmp,jpeg",data.type)){
+                                str = '<img src="'+data1.url+'" width="50" height="50" title="'+data.attachmentName+'" onclick="openDialogView(\'预览\',\''+realPath+ '/a/sys/picturepreview/picturePreview?url=' +data1.url+ '\',\'90%\',\'90%\')" alt="'+data.attachmentName+'"/>';
+                            }else if(isContains("pdf",data.type)){
+                                str = '<a class="attention-info" href="javascript:void(0)" title="'+data.attachmentName+'" onclick="preview(\'预览\',\''+data1.url+'\',\'90%\',\'90%\',\'1\')">'+data.attachmentName+'</a>';
+                            }else {
+                                str = '<a class="attention-info" href="javascript:void(0)" title="'+data.attachmentName+'" onclick="preview(\'预览\',\''+data1.url+'\',\'90%\',\'90%\')">'+data.attachmentName+'</a>';
+                            }
+                            $(prefix).parent().parent().find("td").eq(2).html(str)
+                            $(prefix).parent().parent().find("td").eq(0).find("input").eq(1).val(data.id)
+                            var d = new Date();
+                            var dateTime=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
+                            var result = '<a href="javascript:location.href=\''+realPath+'/a/workfullmanage/workFullManage/downLoadAttach?file=\'+encodeURIComponent(\''+data.url+'\');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
+                            var delResult =
+                                '<a href="javascript:void(0)" onclick="accordingBtn(this,\''+prefix+'\')" class=\"op-btn op-btn-edit" ><i class="fa fa-edit"></i>&nbsp;修改</a>';
+                            $(prefix).parent().parent().find("td").eq(4).append(result)
                         }else {
                             parent.layer.msg("上传失败!",{icon:2});
                         }

+ 131 - 27
src/main/webapp/webpage/modules/projectFilingBatch/projectFilingBatchForm.jsp

@@ -44,6 +44,13 @@
                     parent.layer.msg("请添加归档项目!", {icon: 5});
                     return false
                 }
+                for (var i=0;i<length;i++){
+                    var zhi=$("#projectList tr").eq(i).find("input[name='wType']").val();
+                    if (zhi==""){
+                        parent.layer.msg("信息未填写完整!", {icon: 5});
+                        return false
+                    }
+                }
                 $("#inputForm").submit();
                 return true;
             }else{
@@ -405,13 +412,35 @@
                     },
                     type:"post",
                     success:function (d) {
-                        $("#projectList").append("<tr>" +
-                            "<td><input type=\"hidden\" name=\"proId\" value="+d.id+"/>"+d.projectId+"</td>" +
-                            "<td>"+d.projectName+"</td>"+
-                            "<td>"+d.projectReportNumber+"</td>" +
-                            "<td class=\"text-center op-td\" >" +
-                            "<span class=\"op-btn op-btn-delete\" onclick=\"delEntrustRow(this)\" title=\"删除\"><i class=\"glyphicon glyphicon-remove\"></i>&nbsp;删除</span>" + "</td>"+
-                            "</tr>")
+                        var id="projectList_"+d.id;
+                        var pid="project_"+d.id;
+                        var tid="project_"+d.id+"_proId";
+                        var inId="#"+tid;
+                        var size=$("#projectList .rowSize").size();
+                        var flag=true;
+                        var dd=$(inId).val();
+                        for (var i=0;i<size;i++){
+                            if (dd==d.id){
+                                flag=false;
+                            }
+                        }
+                        if(flag) {
+                            $("#projectList").append("<tr class='rowSize'>" +
+                                "<td><input type=\"hidden\" name=\"proId\" id='" + tid + "' value=" + d.id + ">" + d.projectId + "</td>" +
+                                "<td>" + d.projectName + "</td>" +
+                                "<td>" + d.projectReportNumber + "</td>" +
+                                "<td class=\"text-center op-td\" >" +
+                                "<span class=\"op-btn op-btn-add\" onclick=\"addRowInfo(" + id + ")\" title=\"添加\"><i class=\"fa fa-plus\"></i>&nbsp;添加</span>" +
+                                "<span class=\"op-btn op-btn-delete\" onclick=\"delEntrustRow("+id+")\" title=\"删除\"><i class=\"glyphicon glyphicon-remove\"></i>&nbsp;删除</span>" +
+                                "</td>" +
+                                "</tr>")
+                            $("#projectList").append("<tr style='display: none;'> <td colspan='4' style='padding: 0px;'>" +
+                                "<table style=\"width: 100%;padding: 0px;margin: 0px;\" class=\"table table-bordered table-condensed details\">" +
+                                "<tbody id='" + id + "'>" +
+                                "</tbody>" +
+                                "</table>" +
+                                "</td></tr>")
+                        }
                     }
                 });
                 // alert(obj[i].id+"-------")
@@ -429,31 +458,82 @@
             return false;
         }
 
-        function insertTitle(tValue){
-            $("#flagFile").val(false);
-            var files = $("#attachment_file")[0].files;            for(var i = 0;i<files.length;i++) {                var file = files[i];
-                var attachmentId = $("#id").val();
-                var attachmentFlag = "82";
-                /*console.log(file);*/
-                var timestamp=new Date().getTime();
-
-                var storeAs = "projectRecords";
-                var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
-                var divId = "_attachment";
-                $("#addFile"+divId).show();
-                multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,0);}
-        }
-
 
         function addFile() {
             $("#attachment_file").click();
         }
 
         function addRow(list, idx, tpl, row){
-            // var idx1 = $("#workClientLinkmanList tr").length;
+            // var idx1 = $("#projectList tr").length;
             bornTemplete(list, idx, tpl, row, idx);
         }
+        function addRowInfo(obj,d){
+            var id="#"+obj.id
+            var ss=(obj.id).split("_")
+            var sa=ss[1];
+            $(id).parent().parent().parent().show();
+            $(id).append(
+                "<tr>"+
+                "<td class=\"hide\">"+
+                "<input type='file' multiple='multiple' style='display: none;' onChange='if(this.value)insertAccording(this.value,"+obj.id+",this);'/>"+
+                "<input type='hidden' style='display: none;' id='attId' value=''/>"+
+                "</td>"+
+                "<td style=\"text-align: center\" width=\"20%\"><input name='wType' onChange='upwType(this)' class=\"form-control required\"/></td>"+
+                "<td style=\"text-align: center\" width=\"20%\"></td>"+
+                "<td style=\"text-align: center\" width=\"20%\"></td>"+
+                "<td width=\"20%\">" +
+                "<span href=javascript:void(0); onclick=\"accordingBtn(this)\"   class=\"op-btn op-btn-edit\" title=\"上传附件\"><i class=\"glyphicon glyphicon-edit\"></i>&nbsp;编辑</span>" +
+                "<span class=\"op-btn op-btn-delete\" onclick=\"delEntrustRow(this)\" title=\"删除\"><i class=\"glyphicon glyphicon-remove\"></i>&nbsp;删除</span>" +
+                "</td>"+
+                "</tr>"
+            )
+        }
+        function upwType(obj) {
+            var is=$(obj).parent().parent().find("td").eq(0).find("input").eq(1).val();
+            var id = is.toString()
+            var wtype=$(obj).val()
+            if (is==""){
+                parent.layer.msg("请先上传文件!", {icon: 5});
+                $(obj).val("")
+            }else{
+                $.ajax({
+                    type:"post",
+                    url:"${ctx}/projectFilingBatch/projectFilingBatchInfo/updateByType",
+                    data:{
+                        "id":id,
+                        "remarks":wtype
+                    },
+                    dataType:"json",
+                    success:function (d) {
+
+                    }
+                });
+            }
+        }
 
+        function accordingBtn(obj){
+            var is=$(obj).parent().parent().find("td").eq(0).find("input")
+            $(is).click();
+        }
+        function insertAccording(tValue,idx,obj) {
+            //当前登陆人
+            var currentUser = '${fns:getUser().name}';
+            var is=$(obj).parent().parent().find("td").eq(0).find("input")
+            var files = $(is)[0].files;
+            for(var i=0;i<files.length;i++) {
+                var file = files[i];
+                var attachmentId = idx.id;
+                var attachmentFlag = "";
+                console.log(file);
+                var timestamp = new Date().getTime();
+                var storeAs = "filingBatch";
+                var uploadPath = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/" + storeAs;
+                /*将这段字符串存到数据库即可*/
+                var divId = "_filingBatch";
+                fBmultipartUploadWithSts(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, "0",1,idx,is,currentUser);
+            }
+            $(is).val(123)
+        }
         function bornTemplete(list, idx, tpl, row, idx1){
             $(list).append(Mustache.render(tpl, {
                 idx: idx, delBtn: true, row: row,
@@ -486,6 +566,20 @@
                 $("#linkmanButton").addClass("notForbidden");
             }
         }
+        function ondelEntrustRow(obj, prefix){
+            var id = $(prefix+"_id");
+            var delFlag = $(prefix+"_delFlag");
+            $(obj).parent().parent().remove();
+            if($("#workClientLinkmanList tr").length==0){
+                //按钮禁用
+                $("#addUserButton").addClass("notDisables");
+                //a标签置灰
+                $("#aButton").addClass("notForbidden");
+
+                $("#linkmanDiv").addClass("notDisables");
+                $("#linkmanButton").addClass("notForbidden");
+            }
+        }
 
         function delRow(obj, prefix){
             var id = $(prefix+"_id");
@@ -674,6 +768,12 @@
                         <form:hidden path="createBy.id" htmlEscape="false"   readonly="true"  class="form-control  layui-input"/>
                     </div>
                 </div>
+                <div class="layui-item layui-col-sm6 lw7">
+                    <label class="layui-form-label">归档名称:</label>
+                    <div class="layui-input-block">
+                        <form:input path="filingName" htmlEscape="false" class="form-control  layui-input"/>
+                    </div>
+                </div>
                 <div class="layui-item layui-col-sm12 lw7">
                     <label class="layui-form-label">归档信息:</label>
                     <div class="layui-input-block">
@@ -688,14 +788,15 @@
                     <sys:gridselectClientLink url="${ctx}/projectFilingBatch/projectFilingBatchInfo/finishListShow" id="constructionOrgList"   title="选择项目"
                                               cssClass="form-control required" fieldLabels="${fns:urlEncode('项目编号')}" fieldKeys="name"  searchLabel="${fns:urlEncode('客户名称')}" searchKey="name"></sys:gridselectClientLink>
                 </div>
+                <input id="attachment_file" type="file" name="attachment_file" onclick="addFile()" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
                 <div class="layui-item layui-col-xs12 form-table-container">
                     <table id="contentTable2" class="table table-bordered table-condensed details">
                         <thead>
                         <tr>
                             <th class="hide"></th>
-                            <th style="text-align: center" width="20%">归档项目编号</th>
-                            <th style="text-align: center" width="20%">归档项目名称</th>
-                            <th style="text-align: center" width="20%">报告号</th>
+                            <th style="text-align: center" width="20%">归档项目编号/文件类型</th>
+                            <th style="text-align: center" width="20%">归档项目名称/文件名称</th>
+                            <th style="text-align: center" width="20%">报告号/案卷号</th>
                             <th width="20%">操作</th>
                         </tr>
                         </thead>
@@ -706,7 +807,10 @@
                                         <td><input type="hidden" name="proId" value="${pro.id}"/>${pro.projectId}</td>
                                         <td>${pro.projectName}</td>
                                         <td>${pro.projectReportNumber}</td>
-                                        <td class="text-center op-td" ><span class="op-btn op-btn-delete" onclick="delEntrustRow(this)" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span></td>
+                                        <td class="text-center op-td" >
+                                            <span class="op-btn op-btn-add" onclick="addRowInfo()" title=\添加"><i class="fa fa-plus"></i>&nbsp;添加</span>
+                                            <span class="op-btn op-btn-delete" onclick="delEntrustRow(this)" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>
+                                        </td>
                                     </tr>
                                 </c:forEach>
                             </c:if>