You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1 lines
11 KiB

"use strict";var fnGetFiles=function(n,t,i,r,u){var f=function(t){var e=t,f="";$.each(e,function(n,t){if(t.fileid){var i="default";t.subname=t.subname.toLowerCase();"doc|xls|txt|exe|mp3|mv|pdf|ppt|psd|".indexOf(t.subname)>-1?i=t.subname:"png|jpg|jpeg|gif|bmp".indexOf(t.subname)>-1?i="jpg":"7z|zip|rar".indexOf(t.subname)>-1?i="rar":"docx|doc".indexOf(t.subname)>-1?i="doc":"xls|xlsx".indexOf(t.subname)>-1?i="xls":"pptx".indexOf(t.subname)>-1&&(i="ppt");f+='<p style="line-height: 15px;"><img src="https://www.eurotran.com:9001/Ueditor/dialogs/attachment/fileTypeImages/icon_'+i+'.gif"><a style="text-decoration: underline !important;" href="javascript:void(0);" title="'+t.filename+'" path="'+t.path+'" subname="'+i+'"><span style="font-size: 12px;">'+t.filename+"<\/span><\/a><\/p>"}});i&&(f+='<p style="line-height: 15px;"><img src="https://www.eurotran.com:9001/Ueditor/dialogs/attachment/fileTypeImages/icon_txt.gif"><a style="text-decoration: underline !important;" href="javascript:void(0);" title="'+r+'"oldid="'+i+'"goprg="'+u+'"><span style="font-size: 12px;">'+r+"<\/span><\/a><\/p>");n.append(f).find("a").on("click",function(){var n=$(this).attr("path"),r=$(this).text().split(".")[0],u=$(this).attr("subname"),t=$(this).attr("goprg"),f=$(this).attr("oldid"),i;t?parent.layer.open({type:2,title:i18next.t("common.Info"),area:["900px","600px"],shade:!1,closeBtn:1,shadeClose:!0,maxmin:!0,offset:"100px",anim:0,content:"/Page/Eip/"+t+".html?Action=Upd&Guid="+f,success:function(n){n.find("iframe").contents().find("#Toolbar").hide()}}):"pdf|jpg".indexOf(u)>-1?(i=gServerUrl+"/"+n,window.open(i)):DownLoadFile(n,r)})};return fnGetUploadFiles(t,f)},fnPrePrint=function(n){$(":input,select").not('[type="button"],[type="radio"]').each(function(){var n=$(this).parent(),t,i;n.attr("printele")||(t="",i="",n.find(":input,select").each(function(){$(this).attr("value",this.value);var r=this.outerHTML,n=$("<div>",{"class":"show-text"});switch(this.type){case"text":case"number":case"textarea":n.html(this.value);break;case"select":case"select-one":n.html($(this).find("option:selected").text())}t+=r;i+=n[0].outerHTML}));n.attr("printele",t).html(i)});n.jqprint({operaSupport:!1});$("[printele]").each(function(){var n=$(this).attr("printele");$(this).html(n).removeAttr("printele").find(":input,select").each(function(){this.value=$(this).attr("value")})})},fnCheckFlows=function(n,t,i,r){var h=n.Applicant?n.Applicant:n.AskTheDummy,f=[],e=0,o,u,s;return t&&n.Agent_Person&&(e++,o=$.grep(r,function(t){return t.MemberID===n.Agent_Person})[0],u={},u.ParentId="0",u.FlowId=guid(),u.Order=e,u.SignedWay="flow1",u.SignedId=n.Agent_Person,u.SignedMember=o.MemberName,u.Department=o.DepartmentName,u.Jobtitle=o.JobtitleName,u.SignedDecision="",u.SignedOpinion="",u.SignedDate="",f.push(u)),s=0,$.each(n.CheckOrder,function(i,r){if(t&&i===0){var u=Jsonget(r.SignedMember,"id",n.Agent_Person);u.length>0&&(e--,f=[])}$.each(r.SignedMember,function(n,t){if(t.id!==h){let u=parseInt(r.Order);var i={};i.ParentId=r.id;i.FlowId=guid();i.Order=u+e+s;i.SignedWay=r.SignedWay;i.SignedId=t.id;i.SignedMember=t.name;i.Department=t.deptname;i.Jobtitle=t.jobname;i.SignedDecision="";i.SignedOpinion="";i.SignedDate="";r.SignedMember.length>1&&n!==r.SignedMember.length-1&&(i.Line=!0);n===0&&(i.Icon=!0);f.push(i)}else r.SignedWay=="flow1"&&--s})}),i?JSON.stringify(f):f},fnHandleFlows=function(n,t){var u=[],r,i;return n.Handle_Person&&(r=$.grep(t,function(t){return t.MemberID===n.Handle_Person})[0],i={},i.FlowId=guid(),i.Order=1,i.SignedWay="flow1",i.SignedId=n.Handle_Person,i.SignedMember=r.MemberName,i.Department=r.DepartmentName,i.Jobtitle=r.JobtitleName,i.SignedDecision="N",i.SignedOpinion="",i.SignedDate="",u.push(i)),JSON.stringify(u)},releaseGridList=function(n){var t=[],i=[];return n=Enumerable.From(n).OrderBy("$.Order").ToArray(),$.each(n,function(r,u){if(t.indexOf(r)===-1){var f=n[r+1],e=n[r+2],o=!1;f&&f.SignedWay===u.SignedWay&&u.SignedWay==="flow4"&&(u.SignedMember=u.SignedMember.concat(f.SignedMember),t.push(r+1),o=!0);o&&e&&e.SignedWay===u.SignedWay&&u.SignedWay==="flow4"&&(u.SignedMember=u.SignedMember.concat(e.SignedMember),t.push(r+2));i.push(u)}}),$.each(i,function(n,t){t.Order=n+1}),i},oPenUserListPop=function(n){n=n||{};var t=[];layer.open({type:1,title:i18next.t("common.SelectUsers"),shadeClose:!1,shade:.1,maxmin:!0,area:["500px","460px"],content:'<style>.btn-xs {padding: 1px 5px; }<\/style> <div class="row popsrow"> <label class="col-sm-3 control-label wright" for="input-Default"><span data-i18n="common.Department">部門<\/span>:<\/label> <div class="col-sm-6"> <select class="form-control" id="Department"><\/select> <\/div> <\/div> <div class="row popsrow"> <label class="col-sm-3 control-label wright" for="input-Default"><span data-i18n="common.Filter">過濾<\/span>:<\/label> <div class="col-sm-6"> <input type="text" class="form-control w100p" id="Filter" maxlength="50"> <\/div> <\/div> <div class="row popsrow"> <div class="col-sm-2"><\/div> <div class="col-sm-8"> <table style="width: 100%"> <tr> <td class="w50p"> <select size="10" name="lstLeft" id="lstLeft" class="form-control w100p" multiple><\/select> <\/td> <td> <p> <button type="button" id="btnToRight" class="btn-custom btn-xs"><i class="fa fa-chevron-right"><\/i><\/button> <\/p> <p> <button type="button" id="btnToLeft" class="btn-custom btn-xs"><i class="fa fa-chevron-left"><\/i><\/button> <\/p> <\/td> <td class="w50p"> <select size="10" name="lstRight" id="lstRight" class="form-control w100p" multiple><\/select> <\/td> <td> <p> <button type="button" id="btnToUp" class="btn-custom btn-xs"><i class="fa fa-chevron-up"><\/i><\/button> <\/p> <p> <button type="button" id="btnToDown" class="btn-custom btn-xs"><i class="fa fa-chevron-down"><\/i><\/button> <\/p> <\/td> <\/tr> <\/table> <\/div> <div class="col-sm-2"><\/div> <\/div> <div class="row popsrow"> <div class="col-sm-2"><\/div> <div id="flowtype"> <\/div> <\/div>',success:function(i){var r=[{id:"flow1",text:i18next.t("common.flow1")},{id:"flow2",text:i18next.t("common.flow2")},{id:"flow3",text:i18next.t("common.flow3")},{id:"flow4",text:i18next.t("common.flow4")}];i.find("#flowtype").html(createRadios(r,"id","text","flowtype")).find("label:first").click();n.SignedWay&&i.find("#flowtype [value="+n.SignedWay+"]").click();n.Flowtype&&(i.find("#flowtype").hide(),i.find("#lstLeft,#lstRight").attr("size",12));fnSetDeptDrop(i.find("#Department"));fnSetUserDrop([{Select:i.find("#lstLeft"),Action:"add",ShowId:!0,CallBack:function(r){t=r;i.find("#lstLeft")[0].remove(0);optionListSearch(i.find("#lstLeft"),i.find("#lstRight"),i.find("#Filter"));n.SignedMember&&(n.SignedMember=Enumerable.From(n.SignedMember).Distinct("$=>$.id").ToArray(),i.find("#lstRight").html(createOptions(n.SignedMember,"id","name")),i.find("#lstRight")[0].remove(0),$.each(n.SignedMember,function(n,t){i.find("#lstLeft").find('option[value="'+t.id+'"]').remove()}))}}]);i.find("#Department").on("change",function(){var n=this.value;fnSetUserDrop([{Select:i.find("#lstLeft"),Action:"add",DepartmentID:n,CallBack:function(){i.find("#lstLeft")[0].remove(0);optionListSearch(i.find("#lstLeft"),i.find("#lstRight"),i.find("#Filter"))}}])});i.find("#btnToRight").on("click",function(){optionListMove(i.find("#lstLeft"),i.find("#lstRight"))});i.find("#btnToLeft").on("click",function(){optionListMove(i.find("#lstRight"),i.find("#lstLeft"))});i.find("#btnToUp").on("click",function(){optionListOrder(i.find("#lstRight"),!0)});i.find("#btnToDown").on("click",function(){optionListOrder(i.find("#lstRight"),!1)})},btn:[i18next.t("common.Confirm"),i18next.t("common.Cancel")],yes:function(i,r){var u={},f=[],e=r.find("#flowtype [name=flowtype]:checked").val();r.find("#lstRight option").each(function(){var i=$(this).val(),n=Enumerable.From(t).Where(function(n){return n.MemberID===i}).First();let r=$(this).text().split("-")[1];f.push({id:$(this).val(),name:r,deptname:n.DepartmentName,jobname:n.JobtitleName})});u.Users=f;u.FlowType=e||"";typeof n.Callback=="function"&&n.Callback(u);layer.close(i)},cancel:function(){typeof n.CancelCallback=="function"&&n.CancelCallback()}})},fnSetFlowDrop=function(n){return g_api.ConnectLite(Service.eip,"GetFlows",{Flow_Type:n.Flow_Type||"",ShareTo:n.ShareTo||""},function(t){if(t.RESULT){var i=t.DATA.rel;n.Select&&(n.Select.html(createOptions(i,"Guid","Flow_Name",n.ShowId||!1)),n.DefultVal&&n.Select.val(n.DefultVal),n.Select2&&n.Select.each(function(){$(this).select2();$(this).next().after($(this))}));n.CallBack&&typeof n.CallBack=="function"&&n.CallBack(i)}})},fnGetBills=function(n){return g_api.ConnectLite(Service.opm,"GetBills",{BillNO:n.BillNO||""},function(t){if(t.RESULT){var i=t.DATA.rel;n.CallBack&&typeof n.CallBack=="function"&&n.CallBack(i)}})},fnCheckReEdit=function(n,t){let i=!1,r=parent.UserInfo.roles.indexOf("Admin")>-1;switch(n){case"A":case"B":case"E":t!==parent.UserID&&(i=!0);break;case"C-O":case"D-O":case"X":i=!0;break;case"H-O":i=r?!1:!0;break;default:i=!0}i&&$("#Toolbar_ReEdit").remove()},fnRefreshFlowsThenCopy=function(n,t){CallAjax(ComFn.W_Com,ComFn.GetOne,{Type:"",Params:{checkflow:{Guid:n.FlowId}}},function(i){if(i.d){var r=$.parseJSON(i.d);r.ShareTo===null?showMsg(i18next.t("message.RefreshFlowsThenCopy_Failed_FlowsNotFound"),"error"):r.ShareTo.indexOf(parent.UserID)===-1?showMsg(i18next.t("message.RefreshFlowsThenCopy_Failed_FlowsAccessDenied"),"error"):(r.Flows=$.parseJSON(r.Flows),n.CheckOrder=r.Flows,n.Flows_Lock=r.Flows_Lock,n.Handle_Lock=r.Handle_Lock,n.Handle_Person=r.Handle_Person,n.Handle_DeptID=r.Handle_DeptID,t())}else showMsg(i18next.t("message.RefreshFlowsThenCopy_Failed_SearchingFlowsError"),"error")})};