| | |
| | | %> |
| | | <html> |
| | | <head> |
| | | <title>格线附件上传控件</title>。。。。。。。。。。。。。。。。。。。。。。。。。 |
| | | <title>格线附件上传控件</title> |
| | | <link rel="stylesheet" type="text/css" |
| | | href="<%=hostUrl%>/js/bootstrap/v5.1.3/css/bootstrap.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,"/js/bootstrap/v5.1.3/css/bootstrap.css")%>"> |
| | | <link rel="stylesheet" type="text/css" |
| | |
| | | margin: 0px 5px !important; |
| | | border-radius: 6px; |
| | | } |
| | | .batchDowCss{ |
| | | width: 100%; |
| | | height: 24px; |
| | | line-height:0px!important; |
| | | font-size: 0.2rem!important; |
| | | } |
| | | /* 控制附件浏览现在次数的样式 */ |
| | | .kv-zoom-actions{ |
| | | max-width: 500px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | flex-direction: row; |
| | | } |
| | | </style> |
| | | </head> |
| | | <body> |
| | |
| | | uploadAsync: false, // bool是否多文件批量上传将并行异步/。默认为true |
| | | showCaption: false,//是否显示被选文件的简介 |
| | | showBrowse: false,//是否显示文件浏览按钮 |
| | | showBatchDownload:true,//是否显示批量下载按钮 |
| | | showUpload: false,//是否显示上传按钮 |
| | | showCancel: false,//是否显示取消按钮 |
| | | showRemove: false,//是否显示移除按钮 |
| | |
| | | return ext.match(/(mp3|wav)$/i); |
| | | } |
| | | }, |
| | | isNodragging:false,//自定义属性,在只读状态是否可以执行拖拽 |
| | | //自定义按钮(权限) |
| | | otherActionButtons: '<button type="button" onclick="top.mylockFile(this)" ' + |
| | | 'class="kv-file-lock btn btn-sm btn-kv btn-default btn-outline-secondary"' + |
| | |
| | | fileInput: function () {//渲染,并且绑定事件 |
| | | let F = this.e; |
| | | let g = this.grid; |
| | | let Event=this; |
| | | F.fileinput(this.option).on("filebatchselected", function (event, files) { |
| | | //触发上传功能 |
| | | F.fileinput('upload'); |
| | |
| | | }) |
| | | }).on('filezoomshown', function (event, params) { |
| | | //此事件在模态对用户可见后触发(将等待 CSS 转换完成) |
| | | let kv = $('#kvFileinputModal .file-zoom-content img'); |
| | | if (kv.length > 0) { |
| | | isFileInputImage = new Viewer(kv[0], {title: false}); |
| | | } |
| | | Event.imageEvent(params); |
| | | }).on('filezoomprev', function (event, params) { |
| | | //事件在缩放预览模式下,当点击上一个导航按钮查看上一个文件时触发(也在缩放模式下按下键盘左箭头时触发) |
| | | let kv = $('#kvFileinputModal .file-zoom-content img'); |
| | | if (kv.length > 0) { |
| | | isFileInputImage = new Viewer(kv[0], {title: false}); |
| | | } |
| | | setTimeout(function(){//这个事件不是渲染完进入,导致提前渲染图片查看器。 没什么决绝办法用setTimeout吧 |
| | | Event.imageEvent(params) |
| | | },300); |
| | | }).on('filezoomnext', function (event, params) { |
| | | //该事件在缩放预览模式下,当点击下一个导航按钮查看下一个文件时触发(也在缩放模式下按下键盘右箭头时触发)。 |
| | | let kv = $('#kvFileinputModal .file-zoom-content img'); |
| | | if (kv.length > 0) { |
| | | isFileInputImage = new Viewer(kv[0], {title: false}); |
| | | } |
| | | setTimeout(function(){ |
| | | Event.imageEvent(params) |
| | | },300); |
| | | }).on('filezoomhidden',function (event,params) { |
| | | top.$('.layui-layer-setwin').show();//隐藏图片的时候打开弹出层的关闭按钮 xin 2022-10-28 09:08:24 |
| | | }); |
| | | },imageEvent:function (param) { |
| | | try { |
| | | isFileInputImage = new Viewer(param.modal.find('ul')[0], { |
| | | title: true, inline: true, button: false |
| | | , viewed: function () {// 图片渲染完后进入,旋转大图片 |
| | | param.modal.css('overflow-y','hidden'); |
| | | top.$('.layui-layer-setwin').hide();//打开图片的时候隐藏弹出层的关闭按钮 xin 2022-10-28 09:07:59 |
| | | } |
| | | }); |
| | | isFileInputImage.imageCurrent = 0 |
| | | isFileInputImage.view(param.viewerIndex || 0); |
| | | } catch (e) { |
| | | isFileInputImage = null; |
| | | } |
| | | } |
| | | } |
| | | return o; |
| | |
| | | param.controltype = controlType; |
| | | param.formid = value.formid; |
| | | param.ishd = value.ishd; |
| | | let strIs = ""; |
| | | let strIs = "";//判断更新单据字段值需要到 |
| | | if (value.is1 != null && value.is1 != "") { |
| | | strIs = "&is1=" + value.is1 + "&ishd=" + value.ishd; |
| | | } else if (value.is8 != null && value.is8 != "") { |
| | | strIs = "&is8=" + value.is8 + "&ishd=" + value.ishd; |
| | | } else { |
| | | } else if(value.ishd==2){ |
| | | strIs = "&is16=1&ishd=" + value.ishd; |
| | | }else { |
| | | strIs = "&ishd=" + value.ishd; |
| | | } |
| | | param.docstatus = value.docstatus == null ? 0 : value.docstatus; |
| | | param.rowid = value.rowid; |
| | | param.rowid = (value.detailrowid || value.rowid);//value.rowid; |
| | | param.usercode = value.usercode; |
| | | param.doccode = value.doccode; |
| | | param.headflag = (value.ishd == 0) ? 1 : 0; |
| | |
| | | 'type': jsons[i].fileType, // 上传的图片类型 |
| | | 'filetype': jsons[i].fileType + '/' + jsons[i].orgFileType, |
| | | 'key': jsons[i].unid + ';' + jsons[i].seq, |
| | | 'seq': jsons[i].seq, |
| | | 'title': title,//title |
| | | 'downloadUrl': jsons[i].allowDownload ? Down : false,//jsons[i].domain + "/attachment/downLoadAttachment.do?filePath=" + fileURL,//top.getAttachmentUrl(jsons[i].staticUrl, jsons[i].formid, jsons[i].unid + "@p@" + jsons[i].seq, "", jsons[i].dbid, false, 60, 60, jsons[i].orgFileType, true), |
| | | 'url': deleURL,//删除 |
| | |
| | | }); |
| | | } |
| | | } |
| | | //下载地址 |
| | | //上传地址 |
| | | let upURL = value.domain + '/attachment/uploadAttachmentV2.do?type=' + |
| | | (controlType == 9 ? '1' : '3') + '&formid=' + value.formid |
| | | + '&doccode=' + value.doccode + '&fieldid=' + value.fieldid |
| | | + '&usercode=' + encodeURIComponent(encrypt.encrypt(value.usercode)) + |
| | | '&username=' + encodeURIComponent(encrypt.encrypt(value.username)) + |
| | | '&dbid=' + encodeURIComponent(encrypt.encrypt(value.dbid)) |
| | | + strIs + '&rowid=' + value.rowid + '&uuid=' + (value.unid == undefined ? "" : value.unid); |
| | | '&dbid=' + encodeURIComponent(encrypt.encrypt(value.dbid))+ |
| | | '&rowid=' + (value.detailrowid || value.rowid) + '&uuid=' + (value.unid == undefined ? "" : value.unid)+ |
| | | strIs; |
| | | fileInput.option.uploadUrl = upURL; // 附件上传路径 |
| | | fileInput.option.maxFileCount = 1; // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。 |
| | | // fileInput.option.maxFileCount = 1; // 为每个多次上载允许的最大文件数。如果设置为0,则意味着允许的文件数是无限的。默认值为0。 |
| | | fileInput.option.maxTotalFileCount = 1; |
| | | fileInput.option.isNine = true; |
| | | fileInput.option.validateInitialCount = true; // 是否包括初始预览文件数(服务器上传文件)验证minfilecount和maxfilecount。默认为false. |
| | | fileInput.option.overwriteInitial = false; // 是否要覆盖初始预览内容和标题设置 |