소스 검색

资料库管理添加分类以及文件描述

[user3] 3 년 전
부모
커밋
f6d220740c

+ 11 - 0
src/main/java/com/jeeplus/modules/projectAccessory/dao/CollectAccessoryDao.java

@@ -32,4 +32,15 @@ public interface CollectAccessoryDao extends CrudDao<CollectAccessoryInfo> {
      * @return
      */
     List<CollectAccessoryInfo> companyList(CollectAccessoryInfo collectAccessoryInfo);
+    /**
+     * 查询收藏分类
+     * @return
+     */
+    List<String> classificationList(String userId);
+    /**
+     * 修改收藏的附件信息
+     * @param collectAccessoryInfo
+     * @return
+     */
+    int updateCollectAccessory (CollectAccessoryInfo collectAccessoryInfo);
 }

+ 18 - 0
src/main/java/com/jeeplus/modules/projectAccessory/entity/CollectAccessoryInfo.java

@@ -25,6 +25,8 @@ public class CollectAccessoryInfo extends DataEntity<CollectAccessoryInfo> {
     private Integer officeFlag;     //部门判定
     private Integer companyFlag;    //公司判定
     private Integer individualFlag;    //个人判定
+    private String classification;    //收藏分类
+    private String fileDescription;    //文件描述
 
 
     public String getUrl() {
@@ -154,4 +156,20 @@ public class CollectAccessoryInfo extends DataEntity<CollectAccessoryInfo> {
     public void setCollectUserId(String collectUserId) {
         this.collectUserId = collectUserId;
     }
+
+    public String getClassification() {
+        return classification;
+    }
+
+    public void setClassification(String classification) {
+        this.classification = classification;
+    }
+
+    public String getFileDescription() {
+        return fileDescription;
+    }
+
+    public void setFileDescription(String fileDescription) {
+        this.fileDescription = fileDescription;
+    }
 }

+ 13 - 0
src/main/java/com/jeeplus/modules/projectAccessory/service/CollectAccessoryService.java

@@ -232,4 +232,17 @@ public class CollectAccessoryService extends CrudService<CollectAccessoryDao, Co
     public void deleteByLogic(CollectAccessoryInfo collectAccessoryInfo){
         dao.deleteByLogic(collectAccessoryInfo);
     }
+
+    public List<String> classificationList(){
+        return dao.classificationList(UserUtils.getUser().getId());
+    }
+
+    /**
+     * 修改附件信息
+     * @param collectAccessoryInfo
+     */
+    @Transactional(readOnly = false)
+    public int updateCollectAccessory(CollectAccessoryInfo collectAccessoryInfo){
+        return dao.updateCollectAccessory(collectAccessoryInfo);
+    }
 }

+ 64 - 3
src/main/java/com/jeeplus/modules/projectAccessory/web/CollectAccessoryController.java

@@ -7,10 +7,13 @@ import com.jeeplus.common.web.BaseController;
 import com.jeeplus.modules.feedback.entity.QuestionFeedback;
 import com.jeeplus.modules.projectAccessory.entity.CollectAccessoryInfo;
 import com.jeeplus.modules.projectAccessory.service.CollectAccessoryService;
+import com.jeeplus.modules.projectEngineering.entity.EngineeringTree;
+import com.jeeplus.modules.projectEngineering.entity.ProjectEngineeringInfo;
 import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.json.JSONArray;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -21,9 +24,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author: 徐滕
@@ -178,6 +179,66 @@ public class CollectAccessoryController extends BaseController {
         }
         return map;
     }
