90 lines
3.7 KiB
Java
90 lines
3.7 KiB
Java
package tqq9.lc123.cloud.app.plugin.form.sys;
|
|
|
|
import kd.bos.bill.AbstractBillPlugIn;
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
import kd.bos.dataentity.utils.StringUtils;
|
|
import kd.bos.form.FormShowParameter;
|
|
import kd.bos.form.control.AttachmentPanel;
|
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
import kd.bos.form.operate.FormOperate;
|
|
import kd.bos.orm.query.QCP;
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
|
import kd.sdk.plugin.Plugin;
|
|
|
|
import java.util.EventObject;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 附件上传界面插件
|
|
*/
|
|
public class upattAchmentBillPlugin extends AbstractBillPlugIn implements Plugin {
|
|
|
|
@Override
|
|
public void registerListener(EventObject e) {
|
|
super.registerListener(e);
|
|
this.addItemClickListeners("tqq9_toolbarap");
|
|
}
|
|
|
|
|
|
/**
|
|
* 由商品批次注册证管理界面跳转此界面,选择附件后回传相关信息
|
|
*/
|
|
// @Override
|
|
// public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
|
// super.afterDoOperation(afterDoOperationEventArgs);
|
|
// String itemKey = afterDoOperationEventArgs.getOperateKey();
|
|
// if (StringUtils.equals("dothing", itemKey)) {
|
|
// FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
|
// String buttontype = formShowParameter.getCustomParam("buttontype").toString();
|
|
// String id = formShowParameter.getCustomParam("id").toString();
|
|
// AttachmentPanel tqq9_attachmentpanelap = this.getView().getControl("tqq9_attachmentpanelap");
|
|
// List<Map<String, Object>> attachmentData = tqq9_attachmentpanelap.getAttachmentData();
|
|
// HashMap<String, Object> map = new HashMap<>();
|
|
// map.put("attachmentData", attachmentData);
|
|
// map.put("buttontype", buttontype);
|
|
// map.put("id", id);
|
|
// this.getView().returnDataToParent(map);
|
|
// this.getView().close();
|
|
//
|
|
// }
|
|
// }
|
|
|
|
/**
|
|
* 由商品批次注册证管理界面跳转此界面,选择附件后回传相关信息
|
|
*/
|
|
@Override
|
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
|
super.beforeDoOperation(args);
|
|
FormOperate formOperate = (FormOperate)args.getSource();
|
|
if ( StringUtils.equals( "save", formOperate.getOperateKey())){
|
|
DynamicObject dataEntity = this.getModel().getDataEntity();
|
|
long currentUserId = UserServiceHelper.getCurrentUserId();
|
|
DynamicObject user = BusinessDataServiceHelper.loadSingle("bos_user", new QFilter[]{new QFilter("id", QCP.equals, currentUserId)});
|
|
long timestamp = System.currentTimeMillis();
|
|
String number = String.valueOf(timestamp);
|
|
dataEntity.set("number",number);
|
|
dataEntity.set("status","A");
|
|
dataEntity.set("creator",user);
|
|
dataEntity.set("enable","1");
|
|
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
|
String buttontype = formShowParameter.getCustomParam("buttontype").toString();
|
|
String id = formShowParameter.getCustomParam("id").toString();
|
|
AttachmentPanel tqq9_attachmentpanelap = this.getView().getControl("tqq9_attachmentpanelap");
|
|
List<Map<String, Object>> attachmentData = tqq9_attachmentpanelap.getAttachmentData();
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
map.put("attachmentData", attachmentData);
|
|
map.put("buttontype", buttontype);
|
|
map.put("id", id);
|
|
this.getView().returnDataToParent(map);
|
|
this.getView().close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
} |