Infos(); function Infos() { var info = []; var name,value; var str=location.href; var num=str.indexOf("?"); str=str.substr(num+1); var arr=str.split("&"); for(var i=0;i < arr.length;i++){ num=arr[i].indexOf("="); if(num>0){ name=arr[i].substring(0,num); value=arr[i].substr(num+1); this[name]=value; info.push(value) } } $.ajax({ url:Url+'/record/v1/getRecordInstanceDetailList', type:'get', data:{ recordParentId:info[0], departmentId:JSON.parse(getItem('UserQrcode')).organizationIds }, success:function (res) { console.log(res,'reswwww'); if (res.code === '200') { if (res.data.pageRecord != null) { $('.submitBtn').show(); $('.note').addClass('margin08').removeClass('noneMargin'); }else { $('.submitBtn').hide(); $('.note').addClass('noneMargin').removeClass('margin08'); } var recordInstanceList = res.data.recordInstanceList; for (var r= 0; r< recordInstanceList.length;r++) { var str = `
`; $('.g-flexview').append(str); var str1 = `
${recordInstanceList[r].templateName}
${recordInstanceList[r].createDate}
${recordInstanceList[r].createName}
`; $('.note').append(str1); // 状态 if (recordInstanceList[r].recordStatusInstanceList != null) { var strs = `
状态
`; $('.note').append(strs); for (var u = 0; u < recordInstanceList[r].recordStatusInstanceList.length; u++) { var str2 = `
${recordInstanceList[r].recordStatusInstanceList[u].statusName}
`; $('.statusItem').append(str2); var colors = recordInstanceList[r].recordStatusInstanceList[u].recordStatusInstanceItemList; console.log(colors,'colors') for (var c = 0; c < colors.length; c++) { var statu = `${colors[c].statusContent}`; $('#statusP'+u).append(statu) } } }else { var str2 = `
状态
${recordInstanceList[r].statusName}
${recordInstanceList[r].statusContent}
`; $('.note').append(str2); } var m_card =`
记录项
`; $('.note').append(m_card); if (recordInstanceList[r].inputList != null) { // 记录项 var record = `
`; $('.fileP .contents').append(record); for (var i = 0; i < recordInstanceList[r].inputList.length; i++) { if (recordInstanceList[r].inputList[i].inputType != 'file' && recordInstanceList[r].inputList[i].inputType != "mp3" && recordInstanceList[r].inputList[i].inputType != "photo" && recordInstanceList[r].inputList[i].inputType != "video" && recordInstanceList[r].inputList[i].values != ""){ var recordItem = `
${recordInstanceList[r].inputList[i].inputName}:
${recordInstanceList[r].inputList[i].values[0]}
`; $('.recordItem').append(recordItem); } } } // 检查项 if (recordInstanceList[r].checkItemMap != null) { var inspectItems =`
检查项
`; $('.note').append(inspectItems); var inspect = `
`; $('.inspectItems .content').append(inspect); $.each(recordInstanceList[r].checkItemMap,function(key,value){ var text = []; for (var r = 0; r < value.length; r++) { text.push(value[r].itemValue) } var trem = `
${key}:
${text.join(',')}
` $('.inspectItem').append(trem); }); } // 图片 if (recordInstanceList[r].inputList != null) { for (var p = 0; p < recordInstanceList[r].inputList.length; p++) { // 图片 if (recordInstanceList[r].inputList[p].inputType === "photo") { if (recordInstanceList[r].inputList[p].values !="") { var photo = `
图片:
`; $('.fileP .contents').append(photo); for (var j = 0; j < recordInstanceList[r].inputList[p].values.length; j++) { var photoTrem = `
`; $('.img-list ').append(photoTrem); setTimeout( photoFun,500); } } } } // 文件 for (var t = 0; t < recordInstanceList[r].inputList.length; t++) { if (recordInstanceList[r].inputList[t].inputType === "file") { if (recordInstanceList[r].inputList[t].values !="") { var files = `
文件:
`; $('.fileP .contents').append(files); for (var j = 0; j

${name}

`; $('.file-list ').append(fileTrem); } } } } // 录音 for (var a = 0; a < recordInstanceList[r].inputList.length; a++) { if (recordInstanceList[r].inputList[a].inputType === "mp3") { if (recordInstanceList[r].inputList[a].values != "") { var audio = `
录音:
`; $('.fileP .contents').append(audio); var audioItem = `
`; $('.titleAudio').after(audioItem); } } } // 视频 for (var v = 0; v < recordInstanceList[r].inputList.length; v++) { if (recordInstanceList[r].inputList[v].inputType === "video") { if (recordInstanceList[r].inputList[v].values != "") { var vedio = `
视频:
`; $('.fileP .contents').append(vedio); var vedioItem = ` `; $('.vedios').append(vedioItem); } } } } } } } }) } function photoFun() { auto_data_size(); var initPhotoSwipeFromDOM = function(gallerySelector) { var parseThumbnailElements = function(el) { var thumbElements = el.childNodes, numNodes = thumbElements.length, items = [], figureEl, linkEl, size, item, divEl; for(var i = 0; i < numNodes; i++) { figureEl = thumbElements[i]; //
element // 仅包括元素节点 if(figureEl.nodeType !== 1) { continue; } divEl = figureEl.children[0]; linkEl = divEl.children[0]; // element size = linkEl.getAttribute('data-size').split('x'); // 创建幻灯片对象 item = { src: linkEl.getAttribute('href'), w: parseInt(size[0], 10), h: parseInt(size[1], 10) }; if(figureEl.children.length > 1) { item.title = figureEl.children[1].innerHTML; } if(linkEl.children.length > 0) { // 缩略图节点, 检索缩略图网址 item.msrc = linkEl.children[0].getAttribute('src'); } item.el = figureEl; // 保存链接元素 for getThumbBoundsFn items.push(item); } return items; }; // 查找最近的父节点 var closest = function closest(el, fn) { return el && ( fn(el) ? el : closest(el.parentNode, fn) ); }; // 当用户点击缩略图触发 var onThumbnailsClick = function(e) { e = e || window.event; e.preventDefault ? e.preventDefault() : e.returnValue = false; var eTarget = e.target || e.srcElement; var clickedListItem = closest(eTarget, function(el) { return (el.tagName && el.tagName.toUpperCase() === 'FIGURE'); }); if(!clickedListItem) { return; } var clickedGallery = clickedListItem.parentNode, childNodes = clickedListItem.parentNode.childNodes, numChildNodes = childNodes.length, nodeIndex = 0, index; for (var i = 0; i < numChildNodes; i++) { if(childNodes[i].nodeType !== 1) { continue; } if(childNodes[i] === clickedListItem) { index = nodeIndex; break; } nodeIndex++; } if(index >= 0) { openPhotoSwipe( index, clickedGallery ); } return false; }; var photoswipeParseHash = function() { var hash = window.location.hash.substring(1), params = {}; if(hash.length < 5) { return params; } var vars = hash.split('&'); for (var i = 0; i < vars.length; i++) { if(!vars[i]) { continue; } var pair = vars[i].split('='); if(pair.length < 2) { continue; } params[pair[0]] = pair[1]; } if(params.gid) { params.gid = parseInt(params.gid, 10); } return params; }; var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) { var pswpElement = document.querySelectorAll('.pswp')[0], gallery, options, items; items = parseThumbnailElements(galleryElement); // 这里可以定义参数 options = { barsSize: { top: 100, bottom: 100 }, fullscreenEl : false, shareButtons: [ {id:'wechat', label:'分享微信', url:'#'}, {id:'weibo', label:'新浪微博', url:'#'}, {id:'download', label:'保存图片', url:'{{raw_image_url}}', download:true} ], galleryUID: galleryElement.getAttribute('data-pswp-uid'), getThumbBoundsFn: function(index) { var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail pageYScroll = window.pageYOffset || document.documentElement.scrollTop, rect = thumbnail.getBoundingClientRect(); return {x:rect.left, y:rect.top + pageYScroll, w:rect.width}; } }; if(fromURL) { if(options.galleryPIDs) { for(var j = 0; j < items.length; j++) { if(items[j].pid == index) { options.index = j; break; } } } else { options.index = parseInt(index, 10) - 1; } } else { options.index = parseInt(index, 10); } if( isNaN(options.index) ) { return; } if(disableAnimation) { options.showAnimationDuration = 0; } gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options); gallery.init(); }; var galleryElements = document.querySelectorAll( gallerySelector ); for(var i = 0, l = galleryElements.length; i < l; i++) { galleryElements[i].setAttribute('data-pswp-uid', i+1); galleryElements[i].onclick = onThumbnailsClick; } var hashData = photoswipeParseHash(); if(hashData.pid && hashData.gid) { openPhotoSwipe( hashData.pid , galleryElements[ hashData.gid - 1 ], true, true ); } }; initPhotoSwipeFromDOM('.my-gallery'); } function auto_data_size(){ $("figure img").each(function() { var imgs = new Image(); imgs.src=$(this).attr("src"); var w = imgs.width, h = imgs.height; $(this).parent("a").attr("data-size","").attr("data-size",w+"x"+h); }) }; $('body').on('click','.file-list>.file-item',function () { var url = $(this).attr('file-Url'); var type = url.substring(url.lastIndexOf(".")+1); console.log(type,'type') if (type == 'zip' || type == 'rar') { window.location.href = url; } else if(type == 'ppt' || type == 'pptx'){ window.open('https://view.officeapps.live.com/op/view.aspx?src='+url) }else { window.open('https://view.officeapps.live.com/op/view.aspx?src='+url) } }); $('.submitBtn').on("click",function () { location.href = 'addRecord.html' }); // $('body').on('click','.seeDoc',function () { // var url = $(this).attr('file-Url'); // window.open('https://view.officeapps.live.com/op/view.aspx?src='+url) // }); // $('body').on('click','.downloadPDF',function () { // var url = $(this).attr('file-Url'); // window.location.href = url; // // }); // $('body').on('click','.seePdf',function () { // var url = $(this).attr('file-Url'); // setItem('pdfUrl',url); // window.open('http://apptest.jieweizhineng.com/assets/html/QRcoddetails/pdf.html'); // }); // $('body').on('click','.seePpt',function () { // var url = $(this).attr('file-Url'); // window.open('https://view.officeapps.live.com/op/view.aspx?src='+url) // });