+    /**
+     * 收藏附件信息
+     */
+    @RequestMapping(value = "saveGeCollectAccessory")
+    @ResponseBody
+    public Object saveGeCollectAccessory(CollectAccessoryInfo collectAccessoryInfo, Model model) {
+        Map<String,Object> map = new HashMap<>();
+        //url截取
+        String aliyunUrl = Global.getAliDownloadUrl();
+        if(collectAccessoryInfo.getUrl().indexOf(aliyunUrl)!=-1){
+            collectAccessoryInfo.setUrl(collectAccessoryInfo.getUrl().replace(aliyunUrl,""));
+        }
+        //根据文件id查询文件信息
+        List<Workattachment> workattachments = workattachmentService.getByUrls(collectAccessoryInfo.getUrl());
+        Workattachment workattachment=null;
+        if (workattachments.size()>0){
+            workattachment=workattachments.get(0);
+        }
+        if(null != workattachment){
+            collectAccessoryInfo.setFileName(workattachment.getAttachmentName());
+        }
+        //收藏附件信息
+        Integer result = collectAccessoryService.saveCollectAccessory(collectAccessoryInfo);
+        if(result == 1){
+            map.put("str","收藏附件信息成功!");
+            map.put("success",true);
+        }else{
+            map.put("str","收藏附件信息失败");
+            map.put("success",false);
+        }
+        return map;
+    }
+    /**
+     * 修改收藏信息
+     */
+    @RequestMapping(value = "updateCollectAccessory")
+    public String updateCollectAccessory(CollectAccessoryInfo collectAccessoryInfo, Model model) {
+        //修改附件信息
+        int r=collectAccessoryService.updateCollectAccessory(collectAccessoryInfo);
+        return "redirect:" + Global.getAdminPath() + "/collectAccessory/collectAccessory/?repage";
+    }
+    @RequestMapping(value = "classificationList")
+    @ResponseBody
+    public Object classificationList(CollectAccessoryInfo collectAccessoryInfo, Model model) {
+        LinkedHashSet<EngineeringTree> trees=new LinkedHashSet<>();
+        //查询所有分类
+        List<String> types=collectAccessoryService.classificationList();
+        childs(types,trees,"0");
+        JSONArray jsonArray=new JSONArray(trees);
+        return jsonArray.toString();
+    }
+    public static void childs(List<String> sourcelist,LinkedHashSet<EngineeringTree> list,String parentId){
+        for (int i=0; i<sourcelist.size(); i++){
+            String e = sourcelist.get(i);
+                EngineeringTree tree=new EngineeringTree();
+                tree.setTitle(e);
+                tree.setId(e);
+                list.add(tree);
+        }
+    }
 
 
     /**

+ 16 - 0
src/main/java/com/jeeplus/modules/projectAccessory/web/ProjectAccessoryController.java

@@ -17,6 +17,7 @@ import com.jeeplus.modules.projectAccessory.entity.CollectAccessoryInfo;
 import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryInfo;
 import com.jeeplus.modules.projectAccessory.entity.ProjectAccessoryTree;
 import com.jeeplus.modules.projectAccessory.entity.ProjectTemplateInfo;
+import com.jeeplus.modules.projectAccessory.service.CollectAccessoryService;
 import com.jeeplus.modules.projectAccessory.service.ProjectAccessoryService;
 import com.jeeplus.modules.projectAccessory.service.ProjectTemplateService;
 import com.jeeplus.modules.projectEngineering.service.ProjectEngineeringService;
@@ -67,6 +68,8 @@ public class ProjectAccessoryController extends BaseController {
 	private ProjectEngineeringService engineeringService;
 	@Autowired
 	private WorkattachmentService workattachmentService;
+	@Autowired
+	private CollectAccessoryService collectAccessoryService;
 
 	@ModelAttribute
 	public ProjectAccessoryInfo get(@RequestParam(required=false) String id) {
@@ -386,6 +389,19 @@ public class ProjectAccessoryController extends BaseController {
 		return "modules/projectAccessory/workAttachmentForm";
 	}
 
+	@RequestMapping(value = "collectAccessoryForm")
+	public String collectAccessorytForm(Model model){
+		CollectAccessoryInfo collectAccessoryInfo = new CollectAccessoryInfo();
+		model.addAttribute("collectAccessoryInfo", collectAccessoryInfo);
+		return "modules/projectAccessory/collectAccessoryForm";
+	}
+	@RequestMapping(value = "collectAccessoryModify")
+	public String collectAccessoryModify(CollectAccessoryInfo collectAccessoryInfo,Model model){
+		collectAccessoryInfo = collectAccessoryService.getInfo(collectAccessoryInfo.getId());
+		model.addAttribute("collectAccessoryInfo", collectAccessoryInfo);
+		return "modules/projectAccessory/collectAccessoryModify";
+	}
+
 	/**
 	 * 跳转到附件详情页面
 	 * @param attachmentId

+ 40 - 2
src/main/resources/mappings/modules/collectAccessory/CollectAccessoryDao.xml

@@ -18,6 +18,8 @@
 		a.collect_type  AS "collectType",
 		a.collect_user_id AS "collectUser.id",
 		a.file_size AS "fileSize",
+ 		ifnull(a.classification,'未分类') as "classification",
+		a.fileDescription AS "fileDescription",
 		su.name as "collectUser.name",
 		suc.name as "createBy.name"
 	</sql>
@@ -64,6 +66,17 @@
 					and a.company_id = #{createBy.company.id}
 				</if>
 			</if>
+			<if test="classification!=null and classification!=''">
+				and
+				<choose>
+					<when test="classification=='未分类'">
+						(a.classification = #{classification} or a.classification is null)
+					</when>
+					<otherwise>
+						a.classification =#{classification}
+					</otherwise>
+				</choose>
+			</if>
 		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
@@ -102,6 +115,17 @@
 					and a.company_id = #{createBy.company.id}
 				</if>
 			</if>
+			<if test="classification!=null and classification!=''">
+				and
+				<choose>
+					<when test="classification=='未分类'">
+						(a.classification = #{classification} or a.classification is null)
+					</when>
+					<otherwise>
+						a.classification =#{classification}
+					</otherwise>
+				</choose>
+			</if>
 		</where>
 	</select>
 
@@ -121,7 +145,9 @@
 		  company_id,
 		  collect_type,
 		  collect_user_id,
-		  file_size
+		  file_size,
+		  classification,
+		  fileDescription
 		)
 		values
 		  (
@@ -139,7 +165,9 @@
 			#{companyId},
 			#{collectType},
 			#{collectUser.id},
-			#{fileSize}
+			#{fileSize},
+			#{classification},
+			#{fileDescription}
 		  )
 	</insert>
 
@@ -181,9 +209,19 @@
 		</where>
 		ORDER BY a.create_date asc,a.file_name asc
 	</select>
+	<select id="classificationList" resultType="java.lang.String" >
+		SELECT DISTINCT(ifnull(classification,'未分类')) as "classification" FROM `work_collect_accessory`
+		where create_by =#{userId}
+	</select>
 	<update id="deleteByLogic">
 		UPDATE work_collect_accessory SET
 			del_flag = #{DEL_FLAG_DELETE}
 		WHERE id = #{id}
 	</update>
+	<update id="updateCollectAccessory">
+		UPDATE work_collect_accessory SET
+			classification = #{classification},
+			fileDescription = #{fileDescription}
+		WHERE id = #{id}
+	</update>
 </mapper>

+ 181 - 0
src/main/webapp/static/oss/ossupload.js

@@ -93,6 +93,66 @@ function multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,upload
     else
         multitest(client,storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt);
 };
+function CollectUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt) {
+
+    console.log("-----------------------start");
+    console.log("-----------------------"+realPath);
+
+    file.name.replace(" ","")
+    file.name.replace(/—/g,"")
+    var fileName = file.name;
+    // 将单引号‘’都转换成',将双引号“”都转换成"
+    fileName = fileName.replace(/\’|\‘/g,"'").replace(/\“|\”/g,"\"");
+    // 将中括号【】转换成[],将大括号{}转换成{}
+    fileName = fileName.replace(/\【/g,"(").replace(/\】/g,")").replace(/\{/g,"(").replace(/\}/g,")");
+    fileName = fileName.replace(/\[/g,"(").replace(/\]/g,")").replace(/\{/g,"(").replace(/\}/g,")");
+    // 将逗号,转换成,,将:转换成:
+    fileName = fileName.replace(/,/g,",").replace(/:/g,":");
+    //将中文——转换为英文-
+    fileName = fileName.replace(/—/g,"-")
+    fileName = fileName.replace(/……/g,"")
+    fileName = fileName.replace(/±/g,"")
+    fileName = fileName.replace(/#/g,"")
+    fileName = fileName.replace(/%/g,"")
+    var dfl=new File([file],fileName,{type:file.type});
+    file = dfl
+
+    requestUrl = realPath+"/previewController/getAccess";
+    OSS.urllib.request(requestUrl, {method: 'GET'}, function (err, response) {
+        if (err) {
+            console.log(err);
+            $.ajax({
+                type:"post",
+                url:realPath+"/previewController/saveJSError",
+                data:{object:err.toString()},
+                async: false,
+                success:function(data){
+                }
+            });
+            return alert(err);
+        }
+        try {
+            result = JSON.parse(response);
+        } catch (e) {
+            errmsg = 'parse sts response info error: ' + e.message;
+            return alert(errmsg);
+        }
+        console.log("---------result"+result);
+        client = new OSS.Wrapper({
+            accessKeyId: result.AccessKeyId,
+            accessKeySecret: result.AccessKeySecret,
+            stsToken: result.SecurityToken,
+            bucket: result.Bucket,
+            endpoint: result.Endpoint,
+            timeout:'30000'
+        });
+        storeAs = "attachment-file/" + storeAs +"/"+today+new Date().getTime()+ file.name;
+        if(cpt == 1)
+            multitestFlag(client,storeAs, file,attachmentId,attachmentFlag,uploadPath.replace('http://dmtest-test.oss-cn-shanghai.aliyuncs.com', result.AliyunUrl),divId,size, cpt,idx,prefix,currentUser);
+        else
+            CollectMultitest(client, storeAs, file,attachmentId,attachmentFlag,uploadPath.replace('http://dmtest-test.oss-cn-shanghai.aliyuncs.com', result.AliyunUrl),divId,size, cpt);
+    })
+};
 function multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size, cpt,idx,prefix,currentUser) {
 
     console.log("-----------------------start");
@@ -853,6 +913,127 @@ function multitest (ossClient, storeAs, file,attachmentId,attachmentFlag,uploadP
         console.log(err);
     });
 };
+function CollectMultitest (ossClient, storeAs, file,attachmentId,attachmentFlag,uploadPath,divId, size,cpt) {
+
+    var names =  storeAs.split("/");
+    var name = names[names.length-1];
+    ossClient.multipartUpload(storeAs, file,{
+        partSize: 1 * 1024 * 1024,
+        parallel: 5,
+        progress: function* (percent, cpt) {
+            var p = Math.floor(percent*100);
+            $("#jindutiao"+divId).attr("style","width: "+p+"%");
+            $("#jindutiao"+divId).attr("aria-valuenow",p+"%");
+            $("#baifenbi"+divId).html(p+"%");
+            $("#fileName"+divId).html(file.name);
+            checkpoint_temp = cpt;
+        }
+    }).then(function (result) {
+        var fileLocation = "";
+        var lookUrl = "";
+        //获取文件存储位置(0:本地;1:百度云;2:阿里云)
+        $.ajax({
+            type:"get",
+            url:realPath+"/bos/getFileStorageLocation",
+            async: false,
+            success:function(data){
+                fileLocation = data.fileLocation;
+            }
+        });
+
+        returnUrl = realPath+"/sys/workattachment/saveAttachment";
+        $.ajax({
+            type:'post',
+            url:returnUrl,
+            data:{
+                "attachmentName":file['name'],
+                "attachmentId":attachmentId,
+                "attachmentFlag":attachmentFlag,
+                "fileSize":file['size'],
+                "url":"/"+storeAs
+            },
+            success:function(data){
+                var lowerType = data.type.toLowerCase();
+                if(data.status=="Success"){
+                    parent.layer.msg("上传成功!",{icon:1});
+                    var lenght =$(".trIdAdds").length;
+                    if (size != 0){
+                        lenght += size;
+                    }
+                    var addFile = "addFile"+divId;
+                    var str = '<tr class="trIdAdds">'+
+                        '<td class="text-center">' ;
+                    if(2 == fileLocation){
+                        $.ajax({
+                            type:"post",
+                            async:false,
+                            url:realPath+"/workfullmanage/workFullManage/getFileTemporaryLookUrl",
+                            data:{"file":data.url,},
+                            success:function(result){
+                                lookUrl = result.lookUrl;
+                                if (isContains("jpg,png,gif,bmp,jpeg",lowerType)){
+                                    str = str +'<img src="'+lookUrl+'" width="50" height="50" onclick="openDialogView(\'预览\',\''+ '/a/sys/picturepreview/picturePreview?url=' +lookUrl+ '\',\'90%\',\'90%\')" alt="'+data.attachmentName+'"/>';
+                                }else if(isContains("pdf",lowerType)){
+                                    str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openPreview(\''+lookUrl+'\',1)">'+data.attachmentName+'</a>';
+                                }else if(isContains("rar,zip,jar,7z",lowerType)){
+                                    str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openPreview(\''+lookUrl+'\',3)">'+data.attachmentName+'</a>';
+                                }else if(isContains("avi,wmv,mpg,mpeg,mov,rm,ram,swf,flv,mp4,rmvb",lowerType)){
+                                    str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openDialogView(\'预览\',\''+ '/a/sys/picturepreview/videoPreview?url=' +lookUrl+ '\',\'90%\',\'90%\')">'+data.attachmentName+'</a>';
+                                }else {
+                                    str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openPreview(\''+lookUrl+'\',2)">'+data.attachmentName+'</a>';
+                                }
+                            }
+                        });
+
+                    }else{
+                        if (isContains("jpg,png,gif,bmp,jpeg",lowerType)){
+                            str = str +'<img src="'+data.url+'" width="50" height="50" onclick="openDialogView(\'预览\',\''+realPath+ '/a/sys/picturepreview/picturePreview?url=' +data.url+ '\',\'90%\',\'90%\')" alt="'+data.attachmentName+'"/>';
+                        }else if(isContains("pdf",lowerType)){
+                            str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openPreview(\''+data.url+'\',1)">'+data.attachmentName+'</a>';
+                        }else if(isContains("rar,zip,jar,7z",lowerType)){
+                            str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openPreview(\''+data.url+'\',3)">'+data.attachmentName+'</a>';
+                        }else if(isContains("avi,wmv,mpg,mpeg,mov,rm,ram,swf,flv,mp4,rmvb",lowerType)){
+                            str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openDialogView(\'预览\',\''+ '/a/sys/picturepreview/videoPreview?url=' +lookUrl+ '\',\'90%\',\'90%\')">'+data.attachmentName+'</a>';
+                        }else {
+                            str = str + '<a class="attention-info" href="javascript:void(0)" onclick="openPreview(\''+data.url+'\',2)">'+data.attachmentName+'</a>';
+                        }
+                    }
+                    str = str +'</td>'+
+                        '<td >'+data.createByName+'</td>'+
+                        '<td >'+data.createDate+
+                        '<input name="url" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.url+'"/>'+
+                        '<input name="fileName" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.attachmentName+'"/>'+
+                        '<input name="userId" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.createBy+'"/>'+
+                        '<input name="type" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="1"/>'+
+                        '<input name="fileSize" type="hidden" readonly="readonly" maxlength="20" style="width:140px;" class="form-control" value="'+data.fileSize+'"/>'+
+                        '</td>'+
+                        '<td class="op-td">'+
+                        '<div class="op-btn-box">';
+                    if(2 == fileLocation){
+                        if(isContains("pdf",lowerType)){
+                            str = str +'<a href="'+lookUrl+'" target="_blank" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
+                        }else{
+                            str = str +'<a href="'+lookUrl+'" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>';
+                        }
+                    }else{
+                        str = str +'<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>';
+                    }
+                    str = str + '<a href="javascript:void(0)" onclick="ossCollectingAccessory(this,\''+realPath+'/projectAccessory/projectAccessory/saveCollectAccessory?url='+data.url+'&fileName='+data.attachmentName+'\',\''+addFile+'\',\''+data.createBy+'\')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>'+
+                        '<a href="javascript:void(0)" onclick="deleteFileFromAliyun1(this,\''+realPath+'/a/sys/workattachment/deleteFileFromAliyun?url='+encodeURIComponent(data.url)+'&id='+data.id+'&type=2\',\''+addFile+'\',\''+divId+'\')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>'+
+                        '</div>' +
+                        '</td>'+
+                        '</tr>';
+                    $("#file"+divId).append(str);
+                }else {
+                    parent.layer.msg("上传失败!",{icon:2});
+                }
+            }
+        })
+    }).catch(function (err) {
+        console.log("err------ err:");
+        console.log(err);
+    });
+};
 function multitestWorkOrder (ossClient, storeAs, file,attachmentId,attachmentFlag,uploadPath,divId, size,cpt) {
 
     var names =  storeAs.split("/");

+ 30 - 6
src/main/webapp/webpage/modules/collectAccessory/collectAccessoryCompanyList.jsp

@@ -35,6 +35,23 @@
                 type : 'date'
 , trigger: 'click'
             });
+			$.ajax({
+				type : "POST",
+				url : "${ctx}/collectAccessory/collectAccessory/classificationList",
+				//请求成功
+				success : function(result) {
+					var str=jQuery.parseJSON(result);
+					//分类菜单
+					layui.dropdown.render({
+						elem: '#demo100'
+						,style: 'width: 380px;'
+						,data:str
+						,click: function(item){
+							$("#demo100").find("#classification").val(item.title)
+						}
+					});
+				}
+			});
         });
 
         function reset() {
@@ -282,13 +299,14 @@
 						<div style="    clear:both;"></div>
 					</div>
 					<div id="moresees" style="clear:both;display:none;" class="lw6">
-						<%--<div class="layui-item query athird">
-							<label class="layui-form-label">部门:</label>
+						<div class="layui-item query athird">
+							<label class="layui-form-label">收藏分类:</label>
 							<div class="layui-input-block with-icon">
-								<sys:treeselect id="officeId" name="office.id" value="${ruralProjectRecords.office.id}" labelName="office.name" labelValue="${ruralProjectRecords.office.name}"
-												title="部门" url="/sys/office/treeDataAll?type=2" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="false"/>
+								<span style="width: 100%;text-align: left;position: relative;" id="demo100">
+									<input htmlEscape="false" name="classification" id="classification" maxlength="60" class="form-control layui-input" value="${collectAccessoryInfo.classification}"/>
+								</span>
 							</div>
-						</div>--%>
+						</div>
 						<div style="clear:both;"></div>
 					</div>
 				</form:form>
@@ -324,7 +342,8 @@
             ,cols: [[
 				/*{checkbox: true, fixed: true},*/
                 {field:'index',align:'center', title: '序号',width:55}
