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
7.9 KiB
1 lines
7.9 KiB
"use strict";var fnSetDeptDrop=function(n,t){var i={};return i.OrgID=parent.OrgID,i.DeptID=t||"",g_api.ConnectLite(Service.sys,"GetDepartmentList",i,function(t){if(t.RESULT){var i=t.DATA.rel;n.html(createOptions(i,"DepartmentID","AccountNameSort",!0))}})},fnSetDeptDropWithLimtedDeptId=function(n){var t={};return t.OrgID=parent.OrgID,t.DeptID="",g_api.ConnectLite(Service.sys,"GetDepartmentListNoVoid",t,function(t){if(t.RESULT){var i=t.DATA.rel,r=parent.UserInfo.DepartmentID,u=parent.UserInfo.roles.toLowerCase().indexOf("admin")>-1;u||(i=i.filter(n=>n.ParentDepartmentID===r||n.DepartmentID===r||n.DepartmentID1===r));n.html(createOptions(i,"DepartmentID","AccountNameSort",!0));u||$(n.selector+" option:first").remove()}})},fnSetUserDrop=function(n){var t=[];return $.each(n,function(n,i){i.Effective="";i.Action&&i.Action.toLowerCase()==="add"&&(i.Effective="Y");t.push(g_api.ConnectLite(Service.com,ComFn.GetUserList,{DepartmentID:i.DepartmentID||"",MemberID:i.MemberID||"",UserIDs:i.UserIDs||"",NotUserIDs:i.NotUserIDs||"",ServiceCode:i.ServiceCode||"",Effective:i.Effective||""},function(n){if(n.RESULT){var t=n.DATA.rel;i.Select&&(i.Select.html(createOptions(t,"MemberID","MemberName",i.ShowId||!1)),i.DefultVal&&i.Select.val(i.DefultVal),i.Select2&&i.Select.each(function(){$(this).select2();$(this).next().after($(this))}));i.CallBack&&typeof i.CallBack=="function"&&i.CallBack(t)}}))}),$.whenArray(t)},fnSetArgDrop=function(n){var t=[];return $.each(n,function(n,i){i.ArgClassID&&t.push(g_api.ConnectLite(Service.com,ComFn.GetArguments,{ArgClassID:i.ArgClassID,ParentID:i.ParentID||"",ArgIDs:i.Ids||"",LevelOfArgument:i.Level||-1,OrgID:i.OrgID||""},function(n){if(n.RESULT){var t=n.DATA.rel;if(i.Select){i.Select.html(createOptions(t,"id","text",i.ShowId||!1)).on("change",function(){i.OnChange&&typeof i.OnChange=="function"&&i.OnChange(this.value)});i.DefultVal&&i.Select.val(i.DefultVal);i.Select2&&i.Select.each(function(){$(this).select2();$(this).next().after($(this))})}i.CallBack&&typeof i.CallBack=="function"&&i.CallBack(t)}}))}),$.whenArray(t)},fnSetEpoDrop=function(n){return g_api.ConnectLite("Exhibition_Upd","GetExhibitions",{SN:n.SN||""},function(t){if(t.RESULT){var i=t.DATA.rel;n.Select&&(n.Select.html(createOptions(i,n.IdName||"SN",n.TextName||"ExhibitioFullName",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)}})},fnSetEpoDropWithExhibitionCode=function(n){return g_api.ConnectLite("BillsReport","GetProjects",{},function(t){if(t.RESULT){var i=t.DATA.rel;n.Select&&(n.Select.html(createOptions(i,n.IdName||"id",n.TextName||"text",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)}})},fnSetCustomerWithGuid=function(n){return g_api.ConnectLite(Service.sys,"GetCustomerlist",{},function(t){if(t.RESULT){var i=t.DATA.rel;n.Select&&(n.Select.html(createOptions(i,"id","text",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)}})},fnGetOfficeTempls=function(n){return g_api.ConnectLite(Service.com,"GetOfficeTempls",{TemplID:n.TemplID||""},function(t){if(t.RESULT){var i=t.DATA.rel;n.CallBack&&typeof n.CallBack=="function"&&n.CallBack(i)}})},oPenPops=function(n){var r=null,t=null,u="",i=[];$.each(n.SearchFields,function(t,r){var o=$("<Label />",{"class":"col-sm-2 w20p control-label"}),s=$("<span />",{"data-i18n":r.i18nkey}),f=$("<div />",{"class":"col-sm-3"}),e;switch(r.type){case"text":$("<input />",{type:"text",id:r.id,name:r.id,maxlength:"50","class":"form-control w100p"}).appendTo(f);break;case"select":$("<select />",{id:r.id,name:r.id,"class":"form-control w100p",html:r.html}).appendTo(f)}i.push(o.append(s,":"));i.push(f);(i.length===4||n.SearchFields.length===t+1)&&(e=$("<div />",{"class":"row popsrow"}),e.append(i),u+=e[0].outerHTML,i=[])});u+='<div class="row popsrow"><div class="shadowbox"><div id="PopsGrid"><\/div><\/div><\/div>';layer.open({type:1,title:n.Title||i18next.t("common.PopsMenu"),shadeClose:!1,shade:.5,maxmin:!0,area:["800px",n.SearchFields.length>2?"615px":"565px"],content:u,success:function(i,u){$("#PopsGrid").jsGrid({width:"98%",height:"390px",autoload:!0,pageLoading:!0,sorting:!0,paging:!0,pageIndex:1,pageSize:n.PageSize||10,pagePrevText:"<",pageNextText:">",pageFirstText:"<<",pageLastText:">>",pageButtonCount:10,rowClick:function(n){t=n.item},rowDoubleClick:function(i){t=i.item;n.Callback(t);layer.close(u)},fields:n.Fields,controller:{loadData:function(t){return n.Get(t)}},onInit:function(n){r=n.grid}});i.find(".layui-layer-btn1").css({"border-color":"#4898d5","background-color":"#1E9FFF",color:"#fff"});typeof n.PopSuccessCallback=="function"&&n.PopSuccessCallback()},btn:[i18next.t("common.Toolbar_Qry"),i18next.t("common.Confirm"),i18next.t("common.Cancel")],yes:function(){var n=$(".layui-layer #PerPageNum").val();return r.pageSize=n===""?10:n,r.openPage(1),t=null,!1},btn2:function(i){typeof n.Callback=="function"&&n.Callback(t||{});layer.close(i)},btn3:function(){typeof n.CancelCallback=="function"&&n.CancelCallback()},cancel:function(){typeof n.CancelCallback=="function"&&n.CancelCallback()}})},oPenPopm=function(n){var r=null,u="",i=[],t=[],f=[{width:50,sorting:!1,align:"center",headerTemplate:function(){return[$("<input>",{id:"SelectAll",type:"checkbox",click:function(){this.checked?($("#PopmGrid").find("[type=checkbox]").each(function(){this.checked=!0}),t=r.data):($("#PopmGrid").find("[type=checkbox]").each(function(){this.checked=!1}),t=[])}}),$("<label />",{"for":"SelectAll","data-i18n":"common.SelectAll"})]},itemTemplate:function(n,i){return $("<input>",{type:"checkbox",click:function(n){if(n.stopPropagation(),this.checked)t.push(i);else{var r=[];$.each(t,function(n,t){i.RowIndex!==t.RowIndex&&r.push(t)});t=r;$("#PopmGrid").find("#SelectAll")[0].checked=!1}}})}}];$.each(n.SearchFields,function(t,r){var o=$("<Label />",{"class":"col-sm-2 w20p control-label"}),s=$("<span />",{"data-i18n":r.i18nkey}),f=$("<div />",{"class":"col-sm-3"}),e;switch(r.type){case"text":$("<input />",{type:"text",id:r.id,name:r.id,maxlength:"50","class":"form-control w100p"}).appendTo(f);break;case"select":$("<select />",{id:r.id,name:r.id,"class":"form-control w100p",html:r.html}).appendTo(f)}i.push(o.append(s,":"));i.push(f);(i.length===4||n.SearchFields.length===t+1)&&(e=$("<div />",{"class":"row popsrow"}),e.append(i),u+=e[0].outerHTML,i=[])});u+='<div class="row popsrow"><div class="shadowbox"><div id="PopmGrid"><\/div><\/div><\/div>';f.push.apply(f,n.Fields);layer.open({type:1,title:n.Title||i18next.t("common.PopmMenu"),shadeClose:!1,shade:.5,maxmin:!0,area:[n.Width||"800px",n.SearchFields.length>2?"615px":"565px"],content:(n.ContentPlush||"")+u,success:function(t){$("#PopmGrid").jsGrid({width:"98%",height:"400px",autoload:!0,pageLoading:!0,sorting:!0,paging:!0,pageIndex:1,pageSize:n.PageSize||10,pagePrevText:"<",pageNextText:">",pageFirstText:"<<",pageLastText:">>",pageButtonCount:10,rowClick:function(n){$(n.event.currentTarget).find("[type=checkbox]").click()},fields:f,controller:{loadData:function(t){return n.Get(t)}},onInit:function(n){r=n.grid}});t.find(".layui-layer-btn1").css({"border-color":"#4898d5","background-color":"#1E9FFF",color:"#fff"});typeof n.PopSuccessCallback=="function"&&n.PopSuccessCallback()},btn:[i18next.t("common.Toolbar_Qry"),i18next.t("common.Confirm"),i18next.t("common.Cancel")],yes:function(){var n=$(".layui-layer #PerPageNum").val();return r.pageSize=n===""?10:n,r.openPage(1),t=[],$("#PopmGrid").find("#SelectAll")[0].checked=!1,!1},btn2:function(i){typeof n.Callback=="function"&&n.Callback(t);layer.close(i)},btn3:function(){typeof n.CancelCallback=="function"&&n.CancelCallback()},cancel:function(){typeof n.CancelCallback=="function"&&n.CancelCallback()}})};
|