156 lines
6.1 KiB
Plaintext

<%@ page contentType="text/html; charset=GBK"%>
<%@page import="com.amarsoft.app.base.util.ObjectWindowHelper"%>
<%@page import="com.amarsoft.app.base.util.XMLHelper" %>
<%@page import="com.amarsoft.app.base.businessobject.*"%>
<%@include file="/Frame/resources/include/include_begin_list.jspf"%>
<%
String xmlFile = CurPage.getParameter("XMLFile");
String xmlTags = CurPage.getParameter("XMLTags");
String keys = CurPage.getParameter("Keys");
String componentRightType = CurPage.getParameter("ComponentRightType");
ASObjectWindow dwTemp = ObjectWindowHelper.createObjectWindow_List("PRD_ComponentList", BusinessObject.createBusinessObject(), CurPage, request);
ASDataObject doTemp=dwTemp.getDataObject();
doTemp.setBusinessProcess("com.amarsoft.app.als.businessobject.web.XMLBusinessObjectProcessor");
dwTemp.Style="1"; //设置为Grid风格
dwTemp.ReadOnly="0";
dwTemp.setPageSize(20);
dwTemp.genHTMLObjectWindow("");
String sButtons[][] = {
{(StringX.isEmpty(componentRightType) ? "true" : "false" ),"All","Button","新增","新增","newComponent()","","","","",""},
{"true","","Button","编辑","编辑","editComponent()","","","","",""},
{(xmlTags.indexOf("ChildrenComponent") > 0 ? "false" : "true"),"","Button","保存","保存","as_save(0)","","","","",""},
{(xmlTags.indexOf("ChildrenComponent") > 0 ? "false" : "true"),"","Button","复制","复制","copyComponent()","","","","",""},
{(StringX.isEmpty(componentRightType) ? "true" : "false" ),"All","Button","删除","删除","deleteComponent()","","","","",""},
{(xmlTags.indexOf("ChildrenComponent") > 0 ? "false" : "true"),"","Button","组件同步","组件同步","synchronize()","","","","",""},
};
%>
<div style="width: 100%;height: 100%;background-color: #CCC;display: none" id="input">
<div style="width: 200px;height: 150px;left: 30%;top:30%;position: relative;background-color: white">
<table style="margin-left: 30px; top: 10px;position: relative;">
<tr><td align="center">请输入新组件编号:</td></tr>
<tr><td><input type="text" id= "newComponentID"></td></tr>
<tr><td align="center">请输入新组件名称:</td></tr>
<tr><td><input type="text" id= "newComponentName"></td></tr>
<tr>
<td align="center"><input type="button" value="确认" onclick="doCopy();" >&nbsp;<input type="button" value="取消" onclick="doCancel();" ></td>
</tr>
</table>
</div>
</div>
<%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function newComponent(){
var width = top.document.body.offsetWidth-180;
var height = top.document.body.offsetHeight-100;
AsDialog.PopView("/ProductManage/ComponentConfig/ComponentLibraryInfo.jsp","XMLFile=<%=xmlFile%>&XMLTags=<%=xmlTags%> and ID=''&Keys=<%=keys%>&ID=",{width:width,height:height,title:'新增'},function(returnValue){
reloadSelf();
});
}
function editComponent(){
var id = getItemValue(0,getRow(0),"ID");
var format = getItemValue(0,getRow(0),"Format");
var width = top.document.body.offsetWidth-180;
var componentName = getItemValue(0,getRow(),"Name");
var height = top.document.body.offsetHeight-100;
if(typeof(id)=="undefined" || id.length==0) {
alert(getHtmlMessage('1'));//请选择一条信息!
return ;
}
if(<%=StringX.isEmpty(componentRightType)%>)
{
AsDialog.PopView("/ProductManage/ComponentConfig/ComponentLibraryInfo.jsp","XMLFile=<%=xmlFile%>&XMLTags=<%=xmlTags%> and ID='"+id+"'&Keys=<%=keys%>&ID="+id+"&Format="+format,{width:width,height:height,title:componentName},function(returnValue){
reloadSelf();
});
}else
{
AsDialog.PopView("/ProductManage/ComponentConfig/ComponentRule.jsp","XMLFile=<%=xmlFile%>&XMLTags=<%=xmlTags%> and ID='"+id+"'&Keys=<%=keys%>&ComponentID="+id+"&Format="+format+"&ComponentRightType=<%=componentRightType%>","dialogWidth:900px;dialogHeight:400px;resizable=no;scrollbars=yes;status:yes;maximize:no;help:no;");
}
}
//将组件同步到所有引用该组件的产品组件库中
function synchronize(){
var id = getItemValue(0,getRow(0),"ID");
if(typeof(id)=="undefined" || id.length==0) {
alert(getHtmlMessage('1'));//请选择一条信息!
return ;
}
if(confirm("确认同步引用该组件的产品吗?")){
var result =AsCredit.RunJavaMethodTrans("com.amarsoft.app.als.businesscomponent.config.BusinessComponentManager", "sync", "XMLFile=<%=xmlFile%>,XMLTags=<%=xmlTags%>,Keys=<%=keys%>,ComponentID="+id);
if(result=="true") alert("同步完成!");
else alert("同步失败!");
}
}
function deleteComponent(){
var id = getItemValue(0,getRow(0),"ID");
if(typeof(id)=="undefined" || id.length==0) {
alert(getHtmlMessage('1'));//请选择一条信息!
return ;
}
as_delete(0);
}
function copyComponent(){
var id = getItemValue(0,getRow(0),"ID");
if(typeof(id)=="undefined" || id.length==0) {
alert(getHtmlMessage('1'));//请选择一条信息!
return ;
}
$("#input").show();
}
function doCopy(){
$("#input").hide();
var newID = $("#newComponentID").val();
var newName = $("#newComponentName").val();
var id = getItemValue(0,getRow(0),"ID");
if(typeof(id)=="undefined" || id.length==0) {
alert(getHtmlMessage('1'));//请选择一条信息!
return ;
}
if(typeof(newID)=="undefined" || newID.length==0) {
alert("请输入新的组件编号!");
return;
}
if(typeof(newName)=="undefined" || newName.length==0) {
alert("请输入新的组件名称!");
return;
}
var result = AsCredit.RunJavaMethodTrans("com.amarsoft.app.als.businesscomponent.config.BusinessComponentManager",
"copyComponent","XMLFile=<%=xmlFile%>,XMLTags=<%=xmlTags%>,Keys=<%=keys%>,ComponentID="+id+",NewComponentID="+newID+",NewComponentName="+newName );
if(result){
result=result.split("@");
if(result[0]=="true"){
alert(result[1]);
reloadSelf();
}
else{
alert(result[1]);
}
}
}
function doCancel(){
$("#input").hide();
$("#newComponentID").val("");
$("#newComponentName").val("");
}
$(document).ready(function(){
//非数据库表数据操作,请加入以下代码
for(var i=0;i<DZ[0][1].length;i++){
TableFactory.ColKeyIndexs[TableFactory.ColKeyIndexs.length] = i;
}
});
</script>
<%@include file="/Frame/resources/include/include_end.jspf"%>