123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446 |
- /**
- *
- * 角色 R002105430222 抢修中心 暂时不考虑手动填写要求
- */
- //返回用户属于专业管理部门的角色
- function getZyRole(roleId){
- var arr = [];
- if(roleId.indexOf(",")!=-1){
- var roleIdArr = roleId.split(",");
- for(var i=0;i<roleIdArr.length;i++){
- if(roleIdArr[i]=="R002105430210"||roleIdArr[i]=="R002105430211"||roleIdArr[i]=="R002105430212"||roleIdArr[i]=="R002105430213" || roleIdArr[i]=="R002105430222"){
- arr.push(roleIdArr[i]);
- }
- }
- }else{
- if(roleId=="R002105430210"||roleId=="R002105430211"||roleId=="R002105430212"||roleId=="R002105430213" || roleId=="R002105430222"){
- arr.push(roleId);
- }
- }
-
- return arr.sort(function(a,b){
-
- a = a.substring(3,a.length);
- b = b.substring(3,b.length);
- return a-b;
- });;
- }
- function getAllZyRole(roleId,level){
- var arr = [];
- if(roleId.indexOf(",")!=-1){
- var roleIdArr = roleId.split(",");
- for(var i=0;i<roleIdArr.length;i++){
- if(roleIdArr[i]=="R002105430210"||roleIdArr[i]=="R002105430211"||roleIdArr[i]=="R002105430212"||roleIdArr[i]=="R002105430213" ){
- arr.push(roleIdArr[i]);
- }
-
- if(level=="2"){
- if(roleIdArr[i]=="R002105430222"){
- arr.push(roleIdArr[i]);
- }
- }
- }
- }else{
- if(roleId=="R002105430210"||roleId=="R002105430211"||roleId=="R002105430212"||roleId=="R002105430213"){
- arr.push(roleId);
- }
- if(level=="2"){
- if(roleId=="R002105430222"){
- arr.push(roleId);
- }
- }
- }
-
- return arr.sort(function(a,b){
-
- a = a.substring(3,a.length);
- b = b.substring(3,b.length);
- return a-b;
- });;
- }
- //获取能填报要求角色数组
- function getYqRole(roleId){
- var arr = [];
- if(roleId.indexOf(",")!=-1){
- var roleIdArr = roleId.split(",");
- for(var i=0;i<roleIdArr.length;i++){
- if(roleIdArr[i]=="R002105430210"||roleIdArr[i]=="R002105430211"||roleIdArr[i]=="R002105430212"||roleIdArr[i]=="R002105430213"||roleIdArr[i]=="R002105430205" /*|| roleIdArr[i]=="R002105430222"*/ ){
- arr.push(roleIdArr[i]);
- }
- }
- }else{
- if(roleId=="R002105430210"||roleId=="R002105430211"||roleId=="R002105430212"||roleId=="R002105430213"||roleId=="R002105430205" /*|| roleId=="R002105430222"*/ ){
- arr.push(roleId);
- }
- }
-
- return arr.sort(function(a,b){
-
- a = a.substring(3,a.length);
- b = b.substring(3,b.length);
- return a-b;
- });
- }
- //返回填报部门的专业管理部门角色
- function delYjRole(roleArr){
- var arr = [];
- if(roleArr.length>0){
- for(var i=0;i<roleArr.length;i++){
- for(var k=1;k<arguments.length;k++){
- if(roleArr[i]!=arguments[k]&&$.inArray(roleArr[i],arr)==-1){
- arr.push(roleArr[i]);
- }
- }
- }
-
- }
- return arr;
- }
- //返回填写要求的专业管理部门角色like
- function getzyLikeRole(role){
- var likeRole = "";
- if(role.length>0){
- for(var i=0;i<role.length;i++){
- likeRole +="%"+role[i];
- }
-
-
- likeRole = likeRole+"%";
-
-
- }
- return likeRole;
- }
- //返回用户专业管理部门角色的字符串
- function getUserZyRole(arr){
-
- var zyRoleId = "";
- if(arr.length>0){
- for(var i=0;i<arr.length;i++){
- zyRoleId += "'"+arr[i]+"',";
- }
- zyRoleId = zyRoleId.substring(0, zyRoleId.lastIndexOf(","));
-
- }else{
- zyRoleId = "''";
- }
- return zyRoleId;
- }
- function getyQRole(roleId){
- var arr = [];
- if(roleId.indexOf(",")!=-1){
- var roleIdArr = roleId.split(",");
- for(var i=0;i<roleIdArr.length;i++){
- if(roleIdArr[i]=="R002105430210"||roleIdArr[i]=="R002105430211"||roleIdArr[i]=="R002105430212"||roleIdArr[i]=="R002105430213"||roleIdArr[i]=="R002105430205" ||roleIdArr[i]=="R002105430200" ){
- arr.push(roleIdArr[i]);
- }
- }
- }else{
- if(roleId=="R002105430210"||roleId=="R002105430211"||roleId=="R002105430212"||roleId=="R002105430213"||roleId=="R002105430205" || roleId=="R002105430200" ){
- arr.push(roleId);
- }
- }
-
- return arr;
- }
- //进度监控
- function getRSCRole(roleId){
- var arr = [];
- if(roleId.indexOf(",")!=-1){
- var roleIdArr = roleId.split(",");
- for(var i=0;i<roleIdArr.length;i++){
- if(roleIdArr[i]=="R002105430210"||roleIdArr[i]=="R002105430211"||roleIdArr[i]=="R002105430212"||roleIdArr[i]=="R002105430213"||roleIdArr[i]=="R002105430205" || roleIdArr[i]=="R002105430222" ){
- arr.push(roleIdArr[i]);
- }
- }
- }else{
- if(roleId=="R002105430210"||roleId=="R002105430211"||roleId=="R002105430212"||roleId=="R002105430213"||roleId=="R002105430205" || roleId=="R002105430222" ){
- arr.push(roleId);
- }
- }
-
- return arr.sort(function(a,b){
-
- a = a.substring(3,a.length);
- b = b.substring(3,b.length);
- return a-b;
- });
-
- }
- //返回用户所有角色数组
- function getUserRoleIdArr(roleId){
- var arr = [];
- if(roleId.indexOf(",")!=-1){
- var roleIdArr = roleId.split(",");
- for(var i=0;i<roleIdArr.length;i++){
- arr.push(roleIdArr[i]);
- }
- }else{
- arr.push(roleId);
- }
-
- return arr;
- }
- //判断用户是否拥有某种角色
- function checkUserRole(arr1,arr2){
- for(var i=0;i<arr1.length;i++){
- for(var j=0;j<arr2.length;j++){
- if(arr1[i]==arr2[j]){
- return 1;
- }
- }
- }
- return -1;
- }
- function checkHasRole(arr1,arr2){
- var arr = [];
- for(var i=0;i<arr1.length;i++){
- for(var k=0;k<arr2.length;k++){
- if(arr1[i]==arr2[k]){
- arr.push(arr1[i]);
- }
- }
- }
- return arr;
- }
- function saveSameRole(arr1,arr2){
- var arr = [];
- if(arr1.length==0){
- return arr2;
- }else{
- for(var i=0;i<arr1.length;i++){
- for(var k=0;k<arr2.length;k++){
- if(arr1[i]!=arr2[k]){
- arr.push(arr2[k]);
- }
- }
- }
- return arr;
- }
-
-
-
-
- }
- /**
- *
- * @param userId 用户的角色Id
- * @param roleArr 用户所对应的角色数组
- * @param fn 回调函数(跳转页面)
- * @param url 跳转页面url
- * @param zyRoleId 用户对应角色的字符串
- * @param deatil
- */
- function getSpecialRoleDeaitl (userId,roleArr,fn,url,zyRoleId,deatil){
-
- var diag = new top.Dialog();//定义一个窗口对象
- diag.Title = "角色选择";//窗口标题
- diag.URL = "/nwyj/page/business/em/report/GetRole.html";//窗口对应的页面
- diag.Height = 380;
- diag.Width= 400;
- diag.OKEvent = function(){
- var roleVal = diag.innerFrame.contentWindow.selRole();
- /*
- if(roleVal=="R002105430222"){
- top.Dialog.alert("此角色填写的表暂不支持导入功能");
- $(parent.document.body).find("#_ButtonClose_showRole").click();
- return;
- }
- */
- if(roleVal==""||roleVal==undefined){
- top.Dialog.alert("没有选择角色,请选择角色");
- }else {
-
- if(deatil&&url.indexOf(",")>-1){
- if(roleVal==deatil){
-
- url = url.split(",")[0]+"?role_Id="+roleVal;
-
- }else{
-
- url = url.split(",")[1]+"?role_Id="+roleVal;
- }
- }else if(deatil&&url.indexOf(",")==-1){
-
- url = url+"?fd_id="+deatil+"&role_Id="+roleVal;
-
- }
- else{
- url = url+"?role_Id="+roleVal;
- }
-
-
- fn(url);
- diag.close();
- }
-
-
- };
- diag.CancelEvent = function(){
- diag.close();
- };
- //窗口Id
- diag.ID="showRole";
- diag.ButtonAlign="center";//按钮居中
- diag.show();//显示窗口
- diag.OnLoad=function(){
- diag.innerFrame.contentWindow.showRole(userId,zyRoleId);
- };
-
- }
- /**
- *
- * @param userId 用户的角色Id
- * @param roleArr 用户所对应的角色数组
- * @param fn 回调函数(跳转页面)
- * @param url 跳转页面url
- * @param zyRoleId 用户对应角色的字符串
- * @param deatil
- */
- function getRoleDeaitl (userId,roleArr,fn,url,zyRoleId,deatil){
-
- var diag = new top.Dialog();//定义一个窗口对象
- diag.Title = "角色选择";//窗口标题
- diag.URL = "/nwyj/page/business/em/report/GetRole.html";//窗口对应的页面
- diag.Height = 380;
- diag.Width= 400;
- diag.OKEvent = function(){
- var roleVal = diag.innerFrame.contentWindow.selRole();
- /*
- if(roleVal=="R002105430222"){
- top.Dialog.alert("此角色填写的表暂不支持导入功能");
- $(parent.document.body).find("#_ButtonClose_showRole").click();
- return;
- }
- */
- if(roleVal==""||roleVal==undefined){
- top.Dialog.alert("没有选择角色,请选择角色");
- }else {
-
- if(deatil&&url.indexOf(",")>-1){
- if(roleVal==deatil){
-
- url = url.split(",")[0]+"?role_Id="+roleVal;
-
- }else{
-
- url = url.split(",")[1]+"?role_Id="+roleVal;
- }
- }else if(deatil&&url.indexOf(",")==-1){
-
- url = url+"?fd_id="+deatil+"&role_Id="+roleVal;
-
- }
- else{
- url = url+"?role_Id="+roleVal;
- }
-
-
- fn(url);
- diag.close();
- }
-
-
- };
- diag.CancelEvent = function(){
- diag.close();
- };
- //窗口Id
- diag.ID="showRole";
- diag.ButtonAlign="center";//按钮居中
- diag.show();//显示窗口
- diag.OnLoad=function(){
- diag.innerFrame.contentWindow.showRole(userId,zyRoleId);
- };
-
- }
- function getDelRole(roleArr,params){
-
- var arr = [];
- if(roleArr.length>0){
-
-
- if(params.indexOf(",")==-1){
- for(var i=0;i<roleArr.length;i++){
- if(roleArr[i]!=params){
- arr.push(roleArr[i]);
- }
- }
- }else {
- var paramsArr = params.split(",");
- for(var i=0;i<roleArr.length;i++){
-
- if($.inArray(roleArr[i],paramsArr)==-1){
- arr.push(roleArr[i]);
- }
- }
-
- }
-
- }
- return arr;
- }
- function getRoleNames(roleIds){
- var role_id = getUserZyRole(roleIds.split(","));
- var roleNames = "";
- $.ajax({
- url:$.pathname() + "/ws/xianlutingyun/XianlutingyunService/getRoleNames",
- type:"post",
- async:false,
- data:{role_id:role_id},
- dataType:'text',
- success:function(data){
- roleNames = data;
- },
- error:function(){
- }
- });
- return roleNames;
- }
|