优化支出合同列表收入合同编码超链接点击跳转逻辑

This commit is contained in:
xuhaihui 2025-10-14 17:34:16 +08:00
parent 7ee2e9a60b
commit c4afa4df04
2 changed files with 45 additions and 24 deletions

View File

@ -0,0 +1,40 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.BillOperationStatus;
import kd.bos.bill.BillShowParameter;
import kd.bos.bill.OperationStatus;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.form.ShowType;
import kd.bos.form.events.HyperLinkClickArgs;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.mvc.list.ListView;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.ec.basedata.common.utils.OpenPageUtils;
import org.apache.commons.lang3.StringUtils;
/**
* 支出合同列表插件
* 说明收入合同编码超链接点击跳转
*/
public class OutContractListPlugin extends AbstractListPlugin {
public void billListHyperLinkClick(HyperLinkClickArgs args) {
super.billListHyperLinkClick(args);
String fieldName = args.getFieldName();
if (StringUtils.equals(fieldName, "incontract_number")) {
//收入合同编码
args.setCancel(true);
ListView viewList = (ListView) this.getView();
Object measureId = viewList.getFocusRowPkId();
String billFormId = viewList.getBillFormId();
DynamicObject measure = BusinessDataServiceHelper.loadSingle(measureId, billFormId, "incontract");//收支合同
DynamicObject inContract = measure.getDynamicObject("incontract");//收入合同
DynamicObject ec_all_contract_f7 = BusinessDataServiceHelper.loadSingle(inContract.getPkValue(), "ec_all_contract_f7", "id,number");//收入支出合同f7
QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.equals, ec_all_contract_f7.get("number")).and("paydirection", "=", "in")};
DynamicObject ec_in_contract = BusinessDataServiceHelper.loadSingle("ec_in_contract", "id", qFilters);
BillShowParameter billShowParameter = OpenPageUtils.buildBillShowParam(ec_in_contract.getPkValue(), "ec_in_contract", BillOperationStatus.VIEW, OperationStatus.EDIT, ShowType.MainNewTabPage);
this.getView().showForm(billShowParameter);
}
}
}

View File

@ -3,37 +3,36 @@ package zcgj.zcdev.zcdev.pr.plugin.form;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.greenpineyu.fel.common.NumberUtil;
import kd.bos.bill.BillShowParameter;
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.entity.datamodel.ListSelectedRow;
import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.form.CloseCallBack;
import kd.bos.form.FormMetadataCache;
import kd.bos.form.FormShowParameter;
import kd.bos.form.ShowType;
import kd.bos.form.control.events.BeforeItemClickEvent;
import kd.bos.form.control.events.ItemClickEvent;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.events.BillListHyperLinkClickEvent;
import kd.bos.form.events.HyperLinkClickArgs;
import kd.bos.form.events.HyperLinkClickEvent;
import kd.bos.form.operate.FormOperate;
import kd.bos.list.BillList;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.mvc.bill.BillModel;
import kd.bos.mvc.list.ListView;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.ec.basedata.common.utils.OpenPageUtils;
import kd.fi.dhc.util.BillShowParameterUtil;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import java.util.*;
/**
* 支出合同列表插件
*/
public class RenewalContractBillPlugin extends AbstractListPlugin {
@ -69,24 +68,6 @@ public class RenewalContractBillPlugin extends AbstractListPlugin {
this.addItemClickListeners("tbmain");//监听按钮
}
public void billListHyperLinkClick(HyperLinkClickArgs args) {
super.billListHyperLinkClick(args);
String fielldName = args.getHyperLinkClickEvent().getFieldName();
if (StringUtils.equals(fielldName, "incontract_number")) {
//收入合同编码
args.setCancel(true);
ListSelectedRow selectRow = ((BillList) this.getControl("billlistap")).getCurrentSelectedRowInfo();
Long selectId = (Long) selectRow.getPrimaryKeyValue();
DynamicObject ec_in_contract = QueryServiceHelper.queryOne("ec_in_contract", "id", new QFilter[]{new QFilter("id", "=", selectId)});//收入合同
if (ec_in_contract == null) {
this.getView().showTipNotification(ResManager.loadKDString("您选择的数据已被删除", "MyBillListPlugin_5", "fi-dhc-formplugin", new Object[0]));
} else {
BillShowParameter billShowParameter = OpenPageUtils.buildBillShowParam(selectId, "ec_in_contract");//收入合同
this.getView().showForm(billShowParameter);//打开收入合同
}
}
}
@Override
public void itemClick(ItemClickEvent evt) {
String itemKey = evt.getItemKey();