-                ,{field:'fileName',align:'center', title: '附件名称',minWidth:200,templet:function(d){
+				,{field:'classification',align:'center', title: '收藏分类',  width:150}
+				,{field:'fileName',align:'center', title: '附件名称',minWidth:200,templet:function(d){
                 		if(2 == d.uploadMode){
                 			if(d.fileName.indexOf('jpg') != -1 || d.fileName.indexOf('png') != -1 || d.fileName.indexOf('gif') != -1 || d.fileName.indexOf('bmp') != -1 || d.fileName.indexOf('jpeg') != -1){
 								return "<img src="+d.temporaryUrl+" width='50' height='50' onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.temporaryUrl +"','90%','90%')\" alt='"+d.fileName+"'>";
@@ -343,6 +362,9 @@
 							}
 						}
                     }}
+				,{field:'fileDescription',align:'center', title: '文件描述',  width:150,templet:function(d){
+						return "<span title='"+d.fileDescription+"'>"+d.fileDescription+"</span>"
+					}}
 				,{field:'createName',align:'center', title: '上传人',  width:150}
 				,{field:'collectUserName',align:'center', title: '收藏人',  width:150}
 				,{field:'createDate',align:'center', title: '上传/收藏时间',  width:150}
@@ -371,6 +393,8 @@
                     ,"createName":"${collectAccessoryInfo.createBy.name}"
                     ,"collectUserName":"${collectAccessoryInfo.collectUser.name}"
 					,"individualFlag":"${collectAccessoryInfo.individualFlag}"
+					,"fileDescription":"${collectAccessoryInfo.fileDescription}"
+					,"classification":"${collectAccessoryInfo.classification}"
 					,"createDate":"<fmt:formatDate value="${collectAccessoryInfo.createDate}" pattern="yyyy-MM-dd"/>"
 
                 }

+ 124 - 8
src/main/webapp/webpage/modules/collectAccessory/collectAccessoryList.jsp

@@ -35,6 +35,23 @@
                 type : 'date'
 , trigger: 'click'
             });
