介绍
列表自定义按钮弹出关联选择数据,将选择的数据写入列表
详细步骤
1.在按钮配置中增加弹出关联选择按钮,并授权
2.注册按钮单击事件,编写代码
3.最终效果
相关代码
const {Modal} = JE.useUi();
const { ajax } = JE.useUtils();
const {$func} = EventOptions;
const { showFuncSelect } = JE.useSystem();
//弹出关联选择功能数据
showFuncSelect({
title:'选择数据',
configInfo:"JE_DEMO_JDAL,,,M",
//筛选项目状态是执行中的数据
querys:[{"type":"=","code":"JDAL_XMZT_CODE","value":"ZXZ","cn":"and"}],
callback:({rows})=>{
// 写自己的业务逻辑,rows是选中的数据
if(rows && rows.length>0){
//循环已选择数据
rows.forEach((data)=>{
//Ajax调运保存方法,将已选择数据写入当前功能
ajax({
url:"/je/common/doSave",
params:{
funcCode: "JE_DEMO_JDAL_LISTBTN",
tableCode: "JE_DEMO_JDAL",
JDAL_XMMC:data.JDAL_XMMC,
JDAL_XMZE:data.JDAL_XMZE,
JDAL_XMZT_CODE:data.JDAL_XMZT_CODE,
JDAL_XMZT_NAME:data.JDAL_XMZT_NAME,
JDAL_XMJD:data.JDAL_XMJD,
JDAL_XMJL:data.JDAL_XMJL,
JDAL_XMJLR:data.JDAL_XMJLR,
JDAL_XMKSSJ:data.JDAL_XMKSSJ,
JDAL_XMJSSJ:data.JDAL_XMJSSJ,
JDAL_XMJFSJ:data.JDAL_XMJFSJ,
codeGenFieldInfo: JSON.stringify([{code:"JDAL_XMBM",configInfo:"[{\"qzfs\":\"CL\",\"dyz\":\"XM\",\"gs\":\"\",\"jqws\":\"\",\"cd\":\"\",\"qsh\":\"\",\"bc\":\"\",\"zq\":\"\",\"index\":1},{\"qzfs\":\"QJBL\",\"dyz\":\"@NOW_DATE@\",\"gs\":\"yyyyMMdd\",\"jqws\":\"0,6\",\"cd\":\"\",\"qsh\":\"\",\"bc\":\"\",\"zq\":\"\",\"index\":2},{\"qzfs\":\"LSH\",\"dyz\":\"FUNC\",\"gs\":\"\",\"jqws\":\"\",\"cd\":4,\"qsh\":\"1\",\"bc\":1,\"zq\":\"DAY\",\"index\":3}]",funcId:"hN9FQQlFudzoChzcMlC",funcCode:"JE_DEMO_JDAL_LISTBTN",funcName:"列表按钮操作",tableCode:"JE_DEMO_JDAL"}])
}, headers:{pd:"demo"}
}).then((resObj)=>{
if(resObj.success){
Modal.notice("操作成功", "success");
//刷新列表
$func.getFuncGrid().store.reload();
}else{
Modal.alert(resObj.obj, "error");
}
});
})
}else{
Modal.alert("请选择数据!", "error");
return false;
}
}
});
最后编辑: 呼丽华 文档更新时间: 2024-11-08 17:00 作者:呼丽华