第12节 入库管理级联控制
实现:根据切换采购合同单号来实时更新(切换)对应的子表信息
(1)进入数据源,新增接口(名称:查询合同下的商品;路径:/get-contact-products)
//里面的字段要与入库明细表的字段相同,因为查询入库明细接口和该接口是共用同一张数据表,而且这些字段必须存在!!!像‘0 as currentAdd’即使返回的是0也要返回出来!!
var contractId = body.contractId;
var sql = select<br /> b.product_name productName,b.spec_code specCode,c.type_name typeName,d.unit_code unitCode,<br /> 0 as currentAdd,b.count as storeCount, a.purchase_num purchaseNum,a.purchase_price purchasePrice,a.remark,b.id productId <br /> from mes.wms_pur_list a, mes.wms_product b,mes.wms_product_class c,mes.wms_unit_code d <br /> where a.product_id=b.id and b.product_class_id = c.id and b.unit_code_id=d.id <br /> and a.contract_id=#{contractId} <br />
return db.pager(sql,{contractId:contractId})
(2)回到采购入库页面,为采购合同单号字段的组件添加changeContract事件
编写事件
MC.ref(“stockDetailTable”).apiSetData(response);
(3)编写完成后,返回子表,为子表设置VUE——ref(stockDetailTable)
点击运行查看运行结果

