佰耐钢带--销售管理--销售合同显示权限设置(jc_saleorderqx.xml)
(1)图标
在编辑从表的data标签中:
<input-field name="icon" caption="" width="80"><!--图标栏-->
<input-field virtual="1" name="delrow" caption="删除该行" type="image" src="/images/delete.gif" οnclick="if(confirm('是否删除该行数据?')) deleteTableRow();"/>
<input-field virtual="1" name="copyrow" caption="复制添加" type="image" src="/images/copyadd.gif" οnclick="copyTableRow()"/>
</input-field>
但是在页面上并没有显示出来,原来问题出在对应的view中:?后面忘记了冒号。
<set-attribute key="limit.page.edit.exp">
op_edit ? : table.master.unresovle= $ table.detail.unresovle=delrow,copyrow:
</set-attribute>
(2)权限复制(这个比较复杂,我也说不清楚,只把部分代码记录一下)
权限复制按钮:
<set-attribute key="button.bt_copy"><![CDATA[value='权限复制(C)' accesskey='c' style="width:82" οnclick="showInterFrame1()"
]]></set-attribute>
对应的showInterFrame1()方法:
function showInterFrame1(){
var afterUrl=getRelativeURL('/open.do?listbean=bean_saleorderqx_list&bean=bean_saleorderqx_edit&data=ds_jc_saleorderqx_copy&field=personid&value=-2&src=/sale/baseinfo/saleorderqx_copy.vw');
document.all.queryIframe1.src = getRelativeURL(afterUrl);
showFrame('detailDiv1',true,"",true);
};
<!--销售合同显示权限设置修改页面-->
<view path="/sale/baseinfo/saleorderqx_copy.vw" title="销售合同显示权限复制" pagecode="jc_saleorderqx">
<include path="/frame/header.jsp"/>
<include path="/public/system_param.jsp"/>
<set-attribute key="edit.bean.name">bean_saleorderqx_edit</set-attribute>
<set-attribute key="edit.bean.dataname">ds_jc_saleorderqx_copy</set-attribute>
<set-attribute key="table.inputcount">1</set-attribute>
<form id="queryForm" name="queryForm" action="/sale/baseinfo/saleorderqx_copy_copy.vw" οnsubmit="return false;" οnkeydοwn="return onInputKeyboard();">
<set-attribute key="button">bt_save=$bt_back=</set-attribute>
<set-attribute key="button.bt_save"><![CDATA[value='复制(S)' accesskey='s' style="width:82" onClick="save_e(this)"
]]></set-attribute>
<set-attribute key="button.bt_back">value='返回(C)' accesskey='c' onClick="parent.hideFrame('detailDiv1');" style="width:82"</set-attribute>
<include path="/frame/edit_single_table.jsp"/>
</form>
<include path="/frame/footer.htm"/>
</view>
<!--销售合同显示权限设置拷贝数据的页面-->
<view path="/sale/baseinfo/saleorderqx_copy_copy.vw" title="销售合同显示权限设置" pagecode="jc_saleorderqx">
<set-attribute key="bean">bean_saleorderqx_edit</set-attribute>
<set-attribute key="mastdata">ds_jc_saleorderqx_copy</set-attribute>
<set-attribute key="listbean">bean_saleorderqx_list</set-attribute><!--列表bean-->
<set-attribute key="listdata">ds_saleorderqx_init</set-attribute><!--列表data-->
<set-attribute key="src">/sale/baseinfo/saleorderqx_copy.vw</set-attribute>
<set-attribute key="editKey">1</set-attribute>
<forward page="/baseinfo/saleorderqx_copy.do"/>
</view>
对应action:
<action path="/baseinfo/saleorderqx_copy" scope="request"
type="friends.erp.sale.baseinfo.SaleOrderQxCopy">
</action>
SaleOrderQxCopy.java文件
package friends.erp.sale.baseinfo;
import friends.webapp.action.*;
import friends.web.struts.*;
import friends.dataset.*;
import friends.web.data.*;
import friends.webapp.action.DefaultPostAction;
import friends.util.StringUtils;
import friends.util.MessageFormat;
import friends.pools.PoolFacade;
import friends.common.LoginBean;
import friends.web.struts.*;
import java.math.BigDecimal;
import java.util.*;
import friends.common.LoginBean;
import javax.servlet.http.HttpServletRequest;
public class SaleOrderQxCopy extends DefaultSaveAction{
public SaleOrderQxCopy()
{
super.isOnlyPost = true;
}
protected ActionForward afterDataPost(ActionData actionData, MemoryDataSet dsMaster,Data masterData, MemoryDataSet[] dsDetails, Data[] detailDatas) throws Exception{
LoginBean loginBean =LoginBean.getInstance(actionData.getRequest());
String src = (String)actionData.getAttribute("src","");
boolean isnew =dsMaster.isNew(0);
String id1=dsMaster.getValue("personid");
String id2=dsMaster.getValue("emp_personid");
String SQL1 = " SELECT DISTINCT a1.personid,a1.deptid FROM ( select d.personid,d.deptid from jc_saleorderqx j,jc_saleorderqx_d d where j.saleorderqxid=d.saleorderqxid(+) and j.personid="+id1
+ ")a1 MINUS "
+ "SELECT DISTINCT a1.personid,a1.deptid FROM ( select d.personid,d.deptid from jc_saleorderqx j,jc_saleorderqx_d d where j.saleorderqxid=d.saleorderqxid(+) and j.personid="+id2+") a1";
String SQL2 ="SELECT * FROM jc_saleorderqx WHERE 1<>1 ";
String SQL3 ="SELECT * FROM jc_saleorderqx_d WHERE 1<>1 ";
MemoryDataSet wu=new MemoryDataSet();
wu.setProvider(new MemoryDataSetProvider());
wu.setQueryString(SQL1);
wu.openDataSet();
String countA = dsMaster.getSequence("select count(*) from jc_saleorderqx where personid="+id2);
if(!countA.equals("0"))
SQL2 = "select * from jc_saleorderqx where personid="+id2;
MemoryDataSet wu2=new MemoryDataSet();
wu2.setProvider(new MemoryDataSetProvider());
wu2.setResolver(new MemoryDataSetResolver());
wu2.setQueryString(SQL2);
wu2.openDataSet();
if(countA.equals("0")){
String newsaleorderqxid = new MemoryDataSetProvider().getSequence("s_jc_saleorderqx");
wu2.insertRow(false);
wu2.setValue("saleorderqxid",newsaleorderqxid);
wu2.setValue("personid",id2);
//wu2.setValue("emp_personid",wu.getValue("bz"));
wu2.setValue("fgsid",loginBean.getFilialeId());
wu2.setValue("lawdate",loginBean.getCurrentDate());
wu2.setValue("lawer",loginBean.getUserName());
wu2.post();
}
MemoryDataSet wu3=new MemoryDataSet();
wu3.setProvider(new MemoryDataSetProvider());
wu3.setResolver(new MemoryDataSetResolver());
wu3.setQueryString(SQL3);
if(wu3.isOpen())
wu3.refresh();
else
wu3.openDataSet();
for(int i=0;i<wu.getRowCount();i++){
wu.goToRow(i);
wu3.insertRow(false);
wu3.setValue("saleorderqx_did",new MemoryDataSetProvider().getSequence("s_jc_saleorderqx_d"));
wu3.setValue("saleorderqxid",wu2.getValue("saleorderqxid"));
wu3.setValue("personid",wu.getValue("personid"));
wu3.setValue("deptid",wu.getValue("deptid"));
wu3.post();
}
wu2.saveChanges();
wu3.saveChanges();
processSuccess( actionData.getRequest(),"parent.location.reload();");
return new ActionForward(src);
}
protected void processSuccess(HttpServletRequest req,String script)
{
if(script.length() !=0){
script="<script langauge='javascript'>"+script+"</script>";
}
else return ;
if(script != null && script.length() > 0)
{
//创建一个保存ActionError的对象
ActionMessages msgs = new ActionMessages();
msgs.setIsCustom(true);
//"配置文件的message-mappings的message的key。
msgs.add(new ActionMessage(script));
//保存信息到request中, 网页可以用<pc:messages/>显示消息
saveMessages(req, msgs, true);
}
}
}