| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802 |
- var enctype = "";
- var action = "";
- var target = "";
- var form = "";
- var eara = "";
- var viewObj = "";
- var oldSize = "";
- var isDel = false;
- var isCloudeEitor = 0;
- var isDownload = "";
- var fileNameLen = "";
- var documentName = "";
- $(document).ready(function() {
- $(".fileControl").each(function() {
- changeAddPath(this);
- var isDelFile = $("input[name='isDelFile']", this).val();
- initValue(this);
- if (isDelFile != '3')
- initFile(this);
- else
- $(".add-style", eara).hide();
- });
- showFile();
- });
- function changeAddPath(e) {
- $(".add", e).each(
- function() {
- var path = findProjectName(e) + "/liger/lib/ligerUI/skins/"
- + findStyleCss(e) + "/images/index/jia.png";
- $(this).attr("src", path);
- });
- }
- function init(e) {
- $(e).each(function() {
- initValue(this);
- initFile(this);
- });
- }
- function addIframe() {
- if ($("iframe[name='check_file_frame2']").length == 0)
- $("body")
- .append(
- "<iframe name=\"check_file_frame2\" style=\"display:none;\"></iframe>");
- }
- function initValue(e) {
- eara = e;
- var li = $("#fileList");
- if (li.length == 0)
- return;
- var documentId = $("input[name='defaultValue']", e).val();
- var param = {
- "documentId" : documentId
- };
- sendAjaxParam(param, "loadFile.do", "json", fileBackProcess);
- }
- function fileBackProcess(data) {
- var max = $("input[name='size']", eara).val();
- var isDelFile = $("input[name='isDelFile']", eara).val();
- var cloudeEitor = $("input[name='cloudeEitor']", eara).val();
- var isView = $("input[name='isView']", eara).val();
- var isDownload = $("input[name='isDownload']", eara).val();
- var fieldName = $("[name='fieldName']", eara).val();
- if (isDownload == undefined)
- isDownload = "";
- if (max != undefined && max != "")
- max = parseInt(max, 10);
- var i = 0;
- for (; i < data.length; i++) {
- var d = data[i];
- var fileName = d['srcFile'];
- // 获取文件后缀名
- var suffix_index = fileName.lastIndexOf(".");
- var suffix = fileName.substring(suffix_index + 1);
- var fileNameLen = $("[name='fileNameLen']", eara).val();
- if (fileNameLen != "" && fileName.length > fileNameLen)
- fileName = fileName.substring(0, fileNameLen) + "...";
- /*var str = "<li><a title='" + d['srcFile']
- + "' href='downloadFile.do?documentId=" + d['fileId'] + "'>"
- + fileName + "</a><input type='hidden' id='" + d['fileId'] + "' name='" + fieldName
- + "' value='" + d['fileId'] + "' />";
- if (isDownload == "1") {*/
- var str = "<li>" + fileName + "<input class='fujian' type='hidden' id='" + d['fileId'] + "' name='" + fieldName
- + "' value='" + d['fileId'] + "' />";
- /*}*/
- if (isView == undefined || isView == "") {
- isView = '1';
- }
- if (isDelFile == '1') {
- // str += "<span style='display:inline-block'> "
- // +"<img style='cursor:pointer' title='删除'
- // onclick=deleteFieldFile(\'"+d['fileId']
- // +"\','','','',this) src='/shares/images/no.png' width='12'
- // height='12'/></span>";
- str += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=deleteFieldFile(\'"
- + d['fileId']
- + "\','','','',this) ><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/no.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>删除</font></a></span>";
- }
- if (isDelFile == '2') {
- // str += "<span style='display:inline-block'> "
- // +"<img style='cursor:pointer' title='删除' onclick=cancelFile(this)
- // " +
- // "src='/shares/images/no.png' width='12' height='12'/></span>";
- str += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=cancelFile(this) "
- + "><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/no.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>删除</font></a></span>";
- }
- if (isView == "1") {
- // str += "<span style='display:inline-block'> "
- // +"<img style='cursor:pointer' title='预览'
- // onclick=viewFile(\'"+d['fileId']
- // +"\',this) src='/shares/images/view.png' width='14'
- // height='14'/></span>";
- // str += "<span style='display:inline-block'> "
- // +"<img title='扫描二维码' style='cursor:pointer'
- // onclick=viewScanCode(\'"+d['fileId']
- // +"\',this) src='/shares/images/2code.jpg' width='16' height='16'
- // border=0/></span>";
- /*str += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=viewFile(\'"
- + d['fileId']
- + "\',this) ><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/view.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>预览</font></a></span>";*/
- if (isDownload != "1") {
-
- str += "<span style='display:inline-block'> "
- +"<a style='cursor:pointer;color:blue;' title='" + d['srcFile']
- + "' href='downloadFile.do?documentId=" + d['fileId'] + "'>"
- + "<font style='margin-left: 2px;'>下载</font></a></span>";
-
- str += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=viewScanCode(\'"
- + d['fileId']
- + "\',this) ><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/2code.jpg' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>二维码下载</font></a></span>";
- }
- } else {
- // str += "<span style='display:inline-block'> "
- // +"<img title='扫描二维码' style='cursor:pointer'
- // onclick=viewScanCode(\'"+d['fileId']
- // +"\',this) src='/shares/images/2code.jpg' width='16' height='16'
- // border=0/></span>";
- if (isDownload != "1") {
- str += "<span style='display:inline-block'> "
- +"<a style='cursor:pointer;color:blue;' title='" + d['srcFile']
- + "' href='downloadFile.do?documentId=" + d['fileId'] + "'>"
- + "<font style='margin-left: 2px;'>下载</font></a></span>";
-
- str += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=viewScanCode(\'"
- + d['fileId']
- + "\',this) ><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/2code.jpg' width='15' height='15'/>"
- + "<font style='margin-left: 2px;'>二维码下载</font></a></span>";
- }
-
- }
- if (cloudeEitor == "1") { // 判断是否启用云编辑
- // 判断支持云编辑的文档格式
- if (suffix == "doc" || suffix == "docx" || suffix == "xls"
- || suffix == "xlsx" || suffix == "ppt" || suffix == "pptx") {
- str += "<span style='display:inline-block'> "
- + "<a href='#' style='cursor:pointer;color:blue;' onclick=eidtorFile(\'"
- + d['fileId']
- + "\',this)><img style='cursor:pointer;vertical-align:middle;' src='/shares/resources/css/easyui/themes/icons/pencil.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>云编辑</font></a></span>";
- }
- }
- str += "</li>";
- $("#fileList", eara).append(str);
- }
- ;
- if (i >= max) {
- $("input[name='size']", eara).val(-2);
- } else {
- $("input[name='size']", eara).val(max - i);
- }
- if (isDelFile != '3')
- initFile(eara);
- else
- $(".add-style", eara).hide();
- }
- // nereidFadeObjects = new Object();
- // nereidFadeTimers = new Object();
- // function nereidFade(object, destOp, rate, delta){
- // if (!document.all)
- // return
- // if (object != "[object]"){ // do this so I can take a string too
- // setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
- // return;
- // }
- // clearTimeout(nereidFadeTimers[object.sourceIndex]);
- // diff = destOp-object.filters.alpha.opacity;
- // direction = 1;
- // if (object.filters.alpha.opacity > destOp){
- // direction = -1;
- // }
- // delta=Math.min(direction*diff,delta);
- // object.filters.alpha.opacity+=direction*delta;
- // if (object.filters.alpha.opacity != destOp){
- // nereidFadeObjects[object.sourceIndex]=object;
- // nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
- // }
- // }
- function initFile(e) {
- addIframe();
- var filePrev = $("input[type='file']", e).prev();
- $(filePrev).val("");
- var fid = $("input[type='file']", e).attr("id");
- $("input[type='file']", e).remove();
- $(filePrev).after("<input type=\"file\" name=\"file\" id='" + fid + "' />");
- $("input[type='file']", e).bind("change", function() {
- form = $(this).parents("form");
- eara = e;
- uploadFile(this, form, e);
- });
- // 加入样式
- var definedCss = $("input[name='definedCss']", e).val();
- $(".add-style", e).addClass(definedCss);
- $(".del-style", e).remove();
- // 限制文件数
- var maxFile = $("input[name='size']", e).val();
- if (maxFile != undefined && maxFile == 1) {
- $(".add", e).hide();
- $(".add-style", e).show();
- }
- if (maxFile != undefined && maxFile == -2) {
- $(".add", e).hide();
- $(".add-style", e).hide();
- }
- if (maxFile != undefined && maxFile > 1) {
- $(".add", e).show();
- $(".add-style", e).show();
- }
- if (maxFile == -1)
- $(".add-style", e).hide();
- $(".add", e).unbind("click");
- $(".add", e)
- .bind(
- "click",
- function() {
- // var documentId =
- // $("input[name='defaultValue']",e).val();
- var documents = "";
- var did = "";
- // if(documentId.length>0)documentId.split(",");
- // 文件数
- var max = $("input[name='size']", e).val();
- if (max != undefined && max != "")
- max = parseInt(max, 10);
- if (max == 1)
- $(".add", e).hide();
- // 初始化值
- var size = $("input[type='file']", e).length;
- if (documents.length > 0) {
- $(".documentId", e).val(
- documents[0] == null ? "" : documents[0]);
- did = documents[size];
- }
- if (did == undefined)
- did = "";
- // 复制并生成新的文件上传元素
- var f = $(".add-style", e).clone();
- $("input[type='file']", f).attr("id",
- $("input[type='file']", f).attr("id") + size);
- // by qianqw 20150424
- $("input[type='file']", f).val("");
- // end
- var docid = $(".documentId", f).attr("id");
- $(".documentId", f).attr("id", docid + size).val(did);
- $(f).removeClass("add-style", e).addClass("del-style")
- .addClass(definedCss);
- ;
- // 加入删除
- var del = $("<img alt='' style='cursor:pointer' id='del' align='bottom' src='"
- + findProjectName(e)
- + "/liger/lib/ligerUI/skins/"
- + findStyleCss(e)
- + "/images/index/jian.png'></a>");
- $("span", f).empty().append(
- $(del).bind("click", function(e) {
- eara = e;
- removeFile(this);
- }));
- var fileLen = $(".add-style,.del-style", e).length;
- $($(".add-style,.del-style", e)[fileLen - 1]).after(f);
- // 加入上传事件
- $("input[type='file']").unbind("change");
- $("input[type='file']").bind("change", function() {
- form = $(this).parents("form");
- eara = e;
- uploadFile(this, form, e);
- });
- // 限制文件数
- if (max != undefined && size == max - 1) {
- $(".add", e).hide();
- return;
- }
- });
- }
- function removeFile(removeT) {
- e = $(removeT).parents(".fileControl");
- var ff = $(removeT).parent().prev();
- var d = $(ff).prev().val();
- form = $(ff).parents("form");
- $(removeT).parents(".del-style").remove();
- var size = $("input[type='file']", e).length;
- var max = $("input[name='size']", e).val();
- if (size == 1) {
- $(".add", e).show();
- }
- if (size < max) {
- $(".add", e).show();
- }
- if (d != "" && d != undefined) {
- deleteFormFile(d, '', '', '', removeT);
- }
- }
- function deleteFormFile(documentId, tableName, fieldName, id, e) {
- delImgObject = e;
- fileControl = $(e).parents(".fileControl");
- delEvent = $("input[name='delEvent']", fileControl).val();
- delFileId = documentId;
- delFileName = fieldName;
- delTableName = tableName;
- rowId = id;
- var param = {
- "documentId" : delFileId,
- "tableName" : delTableName,
- "fieldName" : delFileName,
- "rowId" : rowId,
- "delEvent" : delEvent
- };
- sendAjaxParam(param, "delFile.do", "json", delFormProcess);
- }
- function delFormProcess(data) {
- }
- var loadDialog2 = null;
- function uploadFile(e, form, area) {
- var documentId = $(e).prev().val();
- var isLogin = $("input[name='isLogin']", area).val();
- $("input[name='currentDocument']", area).val(documentId);
- var cid = $(e).attr("id");
- $("input[type='file']").each(function() {
- var id = $(this).attr("id");
- if (id != cid)
- $(this).attr("disabled", true);
- });
- $("input[name='lastFieldId']", area).val($(e).attr("id"));
- var formName = $(form).attr("name");
- var formAction = $(form).attr("action");
- if ($(form).length > 0
- && (formAction != "uploadFile.do" || formName == "upfile_form")) {
- action = $(form).attr("action");
- enctype = $(form).attr("enctype");
- target = $(form).attr("target");
- $(form).attr("enctype", "multipart/form-data").get(0).encoding = 'multipart/form-data';
- if (isLogin != undefined && isLogin == "0") {
- $(form)[0].attributes["action"].value = "uploadNoLoginFile.do";
- } else {
- $(form)[0].attributes["action"].value = "uploadFile.do";
- }
- $(form)[0].target = "check_file_frame2";
- loadDialog2 = openTips({
- isTitle : true,
- content : "<div style='width:100%;text-align:center'><img src='/shares/images/loadprocess.gif'/><br/><br/>文件正在上传!请稍候。。。</div>",
- width : 250,
- height : 100,
- isDrag : false,
- allowClose : false,
- isResize : false,
- title : "文件下载",
- showMax : false,
- showMin : false,
- cls : "uploadCls"
- });
- $(form)[0].submit();
- } else {
- $("input[type='file']").each(function() {
- $(this).attr("disabled", false);
- });
- }
- }
- function callback(msg) {
- var imgViewId = $("[name='imgViewId']", eara).val();
- var showSrcFileId = $("[name='showSrcFileId']", eara).val();
- if(form){
- try {
- $(form).attr("enctype", enctype).get(0).encoding = enctype;
- } catch (e) {
- $(form)[0].attributes["enctype"].value = enctype;
- }
- $(form)[0].attributes["action"].value = action;
- }
- if (!target) {
- target = "";
- }
- if(form){
- $(form)[0].target = target;
- }
- var lastId = $("input[name='lastFieldId']", eara).val();
- // $("#" + lastId).prev().val(msg);
- $("[id='"+lastId+"']").prev().val(msg);
- if (imgViewId != "" || showSrcFileId != "") {
- var param = {
- "documentId" : msg
- };
- sendAjaxParam(param, "loadFile.do", "json", viewLoadProcess);
- }
- $("input[type='file']").each(function() {
- $(this).attr("disabled", false);
- });
- loadDialog2.close();
- }
- function backProcess(f) {
- var defaultValue = $("input[name='defaultValue']").val();
- var documentName = "";
- $(".documentId").each(function() {
- documentName = $(this).attr("name");
- $(this).attr("name", documentName + "_bak");
- var value = $(this).val();
- defaultValue += "," + value;
- $(this).remove();
- });
- $(f).append(
- "<input type='hidden' name='" + documentName + "' value='"
- + defaultValue + "' />");
- }
- var delImgObject, fileControl, delEvent, delFileName, delFileId, delTableName, rowId;
- function deleteFieldFile(documentId, tableName, fieldName, id, e) {
- delImgObject = e;
- fileControl = $(e).parents(".fileControl");
- delEvent = $("input[name='delEvent']", fileControl).val();
- delFileId = documentId;
- delFileName = fieldName;
- delTableName = tableName;
- rowId = id;
- var param = {
- "documentId" : delFileId,
- "tableName" : delTableName,
- "fieldName" : delFileName,
- "rowId" : rowId,
- "delEvent" : delEvent
- };
- sendAjaxParam(param, "delFile.do", "json", delProcess);
- }
- function deleteFile(documentId, e) {
- delImgObject = e;
- fileControl = $(e).parents(".fileControl");
- delEvent = $("input[name='delEvent']", fileControl).val();
- var param = {
- "documentId" : documentId,
- "delEvent" : delEvent
- };
- sendAjaxParam(param, "delFile.do", "json", delProcess);
- }
- function cancelFile(e) {
- var filePlugins = $(e).parents(".fileControl");
- var maxFile = $("input[name='size']", filePlugins).val();
- if (maxFile == -1 || maxFile == -2)
- maxFile = 0;
- else if (maxFile == 0)
- maxFile = -1;
- maxFile = parseInt(maxFile, 10);
- $("input[name='size']", filePlugins).val(maxFile + 1);
- $(".add-style", filePlugins).show();
- $(e).parent().parent().remove();
- initFile(filePlugins);
- }
- function delProcess(data) {
- var filePlugins = $(delImgObject).parents(".fileControl");
- if (data.success != null) {
- $(delImgObject).parent().parent().remove();
- var maxFile = $("input[name='size']", filePlugins).val();
- if (maxFile == -1 || maxFile == -2)
- maxFile = 0;
- else if (maxFile == 0)
- maxFile = -1;
- maxFile = parseInt(maxFile, 10);
- $("input[name='size']", filePlugins).val(maxFile + 1);
- $(".add-style", filePlugins).show();
- initFile(filePlugins);
- }
- }
- function viewFile(fileId, e) {
- // var w = $(window).width()*0.9;
- var w = window.top.document.documentElement.clientWidth - 300;
- var h = window.top.document.documentElement.clientHeight - 100;
- var ops = {
- title : "在线预览",
- url : "viewFile.do?documentId=" + fileId + "&w=" + w + "&h=" + h,
- width : w,
- height : h,
- isResize : true,
- isHidden : false
- };
- openTopDialog(ops);
- }
- function viewBack(data) {
- var obj = window.top;
- if (obj != undefined && obj != null) {
- obj.openTips({
- title : "扫描二维码下载",
- content : data,
- width : 300,
- height : 250
- });
- }
- }
- function viewScanCode(fileId, e) {
- var param = {
- 'documentId' : fileId
- };
- sendAsyncAjax(param, 'viewScanCode.do', 'html', viewBack);
- }
- function clearControl(filedName) {
- var f = $(".fileControl").filter("#fileControl_" + filedName);
- $(".add-style", f).each(function() {
- $("input", this).each(function() {
- $(this).val("");
- });
- });
- }
- function showFile() {
- $(".l-file").each(function() {
- isDel = false;
- viewObj = $(this);
- fileNameLen = $(this).attr("len");
- var documentId = $(this).text();
- $(this).html("");
- var param = {
- "documentId" : documentId
- };
- sendAjaxParam(param, "loadFile.do", "json", viewLoadProcess);
- });
- }
- function viewLoadProcess(data) {
- var html = "<ul>";
- var imgViewId = $("[name='imgViewId']", eara).val();
- var showSrcFileId = $("[name='showSrcFileId']", eara).val();
- if (imgViewId != null && imgViewId != "") {
- $("#" + imgViewId).attr("src", data[0].path);
- }
- if (showSrcFileId != null && showSrcFileId != "") {
- var reg = /\.\w+$/;
- $("#" + showSrcFileId).val(data[0].srcFile.replace(reg, ''));
- }
- for (var i = 0; i < data.length; i++) {
- var d = data[i];
- html += geneFileList(d, isDel, isCloudeEitor);
- }
- html += "</ul>";
- $(viewObj).append(html);
- }
- function editViewFileHtml(fileId, fileName, d, len, cloudeEitor) {
- viewObj = $(".fileControl").filter("#fileControl_" + fileName).find(
- ".fileList");
- if (d == true)
- d = "1";
- if (d == false)
- d = "0";
- isCloudeEitor = cloudeEitor;
- isDel = d;
- if (len == "" || len == undefined)
- fileNameLen = "";
- else
- fileNameLen = len;
- reverControl(fileName);
- documentName = fileName;
- var param = {
- "documentId" : fileId
- };
- sendAjaxParam(param, "loadFile.do", "json", viewBackProcess);
- }
- function viewFileHtml(fileId, fileName, len) {
- $("#" + fileName).empty();
- viewObj = $("#" + fileName);
- isDel = "0";
- if (len == "" || len == undefined)
- fileNameLen = "";
- else
- fileNameLen = len;
- documentName = fileName;
- var param = {
- "documentId" : fileId
- };
- sendAjaxParam(param, "loadFile.do", "json", viewProcess);
- }
- function reverControl(fileName) {
- var fileObje = $(viewObj).parent();
- var oldSize = $("input[name='oldSize']", fileObje).val();
- $(viewObj).empty();
- $("input[name='size']", fileObje).val(oldSize);
- initFile(fileObje);
- }
- function viewProcess(data) {
- var html = "";
- for (var i = 0; i < data.length; i++) {
- var d = data[i];
- html += geneFileList(d, isDel, isCloudeEitor);
- }
- $(viewObj).append(html);
- }
- function viewBackProcess(data) {
- var html = "";
- for (var i = 0; i < data.length; i++) {
- var d = data[i];
- html += geneFileList(d, isDel, isCloudeEitor);
- }
- $(viewObj).append(html);
- var fileObje = $(viewObj).parent();
- var size = $("input[name='size']", fileObje).val();
- var remainLen = size - data.length;
- if (remainLen == 0)
- remainLen = -1;
- if (size == 0)
- remainLen = 0;
- $("input[name='size']", fileObje).val(remainLen);
- initFile(fileObje);
- }
- function geneFileList(d, isDel, isCloudeEitor) {
- var html = "";
- var fileName = d['srcFile'];
- var suffix_index = fileName.lastIndexOf(".");
- var suffix = fileName.substring(suffix_index + 1);
- if (fileNameLen != "" && fileName.length > fileNameLen)
- fileName = fileName.substring(0, fileNameLen) + "...";
- html += "<li>" + fileName
- + "<input type='hidden' id='" + d['fileId'] + "' name='"
- + documentName + "' value='" + d['fileId'] + "' />";
- if (isDel == "1") {
- // html += "<span style='display:inline-block'> "
- // +"<img style='cursor:pointer' title='删除'
- // onclick=deleteFieldFile(\'"+d['fileId']
- // +"\','','','',this) src='/shares/images/no.png' width='12'
- // height='12'/></span>";
- html += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=deleteFieldFile(\'"
- + d['fileId']
- + "\','','','',this)><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/no.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>删除</font></a></span>";
- }
- if (isDel == "2") {
- // html += "<span style='display:inline-block'> "
- // +"<img style='cursor:pointer' title='删除' onclick=cancelFile(this)" +
- // " src='/shares/images/no.png' width='12' height='12'/></span>";
- html += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=cancelFile(this)>"
- + "<img style='cursor:pointer;vertical-align:middle;' src='/shares/images/no.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>删除</font></a></span>";
- }
- /*
- * if(fileType!=-1||validateImage(fileName)){ html += "<span
- * style='display:inline-block'> " +"<img style='cursor:pointer'
- * title='预览' onclick=viewFile(\'"+d['fileId'] +"\',this)
- * src='/shares/images/view.png' width='12' height='12'/></span>"; }
- */
- // html += "<span style='display:inline-block'> "
- // +"<img style='cursor:pointer' title='预览' onclick=viewFile(\'"+d['fileId']
- // +"\',this) src='/shares/images/view.png' width='14'
- // height='14'/></span>";
- /*html += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=viewFile(\'"
- + d['fileId']
- + "\',this) ><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/view.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>预览</font></a></span>";*/
- // html += "<span style='display:inline-block'> "
- // +"<img title='扫描二维码' style='cursor:pointer'
- // onclick=viewScanCode(\'"+d['fileId']
- // +"\',this) src='/shares/images/2code.jpg' width='16' height='16'
- // border=0/></span>";
- if (isDownload != "1") {
- html += "<span style='display:inline-block'> "
- +"<a style='cursor:pointer;color:blue;' title='" + d['srcFile']
- + "' href='downloadFile.do?documentId=" + d['fileId'] + "'>"
- + "<font style='margin-left: 2px;'>下载</font></a></span>";
-
- html += "<span style='display:inline-block'> "
- + "<a href='javascript:void(0)' style='cursor:pointer;color:blue;' onclick=viewScanCode(\'"
- + d['fileId']
- + "\',this) ><img style='cursor:pointer;vertical-align:middle;' src='/shares/images/2code.jpg' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>二维码下载</font></a></span>";
- }
- if (isCloudeEitor == "1") { // 判断是否启用云编辑
- // 判断支持云编辑的文档格式
- if (suffix == "doc" || suffix == "docx" || suffix == "xls"
- || suffix == "xlsx" || suffix == "ppt" || suffix == "pptx") {
- html += "<span style='display:inline-block'> "
- + "<a href='#' style='cursor:pointer;color:blue;' onclick=eidtorFile(\'"
- + d['fileId']
- + "\',this)><img style='cursor:pointer;vertical-align:middle;' src='/shares/resources/css/easyui/themes/icons/pencil.png' width='12' height='12'/>"
- + "<font style='margin-left: 2px;'>云编辑</font></a></span>";
- }
- }
- html += "</li>";
- return html;
- }
- function eidtorFile(fileId, e) {
- fileControl = $(e).parents(".fileControl");
- var folder = $("input[name='folder']", fileControl).val();
- var isNewCreate = $("input[name='isNewCreate']", fileControl).val();
- window
- .open(
- '${pageContext.request.contextPath }/fileCloudeditor.do?task=toEditFile&documentId='
- + fileId
- + "&folder="
- + folder
- + "&isNewCreate="
- + isNewCreate,
- 'newwindow',
- 'height='
- + screen.availHeight
- + ',width='
- + screen.availWidth
- + ',top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no,directories=no');
- }
- function findProjectName(e) {
- var projectName = $("input[name='projectName']", e).val();
- if (projectName == "" || projectName == undefined) {
- projectName = getProjectName();
- }
- return projectName;
- }
- function findStyleCss(e) {
- var styleType = $("input[name='styleType']", e).val();
- if (styleType == "" || styleType == undefined) {
- styleType = getCssName();
- }
- return styleType;
- }
- function validateImage(filename) {
- var patn = /\.jpg$|\.tif$|\.jpeg$|\.gif$|\.png$/i;
- if (!patn.test(filename)) {
- return false;
- }
- return true;
- }
- function delFirstFile(fieldName) {
- var first_filedName = "documentId_" + fieldName;
- var first_fileValue = "file_" + fieldName;
- var fileControl = $("#fileControl_" + fieldName);
- var delFileId = $("[id='" + first_filedName+"']").val();
- $("[id='"+first_filedName+"']").val("");
- var file = $("[id='" + first_fileValue+"']");
- file.after(file.clone().val(""));
- file.remove();
- // 加入上传事件
- $("[id='" + first_fileValue+"']").unbind("change");
- $("[id='" + first_fileValue+"']").bind("change", function() {
- form = $(this).parents("form");
- eara = fileControl;
- uploadFile(this, form, fileControl);
- });
- if ("" == delFileId) {
- return;
- }
- var param = {
- "documentId" : delFileId,
- "tableName" : "",
- "fieldName" : "",
- "rowId" : "",
- "delEvent" : delEvent
- };
- sendAjaxParam(param, "delFile.do", "json", delFormProcess);
- }
|