业务场景:
当某些组件不支持自定义查询时,那我们通过js脚本的custWatchs函数去调用自定义查询
实现方式
第一步:配置一个自定义查询
第二步:切换到js脚本,鼠标放到custWatchs函数这里,去点击调用自定义查询
第三步:设置条件和返回值的绑定值
//页面自定义观察函数{name:"data.字段",action:function(){}}
var custWatchs=[{name:"data.yjhd",action:function(val){
var self_=this;
var main=self_.data;
/**
* @param F_HDLX varchar
*/
this.invokeCustomQuery("chax",{"F_HDLX":main.htlx,"REF_ID_":JSON.parse(val).value},function(data){
//返回的数据 data:[{F_SYB_NAME,F_JXSMC,F_KSSJ,F_JSSJ,F_JHYF,F_SGYTCL,F_HDLX,F_WLMTHJZE,F_CZHJJE,F_SQJE,F_SPJE,F_hdlx,F_hdmc,F_cx,F_kssj,F_jssj,F_sl,F_dj,F_zk,F_je,F_HDLX_NAME}]
for(var i=0;i<data.length;i++){
var row=data[i];
main.syb=row.F_SYB_NAME;
main.jxsmc=row.F_JXSMC;
main.jhyf=row.F_JHYF;
main.sgytcl=row.F_SGYTCL;
var subrow={}
subrow.hdmc=row.F_hdmc;
subrow.cx=row.F_cx;
var kssj = new Date(row.F_kssj);
subrow.kssj=(kssj.getFullYear()) + "-" + (kssj.getMonth() + 1) + "-" + (kssj.getDate());
var jssj=new Date(row.F_jssj);
subrow.jssj=(jssj.getFullYear()) + "-" + (jssj.getMonth() + 1) + "-" + (jssj.getDate());
subrow.jhsl=row.F_sl;
subrow.dj=row.F_dj;
subrow.jhje=row.F_je;
subrow.zk=row.F_zk;
self_.data.sub__wlmtmx.push(subrow);
}
});
文档更新时间: 2021-10-26 12:06 作者:zhuyunyun