+			$.ajax({
+				type : "POST",
+				url : "${ctx}/collectAccessory/collectAccessory/classificationList",
+				//请求成功
+				success : function(result) {
+					var str=jQuery.parseJSON(result);
+					//分类菜单
+					layui.dropdown.render({
+						elem: '#demo100'
+						,style: 'width: 380px;'
+						,data:str
+						,click: function(item){
+							$("#demo100").find("#classification").val(item.title)
+						}
+					});
+				}
+			});
         });
 
         function reset() {
@@ -207,6 +224,93 @@
 				$("#addFile"+divId).show();
 				fileCollectAccessory(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,0);}
 		}
+		function openBill2(title,url,width,height,target,formId,tableId){
+			var rows = $(this).parent().prevAll().length + 1;
+			var frameIndex = parent.layer.getFrameIndex(window.name);
+			var urls = url+"&index="+frameIndex;
+			if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+				width='auto';
+				height='auto';
+			}else{//如果是PC端,根据用户设置的width和height显示。
+
+			}
+			top.layer.open({
+				type: 2,
+				area: [width, height],
+				title: title,
+				skin:"two-btns",
+				maxmin: false, //开启最大化最小化按钮
+				content: urls ,
+				btn: ['确定','关闭'],
+				yes: function(index, layero){
+					var body = top.layer.getChildFrame('body', index);
+					var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+					var inputForm = body.find('#inputForm');
+					var top_iframe;
+					if(target){
+						top_iframe = target;//如果指定了iframe,则在改frame中跳转
+					}else{
+						top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+					}
+					inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+					inputForm.attr("action","${ctx}/collectAccessory/collectAccessory/saveGeCollectAccessory");//表单提交成功后,从服务器返回的url在当前tab中展示
+					var $document = iframeWin.contentWindow.document;
+					iframeWin.contentWindow.formSubmit2($document,formId,index,tableId);
+					top.layer.close(index)
+					location.reload();
+				},
+				cancel: function(index){
+				},
+				end:function () {
+					//var reviewFee = $("#reviewFee").val();
+					//$("#"+tableId).load(location.href+"&reviewFee="+reviewFee + " #"+tableId);
+					//location.reload();
+				}
+			});
+		}
+		function openBill3(title,url,width,height,target,formId,tableId){
+			var rows = $(this).parent().prevAll().length + 1;
+			var frameIndex = parent.layer.getFrameIndex(window.name);
+			var urls = url+"&index="+frameIndex;
+			if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
+				width='auto';
+				height='auto';
+			}else{//如果是PC端,根据用户设置的width和height显示。
+
+			}
+			top.layer.open({
+				type: 2,
+				area: [width, height],
+				title: title,
+				skin:"two-btns",
+				maxmin: false, //开启最大化最小化按钮
+				content: urls ,
+				btn: ['确定','关闭'],
+				yes: function(index, layero){
+					var body = top.layer.getChildFrame('body', index);
+					var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+					var inputForm = body.find('#inputForm');
+					var top_iframe;
+					if(target){
+						top_iframe = target;//如果指定了iframe,则在改frame中跳转
+					}else{
+						top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
+					}
+					inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
+					if(iframeWin.contentWindow.doSubmit(1) ){
+						setTimeout(function(){top.layer.close(index)}, 100);//延时0.1秒,对应360 7.1版本bug
+					}
+				},
+				cancel: function(index){
+				},
+				end:function () {
+					//var reviewFee = $("#reviewFee").val();
+					//$("#"+tableId).load(location.href+"&reviewFee="+reviewFee + " #"+tableId);
+					//location.reload();
+				}
+			});
+		}
+
 	</script>
 	<style>
 		body{
@@ -265,13 +369,14 @@
 						<div style="    clear:both;"></div>
 					</div>
 					<div id="moresees" style="clear:both;display:none;" class="lw6">
-						<%--<div class="layui-item query athird">
-							<label class="layui-form-label">部门:</label>
+						<div class="layui-item query athird">
+							<label class="layui-form-label">收藏分类:</label>
 							<div class="layui-input-block with-icon">
-								<sys:treeselect id="officeId" name="office.id" value="${ruralProjectRecords.office.id}" labelName="office.name" labelValue="${ruralProjectRecords.office.name}"
-												title="部门" url="/sys/office/treeDataAll?type=2" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="false"/>
+								<span style="width: 100%;text-align: left;position: relative;" id="demo100">
+									<input htmlEscape="false" name="classification" id="classification" maxlength="60" class="form-control layui-input" value="${collectAccessoryInfo.classification}"/>
+								</span>
 							</div>
-						</div>--%>
+						</div>
 						<div style="clear:both;"></div>
 					</div>
 				</form:form>
@@ -282,7 +387,8 @@
 				<div class="nav-btns">
 					<div class="layui-btn-group">
 						<shiro:hasPermission name="collectAccessory:collectAccessory:save">
-							<button class="layui-btn layui-btn-sm layui-bg-blue" data-toggle="tooltip" data-placement="left" onclick="saveClick()" title="刷新"> 上传附件</button>
+<%--							<button class="layui-btn layui-btn-sm layui-bg-blue" data-toggle="tooltip" data-placement="left" onclick="saveClick()" title="刷新"> 上传附件</button>--%>
+							<a href="javascript:void(0)"  onclick="openBill2('上传附件', '${ctx}/projectAccessory/projectAccessory/collectAccessoryForm?attachmentId=100&uploadMode=2','70%','80%',false,'inputForm','upTable')" class="layui-btn layui-btn-sm layui-bg-blue" > 上传附件</a>
 						</shiro:hasPermission>
 						<button class="layui-btn layui-btn-sm" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"> 刷新</button>
 					</div>
@@ -318,7 +424,8 @@
             ,cols: [[
 				/*{checkbox: true, fixed: true},*/
                 {field:'index',align:'center', title: '序号',width:55}
-                ,{field:'fileName',align:'center', title: '附件名称',minWidth:200,templet:function(d){
+				,{field:'classification',align:'center', title: '收藏分类',  width:150}
+				,{field:'fileName',align:'center', title: '附件名称',minWidth:200,templet:function(d){
                 		if(2 == d.uploadMode){
                 			if(d.fileName.indexOf('jpg') != -1 || d.fileName.indexOf('png') != -1 || d.fileName.indexOf('gif') != -1 || d.fileName.indexOf('bmp') != -1 || d.fileName.indexOf('jpeg') != -1){
 								return "<img src="+d.temporaryUrl+" width='50' height='50' onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.temporaryUrl +"','90%','90%')\" alt='"+d.fileName+"'>";
@@ -337,12 +444,18 @@
 							}
 						}
                     }}
+				,{field:'fileDescription',align:'center', title: '文件描述',  width:150,templet:function(d){
+						return "<span title='"+d.fileDescription+"'>"+d.fileDescription+"</span>"
+					}}
 				,{field:'collectUserName',align:'center', title: '上传人',  width:150}
 				,{field:'createName',align:'center', title: '收藏人',  width:150}
 				,{field:'createDate',align:'center', title: '上传/收藏时间',  width:150}
-                ,{field:'op',align:'center',title:"操作",width:200,templet:function(d){
+                ,{field:'op',align:'center',title:"操作",width:250,templet:function(d){
                         ////对操作进行初始化
                         var xml="<div class=\"layui-btn-group\">";
+						if (d.currentUser ==1){
+							xml+="<a href=\"javascript:void(0)\"  onclick=\"openBill3('更改信息', '${ctx}/projectAccessory/projectAccessory/collectAccessoryModify?id="+d.id+"','70%','80%',false,'inputForm','upTable')\" class=\"layui-btn layui-btn-xs layui-bg-green\" > 编辑</a>\n"
+						}
                         if(d.officeFlag != 1){
 							xml+="<a href=\"${ctx}/collectAccessory/collectAccessory/shareAccessory?id=" + d.id + "&type=2\" onclick=\"return confirmx('确认将该文件共享到部门吗?', this.href)\" class=\"layui-btn layui-btn-xs layui-bg-green\"> 部门共享</a>";
 						}
@@ -371,7 +484,10 @@
                     ,"collectUserName":"${collectAccessoryInfo.collectUser.name}"//上传人
 					,"officeFlag":"${collectAccessoryInfo.officeFlag}"
 					,"companyFlag":"${collectAccessoryInfo.companyFlag}"
+					,"fileDescription":"${collectAccessoryInfo.fileDescription}"
+					,"classification":"${collectAccessoryInfo.classification}"
 					,"createDate":"<fmt:formatDate value="${collectAccessoryInfo.createDate}" pattern="yyyy-MM-dd"/>"
+					,"currentUser":<c:if test="${fns:getUser().id eq collectAccessoryInfo.createBy.id}">1</c:if>
 				}
 				</c:forEach>
                 </c:if>

+ 30 - 6
src/main/webapp/webpage/modules/collectAccessory/collectAccessoryOfficeList.jsp

@@ -35,6 +35,23 @@
                 type : 'date'
 , trigger: 'click'
             });
+			$.ajax({
+				type : "POST",
+				url : "${ctx}/collectAccessory/collectAccessory/classificationList",
+				//请求成功
+				success : function(result) {
+					var str=jQuery.parseJSON(result);
+					//分类菜单
+					layui.dropdown.render({
+						elem: '#demo100'
+						,style: 'width: 380px;'
+						,data:str
+						,click: function(item){
+							$("#demo100").find("#classification").val(item.title)
+						}
+					});
+				}
+			});
         });
 
         function reset() {
@@ -283,13 +300,14 @@
 						<div style="    clear:both;"></div>
 					</div>
 					<div id="moresees" style="clear:both;display:none;" class="lw6">
-						<%--<div class="layui-item query athird">
-							<label class="layui-form-label">部门:</label>
+						<div class="layui-item query athird">
+							<label class="layui-form-label">收藏分类:</label>
 							<div class="layui-input-block with-icon">
-								<sys:treeselect id="officeId" name="office.id" value="${ruralProjectRecords.office.id}" labelName="office.name" labelValue="${ruralProjectRecords.office.name}"
-												title="部门" url="/sys/office/treeDataAll?type=2" cssClass="form-control layui-input" allowClear="true" notAllowSelectParent="false"/>
+								<span style="width: 100%;text-align: left;position: relative;" id="demo100">
+									<input htmlEscape="false" name="classification" id="classification" maxlength="60" class="form-control layui-input" value="${collectAccessoryInfo.classification}"/>
+								</span>
 							</div>
-						</div>--%>
+						</div>
 						<div style="clear:both;"></div>
 					</div>
 				</form:form>
@@ -325,7 +343,8 @@
             ,cols: [[
 				/*{checkbox: true, fixed: true},*/
                 {field:'index',align:'center', title: '序号',width:55}
-                ,{field:'fileName',align:'center', title: '附件名称',minWidth:200,templet:function(d){
+				,{field:'classification',align:'center', title: '收藏分类',  width:150}
+				,{field:'fileName',align:'center', title: '附件名称',minWidth:200,templet:function(d){
                 		if(2 == d.uploadMode){
                 			if(d.fileName.indexOf('jpg') != -1 || d.fileName.indexOf('png') != -1 || d.fileName.indexOf('gif') != -1 || d.fileName.indexOf('bmp') != -1 || d.fileName.indexOf('jpeg') != -1){
 								return "<img src="+d.temporaryUrl+" width='50' height='50' onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.temporaryUrl +"','90%','90%')\" alt='"+d.fileName+"'>";
@@ -344,6 +363,9 @@
 							}
 						}
                     }}
+				,{field:'fileDescription',align:'center', title: '文件描述',  width:150,templet:function(d){
+						return "<span title='"+d.fileDescription+"'>"+d.fileDescription+"</span>"
+					}}
 				,{field:'createName',align:'center', title: '上传人',  width:150}
 				,{field:'collectUserName',align:'center', title: '收藏人',  width:150}
 				,{field:'createDate',align:'center', title: '上传/收藏时间',  width:150}
@@ -371,6 +393,8 @@
                     ,"createName":"${collectAccessoryInfo.createBy.name}"
                     ,"collectUserName":"${collectAccessoryInfo.collectUser.name}"
 					,"individualFlag":"${collectAccessoryInfo.individualFlag}"
+					,"fileDescription":"${collectAccessoryInfo.fileDescription}"
+					,"classification":"${collectAccessoryInfo.classification}"
 					,"createDate":"<fmt:formatDate value="${collectAccessoryInfo.createDate}" pattern="yyyy-MM-dd"/>"
                 }
                 </c:forEach>

+ 210 - 0
src/main/webapp/webpage/modules/projectAccessory/collectAccessoryForm.jsp

@@ -0,0 +1,210 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>收文管理管理</title>
+	<meta name="decorator" content="default"/>
+	<link rel='stylesheet' type="text/css" href="${ctxStatic}/layui/layuidown.css"/>
+	<script type="text/javascript" src="${ctxStatic}/layui/layuidown.js"></script>
+	<script type="text/javascript">
+		var validateForm;
+		function doSubmit(i){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+			if(validateForm.form()){
+
+				$("#inputForm").submit();
+				return true;
+			}
+
+			return false;
+		}
+		$(document).ready(function() {
+			validateForm = $("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+			$("#attachment_btn").click(function () {
+				$("#attachment_file").click();
+			});
+			$.ajax({
+				type : "POST",
+				url : "${ctx}/collectAccessory/collectAccessory/classificationList",
+				//请求成功
+				success : function(result) {
+					var str=jQuery.parseJSON(result);
+					//分类菜单
+					layui.dropdown.render({
+						elem: '#demo100'
+						,style: 'width: 380px;'
+						,data:str
+						,click: function(item){
+							$("#demo100").find("#classification").val(item.title)
+						}
+					});
+				}
+			});
+		});
+		function formSubmit2($document,inputForm,index,tableId){
+			var length=$("#file_attachment tr").length;
+			if (length>1){
+				top.layer.msg("添加收藏附件只能上传一个文件", {icon: 0});
+				return false;
+			}
+			var validateForm = $($document.getElementById(inputForm)).validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$($document.getElementById("#messageBox")).text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+			if(validateForm.form()){
+				$($document.getElementById(inputForm)).ajaxSubmit({
+					success:function(data) {
+						var d = data;
+						//输出提示信息
+						if(d.str.length>0){
+							parent.layer.msg(d.str,{icon:1});
+						}
+						//$("#"+tableId).load(location.href + " #"+tableId);
+						//关闭当前页
+						return true;
+					}
+				});
+			}
+		}
+		function insertTitle(tValue){
+			var fileName = tValue.lastIndexOf(".");//获取到文件名开始到最后一个“.”的长度。
+			var fileNameLength = tValue.length;//获取到文件名长度
+			var list = "${workIncomingMessage.workAttachments}";
+			var size = (list.split('url')).length-1;
+			var files = $("#attachment_file")[0].files;
+
+			for(var i = 0;i<files.length;i++) {
+				var file = files[i];
+				var fileSize = (file.size/(1024 * 1024)).toFixed(2);
+				var attachmentId = "";
+				var attachmentFlag = "100";
+				console.log(file);
+				var timestamp=new Date().getTime();
+
+				var storeAs = "workAttachment";
+				var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile"+divId).show();
+				CollectUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);}
+		}
+		function showfile(){
+			var length=$("#file_attachment tr").length;
+			var files=new Array();
+			for(var i=0;i<length;i++){
+				files[i]=$("#file_attachment").find("tr").eq(i).find("td").html();
+			}
+			return files;
+		}
+		function showfileXia(){
+			var length=$("#file_attachment tr").length;
+			var xia=new Array();
+			for(var i=0;i<length;i++){
+				xia[i]=$("#file_attachment").find("tr").eq(i).find("td").eq(3).find("span").html();
+			}
+			return xia;
+		}
+	</script>
+</head>
+<body>
+<div class="single-form">
+	<div class="container">
+		<form:form id="inputForm" modelAttribute="collectAccessoryInfo" action="${ctx}/collectAccessory/collectAccessory/saveGeCollectAccessory" method="post" class="form-horizontal">
+			<input type="hidden" name="attachTypes" value=""/>
+			<input type="hidden" name="attachLength" value=""/>
+			<div class="form-group layui-row first lw13">
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">收藏分类:</label>
+					<div class="layui-input-block">
+						<span style="width: 100%;text-align: left;position: relative;" id="demo100">
+							<input htmlEscape="false" name="classification" id="classification" maxlength="60" class="form-control layui-input" autocomplete="off" value=""/>
+						</span>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12">
+					<label class="layui-form-label"><span class="require-item">*</span>文件描述:</label>
+					<div class="layui-input-block">
+						<textarea htmlEscape="false" name="fileDescription" rows="4" maxlength="250" class="form-control required" ></textarea>
+					</div>
+				</div>
+			</div>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<div class="layui-item nav-btns">
+					<a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
+				</div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th width="50%">文件预览</th>
+							<th>上传人</th>
+							<th>上传时间</th>
+							<th width="200px">操作</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+						</tbody>
+					</table>
+				</div>
+			</div>
+		</form:form>
+	</div>
+</div>
+<script>
+
+		function collectingAccessory(obj,url,fileUrl,uploadUserId,fileSize){
+		$.ajax({
+			type:"post",
+			url:url,
+			data: {"url":fileUrl,"type":"1","collectType":1,"collectUserId":uploadUserId,"fileSize":fileSize},
+			success:function(data){
+				if(data.success){
+					$(obj).hide()
+					//关闭当前页
+					top.layer.close(index)
+					parent.layer.msg(data.str,{icon:1});
+				}else {
+					parent.layer.msg(data.str,{icon:2});
+				}
+			}
+		});
+	}
+</script>
+</body>
+</html>

+ 244 - 0
src/main/webapp/webpage/modules/projectAccessory/collectAccessoryModify.jsp

@@ -0,0 +1,244 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>收文管理管理</title>
+	<meta name="decorator" content="default"/>
+	<link rel='stylesheet' type="text/css" href="${ctxStatic}/layui/layuidown.css"/>
+	<script type="text/javascript" src="${ctxStatic}/layui/layuidown.js"></script>
+	<script type="text/javascript">
+		var validateForm;
+		function doSubmit(i){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+			if(validateForm.form()){
+				$("#inputForm").submit();
+				return true;
+			}
+			return false;
+		}
+		$(document).ready(function() {
+			validateForm = $("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+			$("#attachment_btn").click(function () {
+				$("#attachment_file").click();
+			});
+			$.ajax({
+				type : "POST",
+				url : "${ctx}/collectAccessory/collectAccessory/classificationList",
+				//请求成功
+				success : function(result) {
+					var str=jQuery.parseJSON(result);
+					//分类菜单
+					layui.dropdown.render({
+						elem: '#demo100'
+						,style: 'width: 380px;'
+						,data:str
+						,click: function(item){
+							$("#demo100").find("#classification").val(item.title)
+						}
+					});
+				}
+			});
+		});
+		function formSubmit2($document,inputForm,index,tableId){
+			var length=$("#file_attachment tr").length;
+			if (length>1){
+				top.layer.msg("添加收藏附件只能上传一个文件", {icon: 0});
+				return false;
+			}
+			var validateForm = $($document.getElementById(inputForm)).validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$($document.getElementById("#messageBox")).text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
+			if(validateForm.form()){
+				$($document.getElementById(inputForm)).ajaxSubmit({
+					success:function(data) {
+						var d = data;
+						//输出提示信息
+						if(d.str.length>0){
+							parent.layer.msg(d.str,{icon:1});
+						}
+						//$("#"+tableId).load(location.href + " #"+tableId);
+						//关闭当前页
+						return true;
+					}
+				});
+			}
+		}
+		function insertTitle(tValue){
+			var fileName = tValue.lastIndexOf(".");//获取到文件名开始到最后一个“.”的长度。
+			var fileNameLength = tValue.length;//获取到文件名长度
+			var list = "${workIncomingMessage.workAttachments}";
+			var size = (list.split('url')).length-1;
+			var files = $("#attachment_file")[0].files;
+
+			for(var i = 0;i<files.length;i++) {
+				var file = files[i];
+				var fileSize = (file.size/(1024 * 1024)).toFixed(2);
+				var attachmentId = "";
+				var attachmentFlag = "100";
+				console.log(file);
+				var timestamp=new Date().getTime();
+
+				var storeAs = "workAttachment";
+				var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
+				var divId = "_attachment";
+				$("#addFile"+divId).show();
+				CollectUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);}
+		}
+		function showfile(){
+			var length=$("#file_attachment tr").length;
+			var files=new Array();
+			for(var i=0;i<length;i++){
+				files[i]=$("#file_attachment").find("tr").eq(i).find("td").html();
+			}
+			return files;
+		}
+		function showfileXia(){
+			var length=$("#file_attachment tr").length;
+			var xia=new Array();
+			for(var i=0;i<length;i++){
+				xia[i]=$("#file_attachment").find("tr").eq(i).find("td").eq(3).find("span").html();
+			}
+			return xia;
+		}
+	</script>
+</head>
+<body>
+<div class="single-form">
+	<div class="container">
+		<form:form id="inputForm" modelAttribute="collectAccessoryInfo" action="${ctx}/collectAccessory/collectAccessory/updateCollectAccessory" method="post" class="form-horizontal">
+			<form:hidden path="id"/>
+			<div class="form-group layui-row first lw13">
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">收藏分类:</label>
+					<div class="layui-input-block">
+						<span style="width: 100%;text-align: left;position: relative;" id="demo100">
+							<input htmlEscape="false" name="classification" id="classification" maxlength="60" class="form-control layui-input" autocomplete="off" value="${collectAccessoryInfo.classification}"/>
+						</span>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12">
+					<label class="layui-form-label"><span class="require-item">*</span>文件描述:</label>
+					<div class="layui-input-block">
+						<textarea htmlEscape="false" name="fileDescription" rows="4" maxlength="250" class="form-control required" >${collectAccessoryInfo.fileDescription}</textarea>
+					</div>
+				</div>
+			</div>
+
+			<div class="form-group layui-row">
+				<div class="form-group-label"><h2>附件信息</h2></div>
+				<div id="addFile_attachment" style="display: none" class="upload-progress">
+					<span id="fileName_attachment" ></span>
+					<b><span id="baifenbi_attachment" ></span></b>
+					<div class="progress">
+						<div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
+						</div>
+					</div>
+				</div>
+				<input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
+				<span id="attachment_title"></span>
+				<div class="layui-item layui-col-xs12" style="padding:0 16px;">
+					<table id="upTable" class="table table-bordered table-condensed details">
+						<thead>
+						<tr>
+								<%-- <th>序号</th>--%>
+							<th width="50%">文件预览</th>
+							<th>上传人</th>
+							<th>上传时间</th>
+						</tr>
+						</thead>
+						<tbody id="file_attachment">
+							<tr>
+								<c:choose>
+									<c:when test="${collectAccessoryInfo.uploadMode == 2}">
+										<c:choose>
+											<c:when test="${collectAccessoryInfo.fileName.indexOf('jpg') != -1 || collectAccessoryInfo.fileName.indexOf('png') != -1 || collectAccessoryInfo.fileName.indexOf('gif') != -1 || collectAccessoryInfo.fileName.indexOf('bmp') != -1 || collectAccessoryInfo.fileName.indexOf('jpeg') != -1}">
+												<td><img src="${collectAccessoryInfo.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${collectAccessoryInfo.temporaryUrl}','90%','90%')" alt="${collectAccessoryInfo.fileName}">
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${collectAccessoryInfo.fileName.indexOf('pdf') != -1}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${collectAccessoryInfo.temporaryUrl}',1)">${collectAccessoryInfo.fileName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${collectAccessoryInfo.temporaryUrl}',2)">${collectAccessoryInfo.fileName}</a></td>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:when>
+									<c:otherwise>
+										<c:choose>
+											<c:when test="${collectAccessoryInfo.fileName.indexOf('jpg') != -1 || collectAccessoryInfo.fileName.indexOf('png') != -1 || collectAccessoryInfo.fileName.indexOf('gif') != -1 || collectAccessoryInfo.fileName.indexOf('bmp') != -1 || collectAccessoryInfo.fileName.indexOf('jpeg') != -1}">
+												<td><img src="${collectAccessoryInfo.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${collectAccessoryInfo.url}','90%','90%')" alt="${collectAccessoryInfo.fileName}"></td>
+											</c:when>
+											<c:otherwise>
+												<c:choose>
+													<c:when test="${collectAccessoryInfo.fileName.indexOf('pdf') != -1}">
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${collectAccessoryInfo.url}',1)">${collectAccessoryInfo.fileName}</a></td>
+													</c:when>
+													<c:otherwise>
+														<td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${collectAccessoryInfo.url}',2)">${collectAccessoryInfo.fileName}</a></td>
+													</c:otherwise>
+												</c:choose>
+											</c:otherwise>
+										</c:choose>
+									</c:otherwise>
+								</c:choose>
+
+								<td>${collectAccessoryInfo.createBy.name}</td>
+								<td><fmt:formatDate value="${collectAccessoryInfo.createDate}" type="both"/></td>
+							</tr>
+						</tbody>
+					</table>
+				</div>
+			</div>
+		</form:form>
+	</div>
+</div>
+<script>
+
+		function collectingAccessory(obj,url,fileUrl,uploadUserId,fileSize){
+		$.ajax({
+			type:"post",
+			url:url,
+			data: {"url":fileUrl,"type":"1","collectType":1,"collectUserId":uploadUserId,"fileSize":fileSize},
+			success:function(data){
+				if(data.success){
+					$(obj).hide()
+					//关闭当前页
+					top.layer.close(index)
+					parent.layer.msg(data.str,{icon:1});
+				}else {
+					parent.layer.msg(data.str,{icon:2});
+				}
+			}
+		});
+	}
+</script>
+</body>
+</html>