2021-03-18 14:29:41 +08:00

126 lines
5.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@page import="com.amarsoft.app.base.businessobject.BusinessObject"%>
<%@page import="com.amarsoft.app.base.businessobject.BusinessObjectManager"%>
<%@page import="com.amarsoft.app.base.util.ObjectWindowHelper"%>
<%@ page contentType="text/html; charset=GBK"%><%@
include file="/IncludeBegin.jsp"%><%
String sDefaultNode = CurPage.getParameter("DefaultNode"); //默认打开节点
if(sDefaultNode == null) sDefaultNode = "";
String productType1 = CurPage.getParameter("ProductType1"); //默认打开节点
if(productType1 == null) productType1 = "";
String isInUse = CurPage.getParameter("IsInUse"); //默认打开节点
if(isInUse == null) isInUse = "";
String userid=CurUser.getUserID();
String condition ="";
String flag="false";
//80009U00000001为adminG张俊创建账户
if("administrator".equals(userid)||"admin".equals(userid)||"80009U00000001".equals(userid)||CurUser.hasRole("800R00000072")){
flag="true";
}else{
condition =ObjectWindowHelper.getProductList(userid);
}
//定义Treeview
OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage, "基础产品","right");
int i=0;
BusinessObjectManager bomanager = BusinessObjectManager.createBusinessObjectManager();
List<BusinessObject> catalogList = bomanager.loadBusinessObjects("jbo.prd.BUSINESS_TYPE", "Attribute10='Catalog' and isInUse='1' "+condition);
for(BusinessObject catalog : catalogList){
String p = tviTemp.insertPage("root",catalog.getString("TypeName"),catalog.getString("TypeNo"),"OpenComp(\"ProductFrame\",\"/ProductManage/ProductConfig/ProductCatalogList.jsp\",\"SortNo="+catalog.getString("SortNo")+"&typeName="+catalog.getString("TYPENAME")+"\",\"frameright\");",i++);
List<BusinessObject> libraryList = bomanager.loadBusinessObjects("jbo.prd.BUSINESS_TYPE", "SortNo like :SortNo and isInUse='1' and (Attribute10 is null or Attribute10 = '')", "SortNo", catalog.getString("SortNo")+"%");
for(BusinessObject library : libraryList){
tviTemp.insertPage(p, library.getString("TypeName"),library.getString("TypeNo"),"OpenComp(\"ProductFrame2\",\"/ProductManage/ProductConfig/ProductInfo.jsp\",\"TypeNo="+library.getString("TypeNo")+"&RightType=ReadOnly\",\"frameright\");",i++);
}
}
String sButtons[][] = {
{flag,"","Button","新增目录","","addCatalog()","","","","btn_icon_add"},
{flag,"","Button","删除目录","","deleteCatalog()","","","","btn_icon_delete"}
};
%><%@include file="/Resources/CodeParts/View07.jsp"%>
<script type="text/javascript">
function addCatalog(){
//路径
var sUrl = "/ProductManage/ProductConfig/ProductCatalogInfo.jsp";
//传参
var sParam = "";
AsDialog.PopView(sUrl,sParam,"dialogWidth=320px;dialogHeight=100px;status:no;center:yes;help:no;minimize:no;maximize:no;border:thin;statusbar:no",function(){
reloadSelf();
});
}
function addProduct(){
var typeNo= getCurTVItem().value;
if(typeNo == null || typeNo == ""){
alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
var res = RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductManager","isCatalog","productID="+typeNo);
if(res == "true"){
var sortNo = RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductManager","getCatalogSortNo","catalogNo="+typeNo);
var res = AsDialog.SelectGridValue('SelectAllProduct',sortNo+"%",'TYPENO','',true,'',function(returnValue){
if(returnValue == null || typeof(returnValue) == "undefined")
return
for(var i=0;i<returnValue.split("~").length;i++){
var library = returnValue.split("~")[i];
RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductManager","addProductIntoCatalog","catalogNo="+typeNo+",productID="+library);
}
alert("添加成功");
reloadSelf();
});
}else{
alert("请选择目录节点进行添加产品");
}
}
function deleteCatalog(){
var typeNo= getCurTVItem().value;
if(typeNo == null || typeNo == ""){
alert(getHtmlMessage('1'));//请选择一条信息!
return;
}
if(confirm("确定要删除此产品?")){
var res = RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductManager","isCatalog","productID="+typeNo);
if(res == "true"){
var res = RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductManager","deleteCatalog","catalogNo="+typeNo + ",userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>");
if(res == "true"){
alert("删除成功");
reloadSelf();
}else{
alert("删除失败");
reloadSelf();
}
}else{
alert("请选择目录节点进行删除目录");
}
}
}
function startProduct(){
<%=tviTemp.generateHTMLTreeView()%>
expandNode('root');
if(!"<%=sDefaultNode%>") click_change(0);
else selectItem("<%=sDefaultNode%>");
}
<%/*[Describe=点击节点事件,查看及修改详情;]*/%>
function TreeViewOnClick(){
var TypeNo= getCurTVItem().value;
if(!TypeNo) return;
// return parent.OpenProductInfo(TypeNo);
}
<%/*刷新所有缓存*/%>
function reloadCacheAll(){
var sReturn = RunJavaMethod("com.amarsoft.app.util.ReloadCacheConfigAction","reloadCacheAll","");
if(sReturn=="SUCCESS") alert("刷新成功!");
else alert("刷新失败!");
}
$("body").addClass("tree_show_in_view");
_Tree_Show_In_View = true;
startProduct();
</script>
<%@ include file="/IncludeEnd.jsp"%>