📄 highquery.js
字号:
objField.focus();
return false;
}
if(objCondition.value == "" && (objLParenthesisPanel.outerText != "" || objRParenthesisPanel.outerText != ""))
{
alert("不查询的字段两边不能加括号,请将不合法的括号删除!");
objField.focus();
return false;
}
strLParenthesis += objLParenthesisPanel.outerText;
strRParenthesis += objRParenthesisPanel.outerText;
}
if(strLParenthesis.length != strRParenthesis.length)
{
alert("\"(\"与\")\"的数量不对应,请检查!");
return false;
}
return true;
}
// 数据校正(like查询专用)。
function checkDataLike(objTemp, strText, action)
{
var strTemp = objTemp.value;
//if(strTemp == "" || action == "checkdate")
// return true;
strTemp = strTemp.replace(/\%/g, "");
strTemp = strTemp.replace(/\_/g, "");
if(strTemp == "")
return true;
return checkS(objTemp, strTemp, strText, action);
}
// 数据校正(in或not in查询专用)。
function checkDataIn(objTemp, strText, action)
{
var strTemp = objTemp.value;
var temps = strTemp.split(',');
var boolOK = true;
for(var i = 0; i < temps.length; i++)
{
if(temps[i] != "")
boolOK = checkS(objTemp, temps[i], strText, action);
if(boolOK == false)
break;
}
return boolOK;
}
// 数据校正。(between查询专用)
function checkDataBetween(objTemp, strText, action)
{
var strTemp = new Array(objTemp[0].value, objTemp[1].value);
var boolOK = true;
for(var i = 0; i < objTemp.length; i++)
{
if(strTemp[i] != "")
boolOK = checkS(objTemp[i], strTemp[i], strText, action);
if(boolOK == false)
break;
}
return boolOK;
}
// 数据校正。(is查询时用)
function checkDataIs(objTemp, strText, action)
{
var strTemp = objTemp.value;
return checkS(objTemp, strTemp, strText, action);
}
// 数据校正。(一般查询时用)
function checkDataNormal(objTemp, strText, action)
{
var strTemp = objTemp.value;
if(strTemp == "")
return true;
return checkS(objTemp, strTemp, strText, action);
}
/******************************以下为触发功能******************************/
// 改变所选字段时,相应改变界面。
function changeField()
{
var objField = window.event.srcElement; // 取得字段选择控件
var id = objField.id.split("_")[1];
var trRow = document.getElementById("row_" + id); // 取得行对象。
var objCondition = document.getElementById("condition_" + id); // 取得条件运算符选择控件对象
var objSignPanel = document.getElementById("signPanel_" + id); // 取得查询符号面板对象
var objBChoicePanel = document.getElementById("bChoicePanel_" + id); // 取得第一个内容文本"选择"面板对象
var objEContentPanel = document.getElementById("eContentPanel_" + id); // 取得第二个内容文本面板对象
var objBContent = document.getElementById("bContent_" + id); // 取得第一个条件内容文件控件对象
var objHibBContent = document.getElementById("hibBContent_" + id); // 取得第一个条件内容文件控件对象(隐藏的)
var isDate = FieldList.fields[objField.selectedIndex].type == "date"?true:false;
var isDateTime = FieldList.fields[objField.selectedIndex].type == "datetime"?true:false;
var isHasDict = FieldList.fields[objField.selectedIndex].dictCode == ""?false:true; // 是否有字典
var isHasEvent = FieldList.fields[objField.selectedIndex].event == ""?false:true; // 是否有事件
var dictCode = !isHasDict?"":FieldList.fields[objField.selectedIndex].dictCode; // 取得字典Code
var event = !isHasEvent?"":FieldList.fields[objField.selectedIndex].event; // 取得事件
objBContent.value = "";
objHibBContent.value = "";
objBContent.maxLength = FieldList.fields[objField.selectedIndex].length; // 根据字段长度改变文本控件的长度
// 如果对应的字段类型是date、datetime、有字典,或者是有事件存在时,删除like查询条件
if(isDate || isDateTime || isHasDict || isHasEvent)
{
var conditionTemp = objCondition.value;
if(objCondition.options[objCondition.length-1].value == "like")
{
objCondition.options.remove(objCondition.options[objCondition.length-1].index)
objSignPanel.innerHTML = ""; // 清除查询符号面板内容
}
if(conditionTemp != "like")
objCondition.value = conditionTemp;
}
else
{
if(objCondition.options[objCondition.length-1].value != "like")
{
objCondition.options.add(new Option('LIKE', 'like'));
}
}
// 内容控件的只读属性处理
if(isDate || isDateTime || objCondition.value == "is" || isHasDict || isHasEvent || objCondition.value == "")
objBContent.setAttribute("readOnly", "true");
else
objBContent.setAttribute("readOnly", "");
switch(objCondition.value)
{
case "": // 不查询时
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
break;
case "like": // 查询条件为like时
objSignPanel.innerHTML = getLikeHtml(id);
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
break;
case "in": // 查询条件为in时
objBContent.maxLength = '2147483647'; // 设为最大值
if(isDate || isDateTime) // 如果对应的字段类型是date或datetime时,给用户选择日期
objBChoicePanel.innerHTML = isDate?getDateInHtml("bContent_" + id):getDateTimeInHtml("bContent_" + id);
else if(isHasDict) // 如果有字典存在
objBChoicePanel.innerHTML = getDictInHtml("bContent_" + id, "hibBContent_" + id, dictCode);
else if(isHasEvent) // 如果有事件存在
objBChoicePanel.innerHTML = getEventInHtml("bContent_" + id, "hibBContent_" + id, event);
else
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
break;
case "not_in": // 查询条件为not in时
objBContent.maxLength = '2147483647'; // 设为最大值
if(isDate || isDateTime) // 如果对应的字段类型是date或datetime时,给用户选择日期
objBChoicePanel.innerHTML = isDate?getDateInHtml("bContent_" + id):getDateTimeInHtml("bContent_" + id);
else if(isHasDict) // 如果有字典存在
objBChoicePanel.innerHTML = getDictInHtml("bContent_" + id, "hibBContent_" + id, dictCode);
else if(isHasEvent) // 如果有事件存在
objBChoicePanel.innerHTML = getEventInHtml("bContent_" + id, "hibBContent_" + id, event);
else
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
break;
case "between": // 查询条件为between时
var objEContent = document.getElementById("eContent_" + id); // between查询时才会出现的第二个条件内容对象
var objHibEContent = document.getElementById("hibEContent_" + id); // between查询时才会出现的第二个条件内容对象(隐藏的)
var objEChoicePanel = document.getElementById("eChoicePanel_" + id); // between查询时才会出现的第二个内容文本"选择"面板对象
objEContent.value = ""; // 如果查询条件使用了between时,这个元素就存在
objHibEContent.value = ""; // 如果查询条件使用了between时,这个元素就存在
objEContent.maxLength = objBContent.maxLength;
if(isDate || isDateTime) // 如果对应的字段类型是date或datetime时,给用户选择日期
{
objEContent.setAttribute("readOnly", "true");
objBChoicePanel.innerHTML = isDate?getDateHtml("bContent_" + id):getDateTimeHtml("bContent_" + id);
objEChoicePanel.innerHTML = isDate?getDateHtml("eContent_" + id):getDateTimeHtml("eContent_" + id);
}
else if(isHasDict) // 如果有字典存在
{
objEContent.setAttribute("readOnly", "true");
objBChoicePanel.innerHTML = getDictHtml("bContent_" + id, "hibBContent_" + id, dictCode);
objEChoicePanel.innerHTML = getDictHtml("eContent_" + id, "hibEContent_" + id, dictCode);
}
else if(isHasEvent) // 如果有事件存在
{
objEContent.setAttribute("readOnly", "true");
objBChoicePanel.innerHTML = getEventHtml("bContent_" + id, "hibBContent_" + id, event);
objEChoicePanel.innerHTML = getEventHtml("eContent_" + id, "hibEContent_" + id, event);
}
else
{
objEContent.setAttribute("readOnly", "");
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
objEChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第二个内容文本"选择"面板内容(不论是否存在)
}
break;
case "is": // 查询条件为is时
objSignPanel.innerHTML = getIsHtml(id);
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
break;
default: // 查询条件为其他时
if(isDate || isDateTime) // 如果对应的字段类型是date或datetime时,给用户选择日期
objBChoicePanel.innerHTML = isDate?getDateHtml("bContent_" + id):getDateTimeHtml("bContent_" + id);
else if(isHasDict) // 如果有字典存在
objBChoicePanel.innerHTML = getDictHtml("bContent_" + id, "hibBContent_" + id, dictCode);
else if(isHasEvent) // 如果有事件存在
objBChoicePanel.innerHTML = getEventHtml("bContent_" + id, "hibBContent_" + id, event);
else
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
break;
}
}
// 改变条件运算符时,相应改变界面。
function changeCondition()
{
var objCondition = window.event.srcElement; // 取得条件运算符选择控件对象
var id = objCondition.id.split("_")[1];
var trRow = document.getElementById("row_" + id); // 取得行对象。
var objField = document.getElementById("field_" + id); // 取得字段选择控件对象
var objSignPanel = document.getElementById("signPanel_" + id); // 取得查询符号面板对象
var objBChoicePanel = document.getElementById("bChoicePanel_" + id); // 取得第一个内容文本"选择"面板对象
var objEContentPanel = document.getElementById("eContentPanel_" + id); // 取得第二个内容文本面板对象
var objBContent = document.getElementById("bContent_" + id); // 取得第一个条件内容文件控件对象
var objHibBContent = document.getElementById("hibBContent_" + id); // 取得第一个条件内容文件控件对象(隐藏的)
var isDate = FieldList.fields[objField.selectedIndex].type == "date"?true:false;
var isDateTime = FieldList.fields[objField.selectedIndex].type == "datetime"?true:false;
var isHasDict = FieldList.fields[objField.selectedIndex].dictCode == ""?false:true; // 是否有字典
var isHasEvent = FieldList.fields[objField.selectedIndex].event == ""?false:true; // 是否有事件
var dictCode = !isHasDict?"":FieldList.fields[objField.selectedIndex].dictCode; // 取得字典Code
var event = !isHasEvent?"":FieldList.fields[objField.selectedIndex].event; // 取得事件
objBContent.maxLength = FieldList.fields[objField.selectedIndex].length; // 根据字段长度改变文本控件的长度
// 如果文本内容长度大于最大长度(通常出现在in查询时)就清除内容或者条件运算符为"is"
if(objBContent.value.length > objBContent.maxLength || objCondition.value == "is" || objCondition.value == "")
{
objBContent.value = "";
objHibBContent.value = "";
}
// 内容控件的只读属性处理
if(isDate || isDateTime || objCondition.value == "is" || isHasDict || isHasEvent || objCondition.value == "")
objBContent.setAttribute("readOnly", "true");
else
objBContent.setAttribute("readOnly", "");
switch(objCondition.value)
{
case "": // 不查询时
objBChoicePanel.innerHTML = ""; // 清除(date、datetime、带事件字段)查询时留下的第一个内容文本"选择"面板内容(不论是否存在)
objSignPanel.innerHTML= ""; // 清除查询符号面板内容(不论是否存在)
objEContentPanel.innerHTML = ""; // 清除between查询的第二个文本面板内容(不论是否存在)
break;
case "like": // 查询条件为like时
objSignPanel.innerHTML = getLikeHtml(id);
objEContentPanel.innerHTML = ""; // 清除between查询的第二个文本面板内容(不论是否存在)
break;
case "in": // 查询条件为in时
objBContent.maxLength = '2147483647'; // 设为最大值
if(isDate || isDateTime) // 如果对应的字段类型是date或datetime时,给用户选择日期
objBChoicePanel.innerHTML = isDate?getDateInHtml("bContent_" + id):getDateTimeInHtml("bContent_" + id);
else if(isHasDict) // 如果有字典存在
objBChoicePanel.innerHTML = getDictInHtml("bContent_" + id, "hibBContent_" + id, dictCode);
else if(isHasEvent) // 如果有事件存在
objBChoicePanel.innerHTML = getEventInHtml("bContent_" + id, "hibBContent_" + id, event);
else
objBChoicePanel.innerHTML = "";
objSignPanel.innerHTML= ""; // 清除查询符号面板内容(不论是否存在)
objEContentPanel.innerHTML = ""; // 清除between查询的第二个文本面板内容(不论是否存在)
break;
case "not_in": // 查询条件为not in时
objBContent.maxLength = '2147483647'; // 设为最大值
if(isDate || isDateTime) // 如果对应的字段类型是date或datetime时,给用户选择日期
objBChoicePanel.innerHTML = isDate?getDateInHtml("bContent_" + id):getDateTimeInHtml("bContent_" + id);
else if(isHasDict) // 如果有字典存在
objBChoicePanel.innerHTML = getDictInHtml("bContent_" + id, "hibBContent_" + id, dictCode);
else if(isHasEvent) // 如果有事件存在
objBChoicePanel.innerHTML = getEventInHtml("bContent_" + id, "hibBContent_" + id, event);
else
objBChoicePanel.innerHTML = "";
objSignPanel.innerHTML= ""; // 清除查询符号面板内容(不论是否存在)
objEContentPanel.innerHTML = ""; // 清除between查询的第二个文本面板内容(不论是否存在)
break;
case "between": // 查询条件为between时
var maxLen = objBContent.maxLength;
if(isDate || isDateTime) // 如果对应的字段类型是date或datetime时,给用户选择日期
{
objBChoicePanel.innerHTML = isDate?getDateHtml("bContent_" + id):getDateTimeHtml("bContent_" + id);
objEContentPanel.innerHTML = "--<input class='HQ_TEXT' id='eContent_" + id + "' readOnly maxLength='" + maxLen + "'>" +
"<input type='hidden' class='HQ_TEXT' id='hibEContent_" + id + "'>" +
"<span id='eChoicePanel_" + id + "'>" + (isDate?getDateHtml("eContent_" + id):getDateTimeHtml("eContent_" + id)) + "</span>";
}
else if(isHasDict) // 如果有字典存在
{
objBChoicePanel.innerHTML = getDictHtml("bContent_" + id, "hibBContent_" + id, dictCode);
objEContentPanel.innerHTML = "--<input class='HQ_TEXT' id='eContent_" + id + "' readOnly maxLength='" + maxLen + "'>" +
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -