| | |
| | | |
| | | 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.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; |
| | |
| | | |
| | | public Page loadAllByFunc(Page page, Map<String, String> env, boolean flg, String statisID, int formID) { |
| | | |
| | | /* |
| | | String s1 = ""; |
| | | String s2 = ""; |
| | | int index = page.getWhere().indexOf("!"); |
| | | if (index > -1) {// 增加处理18类型有过滤条件的情况 |
| | | if (page.getWhere().substring(index + 1) != "" |
| | | && page.getWhere().substring(index + 1).trim().equalsIgnoreCase("1=2")) { |
| | | return page; |
| | | 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()); |
| | | } |
| | | s1 = page.getWhere().substring(0, index); |
| | | s2 = " where " + page.getWhere().substring(index + 1).replaceAll("@~", "%").replaceAll("!", " and ") |
| | | + page.getDataGroup();// 增加数据组权限 12-06-11 |
| | | |
| | | } else { |
| | | s1 = page.getWhere(); |
| | | s2 = page.getDataGroup().trim().length() > 0 ? " where " + ((page.getDataGroup().trim().startsWith("and")) |
| | | ? " 1=1 " + page.getDataGroup() : page.getDataGroup()) : ""; |
| | | String[] strings = tbCols.split(","); |
| | | int index1 = 0; |
| | | for (String s : strings) { |
| | | String[] str = s.split("#");// 分出每个统计的列 |
| | | newTbCols += str[0].toLowerCase() + "=#" + index1 + ";"; |
| | | index1++; |
| | | } |
| | | page.setNewTbCols(newTbCols); |
| | | } |
| | | String temp = this.getFunctionParm(page.getParms(), s1, env); |
| | | if (!"".equalsIgnoreCase(temp)) |
| | | temp = "(" + temp + ")"; |
| | | else |
| | | temp = "()"; |
| | | 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 tableName = page.getTableName(); |
| | | if (tableName.indexOf("dbo.") == -1 || tableName.indexOf("DBO.") == -1) |
| | | tableName = "dbo." + tableName; |
| | | if (flg) {// 为了取页数增加的处理 |
| | | String sql = "select count(1) as p from " + tableName + temp + s2 |
| | | + ((page.getOrderBy() == null || page.getOrderBy().length() == 0) ? "" |
| | | : (page.getOrderBy().toLowerCase().indexOf("order by") > -1) ? page.getOrderBy() |
| | | : " order by " + page.getOrderBy()); |
| | | List<Map<String, Object>> list = this.jdbcTemplate.queryForList(sql); |
| | | int num = (Integer) (((Map<String, Object>) list.get(0)).get("p")); |
| | | if (num <= page.getPageSize()) |
| | | page.setTotalPageNum(1); |
| | | else |
| | | page.setTotalPageNum((int) Math.ceil((double) num / page.getPageSize())); |
| | | return page; |
| | | } else { |
| | | // 修正为18类型也可以只取指定的记录数,通过新的分页函数 |
| | | page.setTableName(tableName + temp); |
| | | page.setWhere(s2.replace("where", "").equalsIgnoreCase("") ? " 1=1 " : s2.replace("where", "")); |
| | | page.setOrderBy(((page.getOrderBy() == null || page.getOrderBy().length() == 0) ? "" |
| | | : (page.getOrderBy().toLowerCase().indexOf("order by") > -1) |
| | | ? page.getOrderBy().replace("order by", "") : page.getOrderBy())); |
| | | // page.setTbCols(this.proccTbCols(page)); |
| | | page.setEnv(env); |
| | | // return this.loadAll(page); |
| | | if (page.getFlag() == 2 || (page.isNull && page.getFlag() != 1) |
| | | || (page.getFlag() != 1 && page.getWhere().length() == 0)) |
| | | page.setWhere("1=2"); |
| | | if (page.getWhere().trim().indexOf("and") == 0) |
| | | page.setWhere("1=1 " + page.getWhere()); |
| | | |
| | | |
| | | 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 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]; |
| | | } |
| | | String[] strings = tbCols.split(","); |
| | | int index1=0; |
| | | for (String s : strings) { |
| | | String[] str = s.split("#");// 分出每个统计的列 |
| | | newTbCols+=str[0].toLowerCase()+"=#"+index1+";"; |
| | | index1++; |
| | | } |
| | | page.setNewTbCols(newTbCols); |
| | | } |
| | | page.setTbCols(gridService.proccTbCols(page));//增加统计列功能 |
| | | //page.setPageSize(100000);//不分页,因为所以都是动态生成,每分页一次都需要重新生成一次所有 |
| | | //gridService.loadAll(page); |
| | | //String pageFetch = " offset ((" + page.getPageNum() + "-1)*" + page.getPageSize() + ") rows\n fetch next " + page.getPageSize() + " rows only;";//分页功能 |
| | | String orderby= ((page.getOrderBy() == null || page.getOrderBy().length() == 0) ? "" |
| | | : (page.getOrderBy().toLowerCase().indexOf("order by") > -1) ? page.getOrderBy() |
| | | : " order by " + page.getOrderBy()); |
| | | String sql = "select " + page.getSql().toLowerCase() + ",ROW_NUMBER() OVER( "+orderby+") AS _rowno from " + tableName + temp + s2 + page.getGroupby(); |
| | | List<Map<String, Object>> list = this.jdbcTemplate.queryForList(sql+orderby); |
| | | //取页脚本统计 |
| | | String querySql = "select COUNT(1) as totalCount,CEILING((COUNT(1)+0.0)/" + page.getPageSize() + ") as pageCount," + (StringUtils.isNotBlank(page.getTbCols())? page.getTbCols():"''")+ " as tbCols from (" + sql + ")a"; |
| | | |
| | | Map<String, Object> query = this.jdbcTemplate.queryForMap(querySql); |
| | | page.setTbColsOut(GridUtils.prossRowSetDataType_String(query, "tbCols")); |
| | | page.setTotalPageNum(GridUtils.prossRowSetDataType_Int(query, "pageCount")); |
| | | page.setTotalRowNum(GridUtils.prossRowSetDataType_Int(query, "totalCount")); |
| | | */ |
| | | gridService.loadAllByFunc(page,env,false); |
| | | //取字段对齐,数字格式 |
| | | String sql1 = "select fieldid,cellAlign,displayformat 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(); |
| | | int indexd= id.toLowerCase().lastIndexOf("as"); |
| | | if(indexd>0) { |
| | | id = id.substring(indexd + 2, id.length()).trim(); |
| | | } |
| | | // objectMap.remove("fieldID"); |
| | | resultMap.put(id,objectMap); |
| | | } |
| | | } |
| | |
| | | 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=\"controlsr1\"><div class=\"controls38c"+DBHelper.getValueInt(sys, "LengthNum") |
| | | +" controls38r"+DBHelper.getValueInt(sys, "HeightNum")+"\" style=\"border:1px #000 solid;border-radius:6px;"+z_index+"\">" |
| | | 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></div>";// px;margin-top:2px; |
| | | + DBHelper.getValue(sys, "fieldname") + "</span></div>";// px;margin-top:2px; |
| | | // 对面板控件边框的高度控制设置 |
| | | panelBean.xuan = ""; |
| | | if(isTabs && DBHelper.getValueInt(panelBean.control38height, DBHelper.getValue(sys, "tabsheetname"))==0) { |
| | |
| | | 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 #cccccc;\">" |
| | | + "<img id="+id+" src=\""+getJspValue(id)+"\" value=\""+getJspValue(id)+"\" alt=\""+DBHelper.getValue(sys, "fieldname")+"\"" |
| | | + " src-source style=\"width:"+w+"px;height:"+h+"px;\"/></div>"; |
| | | returnStr+="<script>$doc('"+id+"').src($doc('"+id+"').src());$('#"+id+"').viewer({movable:false});</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;\""; |
| | |
| | | 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; |
| | | default: |
| | | returnStr = getText(sys, shuai);// 有些控件类型暂无用此替代 |
| | | break; |
| | |
| | | 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\"></span></a></span>"; |
| | | + "');\"><span id=\"" + id + "_Link\" style=\"display: block;margin-top: 5px;\"></span></a></span>"; |
| | | } |
| | | if (panelBean.hasButton) {//有审核按钮(旧) |
| | | returnStr = "<table><tr><td>" + returnStr + "</td><td>" + buttonStr + "</td></tr></table>";// valign=\"top\" |
| | | returnStr = "<table style=\"width:72%;\"><tr><td>" + returnStr + "</td><td>" + buttonStr + "</td></tr></table>";// valign=\"top\" |
| | | } |
| | | getPermission(sys); |
| | | if (DBHelper.getValueInt(sys, "calcuField") == 1) {// 触发公式 |
| | |
| | | String id=panelBean.pHelper.id; |
| | | String maxl=panelBean.maxl; |
| | | if (shuai) { |
| | | str = "<input id=\"" + id + "\" type=\"text\" name=\"" + id + "\" " + maxl + " "; |
| | | str = "<input id=\"" + id + "\" type=\"text\" autocomplete=\"off\" name=\"" + id + "\" " + maxl + " "; |
| | | str = getAll(map, str, shuai); |
| | | str += " />"; |
| | | } else { |
| | |
| | | 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 + " class=\"text "+getControls(map)+ "\""; |
| | | 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 + " class=\"text " + getControls(map) |
| | | str += str1 + " id=\"" + id + "\" name=\"" + id + "\" " + maxl + " autocomplete=\"off\" class=\"text " + getControls(map) |
| | | + "\" value=\"" + getJspValue(id) + "\" "; |
| | | str = getAll(map, str, shuai);// 这里可以提出来,还是提出来 |
| | | str += " />"; |
| | |
| | | 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之内的随机数 |
| | | panelBean.pHelper.div42 = getSuggestFilds(DBHelper.getValue(map, "ft"), 0, DBHelper.getValue(map, "SuggestFileds"), |
| | | DBHelper.getValue(map, "SuggestFileds"), DBHelper.getValue(map, "SeekGroupID"), |
| | | DBHelper.getValue(map, "FK"), rod); |
| | | // } |
| | | String col = DBHelper.getValue(map, "ft") + "#" + DBHelper.getValue(map, "fk") + "#" |
| | | + DBHelper.getValue(map, "SeekGroupID") + "#" + DBHelper.getValue(map, "SuggestFileds") + "#" |
| | | + DBHelper.getValue(map, "RelationField"); |
| | | getdiv = "getDiv42.ShowDivForPanel(document.getElementById('" + id + "'),'" + col |
| | | + "','" + DBHelper.getValue(map, "ft") + "','" + rod + "',@index@);"; |
| | | s_ += " onkeyup=\"" + getdiv + "\""; |
| | | s_ += " onkeydown=\"delemptyrefdata(document.getElementById('" + id + "'),@index@)\" "; // 键盘按下处理 |
| | | s_ += " onclick=\"try{getDiv42.closediv(document.getElementById('T_" + DBHelper.getValue(map, "ft") + "_" |
| | | + rod + "div'),'T_" + DBHelper.getValue(map, "ft") + "_" + rod + "div');}catch(e){}\""; |
| | | 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 |
| | |
| | | } |
| | | } |
| | | if (DBHelper.getValueInt(map, "HeightNum") > 1) { |
| | | str += "<textarea class=\"Three_show " + getControls(map) + "\" id=\"" + id + "\" " |
| | | 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_ + ">" + getJspValue(id) |
| | | + "name=\"" + id + "\" " + s_ + " "+getdiv+">" + getJspValue(id) |
| | | + "</textarea>"; |
| | | } else { |
| | | str += "<input class=\"Three_show " + getControls(map) + "\" id=\"" + id + "\" " |
| | | 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_ + " value=\"" |
| | | + "name=\"" + id + "\" size=\"15\" " + s_ + " "+getdiv+" value=\"" |
| | | + getJspValue(id) + "\" />"; |
| | | } |
| | | String style=""; |
| | |
| | | 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 style=\""+style+"border:0px solid #000000;\">"//position: absolute; 加上的话在2 3窗体显示会出现问题 |
| | | 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>"; |
| | |
| | | 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=\"\" class=\"Wdate\" realValue My97Mark=\"true\">" |
| | | + " 到 <input id=\"enddayDate\" value=\"1\" type=\"hidden\" /><INPUT name=\"endday\" style=\"height:24px;\" id=\"endday\" onclick=\"showDate('endday',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("")) { |
| | |
| | | } |
| | | str = "<input id=\"" + id + "Date\" value=\"" + ((DBHelper.getValueInt(map, "ReadOnly") == 1) ? "0" : "1") |
| | | + "\" type=\"hidden\" /><input id=\"" + id + "\" name=\"" + id |
| | | + "\" type=\"text\" class=\"Wdate "+getControls(map)+"\" onfocus=\"" + dateForm + "\" ";//controlsc1 controlsr1 |
| | | + "\" type=\"text\" autocomplete=\"off\" class=\"Wdate "+getControls(map)+"\" onclick=\"" + dateForm + "\" ";// onfocus= controlsc1 controlsr1 |
| | | str += " value=\"" + getJspValue(id) + "\" "; |
| | | str = getAll(map, str, shuai); |
| | | str += " />"; |
| | |
| | | |
| | | /** |
| | | * 19、9类型上传附件按钮 |
| | | * @param type |
| | | * @param map |
| | | * @return |
| | | */ |
| | | public String createFileUPload (Map<String, Object> map) { |
| | |
| | | +"\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; |
| | | } |
| | | |
| | |
| | | selectStr += optionStr; |
| | | selectStr += "</select> "; |
| | | selectStr += "<input id=\"dataType\" type=\"hidden\" value=" + colAll + "/>"; |
| | | selectStr += "\r\n精确查找" + getCheck("jqcz",panelBean) |
| | | + " <a href=\"javascript:getOder();\" class=\"easyui-linkbutton\" data-options=\"iconCls:'icon-search'\" style=\"width:80px\">查找</a>"; |
| | | selectStr += "\r\n精确查询" + getCheck("jqcz",panelBean) |
| | | + " <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); |
| | |
| | | * @throws Exception |
| | | */ |
| | | private String getShowFrom42(Map<String, Object> map, boolean shuai) throws Exception { |
| | | int rod = (int) (Math.random() * 100 + 1);// 生成100之内的随机数 |
| | | int rod = (int) (Math.random() * 1000 + 1);// 生成1000之内的随机数 |
| | | PanelBean panelBean= (PanelBean) map.get(PANEL_INFO); |
| | | String id=panelBean.pHelper.id; |
| | | panelBean.pHelper.div42 = getSuggestFilds(DBHelper.getValue(map, "ft"), 0, DBHelper.getValue(map, "SuggestFileds"), |
| | | DBHelper.getValue(map, "SuggestFileds"), DBHelper.getValue(map, "SeekGroupID"), |
| | | DBHelper.getValue(map, "FK"), rod); |
| | | // } |
| | | 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); // 是否只读 |
| | | String col = DBHelper.getValue(map, "ft") + "#" + DBHelper.getValue(map, "fk") + "#" |
| | | + DBHelper.getValue(map, "SeekGroupID") + "#" + DBHelper.getValue(map, "SuggestFileds") + "#" |
| | | + DBHelper.getValue(map, "RelationField"); |
| | | String getAll = "getDiv42.ShowDivForPanel(document.getElementById('" + id + "'),'" + col |
| | | + "','" + DBHelper.getValue(map, "ft") + "','" + rod + "',@index@);"; |
| | | s_ += " onkeyup=\"" + getAll + "\""; |
| | | s_ += " onclick=\"try{getDiv42.closediv(document.getElementById('T_" + DBHelper.getValue(map, "ft") + "_" + rod |
| | | + "div'),'T_" + DBHelper.getValue(map, "ft") + "_" + rod + "div');closeOther();}catch(e){}\""; |
| | | s_ += " onkeydown=\"delemptyrefdata(document.getElementById('" + id + "'),@index@)\" "; // 键盘按下处理 |
| | | //添加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 class=\"Three_show " + getControls(map) + "\" id=\"" + id + "\" name=\"" + id + "\" " |
| | | str += "<textarea autocomplete=\"off\" class=\"isControl42 Three_show " + getControls(map) + "\" id=\"" + id + "\" name=\"" + id + "\" " |
| | | + s_ + ">" + getJspValue(id) + "</textarea>"; |
| | | } else { |
| | | str += "<input class=\"Three_show " + getControls(map) + "\" id=\"" + id + "\" name=\"" + id |
| | | + "\" size=\"15\" " + s_ + " value=\"" + getJspValue(id) + "\" />"; |
| | | str += "<input autocomplete=\"off\" class=\"isControl42 Three_show " + getControls(map) + "\" id=\"" + id + "\" name=\"" + id |
| | | + "\" size=\"15\" " + s_ + " value=\"" + getJspValue(id) + "\" "+data+" />"; |
| | | } |
| | | return str; |
| | | } |
| | |
| | | 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; |
| | | String color = " <div class=\"example square\"><input type=\"text\" id=\"" + id + "\" class=\"coloris46 " + getControls(map) + "\" value=\"" + getJspValue(id) + "\" "; |
| | | color += getReadOnly(map);// 这里可以提出来,还是提出来 |
| | | color += "/></div>"; |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 获得权限控制 |
| | |
| | | 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 { |
| | |
| | | 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 |
| | |
| | | /** |
| | | * 42类型控件调用到 |
| | | * sugg--列表显示的字段 backFilds-取外表字段,以便选择后返回哪些值。 tp ---自表字段,返回给哪些字段 |
| | | * ftformtype的值是关联表号的对应窗体类型 |
| | | */ |
| | | public String getSuggestFilds(String ft, int type, String sugg, String backFilds, String to, String form, int rod) {// 取得需要的字段名称 |
| | | int flg = this.setGetPrivaryTable(type); |
| | | StringBuffer sb = new StringBuffer(); |
| | | |
| | | String sql = " select FieldID,fieldname,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(";"); |
| | | String str = "";// 保存哪些字段是隐藏的 |
| | | for (String s : tem) { |
| | | for (Map<String, Object> map : list) { |
| | | if (s.equalsIgnoreCase((String) map.get("FieldID"))) { |
| | | if (GridUtils.prossRowSetDataType_Int(map, "ShowOnGrid") > 0) |
| | | sb.append("<th width=\"80px\">").append(map.get("fieldname") == null |
| | | ? (String) map.get("GridCaption") : (String) map.get("fieldname")).append("</th>"); |
| | | else { |
| | | if (str == "") |
| | | str += map.get("FieldID"); |
| | | else |
| | | str += ";" + map.get("FieldID"); |
| | | sb.append("<th width=\"80px\" style=\"display:none;\">").append(map.get("fieldname") == null |
| | | ? (String) map.get("GridCaption") : (String) map.get("fieldname")).append("</th>"); |
| | | 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,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("width", 150); |
| | | sugMap.put("align", "center"); |
| | | if (GridUtils.prossRowSetDataType_Int(map, "ShowOnGrid") <= 0) { |
| | | sugMap.put("hide", true);//隐藏 |
| | | } |
| | | suglit.add(sugMap); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | String json = "{\"data\":\";" + str + ";\",\"backfilds\":\"" + backFilds + "\",\"to\":\"" + to |
| | | + "\",\"form\":\"" + form + "\",\"one\":\"0\"}"; |
| | | return "<div id=\"T_" + ft + "_" + rod |
| | | + "div\" style=\"z-index:9999;display:none;position:absolute;height:auto;max-height:300px;overflow:auto;\"><table data='" |
| | | + json + "' id=\"T_" + ft + "_" + rod + "CDiv\" class=\"hovertable\"><tr>" + sb.toString() |
| | | + "</tr></table></div>\t\n"; |
| | | } |
| | | |
| | | /** |
| | | * 根据窗体类型取得应当读取哪一个表的数据. |
| | | * |
| | | * |
| | | **/ |
| | | private synchronized int setGetPrivaryTable(int winType) { |
| | | switch (winType) { |
| | | case 5: |
| | | case 9: |
| | | case 2: |
| | | case 30: |
| | | case 301: |
| | | case 10: |
| | | case 19: |
| | | case 304: |
| | | return 1;// 从表 |
| | | case 8:// 三表 |
| | | return 2; |
| | | default: |
| | | return 0; |
| | | return "data-title=\"" + GridUtils.toJson(suglit).replaceAll("\"", "'") + "\" "; |
| | | } catch (Exception e) { |
| | | return ""; |
| | | } |
| | | } |
| | | |