UNPKG

flexbiz-server

Version:

Flexible Server

5 lines (4 loc) 1.78 kB
const model=global.getModel("ctds2"),controller=require("../../controllers/controller"),dmkho=global.getModel("dmkho"),dvcs=global.getModel("dvcs"),dmnv=global.getModel("dmnv"),group=global.getModel("group"),dmbp=global.getModel("dmbp"),dmdt=global.getModel("dmdt"),dmphi=global.getModel("dmphi"),async=require("async"),ctds=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"ctds2",{sort:{group_id:1,ma_dvcs:1,ma_kho:1}});$contr_router$$.route();$contr_router$$.view=function($user$$, $result$$,$fn$$){let $id_app$$=$user$$.current_id_app;async.series({dv:function($callback$$){$result$$.filter($r$$=>$r$$.ma_dvcs).joinModel2($id_app$$,dvcs,{where:"ma_dvcs",fields:{ten_dvcs:"ten_dvcs"}},function(){$callback$$()})},kho:function($callback$$){$result$$.filter($r$$=>$r$$.ma_kho).joinModel2($id_app$$,dmkho,{where:"ma_kho",fields:{ten_kho:"ten_kho"}},function(){$callback$$()})},nv:function($callback$$){$result$$.filter($r$$=>$r$$.ma_nv).joinModel2($id_app$$,dmnv,{where:"ma_nv",fields:{ten_nv:"ten_nv"}}, function(){$callback$$()})},dmbp:function($callback$$){$result$$.filter($r$$=>$r$$.ma_bp).joinModel2($id_app$$,dmbp,{where:"ma_bp",fields:{ten_bp:"ten_bp"}},function(){$callback$$()})},dmdt:function($callback$$){$result$$.filter($r$$=>$r$$.ma_dt).joinModel2($id_app$$,dmdt,{where:"ma_dt",fields:{ten_dt:"ten_dt"}},function(){$callback$$()})},dmphi:function($callback$$){$result$$.filter($r$$=>$r$$.ma_phi).joinModel2($id_app$$,dmphi,{where:"ma_phi",fields:{ten_phi:"ten_phi"}},function(){$callback$$()})}, group:function($callback$$){$result$$.filter($r$$=>$r$$.group_id).joinModel2($id_app$$,group,{where:{group_id:"_id"},fields:{group_name:"group_name"}},function(){$callback$$()})}},function(){$fn$$(null,$result$$)})}};module.exports=ctds;