设备台账列表界面插件重写

This commit is contained in:
zhangzhiguo 2025-11-24 17:24:25 +08:00
parent 3f76f9b4dd
commit a54d746552
1 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,64 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.OperationStatus;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.form.FormShowParameter;
import kd.bos.form.ShowType;
import kd.bos.form.events.BeforeExportFileEvent;
import kd.bos.form.events.HyperLinkClickArgs;
import kd.bos.mvc.list.ListView;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
/**
* 设备台账列表界面插件重写
*/
public class EquipmentCardListPluginExt extends EquipmentCardListPlugin{
public void registerListener(EventObject e) {
super.registerListener(e);
}
public void billListHyperLinkClick(HyperLinkClickArgs args) {
super.billListHyperLinkClick(args);
String fieldName = args.getHyperLinkClickEvent().getFieldName();
if (StringUtils.equalsIgnoreCase(fieldName, "number")) {
this.toEquipInfoView(args);
}
}
protected void toEquipInfoView(HyperLinkClickArgs args) {
Map<String, Object> map = new HashMap();
ListView view = (ListView)this.getView();
Object focusRowPkId = view.getFocusRowPkId();
DynamicObject equipment = BusinessDataServiceHelper.loadSingle(focusRowPkId, "eceq_equipment_card");
String status = equipment.getString("billstatus");
if (StringUtils.equals(status, "C")) {
map.put("formId", "eceq_equipinfo");
map.put("pkId", focusRowPkId.toString());
FormShowParameter parameter = FormShowParameter.createFormShowParameter(map);
parameter.setAppId("eceq");
//parameter.setStatus(OperationStatus.VIEW);
parameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
this.getView().showForm(parameter);
args.setCancel(true);
}
}
public void beforeExportFile(BeforeExportFileEvent e) {
super.beforeExportFile(e);
String oldName = e.getFileName();
String[] nameSplit = oldName.split("_");
if (ResManager.loadKDString("新增设备", "EquipmentCardListPlugin_0", "ec-eceq-formplugin", new Object[0]).equals(nameSplit[1])) {
nameSplit[1] = ResManager.loadKDString("设备台账", "EquipmentCardListPlugin_1", "ec-eceq-formplugin", new Object[0]);
}
e.setFileName(String.join("_", nameSplit));
}
}