package com.yc.service.panel.v2;
|
|
import com.google.gson.JsonArray;
|
import com.yc.action.grid.GridUtils;
|
import com.yc.exception.ApplicationException;
|
import com.yc.service.BaseService;
|
import com.yc.service.grid.GridServiceIfc;
|
import com.yc.service.impl.DBHelper;
|
import com.yc.service.panel.GetDataTypeIfc;
|
import com.yc.service.panel.PanelParmHelper;
|
import com.yc.service.panel.SqlDBHelperIfc;
|
import com.yc.service.panel.SystemSettingsDao;
|
import com.yc.utils.EncodeUtil;
|
import com.yc.utils.JOSNUtils;
|
import com.yc.utils.Page;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.io.UnsupportedEncodingException;
|
import java.util.*;
|
import java.util.regex.Matcher;
|
import java.util.regex.Pattern;
|
|
/**
|
* 生成控件显示在网页上的代码 原先在这段URL(http://的路径不再传进) 而URL真正得到信息是在生产JSP后运行才得到,保证这路径绝对正确
|
*
|
* @author pengbei
|
*
|
*/
|
@Service("TypeControlV2")
|
public class TypeControl extends BaseService implements TypeControlDao {
|
@Autowired
|
SqlDBHelperIfc sqlDBHelperIfc;
|
@Autowired
|
SystemSettingsDao systemSettingsDao;
|
@Autowired
|
GetDataTypeIfc getDataTypeIfc;
|
@Autowired
|
private GridServiceIfc gridService;// 表格处理的业务类
|
|
public static String PANEL_INFO="panel_info";
|
private String getFunctionParm(String st, String parms, Map<String, String> env) {
|
parms = JOSNUtils.prossBase64(parms);
|
if ("".equalsIgnoreCase(st))
|
return "";
|
if ("".equalsIgnoreCase(parms))
|
return "";
|
StringBuilder sb = new StringBuilder();
|
String[] temp = st.split(";");// 函数后面列出的参数,有可能包括数字,字符及参数名称
|
int i = 0;
|
String[] temp1 = parms.split("\\band\\b");
|
for (String str : temp) {
|
if (str.matches("\\d")) {// 只是数字
|
if (i != 0)
|
sb.append(",");
|
sb.append(str);
|
continue;
|
}
|
boolean fl = false;
|
for (String ss : temp1) {
|
int index = 0;
|
String cv1 = "";
|
String cv2 = "";
|
try {
|
index = ss.indexOf("=");
|
} catch (StringIndexOutOfBoundsException e) {
|
index = 0;
|
}
|
cv1 = ss.substring(0, index);
|
cv2 = ss.substring(index + 1);
|
if (str.trim().equalsIgnoreCase(cv1.replaceAll("\\s", ""))) {
|
if (i != 0)
|
sb.append(",");
|
sb.append("'null'".equalsIgnoreCase(cv2.replaceAll("\\s", "")) ? null : cv2);
|
i++;
|
fl = true;
|
break;
|
} else if (str.indexOf("@") > -1) {// 需要从session取值
|
// @usercode|cltcode
|
String[] sts = str.split("=");
|
if (sts[1].trim().equalsIgnoreCase(cv1.replaceAll("\\s", ""))) {
|
if (i != 0)
|
sb.append(",");
|
sb.append("'" + env.get(sts[0]) + "'");
|
i++;
|
fl = true;
|
break;
|
}
|
}
|
}
|
if (!fl) {
|
if (i != 0)
|
sb.append(",");
|
sb.append("'").append(str).append("'");
|
i++;
|
}
|
}
|
return sb.toString();
|
}
|
|
public Page loadAllByFunc(Page page, Map<String, String> env, boolean flg, String statisID, int formID) {
|
|
String newTbCols="";
|
if(StringUtils.isNotBlank(page.getTbCols())){
|
String tbCols=page.getTbCols();
|
try {
|
tbCols = EncodeUtil.base64Decode(tbCols);
|
tbCols = tbCols.replaceAll("%2F", "/").replaceAll("%2B", "+");
|
} catch (UnsupportedEncodingException e) {
|
throw new ApplicationException(e.getMessage());
|
}
|
String[] strings = tbCols.split(",");
|
int index1 = 0;
|
for (String s : strings) {
|
String[] str = s.split("#");// 分出每个统计的列
|
newTbCols += str[0].toLowerCase() + "=#" + index1 + ";";
|
index1++;
|
}
|
page.setNewTbCols(newTbCols);
|
}
|
gridService.loadAllByFunc(page, env, false);
|
//取字段对齐,数字格式,长度
|
String sql1 = "select fieldid,cellAlign,cellAlign as appCellAlign,displayformat,displayWidth as gridlength FROM _sysStatisDetail where formID=" + formID + " AND statisID="
|
+ "'" + statisID + "'" + "";
|
List<Map<String, Object>> list1 = this.jdbcTemplate.queryForList(sql1);
|
//处理成Map结构方便后面组装
|
Map<String, Map<String, Object>> resultMap = new HashMap<>();
|
if (list1 != null && list1.size() > 0) {
|
for (Map<String, Object> objectMap : list1) {
|
|
String id = GridUtils.prossRowSetDataType_String(objectMap, "fieldID").toLowerCase();
|
final String[] byAsOfEnd = id.split("\\s*\\b(?i)as\\b\\s*");
|
if (byAsOfEnd.length > 1) {
|
id = byAsOfEnd[1];
|
}
|
resultMap.put(id,objectMap);
|
}
|
}
|
page.setData(page.getData());
|
page.setResultMap(resultMap);
|
return page;
|
//}
|
}
|
|
|
|
|
public void setFunLoadList(JsonArray fun, boolean isNew,PanelBean panelBean) {
|
if (isNew) {
|
panelBean.funLoadList = new JsonArray();
|
} else {
|
panelBean.funLoadList.add(fun);
|
}
|
}
|
|
|
public void setFunList(String fun, boolean isNew,PanelBean panelBean) {
|
if (isNew) {
|
panelBean.funList = new ArrayList<String>();
|
} else {
|
panelBean.funList.add(fun);
|
}
|
}
|
|
/**
|
* 生成设置的类型控件 筛选面板获得
|
*/
|
public String get(Map<String, Object> map) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
panelBean.tabindexIs++;
|
String id=panelBean.pHelper.id;
|
String returnStr = "";
|
panelBean.getBackStr = getMassterCodeKeyDown(map, true);
|
String fun="";
|
switch (DBHelper.getValueInt(map, "ControlType")) {
|
case 1: // 文本框(text控件)
|
fun = "getText('" + id + "','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getText(map, true);
|
break;
|
case 2: // 下拉列表(select控件)
|
// 给集合添加函数
|
fun = "getSelect('" + id + "','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getOptions(map);// 有处理sql的函数,解决
|
break;
|
case 3:// 弹出选择框
|
isTreeMus(map);
|
fun = "getText('" + id + "','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getShowFrom(map, true);
|
break;
|
case 5:// 日期选择
|
panelBean.pHelper.linkJsDate = "<script type=\"text/javascript\" src=\"/js/calendar/WdatePicker.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/calendar/WdatePicker.js\")%>\" defer=\"defer\"></script>";//
|
fun = "getBetweenDate('" + id + "','beginday','endday')";
|
setFunList(fun, false,panelBean);
|
returnStr = getDate(map, true);
|
break;
|
case 6:// 复选框(check控件:单选项,只能选择1个打√)
|
fun = "getCheck('" + id + "','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getCheckBox(map, true);
|
break;
|
case 30:// 复选框(check控件:多选项,能选择多个打√)
|
// 给集合添加函数
|
fun = "getCheckList('" + id + "','" + id + "Check','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getCheckBoxList(map);
|
break;
|
case 31:// 下拉列表+SQL(select控件+SQL动态列表)
|
// 给集合添加函数
|
fun = "getSelect('" + id + "','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getOptionsSql(map);// 有处理sql的函数,解决
|
break;
|
case 32:// 单选框(radio控件:多选项值,但只能选择一个)
|
// 给集合添加函数Radio
|
fun = "getRadio('" + id + "','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getRadio(map);// 有处理sql的函数,解决
|
break;
|
case 33:// 多功能搜索控件(文本框+下拉列表框[多字段列表])
|
// 给集合添加函数
|
fun = "multifunctional('valueis','colis','jqcz','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getTextAndSelect(map);// //有处理sql的函数,解决
|
break;
|
case 35:// 录入+下拉组合框
|
fun = "getSelect('" + id + "','" + DBHelper.getValue(map, "CompSingle") + "')";
|
setFunList(fun, false,panelBean);
|
returnStr = getOptionEdit(map, true);
|
break;
|
default:
|
break;
|
}
|
return returnStr;
|
}
|
|
/**
|
* 生成页面需要的控件 获得面板显示(多数在这个方法获取控件)
|
*/
|
public String getComponentForPanel(Map<String, Object> sys, boolean shuai, Map<String, Integer> listmax) throws Exception {
|
PanelBean panelBean= (PanelBean) sys.get(PANEL_INFO);
|
String type = null;
|
try {
|
// 查出当前窗体类型,以便处理496多表的情况,
|
type = gridService.getSimpleJdbcTemplate().queryForObject("select formtype from _sysmenu where formid=?",
|
new Object[] { sys.get("formid") }, String.class);
|
} catch (Exception e) {
|
}
|
String id=panelBean.pHelper.id;
|
if (id.trim().equals("")) {
|
return "";// 无字段ID不生成控件
|
}
|
if (!DBHelper.getValue(sys, "SqlScript").equals("")) {
|
String sqlContype = "";
|
sqlContype ="$(function(){";
|
if(DBHelper.getValueInt(sys, "ControlType") != 43){
|
sqlContype +="getControlValue('" + id + "'," + DBHelper.getValueInt(sys, "ControlType") + ",'" + id + "','"
|
+ DBHelper.getValueInt(sys, "FT") + "','@index@');";
|
}else{
|
sqlContype +="getSelect2('" + id + "'," + DBHelper.getValueInt(sys, "ControlType") + ",'" + id
|
+ "','" + DBHelper.getValueInt(sys, "FT") + "','@index@','"+getControls(sys)+"');";
|
}
|
sqlContype+="})";
|
panelBean.sqlContype=sqlContype;
|
}else{
|
panelBean.sqlContype="";
|
}
|
if (!DBHelper.getValue(sys, "dyfieldview").equals("")) {
|
panelBean.dyfieldStr = "dyfield_view('" + panelBean.initialValue.getValRep(DBHelper.getValue(sys, "dyfieldview"), false)
|
+ "');";
|
} else {
|
panelBean.dyfieldStr = "";
|
}
|
if (listmax != null) { // 处理控件的输入长度
|
try {
|
if (listmax.get(id) != null) {// 一一对应
|
panelBean.maxl = "maxLength=\"" + listmax.get(id)
|
+ "\" onkeyup=\"while(value.replace(/[^\\\\x00-\\\\xff]/g, '**').length>maxLength)value=value.slice(0,-1)\"";
|
} else {
|
panelBean.maxl = "";
|
} // 如果不存在就把maxl清空 防止出错。2014-8-30
|
} catch (Exception e) {
|
panelBean.maxl = "";
|
}
|
}
|
panelBean.tabindexIs++;// 每次调用是把tabindex上升一个次序
|
String returnStr = "";
|
panelBean.getBackStr = getMassterCodeKeyDown(sys, shuai);
|
String buttonStr = getButtonNext(sys);// 通过,驳回,下一步 等等的审核
|
boolean isTabs=(DBHelper.getValue(sys, "tabs38").equals("null")?false:true);//判断是否是面板上的选项卡控件-xin 2018-11-5 15:19:22
|
// double hei = 0;
|
PanelParmHelper pHelper=panelBean.pHelper;
|
switch (DBHelper.getValueInt(sys, "ControlType")) {
|
case 1: // 文本框(text控件)
|
returnStr = getText(sys, shuai);
|
break;
|
case 2: // 下拉列表(select控件)
|
returnStr = getOptions(sys);
|
break;
|
case 3: // 弹出选择框
|
isTreeMus(sys);
|
returnStr = getShowFrom(sys, shuai);
|
break;
|
case 5:// 日期选择
|
pHelper.linkJsDate = "<script type=\"text/javascript\" src=\"/js/calendar/WdatePicker.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/js/calendar/WdatePicker.js\")%>\" defer=\"defer\"></script>";//
|
returnStr = getDate(sys, shuai);
|
break;
|
case 6:// 复选框(check控件:单选项,只能选择1个打√)
|
returnStr = getCheckBox(sys, shuai);
|
break;
|
case 7:// 弹出式文本编辑框
|
returnStr = getShowText(sys, shuai, listmax);
|
break;
|
case 10:// 金钱框---以输入框先代替
|
returnStr = getText(sys, shuai);
|
break;
|
case 9:// 图片预览
|
case 19:// 上传附件按钮
|
returnStr=this.createFileUPload(sys);
|
if(DBHelper.getValueInt(sys, "ControlType")==19){
|
pHelper.seqtypefilde="19;"+id;//19类型控件面板需要用到
|
}
|
break;
|
case 30:// 复选框(check控件:多选项,能选择多个打√)
|
panelBean.clickStr = "cheeckSToValue('" + id + "');";
|
returnStr = getCheckBoxList(sys);
|
panelBean.clickStr = "";
|
break;
|
case 31:// 下拉列表+SQL(select控件+SQL动态列表)
|
returnStr = getOptionsSql(sys);// 有处理sql的函数,解决
|
break;
|
case 32:// 单选框(radio控件:多选项值,但只能选择一个)
|
returnStr = getRadio(sys);// 有处理sql的函数,解决
|
break;
|
case 33:// 多功能搜索控件(文本框+下拉列表框[多字段列表])
|
returnStr = getTextAndSelect(sys);// //有处理sql的函数,解决
|
break;
|
case 34:// 区域录入提示信息
|
String panStyle = "style=\"font-family: '黑体';font-size: 18px;\"";
|
String invString = DBHelper.getValue(sys, "styleCss");
|
panStyle = invString.trim().equals("") ? panStyle : invString;
|
returnStr += "<span " + panStyle + ">" + DBHelper.getValue(sys, "fieldname") + "</span>";// 只显示描述控件,设置占用一行
|
break;
|
case 35:// 录入+下拉组合框
|
returnStr = getOptionEdit(sys, shuai);
|
break;
|
case 36:// 自定义HTML
|
try {
|
returnStr = "<div style=\"width:auto; table-layout:fixed; word-break: break-all; overflow:auto; \"><span id=\""
|
+ id + "SetHtml\"><input id=\"" + id + "\" value=\"\" type=\"hidden\" />";
|
pHelper.customHTMLList = systemSettingsDao.getCustomHTML(pHelper.formIdPan, id);
|
for (int i = 0; i < pHelper.customHTMLList.size(); i++) {
|
returnStr += pHelper.customHTMLList.get(i).get("htmlcontent").toString().replaceAll("\\\\",
|
";pbZhuan#");
|
}
|
returnStr += "</span></div>";
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
break;
|
case 37:// 富文本框控件
|
int height = (pHelper.rowHei) * DBHelper.getValueInt(sys, "HeightNum");
|
if (pHelper.formTypePan != 496 || pHelper.formTypePan != 497) {
|
pHelper.linkJsFu = "\n<script type=\"text/javascript\" src=\"/ckeditor/ckeditor.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/ckeditor/ckeditor.js\")%>\"></script>";
|
pHelper.linkJsFu += "\n<script type=\"text/javascript\" src=\"/ckeditor/samples/js/ckimpl.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/ckeditor/samples/js/ckimpl.js\")%>\"></script>";
|
}
|
returnStr += "\n<form><textarea id=\"" + id + "\" name=\"" + id + "\">" + getJspValue(id) + "</textarea></form>";
|
returnStr += "\n<script type=\"text/javascript\">$(function(){initSample('" + id + "',"+height+");})</script>";
|
break;
|
case 38:// 控件分组显示
|
// hei = (pHelper.rowHei) * DBHelper.getValueInt(sys, "HeightNum");
|
String z_index=(isTabs?"margin-top:15px;margin-left:6px;position:absolute;z-index:0;":"margin-top:12px;margin-left:3px;position:absolute;z-index:-1;");
|
returnStr += "<div class=\"controls38Div controls38c"+DBHelper.getValueInt(sys, "LengthNum")
|
+" controls38r"+DBHelper.getValueInt(sys, "HeightNum")+"\" style=\"border:1px #75a3e1 solid;border-radius:6px;"+z_index+"\">"
|
+ "<span style=\"margin-top:-10px;background:#FFFFFF;width:auto;left:10px;position:absolute\">"
|
+ DBHelper.getValue(sys, "fieldname") + "</span></div>";// px;margin-top:2px;
|
// 对面板控件边框的高度控制设置
|
panelBean.xuan = "";
|
if(isTabs && DBHelper.getValueInt(panelBean.control38height, DBHelper.getValue(sys, "tabsheetname"))==0) {
|
panelBean.control38height.put(DBHelper.getValue(sys, "tabsheetname"),(DBHelper.getValueInt(sys, "RowNo")+DBHelper.getValueInt(sys, "HeightNum")));
|
}
|
break;
|
case 39:// 控件分组显示
|
int hei39 = pHelper.rowHei * DBHelper.getValueInt(sys, "HeightNum");
|
returnStr = "<input type='text' value='" + getJspValue(id) + "' id=\"" + id
|
+ "\" readonly=\"readonly\" style='width: " + (DBHelper.getValueInt(sys, "tdlen") - 25)
|
+ "px ; height: " + hei39 + "px;" + DBHelper.getValue(sys, "styleCss")
|
+ "'><input type=\"button\" id='" + id + "_dibang' onclick=\"stopOrStart(this,'" + id
|
+ "')\" value=\"解锁\"><script>stopOrStartBegin(document.getElementById('" + id + "_dibang'),'" + id
|
+ "')</script>";
|
break;
|
case 40:// 图片浏览控件 -xin 2020-6-15 17:24:07
|
int w=116*DBHelper.getValueInt(sys, "LengthNum");
|
int h=pHelper.rowHei * DBHelper.getValueInt(sys, "HeightNum");
|
pHelper.linkJsFu = "\n<link rel=\"stylesheet\" type=\"text/css\" href=\"/general/Viewer/css/viewer.min.css?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/general/Viewer/css/viewer.min.css\")%>\">";
|
pHelper.linkJsFu += "\n<script type=\"text/javascript\" src=\"/general/Viewer/js/viewer-jquery.min.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/general/Viewer/js/viewer-jquery.min.js\")%>\"></script>";
|
pHelper.linkJsFu += "\n<script type=\"text/javascript\" src=\"/general/Viewer/js/viewer.min.js?v=<%=com.yc.utils.FileUtil.getVerstion(request,\"/general/Viewer/js/viewer.min.js\")%>\"></script>";
|
returnStr += "<div style=\"border: 1px solid #99BBE8;border-radius: 5px;\">"
|
+ "<ul id=\""+id+"\" class=\"isViewer40\" data-value=\""+getJspValue(id)+"\">" +
|
"</ul></div>" ;
|
// "<img id="+id+" src=\""+getJspValue(id)+"\" value=\""+getJspValue(id)+"\" alt=\""+DBHelper.getValue(sys, "fieldname")+"\""
|
// + " src-source style=\"width:100%;height:150px;\"/>";
|
// returnStr+="<script>$(function(){OpenImage40('"+id+"')})</script>";
|
break;
|
case 41:// 标签(label)
|
String secc = "style=\"font-size: 16px;\"";
|
String sytlep = DBHelper.getValue(sys, "styleCss");
|
secc = sytlep.trim().equals("") ? secc : sytlep;
|
//标签控件那就是静态的显示字段描述内容就可以了,所以直接取fieldName的值 xin 2023-4-27 17:23:36
|
returnStr = "<label id=\""+id+"\" " + secc + ">" + DBHelper.getValue(sys, "fieldname") + "</label>";//getJspValue(id)
|
break;
|
case 42:// 文本框+录入时动态下拉提示选择框
|
returnStr = getShowFrom42(sys, shuai);
|
break;
|
case 43:// 下拉列表复选框
|
returnStr = getSelect43(sys, shuai);
|
break;
|
case 44://静态图标控件
|
returnStr=getBigIcon44(sys,shuai);
|
break;
|
case 46:
|
returnStr=getColorFinder(sys,shuai);
|
break;
|
case 47:
|
returnStr=getProgressBar(sys,shuai);
|
break;
|
case 48://css样式控件
|
returnStr=getTextCssEdit(sys,shuai);
|
break;
|
default:
|
returnStr = getText(sys, shuai);// 有些控件类型暂无用此替代
|
break;
|
}
|
returnStr = "<span id=\"" + id + "_show_type\">" + returnStr + "</span>";
|
if (!DBHelper.getValue(sys, "HyperlinkFT").equals("")) {
|
returnStr += "<span id=\"" + id
|
+ "_show_link\" style='display:none'><a href=\"javascript:void(0)\" onclick=\"windowLink('" + id
|
+ "');\"><span id=\"" + id + "_Link\" style=\"display: block;margin-top: 5px;\"></span></a></span>";
|
}
|
if (panelBean.hasButton) {//有审核按钮(旧)
|
returnStr = "<table style=\"width:72%;\"><tr><td>" + returnStr + "</td><td>" + buttonStr + "</td></tr></table>";// valign=\"top\"
|
}
|
getPermission(sys);
|
if (DBHelper.getValueInt(sys, "calcuField") != 0 ) {// 触发公式
|
pHelper.gongsiCols.add(id);
|
// pHelper.gongsiCols += id + ";";
|
}
|
if (!DBHelper.getValue(sys, "formula").equals("")) {
|
pHelper.gongsiStr.add(id + "=" + DBHelper.getValue(sys, "formula").replaceAll("\'", "\\\\\'"));
|
// pHelper.gongsiStr += id + "=" + DBHelper.getValue(sys, "formula") + ";";
|
}
|
panelBean.maxl = "";// 清空该控件的输入长度,防止对 下一个控件的输入长度造成影响
|
return "<span id=\"" + id + "_dynamic\">" + returnStr + "</span></span></div>" + getKeyInput(sys);
|
}
|
|
/**
|
* 1类型控件。文本框(text控件)
|
*
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getText(Map<String, Object> map, boolean shuai) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String str = "";
|
String id=panelBean.pHelper.id;
|
String maxl=panelBean.maxl;
|
if (shuai) {
|
str = "<input id=\"" + id + "\" type=\"text\" autocomplete=\"off\" name=\"" + id + "\" " + maxl + " ";
|
str = getAll(map, str, shuai);
|
str += " />";
|
} else {
|
String str1 = "";
|
if (DBHelper.getValueInt(map, "HeightNum") > 1) {
|
int num=(panelBean.hasButton?DBHelper.getValueInt(map, "LengthNum")-1:DBHelper.getValueInt(map, "LengthNum"));
|
str1 = "<textarea ";
|
str += str1 + " id=\"" + id + "\" name=\"" + id + "\" " + maxl + " autocomplete=\"off\" class=\"text "+getControls(map)+ "\"";
|
str = getAll(map, str, shuai) + " ><%=DBHelper.replaceBlankOnWeb(DBHelper.getValue(docMap,\"" + id
|
+ "\",mapAll))%>";
|
str += "</textarea>";
|
} else {
|
str1 = "<input type=\"" + ((DBHelper.getValueInt(map, "passwordchar") == 1) ? "password" : "text")
|
+ "\" ";
|
str += str1 + " id=\"" + id + "\" name=\"" + id + "\" " + maxl + " autocomplete=\"off\" class=\"text " + getControls(map)
|
+ "\" value=\"" + getJspValue(id) + "\" ";
|
str = getAll(map, str, shuai);// 这里可以提出来,还是提出来
|
str += " />";
|
}
|
}
|
return str;
|
}
|
|
/**
|
* 2类型控。下拉列表(select控件)
|
*
|
* @param mapW
|
* @return
|
* @throws Exception
|
*/
|
private String getOptions(Map<String, Object> mapW) throws Exception {
|
PanelBean panelBean= (PanelBean) mapW.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String selectStr = "";
|
if (DBHelper.getValue(mapW, "SqlScript") == null || DBHelper.getValue(mapW, "SqlScript").trim().equals("")) {
|
selectStr = "<select class=\""+getControls(mapW)+"\" onfocus=\"" + panelBean.sqlContype + "\" " + panelBean.onClickStr + " onkeydown=\"keyDown('" + id
|
+ "',event);key_Delete_Selete(event,'" + id + "');\" ";
|
selectStr += getChange(panelBean);
|
selectStr += getReadOnly(mapW);// 后加
|
selectStr += " onblur=\"" + panelBean.clickStr + "\" name=\"" + id + "\" size=\"1\" id=\"" + id + "\">";
|
String sql = "select * from _sysdict where dictid = " + DBHelper.getValueInt(mapW, "FT");
|
List<HashMap<String, String>> list = null;
|
list = sqlDBHelperIfc.getHashMap(sql);
|
if (DBHelper.getValueInt(mapW, "issuppressblanklinefordropdown") != 1) {
|
selectStr += "\r\n <option value></option>";
|
}
|
// selectStr += "\r\n<option value=\"\"></option>";
|
for (HashMap<String, String> map : list) {
|
selectStr += "\r\n<option value=\"" + DBHelper.replaceBlank(map.get("intervalue")) + "\" ";
|
selectStr += ">" + map.get("dictvalue") + "</option>";
|
}
|
selectStr += "</select>";
|
// 清除第一个默认值
|
selectStr += getSelectfun(getJspValue(id), id);
|
} else {
|
selectStr += getOptionsSql(mapW);
|
}
|
return selectStr;
|
}
|
|
/**
|
* 46控件颜色下拉 2类型
|
* @param mapW
|
* @return
|
* @throws Exception
|
*/
|
private String getColorOptions(Map<String, Object> mapW) throws Exception {
|
PanelBean panelBean = (PanelBean) mapW.get(PANEL_INFO);
|
String id = panelBean.pHelper.id;
|
String selectStr = "";
|
selectStr = "<select class=\"" + getControls(mapW) + "\" onchange=\"getColors46('" + id + "');\" onfocus=\"" + panelBean.sqlContype + "\" " + panelBean.onClickStr + " onkeydown=\"keyDown('" + id
|
+ "',event);key_Delete_Selete(event,'" + id + "');\" ";
|
selectStr += getChange(panelBean);
|
selectStr += getReadOnly(mapW);// 后加
|
selectStr += " onblur=\"" + panelBean.clickStr + "\" name=\"" + id + "\" size=\"1\" id=\"" + id + "\">";
|
String sql = "select HexColor as intervalue from t9685 where formid=120201 order by DocItem asc";//"select * from _sysdict where dictid = " + DBHelper.getValueInt(mapW, "FT");
|
List<HashMap<String, String>> list = null;
|
list = sqlDBHelperIfc.getHashMap(sql);
|
selectStr += "\r\n<option value=\"\" style=\"background-color:white;color:white\"></option>";
|
for (HashMap<String, String> map : list) {
|
if(StringUtils.isBlank(DBHelper.replaceBlank(map.get("intervalue")))){
|
continue;
|
}
|
selectStr += "\r\n<option value=\"" + DBHelper.replaceBlank(map.get("intervalue")) + "\" ";
|
selectStr += " style=\"background-color:" + DBHelper.replaceBlank(map.get("intervalue")) + "\"></option>";
|
}
|
selectStr += "</select>";
|
// 清除第一个默认值
|
selectStr += getSelectfun(getJspValue(id), id);
|
return selectStr;
|
}
|
|
private String getJspValue(String id) {
|
return "<%=DBHelper.getValue(docMap,\"" + id + "\",mapAll)%>";
|
}
|
|
/**
|
* 3类型控件调用
|
* @param map
|
* @throws Exception
|
*/
|
private void isTreeMus(Map<String, Object> map) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
switch (DBHelper.getValueInt(map, "FTFormType")) {
|
case 302:
|
panelBean.treeMus = true;
|
break;
|
default:
|
panelBean.treeMus = false;
|
break;
|
}
|
}
|
|
/**
|
* 3类型控件。弹出选择框
|
*
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getShowFrom(Map<String, Object> map, boolean shuai) throws Exception {
|
String s_ = "";
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String maxl=panelBean.maxl;
|
s_ += getReadOnly(map); // 是否只读
|
String getdiv = "";
|
String isControl42Css="";//是否也是42控件查询功能需要的样式
|
if (!DBHelper.getValue(map, "SuggestFileds").equals("")) {// 42类型控件js
|
int rod = (int) (Math.random() * 100 + 1);// 生成100之内的随机数
|
String divId="T_"+DBHelper.getValue(map, "ft")+"_"+rod+"div";
|
String tableId="T_"+DBHelper.getValue(map, "ft")+"_"+rod+"CDiv";
|
panelBean.pHelper.div42="<div id=\""+divId+"\" style=\"z-index:9999;display:none;position:absolute;height:auto;max-height:320px;overflow:auto;\">" +
|
"<table id=\""+tableId+"\" lay-filter=\""+tableId+"\" " +
|
getSuggestFilds(DBHelper.getValue(map, "ft"),DBHelper.getValue(map, "SuggestFileds"),DBHelper.getValueInt(map, "ftformtype"))+">" +
|
"</table></div>\t\n";
|
//添加data-xxx属性 xin 2021-3-17 15:54:36
|
getdiv="data-index=\"@index@\" data-rod=\""+rod+"\" data-relation=\""+DBHelper.getValue(map, "RelationField")+"\" data-sugges=\""+DBHelper.getValue(map, "SuggestFileds")+"\"";
|
isControl42Css="isControl42";//赋固定值样式
|
} else {// 3类型控件
|
String getAll = panelBean.getBackStr + ((panelBean.keyBack) ? "keyDown('" + id + "',event);" : "");
|
String getAllChan = panelBean.getBackStr + ((panelBean.toKeBack) ? "keyDown('123',event);" : "");// --getBackStr
|
// +
|
// 不需要触发这个事件
|
// 2015-3-12
|
// 10:07:37
|
String getChan = ((panelBean.toKeBack) ? "keyDown('123',event);" : "");
|
s_ += " onPropertyChange=\"upSub('" + id + "',@index@);" + getChan + panelBean.dyfieldStr + "\" "; // 值发生改变处理
|
s_ += " onchange=\"getBackElse=true;" + getAllChan + "upSub('" + id + "',@index@);\"";
|
s_ += " onkeydown=\"" + getAll + "delemptyrefdata(document.getElementById('" + id + "'),@index@);\" "; // 键盘按下处理
|
}
|
String str = "<input id=\"" + id + "Tree\" value=\""
|
+ ((DBHelper.getValueInt(map, "ReadOnly") == 1) ? "0" : "1") + "\" type=\"hidden\" />";
|
|
int flag=-1;
|
boolean bol=false;
|
//是否有会计科目设置 xin 2020-11-6 10:44:28
|
if(!Objects.equals("", DBHelper.getValue(map, "glcodefield")) &&
|
(id.toLowerCase().matches("cv\\d{1}") || id.toLowerCase().matches("cv\\d{1}name"))) {
|
try {
|
Pattern p = Pattern.compile("[^0-9]");
|
Matcher m = p.matcher(id);
|
flag = Integer.parseInt(m.replaceAll("").trim());
|
bol=true;
|
} catch (Exception e) {
|
flag = -1;
|
}
|
}
|
if (DBHelper.getValueInt(map, "HeightNum") > 1) {
|
str += "<textarea class=\""+isControl42Css+" Three_show " + getControls(map) + "\" id=\"" + id + "\" "
|
+ (getdiv.equals("") ? maxl : "") + (bol?" data-flcode=\""+DBHelper.getValue(map, "glcodefield")+"\" data-flag="+flag+" ":" ")
|
+ "name=\"" + id + "\" " + s_ + " "+getdiv+">" + getJspValue(id)
|
+ "</textarea>";
|
} else {
|
str += "<input autocomplete=\"off\" class=\""+isControl42Css+" Three_show " + getControls(map) + "\" id=\"" + id + "\" "
|
+ (getdiv.equals("") ? maxl : "") + (bol?" data-flcode=\""+DBHelper.getValue(map, "glcodefield")+"\" data-flag="+flag+" ":" ")
|
+ "name=\"" + id + "\" size=\"15\" " + s_ + " "+getdiv+" value=\""
|
+ getJspValue(id) + "\" />";
|
}
|
String style="";
|
if(!DBHelper.getValue(map, "tabs38").equals("null")){
|
//margin-left:"+((256*DBHelper.getValueInt(map, "LengthNum"))-12-8-116-16)+"px;
|
style="position:absolute;z-index:1;margin-top:2px;";
|
}else {
|
int i=(DBHelper.getValueInt(map, "Hidelabel")==1?0:116);
|
style="display:block;margin-left:"+(256*DBHelper.getValueInt(map, "LengthNum")-22-i)+"px;position:absolute;margin-top: -"+((DBHelper.getValueInt(map, "HeightNum")*29.2)-2-5.2)+"px;";
|
}
|
str += "<span class=\"AllShowType\" style=\""+style+"border:0px solid #000000;\">"//position: absolute; 加上的话在2 3窗体显示会出现问题
|
+ "<img src=\"/images/ppp.gif\" id=\"" + id + "_click\" style=\"cursor: pointer;margin-left:-16px;\" onclick=\""
|
+ (panelBean.treeMus ? "musChoies=true;" : "") + "windowOpen('" + id + "','@index@','"
|
+ DBHelper.getValueInt(map, "onlyOne") + "');" + (panelBean.treeMus ? "musChoies=false;" : "") + "\"/></span>";
|
return str;
|
}
|
|
/**
|
* 5类型控。日期选择
|
*
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getDate(Map<String, Object> map, boolean shuai) throws Exception {
|
String str = "";
|
String dateForm = "";
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
if (shuai) {
|
str = "从<input id=\"begindayDate\" value=\"1\" type=\"hidden\" /><INPUT name=\"beginday\" style=\"height:24px;\" id=\"beginday\" onclick=\"showDate('beginday',true,'');"
|
+ panelBean.clickStr + "\" value=\"\" autocomplete=\"off\" class=\"Wdate\" realValue My97Mark=\"true\">"
|
+ " 到 <input id=\"enddayDate\" value=\"1\" type=\"hidden\" /><INPUT name=\"endday\" autocomplete=\"off\" style=\"height:24px;\" id=\"endday\" onclick=\"showDate('endday',true,'');"
|
+ panelBean.clickStr + "\" value=\"\" class=\"Wdate\" realValue>";
|
} else {
|
if (!DBHelper.getValue(map, "Displayformat").equals("")) {
|
dateForm = "showDate('" + id + "',true,'" + DBHelper.getValue(map, "Displayformat") + "')";
|
} else {
|
dateForm = "showDate('" + id + "',true,'')";
|
}
|
str = "<input id=\"" + id + "Date\" value=\"" + ((DBHelper.getValueInt(map, "ReadOnly") == 1) ? "0" : "1")
|
+ "\" type=\"hidden\" /><input id=\"" + id + "\" name=\"" + id
|
+ "\" type=\"text\" autocomplete=\"off\" class=\"Wdate "+getControls(map)+"\" onclick=\"" + dateForm + "\" ";// onfocus= controlsc1 controlsr1
|
str += " value=\"" + getJspValue(id) + "\" ";
|
str = getAll(map, str, shuai);
|
str += " />";
|
}
|
return str;
|
}
|
|
/**
|
* 6类型控件。复选框(check控件:单选项,只能选择1个打√)
|
*
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getCheckBox(Map<String, Object> map, boolean shuai) throws Exception {
|
String str = "";
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String checkId = id + "CheckBox";
|
String css="";
|
// if(panelBean.control38height>DBHelper.getValueInt(map, "RowNo")){
|
// css="z_indexTabs";
|
// }else{
|
// panelBean.control38height=0;
|
// }
|
str = "<input id=\"" + checkId + "\" name=\"" + checkId
|
+ "\" type=\"checkbox\" class=\"controls6 "+css+"\" <%=DBHelper.getValue(docMap,\"" + id
|
+ "\",mapAll).equals(\"1\")?\"checked\":\"\"%> ";
|
str = getAll(map, str, shuai);
|
str += " onClick=\"document.getElementById('" + id + "').value=document.getElementById('" + checkId
|
+ "').checked ? '1' : '0' ;" + panelBean.clickStr + "\" />" + "<input type=\"hidden\" id='" + id + "' name=\""
|
+ id + "\" value=\"" + getJspValue(id) + "\" onPropertyChange=\"cheeckValueChan('" + id + "')\">";
|
return str;
|
}
|
|
|
/**
|
* 7类型控件。弹出式文本编辑框
|
* @param map
|
* @param shuai
|
* @param listmax
|
* @return
|
* @throws Exception
|
*/
|
private String getShowText(Map<String, Object> map, boolean shuai, Map<String, Integer> listmax) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String str = "<input id=\"" + id + "Text\" value=\"1\" type=\"hidden\" /><textarea class=\""+getControls(map)+"\" id=\"" + id + "\" name=\""
|
+ id + "\" " + panelBean.maxl + " rows=\"" + DBHelper.getValueInt(map, "HeightNum") + "\" ";
|
str = getAll(map, str, shuai);
|
str += " ><%=DBHelper.replaceBlankOnWeb(DBHelper.getValue(docMap,\"" + id
|
+ "\",mapAll))%></textarea><img onClick=\"show('" + id + "'," + listmax.get(id)
|
+ ");\" style=\"position:absolute;margin-left:-19px;margin-top:1px;height:" + (panelBean.pHelper.rowHei-4)
|
+ "px;width:18px;cursor:hand;\" src=\"/images/dian.jpg\">";
|
return str;
|
}
|
|
/**
|
* 19、9类型上传附件按钮
|
* @param map
|
* @return
|
*/
|
public String createFileUPload (Map<String, Object> map) {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
int ReadOnly=DBHelper.getValueInt(map, "ReadOnly");//只读设置 xin 2021-3-3 10:39:28
|
String upload="\n <div class=\"form-group "+getControls(map)+"\" id=\"uploadDiv_"+id+"\" style=\""+(ReadOnly==1?"background: #CCC;":"")+"\">\n"
|
+ "<input id=\""+id+"_up\" type=\"file\" "+(ReadOnly==1?"disabled = \"disabled\"":"")+" class=\"file\" multiple data-preview-file-type=\"any\" data-overwrite-initial=\"false\" data-min-file-count=\"1\"> \n" //multiple 控制上传时可以点击多附件同时上传
|
+ "<input id=\""+id+"\" name=\""+id+"\" value=\"<%=DBHelper.getValue(docMap,\""+id+"\")%>\" type=\"hidden\" /> \n"
|
+ "</div>\n";
|
upload+="<script>"//<%=DBHelper.getValueInt(docMap,\"rowid\")%>
|
+"\n onfileiput('"+panelBean.pHelper.formIdPan+"','"+id+"','"+DBHelper.getValueInt(map, "ControlType")+"','<%=DBHelper.getValueInt(docMap,\"docstatus\")%>','','<%=session.getAttribute(SessionKey.USERCODE)%>',null,"+DBHelper.getValueInt(map, "maxFileSize")+");//加载附件"
|
+"\n picevent('"+id+"');//事件\r";
|
upload+="\n </script>";
|
// String upload="\n <div class=\"form-group "+getControls(map)+"\" style=\""+(ReadOnly==1?"background:#CCC;":"")+"\">" +
|
// "<input id=\""+id+"\" name=\""+id+"\" data-readonly=\""+(ReadOnly==1?"true":"false")+"\" " +
|
// "data-status=\"<%=DBHelper.getValueInt(docMap,\"docstatus\")%>\" " +
|
// "data-size=\""+DBHelper.getValueInt(map, "maxFileSize")+"\" " +
|
// "data-type=\""+DBHelper.getValueInt(map, "ControlType")+"\" " +
|
// "value=\"<%=DBHelper.getValue(docMap,\""+id+"\")%>\" " +
|
// "type=\"hidden\" class=\"isFileInput\"/>";
|
// upload+="<input id=\""+id+"_upload\" "+(ReadOnly==1?"disabled = \"disabled\"":"")+" type=\"file\"/></div>";
|
return upload;
|
}
|
|
/**
|
* 30类型控件。复选框(check控件:多选项,能选择多个打√)
|
* @param map
|
* @return
|
* @throws Exception
|
*/
|
private String getCheckBoxList(Map<String, Object> map) throws Exception {
|
String returnStr = "";
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
if (DBHelper.getValue(map, "SqlScript") == null || DBHelper.getValue(map, "SqlScript").trim().equals("")) {
|
String sql = "select * from _sysdict where dictid = " + DBHelper.getValueInt(map, "FT");
|
returnStr = "<span id=\"" + id + "Span\" name=\"" + id + "Span\" style=\"border:0px solid #a5a6ad; height:26px;\">"
|
+ "<input id=\"" + id + "\" name=\"" + id + "\" value=\"" + getJspValue(id) + "\" type=\"hidden\" "
|
+ "onPropertyChange=\"cheeckSValueChan('" + id + "')\" /><ul class=\"checkcss\">";
|
List<HashMap<String, String>> list = null;
|
list = sqlDBHelperIfc.getHashMap(sql);
|
int i = 0;
|
for (HashMap<String, String> mapR : list) {
|
returnStr += "<li><input type=\"checkbox\" name=\"" + id + "Check\" id=\"" + id
|
+ "_" + i + "\" value=\"" + mapR.get("intervalue") + "\" class=\""+getControls(map)+"\" onclick=\"" + panelBean.clickStr
|
+ "\" style=\"width:20px;height:20px;\"><span class=\"checkcsstxt\">" + mapR.get("dictvalue")
|
+ "</span></li> ";
|
i++;
|
}
|
returnStr += "</ul></span>" + getCheckFun(id);
|
} else {
|
returnStr += "<span id=\"" + id + "Span\" name=\"" + id + "Span\" style=\"border:0px solid #a5a6ad; height:24px;\">"
|
+ "<input id=\"" + id + "\" name=\"" + id + "\" value=\"" + getJspValue(id) + "\" type=\"hidden\" "
|
+ "onPropertyChange=\"cheeckSValueChan('" + id + "')\" /><ul class=\"checkcss\"><% outStr=\"\";";
|
returnStr += "\r\ntry{\r\n int i_sql_checks=0;";
|
returnStr += "\r\n sql = \""
|
+ DBHelper.replaceBr(panelBean.initialValue.getValLinShi(DBHelper.getValue(map, "SqlScript"), true)) + "\";";
|
returnStr += "\r\n SRS = build.getSqlRowSet(DBHelper.getValRepShi(sql,session,docMap, false));";
|
returnStr += "\r\n while(SRS.next()){ %>";
|
returnStr += "<li><input name=\"" + id + "Check\" type=\"checkbox\" id=\"" + id
|
+ "_<%=i_sql_checks%>\" value=\"<%=SRS.getString(1)%>\" class=\""+getControls(map)+"\" onclick=\"" + panelBean.clickStr
|
+ "\" style=\"width:20px;height:20px;\"><span class=\"checkcsstxt\"><%=SRS.getString(2)%></span></li> ";
|
returnStr += " <%i_sql_checks++;}}finally {}%></ul></span>" + getCheckFun(id);
|
}
|
return returnStr;
|
}
|
|
/**
|
* 31类型控。下拉列表+SQL(select控件+SQL动态列表)
|
*
|
* @param map
|
* @return
|
* @throws Exception
|
*/
|
private String getOptionsSql(Map<String, Object> map) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String getBackStr=panelBean.getBackStr;
|
boolean toKeBack=panelBean.toKeBack;
|
String selectStr = "";
|
String getAll = getBackStr + ((panelBean.keyBack) ? "keyDown('" + id + "',event);" : "");
|
String getAllChan = getBackStr + ((toKeBack) ? "keyDown('123',event);" : "");
|
String getChan = ((toKeBack) ? "keyDown('123',event);" : "");
|
String sql = DBHelper.replaceBr(DBHelper.getValue(map, "SqlScript"));
|
List<String> list = DBHelper.getStrRepInfo(sql+DBHelper.replaceBr(DBHelper.getValue(map, "SqlWhere")), "&");
|
if(list!=null && list.size()>0) {
|
HashSet<String> set = new HashSet<String>(list);
|
for(String key:set) {
|
key=key.toLowerCase();
|
panelBean.selectMap.put(key, id+(panelBean.selectMap.get(key)!=null?";"+panelBean.selectMap.get(key):""));
|
}
|
}
|
if ((DBHelper.getValueInt(map, "FT") < 0 && (DBHelper.getValueInt(map, "ControlType") == 2)
|
|| ("").equals(sql))) {//2类型控件
|
sql = "select intervalue,dictvalue from _sysdict where dictid =" + DBHelper.getValueInt(map, "FT")
|
+ " order by sequence asc";
|
}
|
selectStr += "\r\n<%try{";
|
selectStr += "\r\n sql = \"" + sql + "\";";
|
String sqlWhere=DBHelper.replaceBr(DBHelper.getValue(map, "SqlWhere"));
|
if(StringUtils.isNotBlank(sqlWhere)){
|
boolean b = false;//默认组装进行
|
b = (DBHelper.getValueInt(map, "ReadOnly") == 1 ? true : b);//只读状态不需要组装
|
sqlWhere = b ? null : "\""+sqlWhere+"\"";//只读情况不传sqlWhere值 xin 2023-3-15 14:35:18
|
selectStr += "\r\n if(\"\".equals(DBHelper.getValue(docMap,\"docstatus\")) && request.getAttribute(\"docStatue\") != null){";
|
selectStr += "\r\n docMap.put(\"docstatus\",request.getAttribute(\"docStatue\"));//这里是为了在多表情况,子功能没状态值,这里获取主表的状态值";
|
selectStr += "\r\n }";//docStatus=((\"\".equals(docStatus) && request.getAttribute(\"docStatue\") != null)?(String)request.getAttribute(\"docStatue\"):docStatus);";
|
selectStr += "\r\n sql = DBHelper.getSqlWhere(sql," + b + ",DBHelper.getValue(docMap,\""+id+"_expr\")," +
|
"\"" + DBHelper.getValue(map, "editStatus") + "\",DBHelper.getValue(docMap,\"docstatus\")," + sqlWhere + ");";
|
}
|
selectStr += "\r\n SRS = build.getSqlRowSet(DBHelper.getValRepShi(sql,session,docMap, false));";
|
selectStr += "\r\n %>";
|
selectStr += "\r\n <input id=\"" + id + "text\" name=\"" + id + "text\" value=\"" + getJspValue(id)
|
+ "\" type=\"hidden\">\r";
|
//onfocus=\"" + panelBean.clickStr
|
// + "getControlValue('" + id + "'," + DBHelper.getValueInt(map, "ControlType") + ",'" + id + "','"
|
// + DBHelper.getValueInt(map, "FT") + "','@index@');\"
|
selectStr += "<select class=\""+getControls(map)+"\" onchange=\"getSelect31('" + id + "');getBackElse=true;"
|
+ getAllChan + "upSub('" + id + "',@index@);\" "+getReadOnly(map)// 后加
|
+ " onPropertyChange=\"if(panMain[panIndex].no_load_first){upSub('" + id + "',@index@);" + getChan
|
+ "}\" onkeydown=\"" + getAll + "key_Delete_Selete(event,'" + id + "');\" name=\"" + id + "\" size=\"1\" id=\"" + id + "\">";
|
if (DBHelper.getValueInt(map, "issuppressblanklinefordropdown") != 1) {
|
selectStr += "\r\n <option value></option>";
|
}
|
selectStr += "\r <% while(SRS!=null && SRS.next()){%> ";
|
selectStr += "\r\n <option value=\"<%= DBHelper.replaceBlank(SRS.getString(1))%>\"><%=SRS.getObject(2)%></option>";
|
selectStr += "\r\n <% }%>";
|
if (DBHelper.getValueInt(map, "FT") != 0) {
|
selectStr += "\r\n <option value=\"pb_xinzen\"><<新增>></option>";
|
}
|
selectStr += "\r\n </select>";
|
selectStr += "\r\n<%}catch(Exception e){";
|
selectStr += "\r\n throw e;";
|
selectStr += "\r\n}%>\r\n";
|
selectStr += getSelectfun(getJspValue(id), id);
|
// selectStr += "<script>" + panelBean.sqlContype + "</script>\r\n";
|
return selectStr;
|
}
|
|
/**
|
* 32类型控件。单选框(radio控件:多选项值,但只能选择一个)
|
*
|
* @param map
|
* @return
|
* @throws Exception
|
*/
|
private String getRadio(Map<String, Object> map) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String returnStr = "";
|
if (DBHelper.getValue(map, "SqlScript") == null || DBHelper.getValue(map, "SqlScript").trim().equals("")) {
|
String sql = "select * from _sysdict where dictid = " + DBHelper.getValueInt(map, "FT");
|
returnStr = "<span id=\"" + id + "Span\" style=\"border:0px solid #a5a6ad; height:24px;\">";
|
List<HashMap<String, String>> list = null;
|
list = sqlDBHelperIfc.getHashMap(sql);
|
int i = 0;
|
for (HashMap<String, String> mapR : list) {
|
returnStr += "<input name=\"" + id + "Radio\" type=\"radio\" id=\"" + id + "_" + i + "\" value=\""
|
+ mapR.get("intervalue") + "\" onclick=\"getRad('" + id + "')\">" + mapR.get("dictvalue")
|
+ " ";
|
i++;
|
}
|
returnStr += "</span><input id=\"" + id + "\" value=\"" + getJspValue(id)
|
+ "\" type=\"hidden\" onPropertyChange=\"radioValueChan('" + id + "')\">" + getRadiosFun(id);
|
} else {
|
returnStr += "<span id=\"" + id
|
+ "Span\" style=\"border:0px solid #a5a6ad; height:24px;\"><% outStr=\"\";";
|
returnStr += "\r\ntry{\r\n int i_sql_radio=0;";
|
returnStr += "\r\n sql = \""
|
+ DBHelper.replaceBr(panelBean.initialValue.getValLinShi(DBHelper.getValue(map, "SqlScript"), true)) + "\";";
|
returnStr += "\r\n SRS = build.getSqlRowSet(DBHelper.getValRepShi(sql,session,docMap, false));";
|
returnStr += " while(SRS.next()){ ";
|
returnStr += "if((\"" + panelBean.initialValue.getValLinShi(DBHelper.getValue(map, "initValue"), false)
|
+ "\").equals(SRS.getObject(2))||(\""
|
+ panelBean.initialValue.getValLinShi(DBHelper.getValue(map, "initValue"), false)
|
+ "\").equals(SRS.getObject(1))){";
|
returnStr += " outStr += \" checked='checked' \";";
|
returnStr += "}else{outStr += \"\";}%>";
|
returnStr += "<input <%=outStr%> name=\"" + id + "Radio\" type=\"radio\" id=\"" + id
|
+ "_<%=i_sql_radio%>\" value=\"<%=SRS.getString(1)%>\" onclick=\"getRad('" + id
|
+ "')\"><%=SRS.getString(2)%> ";
|
returnStr += " <%i_sql_radio++;}}finally {}%>";
|
returnStr += "</span><input id=\"" + id + "\" value=\"" + getJspValue(id)
|
+ "\" type=\"hidden\" onPropertyChange=\"radioValueChan('" + id + "')\">" + getRadiosFun(id);
|
}
|
return returnStr;
|
}
|
|
/**
|
* 33类型控件。多功能搜索控件(文本框+下拉列表框[多字段列表])
|
* @param map
|
* @return
|
* @throws Exception
|
*/
|
private String getTextAndSelect(Map<String, Object> map) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String selectStr = "";
|
selectStr += "<input type=\"text\" id=\"valueis\" style=\"border: 1px solid #a5a6ad;\" class=\"controlsr1\" /> ";
|
selectStr += "<select onkeydown=\"keyDown('colis',event);colisKey(event);\" " + panelBean.onClickStr + " ";
|
selectStr += " name=\"colis\" size=\"1\" style=\"width:168px;height:25px;\" class=\"controlsr1\" id=\"colis\">";
|
String optionStr = "";
|
String colAll = "";
|
String colAllDataType = "";
|
for (Map<String, Object> sys : panelBean.queryList) {
|
Object obj = getDataTypeIfc.getDataTypeByName(panelBean.pHelper.tableIs, DBHelper.getValue(sys, "FieldID"));
|
colAllDataType += obj.toString() + ";";
|
colAll += DBHelper.getValue(sys, "FieldID") + ";";
|
optionStr += "\r\n<option value=\"" + DBHelper.getValue(sys, "FieldID") + "\" ";
|
optionStr += ">" + DBHelper.getValue(sys, "fieldname") + "</option>";
|
}
|
if (colAll.lastIndexOf(";") != -1) {
|
colAll = colAll.substring(0, colAll.lastIndexOf(";"));
|
}
|
|
if (colAllDataType.lastIndexOf(";") != -1) {
|
colAllDataType = colAllDataType.substring(0, colAllDataType.lastIndexOf(";"));
|
}
|
colAll = colAll + "|" + colAllDataType;
|
|
selectStr += "\r\n<option value=\"" + colAll + "\" selected=\"selected\">查询所有字段</option>";
|
selectStr += optionStr;
|
selectStr += "</select> ";
|
selectStr += "<input id=\"dataType\" type=\"hidden\" value=" + colAll + "/>";
|
selectStr += "\r\n<span class=\"preciseQuery\">精确查询" + getCheck("jqcz",panelBean)
|
+ "</span> <a href=\"javascript:getOder();\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-search'\" style=\"width:80px\">查询</a>";
|
//+ "<a href=\"\" class=\"easyui-linkbutton\" onclick=\"getOder();\" value=\"查找\"/>";
|
// 清除第一个默认值
|
String showValue = panelBean.initialValue.getInv(map);
|
if (!showValue.trim().equals("")) {
|
selectStr += getSelectfun(showValue, "colis");
|
}
|
return selectStr;
|
}
|
|
/**
|
* 35类型控件。录入+下拉组合框
|
* @param mapW
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getOptionEdit(Map<String, Object> mapW, boolean shuai) throws Exception {
|
String selectStr = "";
|
PanelBean panelBean= (PanelBean) mapW.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
int len = DBHelper.getValueInt(mapW, "tdLen") - 28;
|
// 暂时用,没设置tdLen
|
if (shuai) {
|
len = 100;
|
}
|
if (DBHelper.getValue(mapW, "SqlScript") == null || DBHelper.getValue(mapW, "SqlScript").trim().equals("")) {
|
selectStr = "<div style=\"position:relative;\"><span style=\"width:" + (len + 23)
|
+ "px;overflow:hidden;\"><select onmouseover=\"" + panelBean.sqlContype + "\" onkeydown=\"keyDown('" + id
|
+ "',event);\" style=\"\" onPropertyChange=\"set35('" + id //width:" + (len + 18) + "px;height:20px;
|
+ "');upSub('" + id + "',@index@)\" onchange=\"set35('" + id + "');upSub('" + id + "',@index@)\" onclick=\"set35('"
|
+ id + "');\" id=\"" + id + "_35\" class=\"" + getControls(mapW) + "\">";
|
String sql = "select * from _sysdict where dictid = " + DBHelper.getValueInt(mapW, "FT");
|
List<HashMap<String, String>> list = null;
|
list = sqlDBHelperIfc.getHashMap(sql);
|
for (HashMap<String, String> map : list) {
|
selectStr += "\r\n<option value=\"" + DBHelper.replaceBr(map.get("intervalue")) + "\" ";
|
selectStr += ">" + map.get("dictvalue") + "</option>";
|
}
|
selectStr += "</select></span>";
|
selectStr += "<input type = \"text\" name=\"" + id + "\" id=\"" + id + "\" " + panelBean.maxl + " style=\"position:absolute;left:0px;border-radius: 5px 0px 0px 5px;\" "
|
+ "class=\"controlszh"+DBHelper.getValueInt(mapW, "LengthNum")+" controlsr" + DBHelper.getValueInt(mapW, "HeightNum") + "\" value=\"" + getJspValue(id)//input35
|
+ "\">" + getSelectfun(getJspValue(id), id + "_35");
|
selectStr += "</div>";
|
} else {
|
selectStr += "<div style=\"position:relative;\"><span style=\"width:" + (len + 23)
|
+ "px;overflow:hidden;\"><select onmouseover=\"" + panelBean.sqlContype + "\" onkeydown=\"keyDown('" + id
|
+ "',event);\" style=\"\" onPropertyChange=\"set35('" + id//width:" + (len + 18) + "px;height:20px;
|
+ "');upSub('" + id + "',@index@)\" onchange=\"set35('" + id + "');upSub('" + id + "',@index@)\" onclick=\"set35('"
|
+ id + "');\" id=\"" + id + "_35\" class=\"" + getControls(mapW) + "\"><%";
|
selectStr += "\r\n sql = \""
|
+ DBHelper.replaceBr(panelBean.initialValue.getValLinShi(DBHelper.getValue(mapW, "SqlScript"), true)) + "\";";
|
selectStr += "\r\n SRS = build.getSqlRowSet(DBHelper.getValRepShi(sql,session,docMap, false));";
|
selectStr += "\r\n while(SRS.next()){ ";
|
selectStr += "%><option value=\"<%=DBHelper.replaceBr(SRS.getString(1)) %>\" ><%=SRS.getObject(2) %></option>";
|
selectStr += " <%}%>";
|
selectStr += "</select></span><input type = \"text\" name=\"" + id + "\" id=\"" + id + "\" " + panelBean.maxl
|
+ " style=\"position:absolute;left:0px;border-radius: 5px 0px 0px 5px;\" class=\"controlszh"+DBHelper.getValueInt(mapW, "LengthNum")+" controlsr" + DBHelper.getValueInt(mapW, "HeightNum") + "\" value=\"" + getJspValue(id)//input35
|
+ "\"></div>" + getSelectfun(getJspValue(id), id + "_35");
|
}
|
return selectStr;
|
}
|
|
/**
|
* 42类型控件。文本框+录入时动态下拉提示选择框
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getShowFrom42(Map<String, Object> map, boolean shuai) throws Exception {
|
int rod = (int) (Math.random() * 1000 + 1);// 生成1000之内的随机数
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String divId="T_"+DBHelper.getValue(map, "ft")+"_"+rod+"div";
|
String tableId="T_"+DBHelper.getValue(map, "ft")+"_"+rod+"CDiv";
|
panelBean.pHelper.div42="<div id=\""+divId+"\" style=\"z-index:9999;display:none;position:absolute;height:auto;max-height:320px;overflow:auto;\">" +
|
"<table id=\""+tableId+"\" lay-filter=\""+tableId+"\" " +
|
getSuggestFilds(DBHelper.getValue(map, "ft"),DBHelper.getValue(map, "SuggestFileds"),DBHelper.getValueInt(map, "ftformtype"))+">" +
|
"</table></div>\t\n";
|
String s_ = "";
|
s_ += getReadOnly(map); // 是否只读
|
//添加data-xxx属性 xin 2021-3-17 15:54:36
|
String data="data-index=\"@index@\" data-rod=\""+rod+"\" data-relation=\""+DBHelper.getValue(map, "RelationField")+"\" data-sugges=\""+DBHelper.getValue(map, "SuggestFileds")+"\"";
|
String str = "<input id=\"" + id + "Tree\" value=\""
|
+ ((DBHelper.getValueInt(map, "ReadOnly") == 1) ? "0" : "1") + "\" type=\"hidden\" />";
|
if (DBHelper.getValueInt(map, "HeightNum") > 1) {
|
str += "<textarea autocomplete=\"off\" class=\"isControl42 Three_show " + getControls(map) + "\" id=\"" + id + "\" name=\"" + id + "\" "
|
+ s_ + ">" + getJspValue(id) + "</textarea>";
|
} else {
|
str += "<input autocomplete=\"off\" class=\"isControl42 Three_show " + getControls(map) + "\" id=\"" + id + "\" name=\"" + id
|
+ "\" size=\"15\" " + s_ + " value=\"" + getJspValue(id) + "\" "+data+" />";
|
}
|
return str;
|
}
|
|
/**
|
* 43类型控件。下拉列表复选框
|
*
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getSelect43(Map<String, Object> map, boolean shuai) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
List<String> list = DBHelper.getStrRepInfo(DBHelper.replaceBr(DBHelper.getValue(map, "SqlScript"))+DBHelper.replaceBr(DBHelper.getValue(map, "SqlWhere")), "&");
|
if(list!=null && list.size()>0) {
|
HashSet<String> set = new HashSet<String>(list);
|
for(String key:set) {
|
key=key.toLowerCase();
|
panelBean.selectMap.put(key, id+(panelBean.selectMap.get(key)!=null?";"+panelBean.selectMap.get(key):""));
|
}
|
}
|
String select = "<input id=\"" + id + "text\" name=\"" + id + "text\" value=\"" + getJspValue(id)
|
+ "\" type=\"hidden\">\r";
|
select += " <select id=\"" + id + "\" class=\"js-" + id + " " + getControls(map) + "\" multiple=\"multiple\" ";
|
select += getReadOnly(map);// style样式 1
|
select += " ></select>\r";
|
select += " <script>" + panelBean.sqlContype + "</script>";
|
if (shuai) {
|
select = getAll(map, select, shuai);// 权限控制
|
}
|
return select;
|
}
|
|
/**
|
* 静态图标控件
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getBigIcon44(Map<String, Object> map, boolean shuai) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
String maxl=panelBean.maxl;
|
map.put("readonly",1);//只读
|
String icon = "<input type=\"" + ((DBHelper.getValueInt(map, "passwordchar") == 1) ? "password" : "text")
|
+ "\" ";
|
icon += icon + " id=\"" + id + "\" name=\"" + id + "\" " + maxl + " class=\"text isBigIcon " + getControls(map)
|
+ "\" value=\"" + getJspValue(id) + "\" ";
|
icon = getAll(map, icon, true);// 这里可以提出来,还是提出来
|
icon += getChange(panelBean); // 值发生改变处理
|
icon += " />";
|
icon +="<span class=\"bigIconImg44\" onclick=\"openIcon('"+id+"')\" title=\"点击浏览\">" +
|
"<img id=\""+id+"-img44\" src=\"" + getJspValue(id) + "\"></span>";
|
return icon;
|
}
|
|
/**
|
* 获取取色器
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getColorFinder(Map<String, Object> map, boolean shuai) throws Exception {
|
PanelBean panelBean = (PanelBean) map.get(PANEL_INFO);
|
String id = panelBean.pHelper.id;
|
//设置有sql条件(31控件类型)
|
if(StringUtils.isNotBlank(DBHelper.getValue(map,"SqlWhere"))){
|
String sql=DBHelper.getValue(map,"SqlWhere");
|
String getBackStr=panelBean.getBackStr;
|
boolean toKeBack=panelBean.toKeBack;
|
String getAll = getBackStr + ((panelBean.keyBack) ? "keyDown('" + id + "',event);" : "");
|
String getAllChan = getBackStr + ((toKeBack) ? "keyDown('123',event);" : "");
|
String getChan = ((toKeBack) ? "keyDown('123',event);" : "");
|
//判断是否只读
|
boolean b=false;//默认组装进行
|
b=(DBHelper.getValueInt(map, "ReadOnly") == 1?true:b);//只读状态不需要组装
|
String selectStr="";
|
selectStr += "\r\n<%try{";
|
selectStr += "\r\n sql = \"" + sql + "\";";
|
selectStr += "\r\n sql = DBHelper.getSqlWhere(sql,"+b+",\""+DBHelper.getValue(map, "editStatus")+"\",DBHelper.getValue(docMap,\"docstatus\"),\""+DBHelper.replaceBr(DBHelper.getValue(map, "SqlWhere"))+"\");";
|
selectStr += "\r\n SRS = build.getSqlRowSet(DBHelper.getValRepShi(sql,session,docMap, false));";
|
selectStr += "\r\n %>";
|
selectStr += "\r\n <input id=\"" + id + "text\" name=\"" + id + "text\" value=\"" + getJspValue(id)
|
+ "\" type=\"hidden\">\r";
|
selectStr += "<select class=\""+getControls(map)+"\" onchange=\"getColors46('" + id + "');getBackElse=true;"
|
+ getAllChan + "upSub('" + id + "',@index@);\" "+getReadOnly(map)// 后加
|
+ " onPropertyChange=\"if(panMain[panIndex].no_load_first){upSub('" + id + "',@index@);" + getChan
|
+ "}\" onkeydown=\"" + getAll + "key_Delete_Selete(event,'" + id + "');\" name=\"" + id + "\" size=\"1\" id=\"" + id + "\">";
|
if (DBHelper.getValueInt(map, "issuppressblanklinefordropdown") != 1) {
|
selectStr += "\r\n <option value style=\"background-color:white;color:white\"></option>";
|
}
|
selectStr += "\r <% while(SRS!=null && SRS.next()){%> ";
|
selectStr += "\r\n <option value=\"<%= DBHelper.replaceBlank(SRS.getString(1))%>\" " +
|
" style=\"background-color:<%= DBHelper.replaceBlank(SRS.getString(1))%>\"></option>";//<%=SRS.getObject(2)%>
|
selectStr += "\r\n <% }%>";
|
selectStr += "\r\n </select>";
|
selectStr += "\r\n<%}catch(Exception e){";
|
selectStr += "\r\n throw e;";
|
selectStr += "\r\n}%>\r\n";
|
selectStr += getSelectfun(getJspValue(id), id);
|
return selectStr;
|
}
|
//设置有外表单号(2控件类型)
|
if(StringUtils.isNotBlank(DBHelper.getValue(map,"FT"))){
|
return getColorOptions(map);
|
}
|
String color = "<input type=\"color\" id=\""+id+"\" class=\""+getControls(map)+"\" value=\""+getJspValue(id)+"\"";
|
color += getReadOnly(map);// 这里可以提出来,还是提出来
|
color += "/>";
|
return color;
|
}
|
|
/**
|
* 进度条
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getProgressBar(Map<String, Object> map, boolean shuai) throws Exception {
|
PanelBean panelBean = (PanelBean) map.get(PANEL_INFO);
|
String id = panelBean.pHelper.id;
|
String data="data-id=\""+id+"\"";
|
String bar = "<div "+data+" class=\"progressBar47 " + getControls(map) + "\"></div>";
|
bar += "<input type=\"hidden\" id=\"" + id + "\" value=\"" + getJspValue(id) + "\">";
|
return bar;
|
}
|
|
/**
|
* css样式控件生成
|
* @param map
|
* @param shuai
|
* @return
|
* @throws Exception
|
*/
|
private String getTextCssEdit(Map<String, Object> map, boolean bol)throws Exception{
|
PanelBean panelBean = (PanelBean) map.get(PANEL_INFO);
|
String id = panelBean.pHelper.id;
|
String str = "";
|
String s_ = getReadOnly(map); // 是否只读
|
if (DBHelper.getValueInt(map, "HeightNum") > 1) {
|
str += "<textarea class=\" Three_show " + getControls(map) + "\" id=\"" + id + "\" "
|
+ "name=\"" + id + "\" " + s_ + " >" + getJspValue(id)
|
+ "</textarea>";
|
} else {
|
str += "<input autocomplete=\"off\" class=\" Three_show " + getControls(map) + "\" id=\"" + id + "\" "
|
+ "name=\"" + id + "\" size=\"15\" " + s_ + " value=\""
|
+ getJspValue(id) + "\" />";
|
}
|
String style = "";
|
if (!DBHelper.getValue(map, "tabs38").equals("null")) {
|
style = "position:absolute;z-index:1;margin-top:2px;";
|
} else {
|
int i = (DBHelper.getValueInt(map, "Hidelabel") == 1 ? 0 : 116);
|
style = "display:block;margin-left:" + (256 * DBHelper.getValueInt(map, "LengthNum") - 22 - i) + "px;position:absolute;margin-top: -" + ((DBHelper.getValueInt(map, "HeightNum") * 29.2) - 2 - 5.2) + "px;";
|
}
|
str += "<span class=\"AllShowType\" style=\"" + style + "border:0px solid #000000;\">"
|
+ "<img src=\"/images/ppp.gif\" id=\"" + id + "_click\" style=\"cursor: pointer;margin-left:-16px;\" onclick=\""
|
+ (panelBean.treeMus ? "musChoies=true;" : "") + "getTextCssEdit({'id':'" + id + "','index':'@index@','onlyOne':'"
|
+ DBHelper.getValueInt(map, "onlyOne") + "'});" + (panelBean.treeMus ? "musChoies=false;" : "") + "\"/></span>";
|
return str;
|
}
|
|
/**
|
* 获得权限控制
|
* @param sys
|
* @throws Exception
|
*/
|
private void getPermission(Map<String, Object> sys) throws Exception {
|
PanelBean panelBean= (PanelBean) sys.get(PANEL_INFO);
|
if (";34;".indexOf(";" + DBHelper.getValue(sys, "ControlType") + ";") == -1) {
|
if (!DBHelper.getValue(sys, "EditStatus").trim().equals("")) {// 再加上判断状态,看看是否可以编辑,则此控件基本就可以了
|
JsonArray read=new JsonArray();
|
// fun = "0;pb#" + DBHelper.getValue(sys, "EditStatus") + ";pb#" + id + ";pb#"
|
// + ((hasButton) ? "true" : "false") + ";pb#" + DBHelper.getValue(sys, "ControlType");
|
read.add(0);
|
read.add(DBHelper.getValue(sys, "EditStatus"));
|
read.add(panelBean.pHelper.id);
|
read.add(((panelBean.hasButton) ? "true" : "false"));
|
read.add(DBHelper.getValue(sys, "ControlType"));
|
setFunLoadList(read, false,panelBean);
|
}
|
if (DBHelper.getValueInt(sys, "ReadOnly") == 1) {// 只读,js处理,避免一些未能考虑到,可以在js中逐步实现,不必要来更改类
|
JsonArray read=new JsonArray();
|
// fun = "1;pb#" + id + ";pb#" + DBHelper.getValue(sys, "ControlType");
|
read.add(1);
|
read.add(panelBean.pHelper.id);
|
read.add(DBHelper.getValue(sys, "ControlType"));
|
setFunLoadList(read, false,panelBean);
|
}
|
}
|
}
|
|
/**
|
* f 通过,驳回,下一步 等等的审核
|
*
|
* @param map
|
* @return
|
* @throws Exception
|
*/
|
private String getButtonNext(Map<String, Object> map) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
panelBean.hasButton = false;
|
String buttonStr = "<span id=\"" + id + "ButtonS\" style=\"position: absolute; margin-top: -15;\">"
|
+ "<%if(bdMap.size()>0){%><table width=\"@butwidth@\"> <tr>";// <%if(atMap.size()>0&&nb){%>
|
String addtd = "<td align=\"right\">";
|
String onclickStr = "";
|
String butwidht = "145";
|
int cont = 0;
|
if (panelBean.buttonList != null && panelBean.buttonList.size() > 0) {
|
for (Map<String, Object> buttonMap : panelBean.buttonList) {// 查询按钮集合中是否有当前字段,有则在此上加按钮
|
if (DBHelper.getValue(buttonMap, "fieldid").toLowerCase().equals(id)) {
|
String pawString = (DBHelper.getValueInt(buttonMap, "isShowPwdEdit") == 1) ? "true" : "false";// 弹出密码框
|
String ReturnCurChecker = DBHelper.getValue(buttonMap, "ReturnCurChecker");
|
String ReturnCurCheckerName = DBHelper.getValue(buttonMap, "ReturnCurCheckerName");
|
boolean isInspection = (DBHelper.getValueInt(buttonMap, "isInspection") == 1 ? true : false);// 是否禁止必录检查
|
String getBtnStr = pawString + ",'" + DBHelper.getValueInt(buttonMap, "formid") + "',"
|
+ "'<%=URL%>/',this," + isInspection + ",'" + DBHelper.getValue(buttonMap, "ExternalURL")
|
+ "'," + DBHelper.getValueInt(buttonMap, "UrlShowLocation") + ","
|
+ DBHelper.getValue(buttonMap, "buttonID");
|
String url1 = DBHelper.getValueInt(buttonMap, "FT") + "/"
|
+ DBHelper.getValueInt(buttonMap, "FTFormType") + "/index.jsp";
|
switch (DBHelper.getValueInt(buttonMap, "SelectChecker")) {
|
case 0:
|
onclickStr = "getBtn(" + getBtnStr + ");";
|
break;
|
case 1:
|
onclickStr = "createPopSelect('" + ReturnCurChecker + "','" + ReturnCurCheckerName + "',"
|
+ getBtnStr + ");";
|
break;
|
case 2:
|
onclickStr = "mulChoice2('" + DBHelper.getValue(buttonMap, "FK") + "','"
|
+ DBHelper.getValue(buttonMap, "SeekGroupID") + "','"
|
+ DBHelper.getValue(buttonMap, "sPremissField") + "','"
|
+ DBHelper.getValue(buttonMap, "dPremissField") + "','"
|
+ DBHelper.getValue(buttonMap, "FKeFilter") + "','<%=URL%>/app'+spellPath+'" + url1
|
+ "'," + getBtnStr + ");";
|
break;
|
default:
|
break;
|
}
|
if (cont > 1) {
|
butwidht = "175";
|
}
|
cont++;
|
String parString = id + ";" + DBHelper.getValue(buttonMap, "docitem");
|
String bds = "<%if(DBHelper.getValue(bdMap,\"" + DBHelper.getValue(buttonMap, "buttonID")
|
+ "\").equals(\"1\")){%>";
|
buttonStr += addtd + bds + "<input id=\"" + DBHelper.getValue(buttonMap, "buttonID")
|
+ "\" type=\"button\" class=\"easyui-linkbutton l-btn-text\" style=\"width:"+(DBHelper.getValue(buttonMap, "ButtonName").length())*20+"px;\" "
|
+ "value=\"" + DBHelper.getValue(buttonMap, "ButtonName")
|
+ "\" onClick=\"setOa('" + parString + "');" + onclickStr + "\" /><%}%></td>";// +"<%}%>";//<%if(docstatePan==DBHelper.getValueInt(atMap,\""+DBHelper.getValue(buttonMap,
|
// "buttonID")+"\")){%>
|
panelBean.hasButton = true;
|
}
|
}
|
}
|
if (panelBean.hasButton) {
|
int tdLen = DBHelper.getValueInt(map, "tdLen") - 120;
|
map.remove("tdLen");
|
map.put("tdLen", tdLen);
|
}
|
buttonStr = buttonStr.replace("@butwidth@", butwidht);
|
buttonStr += "</tr></table><%}%></span>";// <%}%>
|
return panelBean.hasButton ? buttonStr : "";
|
}
|
|
private String getMassterCodeKeyDown(Map<String, Object> map, boolean shuai) throws Exception {// 这有一定用,很多没有设置信息却又带回了值,依照这个解决
|
String iniv = DBHelper.getValue(map, "InitValue");
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String reString = "";
|
String upinv = null;
|
if (DBHelper.getValueInt(map, "FT") != 0) {
|
reString = "(event,'" + panelBean.pHelper.id + "','@index@');";
|
if (iniv != null) {
|
upinv = iniv.toUpperCase().trim();
|
reString = (("MASTERCODE".equals(upinv)) ? "getBackAll" : "getBack") + reString;
|
} else {
|
reString = "getBack" + reString;
|
}
|
}
|
return reString;
|
}
|
|
|
public String getSelectAndCheckBox(String fieldid, String StatisID, String StatisType, String fieldCaption, PanelBean panelBean)
|
throws Exception {
|
panelBean.bian38++;//
|
panelBean.pHelper.id = fieldid.toLowerCase();// "checkId__" + bian38;
|
String checkId2 = panelBean.pHelper.id + "vulue"; // 复选框
|
String str = "<input id=\"" + panelBean.pHelper.id + "\" name=\"checkName\" type=\"checkbox\" onchange='checkChange()' />";
|
str += "<input type=\"hidden\" id='" + checkId2 + "' name=\"" + checkId2 + "\" value=\"" + StatisID + "#P#"
|
+ fieldid + "#P#" + StatisType + "#P#" + fieldCaption + "\">";// 后改
|
// by
|
// danaus
|
// 因为字段名有可能是自定义sql,会存在,号的情况
|
return str;
|
}
|
|
public String getSelectAndCheckBoxs(String s, String StatisID, String fieldid, String FieldAlias, String StatisType,
|
String Sequence, String DisplayWidth, String displayformat, String displayYN, String isFilterZero,
|
String jionFlag, String jionFlagGroup, String conFlag, String modfvalues, String modfvalues2,
|
String FieldCaption,PanelBean panelBean) throws Exception {
|
panelBean. bian38++;//
|
panelBean.pHelper.id = fieldid.toLowerCase();// "checkId__" + bian38;
|
// int a=0;
|
String checkId2 = s; // 复选框
|
// a++;
|
String str = "<input id=\"" + panelBean.pHelper.id + "\" name=\"checkName\" type=\"hidden\" onchange='checkChange()' />";
|
str += "<input type=\"hidden\" id='" + checkId2 + "' name=\"" + checkId2 + "\" value=\"" + StatisID + "#P#"
|
+ fieldid + "#P#" + FieldAlias + "#P#" + StatisType + "#P#" + Sequence + "#P#" + DisplayWidth + "#P#"
|
+ displayformat + "#P#" + displayYN + "#P#" + isFilterZero + "#P#" + jionFlag + "#P#" + jionFlagGroup
|
+ "#P#" + conFlag + "#P#" + modfvalues + "#P#" + modfvalues2 + "#P#" + FieldCaption + "\"></input>";// 后改
|
// by
|
// danaus
|
// 因为字段名有可能是自定义sql,会存在,号的情况
|
|
return str;
|
}
|
|
public String getSelectAndCheckBoxss(String StatisID, String fieldid, String FieldAlias, String StatisType,
|
String Sequence, String DisplayWidth, String displayformat, String displayYN, String isFilterZero,
|
String jionFlag, String jionFlagGroup, String conFlag, String modfvalues, String modfvalues2,
|
String FieldCaption, PanelBean panelBean) throws Exception {
|
panelBean.bian38++;//
|
panelBean.pHelper.id = fieldid.toLowerCase();// "checkId__" + bian38;
|
String str = StatisID + "#P#" + fieldid + "#P#" + FieldAlias + "#P#" + StatisType + "#P#" + Sequence + "#P#"
|
+ DisplayWidth + "#P#" + displayformat + "#P#" + displayYN + "#P#" + isFilterZero + "#P#" + jionFlag
|
+ "#P#" + jionFlagGroup + "#P#" + conFlag + "#P#" + modfvalues + "#P#" + modfvalues2 + "#P#"
|
+ FieldCaption + "'";// 后改 by danaus
|
// 因为字段名有可能是自定义sql,会存在,号的情况
|
|
return str;
|
}
|
|
/**
|
* 给控件设置长高
|
* @param map
|
* @return
|
*/
|
private String getControls(Map<String, Object> map) {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
String controls = (DBHelper.getValueInt(map, "Hidelabel") == 1 ? "controlsm" : "controlsc");
|
controls += DBHelper.getValueInt(map, "LengthNum");
|
controls += " AllControlsWH";
|
if (DBHelper.getValueInt(map, "ControlType") == 38) {
|
controls += " controlsd"+DBHelper.getValueInt(map, "HeightNum");
|
} else {
|
controls += ((DBHelper.getValueInt(map, "ControlType") == 9
|
|| DBHelper.getValueInt(map, "ControlType") == 19 ) ? ""
|
: " controlsr" + DBHelper.getValueInt(map, "HeightNum"));
|
}
|
//在选页卡里面的控件需要添加这个css-xin 2018-11-5 15:20:33
|
if(!DBHelper.getValue(map, "tabs38").equals("null")){
|
int i=DBHelper.getValueInt(panelBean.control38height, DBHelper.getValue(map, "tabsheetname"));
|
if(i>0 && DBHelper.getValueInt(map, "RowNo")<i) {
|
controls+=" z_indexTabs";
|
}else if(i>0 && DBHelper.getValueInt(map, "RowNo")==i) {
|
controls+=" jiaNum";
|
}
|
}
|
return controls;
|
}
|
|
/**
|
* 精准查找
|
* @param ids
|
* @return
|
* @throws Exception
|
*/
|
private String getCheck(String ids,PanelBean panelBean) throws Exception {
|
String str = "";
|
String checkId = ids + "CheckBox";
|
str += "<input id=\"" + checkId + "\" name=\"" + checkId + "\" type=\"checkbox\" ";
|
str += " style=\"width:15px;height:15px;margin-left:5px;\" ";
|
str += getKeyDown(panelBean);
|
str += " onClick=\"document.getElementById('" + ids + "').value=document.getElementById('" + checkId
|
+ "').checked ? '1' : '0' ;\" />" + "<input type=\"hidden\" id='" + ids + "' name=\"" + ids
|
+ "\" value=\"0\" onPropertyChange=\"cheeckValueChan('" + panelBean.pHelper.id + "')\">";
|
return str;
|
}
|
|
/**
|
* 42类型控件调用到
|
* sugg--列表显示的字段 backFilds-取外表字段,以便选择后返回哪些值。 tp ---自表字段,返回给哪些字段
|
* ftformtype的值是关联表号的对应窗体类型
|
*/
|
public String getSuggestFilds(String ft, String sugg,int ftformtype) {// 取得需要的字段名称
|
int flg = 0;
|
if (ftformtype == 20) {//20窗体类型是从表
|
flg = 1;
|
}
|
List<Map<String, Object>> suglit = new ArrayList<>();
|
try {
|
String sql = " select FieldID,fieldname,controltype,displayformat,GridCaption,ShowOnGrid from gfield where formid=? and HeadFlag=? order by statisid asc";
|
List<Map<String, Object>> list = gridService.getSimpleJdbcTemplate().queryForList(sql,
|
new Object[]{ft, flg});
|
String[] tem = sugg.replaceAll(",", ";").split(";");
|
for (String sug : tem) {
|
for (Map<String, Object> map : list) {
|
if (sug.equalsIgnoreCase((String) map.get("FieldID"))) {
|
Map<String, Object> sugMap = new HashMap<>();
|
sugMap.put("field", sug.toLowerCase());
|
sugMap.put("title", map.get("fieldname") == null
|
? (String) map.get("GridCaption") : (String) map.get("fieldname"));
|
sugMap.put("controlType", DBHelper.getValueInt(map,"controltype"));
|
sugMap.put("displayformat", DBHelper.getValue(map,"displayformat"));
|
// sugMap.put("width", 150);
|
sugMap.put("align", "center");
|
if (GridUtils.prossRowSetDataType_Int(map, "ShowOnGrid") <= 0) {
|
sugMap.put("hide", true);//隐藏
|
}
|
suglit.add(sugMap);
|
}
|
}
|
}
|
return "data-title=\"" + GridUtils.toJson(suglit).replaceAll("\"", "'") + "\" ";
|
} catch (Exception e) {
|
return "";
|
}
|
}
|
|
private String getSelectfun(String showValue, String kongId) throws Exception {
|
return getScriptFun("seletMorenOrValue('" + showValue + "','" + kongId + "');");// 转换一个函数,避免与页面逻辑共用一个函数出错
|
}
|
|
private String getCheckFun(String kongId) throws Exception {
|
return getScriptFun("cheeckSValueChan('" + kongId + "');");
|
}
|
|
private String getRadiosFun(String id) throws Exception {
|
return getScriptFun("radioValueChan('" + id + "');");
|
}
|
|
private String getScriptFun(String fun) throws Exception {
|
return "<script type=\"text/javascript\">" + fun + "</script>\r\n";//language=\"javascript\"
|
}
|
|
// ----------------map
|
private String getAll(Map<String, Object> sys, String str, boolean shuai) throws Exception {
|
PanelBean panelBean=(PanelBean)sys.get(PANEL_INFO);
|
if (shuai) {
|
str += getReadOnly(sys); // 是否只读
|
str += getKeyDown(panelBean); // 键盘按下处理
|
} else {
|
str += getReadOnly(sys); // 是否只读
|
str += getChange(panelBean); // 值发生改变处理
|
str += getKeyDown(panelBean); // 键盘按下处理
|
}
|
|
return str;
|
}
|
|
private String getChange(PanelBean panelBean) throws Exception {
|
String yanZheng = "";// 添加验证脚本
|
yanZheng = getVerification(panelBean).trim();
|
String str = " onPropertyChange=\"" + yanZheng + panelBean.dyfieldStr + "upSub('" + panelBean.pHelper.id + "',@index@);\" onChange=\"" + yanZheng
|
+ "upSub('" + panelBean.pHelper.id + "',@index@);\"";
|
return str;
|
}
|
|
private String getVerification(PanelBean panelBean) throws Exception {
|
String yanZheng = "";
|
if (panelBean.pHelper.verificationMap != null && panelBean.pHelper.verificationMap.size() > 0) {
|
if (panelBean.pHelper.verificationMap.get(panelBean.pHelper.id) != null) {
|
switch (Integer.parseInt(panelBean.pHelper.verificationMap.get(panelBean.pHelper.id))) {
|
case 1:// 数字
|
yanZheng = "math(/^[-]?[0-9]*[.]?[0-9]*$/,'" + panelBean.pHelper.id + "','输入必须数字');";
|
break;
|
case 2:// 表示text,ntext,image之类
|
break;
|
case 3:// 字符
|
break;
|
case 4:// 日期
|
break;
|
default:
|
break;
|
}
|
}
|
}
|
return yanZheng;
|
}
|
|
private String getKeyDown(PanelBean panelBean) throws Exception {
|
return (panelBean.keyBack) ? " onkeydown=\"keyDown('" + panelBean.pHelper.id + "',event);\" " : "";
|
}
|
|
/**
|
* 只读
|
* @param map
|
* @return
|
* @throws Exception
|
*/
|
private String getReadOnly(Map<String, Object> map) throws Exception {
|
PanelBean panelBean= (PanelBean) map.get(PANEL_INFO);
|
PanelParmHelper pHelper = panelBean.pHelper;
|
int hei = pHelper.rowHei * DBHelper.getValueInt(map, "HeightNum");
|
hei = ((pHelper.kongHei != pHelper.rowHei && DBHelper.getValueInt(map, "HeightNum") != 1)
|
? 2 * hei - pHelper.rowHei - 6 : hei) - 6;
|
String str = "style=\"";
|
if (DBHelper.getValue(map, "styleCss").indexOf("!") != -1) {
|
} else {
|
String fenh = DBHelper.getValue(map, "styleCss");
|
if (!"".equals(fenh)) {
|
boolean bol = (fenh.substring(fenh.length() - 1, fenh.length()).indexOf(";") != -1);
|
str += DBHelper.getValue(map, "styleCss") + (bol ? "" : ";");
|
} else {
|
str += fenh;
|
}
|
}
|
if (DBHelper.getValueInt(map, "uppercase") == 1) {// 大写形式输入
|
str += " text-transform: uppercase;";
|
}
|
if(DBHelper.getValueInt(map, "ControlType")==31 || DBHelper.getValueInt(map, "ControlType")==2){
|
str += "height:24px;";
|
}
|
if (DBHelper.getValueInt(map, "ReadOnly") == 1) {
|
panelBean.tabindexIs--;// 只读tabindex还原
|
if (DBHelper.getValue(map, "styleCss") == "" || DBHelper.getValue(map, "styleCss") == null) {
|
str += " background:#CCC; border:#999 1px solid; color:#000;\" readonly=\"readonly\" ";//
|
} else {
|
if (DBHelper.getValue(map, "styleCss").indexOf("background") != -1) {
|
} else {
|
str += " background:#CCC; ";
|
}
|
if (DBHelper.getValue(map, "styleCss").indexOf("border") != -1) {
|
} else {
|
str += "border:#999 1px solid; ";
|
}
|
if (DBHelper.getValue(map, "styleCss").indexOf("color") != -1) {
|
} else {
|
str += "color:#000;";
|
}
|
str += " readonly=\"readonly\"";
|
}
|
} else {
|
str += " \" tabindex=\"" + panelBean.tabindexIs + "\"";
|
}
|
return str;
|
}
|
|
/**
|
*
|
*
|
* 38类型面板上增加的下拉编码实现
|
*
|
* @param colId
|
* 列名
|
* @param ft
|
* 设置下拉到外表id
|
* @param invalue
|
* 给定的初始值(默认选择项)
|
* @return 下拉的网页编码
|
*/
|
public String getOptions(String colId, int ft, String invalue) throws Exception {
|
String selectStr = "<select ";
|
selectStr += " name=\"" + colId + "\" size=\"1\" id=\"" + colId + "\">";
|
String sql = "select * from _sysdict where dictid = " + ft;
|
List<HashMap<String, String>> list = null;
|
list = sqlDBHelperIfc.getHashMap(sql);
|
for (HashMap<String, String> map : list) {
|
selectStr += "\r\n<option value=\"" + map.get("intervalue") + "\" ";
|
if (invalue.trim().equals(map.get("dictvalue").trim())) {
|
selectStr += " selected ";
|
}
|
selectStr += ">" + map.get("dictvalue") + "</option>";
|
}
|
selectStr += "</select>";
|
return selectStr;
|
}
|
|
/**
|
* 是否必录
|
* @param map
|
* @return
|
* @throws Exception
|
*/
|
private static String getKeyInput(Map<String, Object> map) throws Exception {
|
String style="";
|
if(!DBHelper.getValue(map, "tabs38").equals("null")){
|
style="style=\"margin-left:"+((256*DBHelper.getValueInt(map, "LengthNum"))-12-8)+"px;position:absolute;\"";
|
}
|
return (DBHelper.getValueInt(map, "KeyInput") == 1?
|
"<div class=\"bilus\" "+style+" title=\"必录\">✲</div>":"<div class=\"bilus\"></div>");
|
}
|
|
// 得到隐藏网页代码
|
public String getHidText(Map<String, Object> sys) throws Exception {
|
PanelBean panelBean= (PanelBean) sys.get(PANEL_INFO);
|
getPermission(sys);
|
if ((DBHelper.getValueInt(sys, "isCustomHTMLComponent") == 1
|
&& DBHelper.getValueInt(sys, "MasterFieldShowLocation") == 0)) {
|
return "";// 因为是36控件字段 ,不输出控件,如果不在第二个面板则输出
|
}
|
return "<input id=\"" + panelBean.pHelper.id + "\" value=\"" + getJspValue(panelBean.pHelper.id) + "\" type=\"hidden\" />";
|
}
|
|
// 得到_expr隐藏网页代码
|
public String getHidTextexpr(Map<String, Object> sys) throws Exception {
|
PanelBean panelBean= (PanelBean) sys.get(PANEL_INFO);
|
String id=panelBean.pHelper.id;
|
getPermission(sys);
|
if ((DBHelper.getValueInt(sys, "isCustomHTMLComponent") == 1
|
&& DBHelper.getValueInt(sys, "MasterFieldShowLocation") == 0)) {
|
return "";// 因为是36控件字段 不输出控件,如果不在第二个面板则输出
|
}
|
String inp = "";
|
if (!DBHelper.getValue(sys, "showfieldvalueexpression").equals("")) {
|
inp += "<input id=\"" + id + "_expr\" value=\"" + getJspValue(id + "_expr") + "\" type=\"hidden\" />";
|
}
|
if (!DBHelper.getValue(sys, "stylecss").equals("")) {
|
inp += "<input id=\"" + id + "_css\" value=\"" + getJspValue(id + "_css") + "\" type=\"hidden\" />";
|
}
|
return inp;
|
}
|
|
|
|
}
|