📄 dataauth.js
字号:
//显示数据权限设置页面
function setDA(menuid,viewid,unitid){
//window.showModalDialog("/c?_view=_dataauth&_dataauth_list.o=u","","dialogWidth:40");
//window.location="/c?_view=_dataauth&_dataauth_list.o=u&_dataauth_search.emenuid="+menuid+"&_dataauth_search.eviewid="+viewid+"&_dataauth_search.eunitid="+unitid;
doLink("/c?_view=_dataauth&_dataauth_list.o=u&_dataauth_search.emenuid="+menuid+"&_dataauth_search.eviewid="+viewid+"&_dataauth_search.eunitid="+unitid);
}
function showDADialog(menuid,viewid,unitid,roleid){
var url = "/c?_view=_da_select&_dataauth_list.o=u&_dataauth_search.emenuid="+menuid+"&_dataauth_search.eviewid="+viewid+"&_dataauth_search.eunitid="+unitid;
//window.location=url;
doLink(url);
}
function doSAClose(action){
//window.close();
}
function doSABack(action){
var menuid = document.forms[0].all('_dataauth_search.emenuid').value;
//window.location="/c?_view=_daset&_daset.emenuid="+menuid;
doLink("/c?_view=_daset&_daset.emenuid="+menuid);
}
function doSASubmit(action){
alert('submit')
}
function gotoreset(){
var head = '_r_da_select.eroleidsel';
//var checks = document.all(head);
var checks = getAllElements(head);
var checkedid='';
if(!checks) return;
/*
if(checks.length == undefined){
if(checks.checked){
checkedid=checks.value;
}
}else{
*/
for(var i=0;i<checks.length;i++){
if(checks[i].checked){
if(i==0){
checkedid=checks[i].value;
}else{
checkedid=checkedid+","+checks[i].value;
}
}
}
/*
}
*/
document.forms[0].action=getContextPath() + '/c?_view=_da_select&_da_select.actiontype=set&_da_select.idstr='+checkedid;
//doLink('/c?_view=_da_select&_da_select.actiontype=set&_da_select.idstr='+checkedid);
document.forms[0].submit();
}
function doSAABack(){
var menuid = document.forms[0].all('_dataauth_search.emenuid').value;
//window.location="/c?_view=_daassign&_daassign.emenuid="+menuid;
doLink("/c?_view=_daassign&_daassign.emenuid="+menuid);
}
function doSAABacktoRole(){
//window.location="/c?_view=_role_da";
doLink("/c?_view=_role_da");
}
//增加数据权限标记
function addDataAuthTag(){
var unitId = getUnitId();
//var e = document.getElementById(unitId + ".esql");
var e = getAllElements(unitId + ".esql")[0];
var pos = getCursorPosition(unitId + ".esql");
var prefix = e.value.substr(0,pos);
var suffix = e.value.substr(pos,e.value.length);
var daTag = " #DA# "; //此处应和SQLExpression中定义一致
e.value = prefix + daTag + suffix;
setCursorPosition(unitId + ".esql",pos);
if(document.selection){
var select = document.selection.createRange();
select.moveEnd('character',daTag.length);
select.select();
}else{
e.selectionStart=pos;
e.selectionEnd=pos+daTag.length;
}
}
//获得光标位置
function getCursorPosition(eid)
{
//var txb = document.getElementById(eid);//根据ID获得对象
var txb = getAllElements(eid)[0];//根据ID获得对象
var pos = 0;//设置初始位置
txb.focus();//输入框获得焦点,这句也不能少,不然后面会出错,血的教训啦.
var s = txb.scrollTop;//获得滚动条的位置
if(document.selection){
var r = document.selection.createRange();//创建文档选择对象
var t = txb.createTextRange();//创建输入框文本对象
t.collapse(true);//将光标移到头
t.select();//显示光标,这个不能少,不然的话,光标没有移到头.当时我不知道,搞了十几分钟
var j = document.selection.createRange();//为新的光标位置创建文档选择对象
r.setEndPoint("StartToStart",j);//在以前的文档选择对象和新的对象之间创建对象
var str = r.text;//获得对象的文本
var re = new RegExp("[\\n]","g");//过滤掉换行符,不然你的文字会有问题,会比你的文字实际长度要长一些
str = str.replace(re,"");//过滤
pos = str.length;//获得长度.也就是光标的位置
r.collapse(false);
r.select();//把光标恢复到以前的位置
txb.scrollTop = s;//把滚动条恢复到以前的位置
}else{
var r = document.getSelection();
pos = txb.selectionStart;
}
return pos;
}
//设置光标函数
function setCursorPosition(id,pos)
{
//var textbox = document.getElementById(id);
var textbox = getAllElements(id)[0];
if(document.selection){
var r = textbox.createTextRange();
r.collapse(true);
r.moveStart('character',pos);
r.select();
}else{
textbox.selectionStart=pos;
}
}
function openAllRole(id) {
showDialog('/c?_view=_da_allRoleSelect&_daid=' + id ,this,'dialogHeight:400px;dialogWidth:700px');
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -