/*
|
* 生成1类型窗体文件,生成路径已系统菜单为准,文件为formID_file.jsp为准。 xiangluan 2010-04-16
|
*/
|
package com.yc.service.build.type.v2;
|
|
import com.yc.action.grid.GridUtils;
|
import com.yc.action.grid.TMuiDTO;
|
import com.yc.api.bean.T9685Entity;
|
import com.yc.api.service.ApiServiceIfc;
|
import com.yc.exception.ApplicationException;
|
import com.yc.service.build.top.v2.BuildTopIfc;
|
import com.yc.service.commons.GformIfc;
|
import com.yc.service.impl.DBHelper;
|
import com.yc.service.panel.SqlDBHelperIfc;
|
import com.yc.service.panel.v2.PanelServiceIfc;
|
import org.apache.commons.collections.map.HashedMap;
|
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.lang.StringUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.io.File;
|
import java.util.*;
|
|
|
@Service("V496")
|
public class T_496_Impl extends T_Based_Impl implements T_496_Ifc {
|
// 通过功能号id获得明细设置
|
private static final String GET_TABPAGE_DETAIL = " set nocount on ; select " +
|
"[mainformid] " +
|
",[mainformname] " +
|
",[FormGroupID] " +
|
",[FormGroupName]" +
|
",[SortBy] " +
|
",[formid] " +
|
",[formname] " +
|
",[formtype] " +
|
",[LabelName] " +
|
",[FT] " +
|
",[FTName] " +
|
",[FK] " +
|
",[SeekGroupID] " +
|
",[GridHeight] " +
|
",[GroupID] " +
|
",[GroupName] " +
|
",[TabID] " +
|
",[TabHeight] " +
|
",[isStartupCollapsed] "
|
+ " from _sys_tabpageformid where mainformid=? and Actived=1 order by sortby asc";
|
private static final String gridSql = "set nocount on; \n " +
|
"declare @mainFormid int = ? ,@result int\n" +
|
"declare @table table (mainFormid int)\n" +
|
"declare @table2 table(tabid int,formtype int,sortby int)\n" +
|
"if not exists(select 1 from _sys_TabPageFormid where mainformid = @mainFormid and formtype = 1 )\n" +
|
"begin\n" +
|
"select 0 \n" +
|
"return\n" +
|
"end\n" +
|
"if exists(select 1 from _sys_TabPageFormid where mainformid = @mainFormid and TabID is null and formtype = 1 )\n" +
|
"begin\n" +
|
"select 0 \n" +
|
"return\n" +
|
"end\n" +
|
"insert into @table2(tabid , formtype,sortby)\n" +
|
"select tabid,formtype,sortby from _sys_TabPageFormid where mainformid = @mainFormid and TabID is not null\n" +
|
"if not exists(select 1 from @table2 a \n" +
|
"where a.sortby in ( select min(sortby) from @table2 b where a.tabid = b.tabid )\n" +
|
"and formtype = 1 ) \n" +
|
"insert into @table(mainFormid) values (@mainFormid) \n" +
|
"select @result=mainFormid from @table\n" +
|
"select @result";
|
@Autowired
|
private GformIfc gformIfc;
|
@Autowired
|
private BuildTopIfc buildTopIfc;
|
@Autowired
|
private PanelServiceIfc pIfc;
|
@Autowired
|
SqlDBHelperIfc sqlDBHelperIfc;
|
@Autowired
|
private ApiServiceIfc apiServiceIfc;
|
|
/*
|
* 生成文件
|
*/
|
@Override
|
public int build(BaseBean baseBean) throws Exception {
|
Map<String, Object> gformInfo = this.init(baseBean);
|
buildJsCssHead(gformInfo);
|
buildTop(gformInfo);
|
buildHelpPage(gformInfo);
|
buildFoolter(baseBean);
|
buildCss(baseBean);
|
buildIndex(gformInfo);
|
buildDataHead(gformInfo);
|
return 0;
|
}
|
|
|
public void buildCss(BaseBean baseBean) throws Exception {
|
String fileName = "css.css";
|
String data = getPageCode(fileName, baseBean);
|
// ----------------
|
buildPageCode(data, fileName, baseBean);
|
|
}
|
|
/**
|
* 通过分组id+页框id获得明细设置
|
*
|
* @param formGroupId
|
* @return
|
*/
|
public List<Map<String, Object>> getTabPageDetail(String formGroupId) {
|
return this.jdbcTemplate.queryForList(GET_TABPAGE_DETAIL, formGroupId);
|
}
|
|
/**
|
* 判断是实体表还是视图 如果是视图则返回true
|
*
|
* @param action 表名
|
* @return
|
*/
|
public boolean getdocstaut(String action) {
|
boolean bolcont = false;
|
String sql = " set nocount on ; select count(1) from INFORMATION_SCHEMA.TABLES where table_type='view' and table_name=?";
|
int cont = this.jdbcTemplate.queryForObject(sql, Integer.class, new Object[]{action});
|
if (cont == 1) {//是视图
|
bolcont = true;
|
}
|
return bolcont;
|
}
|
|
protected Map<String, Object> getFormInfo(String formid) {
|
Map<String, Object> gformInfo = gformIfc.getGformInfo("predocstatus,formname,showdetail,"
|
+ "isopenFuncshowpwdedit," + "isshowpwdedit,isShowOnlineMsg,isShowProcessTracking,optype,"
|
+ "HDTable,version,CancelBtnProcName,RevokeBtnProcName,RevokeBtnExpression,"
|
+ "RevokeBtnEditStatus,isshowinserialbtn,inserialbtneditstatus,isshowoutserialbtn ," +
|
"outserialbtneditstatus ", Integer.parseInt(formid));
|
return gformInfo;
|
}
|
|
/**
|
* 生成主页面
|
*
|
* @throws Exception
|
*/
|
@Override
|
public void buildIndex(Map<String, Object> gformInfo) throws Exception {
|
String fileName = "index.jsp";
|
BaseBean baseBean = (BaseBean) gformInfo.get(BEAN_INFO);
|
String formID = baseBean.formID;
|
String data = getPageCode(fileName, baseBean);
|
// --------从gform表获取是否显示大标题字段值(isTitle)判断是否显示大标题,并替换标识符-2012-02-20-syz--------[begin]----------------------
|
if (GridUtils.prossRowSetDataType_Int(gformInfo, "isTitle") == 1) {// 如果配置了显示大标题
|
String TopTitle = "<table id=\"top_table\" width=\"100%\" bgcolor=\"#DEEDF7\">\n" + "<tr>\n"
|
+ "<td>\n" + "<div id=\"title_top\">[?title]</div>\n" + "</td></tr>\n"
|
// + "<tr>\n" + "<td>\n"
|
// + "<hr style=\"position: absolute;left:0px;top:28px;height: 1px;color: #bdc7c6;width: 99%;\">\n"
|
// + "</td>\n" + "</tr>\n"
|
+ "<tr><td>\n" + "<div id=\"tplt-top\">\n"
|
+ "\t\t\t<jsp:include page=\"top.jsp\" flush=\"true\"/>\n" + "\t\t</div>\n" + "</td></tr>\n"
|
+ "</table>\n";// <%@include file=\"top.jsp\"%>
|
data = data.replace("[?TopAndTitle]", TopTitle);// 替换功能号标识符
|
} else {// 如果没有配置显示大标题
|
String TopAndTitle_str = "<div id=\"tplt-top\">\n\t\t\t<jsp:include page=\"top.jsp\" flush=\"true\"/>\n";
|
data = data.replace("[?TopAndTitle]", TopAndTitle_str);// 替换功能号标识符
|
}
|
// --------从gform表获取是否显示大标题字段值(isTitle)判断是否显示大标题,并替换标识符-2012-02-20-syz-----[end]-------------------------//
|
// ----------------
|
Map<String, String> endCreate = new HashMap<String, String>();// 延长生成文件
|
String jspName = "";//jsp名称
|
boolean isMainPanel = true;//是否是主面板
|
String html = "";//没设置页卡时候的内容
|
String htmlTab = "";//页卡内容
|
String nohtmlTab = "";//设置了页卡但是个别子功能没有设置页卡的情况内容或直接是没设置有页卡内容。
|
int gridIndex = 0;//索引(格线索引)
|
int panelIndex = 0;//确定为页面上的第几个面板(16类型索引)
|
int tabID = 0;//页卡分组编号
|
int sortBy = 0;//显示顺序
|
int TabHeight=400;//页卡高度。默认400
|
boolean isTabs = false;// 是否是选项卡
|
String grid = "0";//格线
|
int height1 = 0;
|
String inPan = "";//inPan替换index.jsp里的@panFou@,进入主功能号panel.jsp
|
Map<String, Object> tabData = new HashMap<String, Object>(); // 选项卡内容和高度
|
List<Integer> tabIDlit = new ArrayList<>();// 选项卡对应的ID集合
|
List<Integer> sortBylit = new ArrayList<>();// 选项卡对应序列的ID集合
|
Map<String, Object> TabHeightMap=new HashedMap();//页卡高度集合
|
try {
|
//通过分组id+页框id获得明细设置
|
List<Map<String, Object>> sheMap = this.getTabPageDetail(formID);
|
Integer result = this.getJdbcTemplate().queryForObject(gridSql, Integer.class, formID);
|
if (result != null && result > 0) {// 存在有格线才需要判断 by danaus 2019/11/19 16:18
|
//处理当子功能号有格线,需要把格线的子功能号放在第一,如果不是这样设置则需要在生成页面时作出提示
|
throw new ApplicationException("请在【9771】496多表设置,把其中一个子功能号类型为1的子功能号放置到页卡的第一个位置显示");
|
}
|
result = this.getSimpleJdbcTemplate().queryForObject(" set nocount on ; if not exists(select 1 from _sys_TabPageFormid where mainformid=? and mainformid=formid and Actived=1) \n begin select 0 return end else begin select 1 return end",Integer.class,formID);
|
if (result != null && result ==0) {
|
//处理496多表面板查找不到有设置主功能号面板
|
throw new ApplicationException("请在【9771】设置 "+formID+" 子功能号使其处于【生效】状态");
|
}
|
String[] data1 = null;
|
for (Map<String, Object> map : sheMap) {
|
if (baseBean.doc == "") {
|
baseBean.doc = DBHelper.getValue(map, "SeekGroupID").toLowerCase();// 取得第一个功能号的关联字段
|
}
|
//子功能号是否和主功能号相同。 true表示相同 ,false表示不相同
|
isMainPanel = (DBHelper.getValueInt(map, "formid") != DBHelper.getValueInt(map, "mainformid") ? false : true);
|
tabID = DBHelper.getValueInt(map, "TabID");//页卡分组编号
|
sortBy = DBHelper.getValueInt(map, "SortBy");//显示顺序
|
TabHeight=(DBHelper.getValueInt(map, "TabHeight")==0?TabHeight:DBHelper.getValueInt(map, "TabHeight"));//页卡高度
|
String labelName= GridUtils.prossRowSetDataType_String(map, "LabelName");
|
if(org.apache.commons.lang3.StringUtils.isBlank(labelName)){
|
labelName=GridUtils.prossRowSetDataType_String(map, "formname");
|
}
|
switch (DBHelper.getValueInt(map, "formtype")) {// 子功能号类型
|
case 1:// 子功能号类型为表格
|
if (gridIndex > 0) {
|
baseBean.id_info += ";" + "create" + gridIndex + "|" + DBHelper.getValue(map, "SeekGroupID").split(";")[0]
|
+ "," + DBHelper.getValue(map, "FK").split(";")[0];// 前提是以主功能号组装格线中各个关联字段:0|doccode,docede;1|test,test;
|
} else {
|
baseBean.id_info += "create|" + DBHelper.getValue(map, "SeekGroupID").split(";")[0] + ","
|
+ DBHelper.getValue(map, "FK").split(";")[0];// 前提是以主功能号组装格线中各个关联字段:0|doccode,docede;1|test,test;
|
}
|
jspName = DBHelper.getValueInt(map, "formid") + "_grid.jsp";
|
// 是页卡进入处理 --xin 2019-10-14 16:27:08
|
if (tabID > 0) {
|
//格线
|
tabIDlit.add(tabID);
|
sortBylit.add(sortBy);
|
int heig=DBHelper.getValueInt(TabHeightMap, tabID+"");
|
TabHeightMap.put(tabID+"", (heig>TabHeight?heig:TabHeight));
|
tabData.put("t" + tabID + sortBy,
|
"<div id=\"create" + (gridIndex == 0 ? "" : gridIndex) + "\" title=\"" + labelName
|
+ "\" style=\"margin-top:5px;\">" + "<%@ include file=\"" + jspName + "\" %>"
|
+ getPanFile(DBHelper.getValueInt(map, "formid")) + "\r<div id=\"mbcreate" + (gridIndex == 0 ? "" : gridIndex) + "\">"
|
+ "<jsp:include page=\"" + DBHelper.getValueInt(map, "formid") + "_top.jsp\" flush=\"true\"/></div></div>\n");
|
isTabs = true;
|
} else {//不是页卡的处理
|
if (gridIndex == 0) { // 第一个格线需要显示出来
|
html = "<div style=\"font-family:黑体; margin-left:10px;\">" + labelName + "</div>\r";
|
} else {
|
html = "<div style=\"font-family:黑体; margin-left:10px;\"><a title='展开' href='javascript:shows("
|
+ gridIndex + "," + DBHelper.getValueInt(map, "formid") + ");' id='A_"
|
+ DBHelper.getValueInt(map, "formid") + "'>\r<img id='img_" + DBHelper.getValueInt(map, "formid")
|
+ "' src='/images/down_list.gif' border='0'/> "
|
+ labelName + "</a><jsp:include page=\""
|
+ DBHelper.getValueInt(map, "formid") + "_top.jsp\" flush=\"true\"/></div>";
|
|
}
|
html += "<%@ include file=\"" + jspName + "\" %>" + getPanFile(DBHelper.getValueInt(map, "formid"));
|
nohtmlTab += html;//在设置有页卡但是个别没设置页卡的内容
|
}
|
// ---生成功能链接,通过增加top.jsp页面
|
buildTopIfc.build(DBHelper.getValueInt(map, "formid"), DBHelper.getValueInt(map, "formtype"), getBuildPath(baseBean) + "subtop.jsp",
|
getToPath(baseBean) + DBHelper.getValueInt(map, "formid") + "_top.jsp",
|
getFormInfo(DBHelper.getValueInt(map, "formid") + ""), this);
|
String indexs[] = this.getPrIndex(DBHelper.getValue(map, "formid"), sheMap, "1");
|
height1 = DBHelper.getValueInt(map, "gridheight");
|
if (height1 == 0) {
|
height1 = treeGrid.getGrigHieght(DBHelper.getValueInt(map, "formid"),
|
DBHelper.getValueInt(map, "formtype"), baseBean.dataBaseId);
|
}
|
TMuiDTO dto = new TMuiDTO();
|
if (gridIndex == 0) {
|
dto.type = baseBean.type;
|
dto.height1 = height1;
|
dto.indexs = indexs[0];
|
dto.tolkey = indexs[1];
|
dto.fromid = Integer.parseInt(formID);
|
dto.index = 0;
|
} else if (indexs[0] != "") {
|
dto.type = baseBean.type;
|
dto.height1 = height1;
|
dto.indexs = indexs[0];
|
dto.tolkey = indexs[1];
|
dto.fromid = 0;
|
dto.index = gridIndex;
|
} else {
|
dto.type = 1;
|
dto.height1 = height1;
|
dto.indexs = "";
|
dto.tolkey = "";
|
dto.fromid = 0;
|
dto.index = gridIndex;
|
}
|
dto.formTabName =labelName;
|
dto.addnew = true;// 表示需要生成处理+号的按钮代码
|
dto.xxk = (isTabs ? 1 : 0); // DBHelper.getValueInt(map,"isStartupCollapsed");
|
treeGrid.createGrid(DBHelper.getValueInt(map, "formtype"), DBHelper.getValueInt(map, "formid"), baseBean.URI,
|
"app/" + baseBean.gPath + "/", new String[]{jspName}, getTemPath(baseBean),
|
"/" + baseBean.formID + "/" + baseBean.type + "/", dto, baseBean.dataBaseId);
|
height1 = (height1 <= 0) ? 320 : height1 + 20;
|
grid = "1";
|
gridIndex++;
|
break;
|
case 16://子功能号类型为16类型面板
|
data1 = new String[3];
|
data1[0] = FileUtils.readFileToString(new File(getBuildPath(baseBean) + "panel.jsp"), "utf-8");
|
data1[1] = FileUtils.readFileToString(new File(getTemPath(baseBean) + "panelControl.jsp"), "utf-8");
|
if (Integer.parseInt(formID) != DBHelper.getValueInt(map, "formid")) {
|
data1[2] = "1";
|
}
|
// ----------------
|
baseBean.isPrimaryPan = isMainPanel;// 控制496主面板和子面板
|
baseBean.indexPan = panelIndex;
|
// 生成面板内容
|
Map<String, String> mapIf = pIfc.getPanelHtml(DBHelper.getValueInt(map, "formid"),
|
DBHelper.getValueInt(map, "formtype"), data1, gformInfo);
|
//-----------------
|
boolean bol = this.getdocstaut((mapIf.get("zhu") != null ? mapIf.get("zhu").toString() : ""));
|
String pan16_496 = DBHelper.getValueInt(map, "FT") + ";" + DBHelper.getValue(map, "FK") + ";"
|
+ DBHelper.getValue(map, "SeekGroupID").toLowerCase();
|
String equalbol = (DBHelper.getValueInt(map, "formid") != DBHelper.getValueInt(map, "FT") ? "true"
|
: "false");
|
String errorText=(DBHelper.getValueInt(map, "formid") != DBHelper.getValueInt(map, "FT") ?
|
labelName+"-"+DBHelper.getValueInt(map, "formid") :""+DBHelper.getValueInt(map, "formid"));
|
|
//formID功能号和子功能号相同则为主功能号面板
|
if (Integer.parseInt(formID) == DBHelper.getValueInt(map, "formid")) {
|
String isPanelTabs = "";//主功能号也在页卡里面
|
if (tabID > 0) {
|
int heig=DBHelper.getValueInt(TabHeightMap, tabID+"");
|
isPanelTabs = "\n<div class=\"istabs\" style=\"margin:10px 40px 20px 30px;width:auto;height:"+(heig>TabHeight?heig:TabHeight)+"px;\">\n";
|
isPanelTabs += "<div id=\"panl-" + panelIndex + "\" title=\"" + labelName
|
+ "\" style=\"margin-top:5px;\">\r<div id=\"mbpanl-" + panelIndex + "\">"
|
+ "<jsp:include page=\"" + DBHelper.getValueInt(map, "formid") + "_top.jsp\" flush=\"true\"/></div>";
|
tabIDlit.add(tabID);
|
sortBylit.add(sortBy);
|
TabHeightMap.put(tabID+"",(heig>TabHeight?heig:TabHeight));
|
tabData.put("t" + tabID + sortBy, "ispaneltabs");
|
isTabs = true;
|
// --------生成子功能号功能链接
|
buildTopIfc.build(DBHelper.getValueInt(map, "formid"), baseBean.type, getBuildPath(baseBean) + "subtop.jsp",
|
getToPath(baseBean) + map.get("formid") + "_top.jsp",
|
getFormInfo(DBHelper.getValueInt(map, "formid") + ""), this);
|
// ---end
|
}
|
//主面板不是页卡形式,可以去掉,by danaus 2020/12/9 17:08
|
// else {
|
// // html = "<div style=\"font-family:黑体; margin-left:10px;\">" + labelName + "</div>";
|
// }
|
html += "<jsp:include page=\"panel.jsp\" flush=\"true\"/>";
|
inPan = html;//在index.jsp进入主功能号 panel.jsp
|
String filterFormId=DBHelper.getValue(map, "FT").equals(DBHelper.getValue(map,"formid"))?"true":"false";//496的子功能不需要执行浏览历史记录 xin 2022-4-12 16:13:10
|
endCreate.put("panel.jsp", mapIf.get("panHTML").replace("@FT@", DBHelper.getValue(map, "FT"))
|
.replace("@MultiTableFormId@",DBHelper.getValueInt(map, "formid")+"")
|
.replace("@isMasterFormId@",Integer.parseInt(formID) != DBHelper.getValueInt(map, "formid")?"true":"false")
|
.replace("@filterFormId@",filterFormId)
|
.replace("@FK@", DBHelper.getValue(map, "FK")).replace("@equalbol@", equalbol)
|
.replace("@errorText@", errorText)
|
.replace("@SeekGroupID@", DBHelper.getValue(map, "SeekGroupID").toLowerCase())
|
.replace("@where16_496@", pan16_496).replace("@view@", "" + bol)
|
.replace("@zhu496@", DBHelper.getValue(map, "formid")).replace("@isMaster@", "true").replace("@isPanelTabs@", isPanelTabs));
|
// by danaus 增加@isMaster@标记只有主功能号面板才需要执行取消确认和撤回
|
buildPageCode(mapIf.get("panelControl"), "panelControl" + formID + ".jsp", baseBean);//生成panelControl+formId.jsp
|
} else {// 子功能号面板
|
// --------生成子功能号功能链接
|
buildTopIfc.build(DBHelper.getValueInt(map, "formid"), DBHelper.getValueInt(map, "formtype"), getBuildPath(baseBean) + "subtop.jsp",
|
getToPath(baseBean) + map.get("formid") + "_top.jsp",
|
getFormInfo(DBHelper.getValueInt(map, "formid") + ""), this);
|
// ---end
|
jspName = DBHelper.getValueInt(map, "formid") + "_panel.jsp";
|
String filterFormId=DBHelper.getValue(map, "FT").equals(DBHelper.getValue(map,"formid"))?"true":"false";//496的子功能不需要执行浏览历史记录 xin 2022-4-12 16:13:10
|
buildPageCode(mapIf.get("panHTML").replace("@isPanelTabs@", "").replace("@include@", "")
|
.replace("@FT@", DBHelper.getValue(map, "FT"))
|
.replace("@MultiTableFormId@",DBHelper.getValueInt(map, "formid")+"")
|
.replace("@isMasterFormId@",Integer.parseInt(formID) != DBHelper.getValueInt(map, "formid")?"true":"false")
|
.replace("@filterFormId@",filterFormId)
|
.replace("@FK@", DBHelper.getValue(map, "FK")).replace("@equalbol@", equalbol)
|
.replace("@errorText@", errorText)
|
.replace("@SeekGroupID@", DBHelper.getValue(map, "SeekGroupID").toLowerCase())
|
.replace("@grid@", grid).replace("@where16_496@", pan16_496).replace("@view@", "" + bol)
|
.replace("@zhu496@", DBHelper.getValue(map, "formid")).replace("@isMaster@", "false"),
|
jspName, baseBean);
|
buildPageCode(mapIf.get("panelControl"),
|
"panelControl" + DBHelper.getValueInt(map, "formid") + ".jsp", baseBean);
|
// 是页卡进入处理 --xin 2019-10-14 16:27:08
|
if (tabID > 0 && !isMainPanel) {
|
//面板
|
tabIDlit.add(tabID);
|
sortBylit.add(sortBy);
|
int heig=DBHelper.getValueInt(TabHeightMap, tabID+"");
|
TabHeightMap.put(tabID+"", (heig>TabHeight?heig:TabHeight));
|
tabData.put("t" + tabID + sortBy,
|
"<div id=\"panl-" + panelIndex + "\" title=\"" + labelName
|
+ "\" style=\"margin-top:5px;\"><jsp:include page=\"" + jspName + "\" flush=\"true\"/>"
|
+ getPanFile(DBHelper.getValueInt(map, "formid")) + "\r<div id=\"mbpanl-" + panelIndex + "\">"
|
+ "<jsp:include page=\"" + DBHelper.getValueInt(map, "formid") + "_top.jsp\" flush=\"true\"/></div></div>\n");
|
isTabs = true;
|
} else {//不是页卡的处理
|
html += "<jsp:include page=\"" + jspName + "\" flush=\"true\"/><jsp:include page=\""
|
+ DBHelper.getValueInt(map, "formid") + "_top.jsp\" flush=\"true\"/>"
|
+ getPanFile(DBHelper.getValueInt(map, "formid"));
|
nohtmlTab += html;//在设置有页卡但是个别没设置页卡的内容
|
}
|
}
|
//baseBean.indexPan = 0;
|
panelIndex++;
|
break;
|
}
|
}
|
|
/** 处理组装成选项卡功能号的样式 */
|
if (isTabs) {
|
try {
|
htmlTab = getTabsValue(tabIDlit, sortBylit, tabData,TabHeightMap);
|
if (!nohtmlTab.equals("")) {
|
htmlTab = "<br>" + htmlTab + nohtmlTab; // 处理好的选项卡
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
} else {
|
htmlTab = nohtmlTab;
|
}
|
baseBean.isPrimaryPan = true;
|
if (endCreate.get("panel.jsp") != null) {
|
html = inPan;
|
buildPageCode(endCreate.get("panel.jsp").replace("@include@", htmlTab).replace("@grid@", grid),
|
"panel.jsp", baseBean);
|
} else {
|
html = htmlTab;
|
}
|
} catch (Exception e) {
|
throw new ApplicationException(e.getMessage());
|
}
|
//-------------文字颜色说明---------xin 2022-5-18 16:09:54-----------//
|
StringBuilder colorText =new StringBuilder();//文字颜色说明
|
if(StringUtils.isNotBlank(formID)) {
|
List<T9685Entity> colorList = apiServiceIfc.get9685List(Integer.parseInt(formID));
|
if (colorList != null && colorList.size() > 0) {
|
colorText.append("文字颜色说明");
|
for (T9685Entity t : colorList) {
|
colorText.append("<div><span title=\"" + t.getItemMemo() + "\" class=\"spanColor\" " +
|
"style=\"background-color: " + t.getHexColor() + "\"></span>" +
|
"<span style=\"color: " + t.getHexColor() + "\">" +
|
t.getColorName() + "</span></div>");
|
}
|
}
|
}
|
//文字颜色说明 xin 2022-5-18 15:53:13
|
data = data.replace("[?ColorDescription]",colorText);
|
data = data.replace("[?title]", gformInfo.get("formname") + "");
|
data = data.replace("@panFou@", html);
|
data = data.replace("[?notab]", "" + isTabs);
|
data = data.replace("[?height]", "");
|
buildPageCode(data, fileName, baseBean);
|
}
|
|
/**
|
* 添加需显示字段
|
*
|
* @param formId 某功能号后
|
* @return String
|
*/
|
private String getPanFile(int formId) {
|
StringBuffer sBuffer = new StringBuffer();
|
sBuffer.append("<div id=\"").append(formId).append("_panel\"></div>");
|
return sBuffer.toString();
|
}
|
|
/**
|
* 组装页卡里的顺序和页卡号。
|
*/
|
private String getTabsValue(List<Integer> tabIDlit, List<Integer> sortBylit, Map<String, Object> tabData,Map<String, Object> TabHeightMap) {
|
try {
|
String tabs = "";//组装页卡内容
|
removeDuplicateWithOrder(tabIDlit);
|
for (Integer tid : tabIDlit) {
|
tabs += "\n<%try{%>\n<div class=\"istabs\" style=\"margin:10px 40px 20px 30px;width:auto;height:"+DBHelper.getValueInt(TabHeightMap, tid+"")+"px;\">\n";//选项卡 height:"+ getTabsHeight(t, sortByList, tabsData) + "px;
|
for (Integer sid : sortBylit) {//获取上层选项卡里面的内容
|
if ("ispaneltabs".equals(DBHelper.getValue(tabData, "t" + tid + sid))) {//主功能号也是页卡
|
tabs = "\n<%try{%>\r</div>\r";
|
} else {
|
tabs += DBHelper.getValue(tabData, "t" + tid + sid);
|
}
|
}
|
tabs += "</div>\n"
|
+ "<%}catch(Exception e){\nthrow new Exception(e.getCause()!=null?e.getCause().getMessage():e.getMessage());\n}%>\n";//抛出错误信息
|
}
|
tabs += "\n<script type=\"text/javascript\">$(function(){Tabs(<%=flag%>,iscp);})</script>\n";//加载页卡js
|
return tabs;
|
} catch (Exception e) {
|
throw new ApplicationException(e.getMessage());
|
}
|
}
|
|
/**
|
* 删除ArrayList中重复元素,保持顺序
|
*
|
* @param list
|
*/
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
public static void removeDuplicateWithOrder(List list) {
|
Set set = new HashSet();
|
List newList = new ArrayList();
|
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
|
Object element = iter.next();
|
if (set.add(element))
|
newList.add(element);
|
}
|
list.clear();
|
list.addAll(newList);
|
}
|
}
|