UNPKG

flexbiz-server

Version:

Flexible Server

4 lines (3 loc) 1.25 kB
const model=global.getModel("hanmucton"),controller=require("../../controllers/controller"),dvcs=global.getModel("dvcs"),dmvt=global.getModel("dmvt"),dmkho=global.getModel("dmkho"),async=require("async"),hanmucton=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"hanmucton",{sort:{ma_dvcs:1,ma_kho:1,ma_vt:1,han_sd:1},unique:"ma_dvcs ma_kho ma_vt ma_lo ma_tt1 ma_tt2 ma_tt3".split(" ")});$contr_router$$.route();$contr_router$$.view=function($user$$,$result$$,$fn$$){const $id_app$$= $user$$.current_id_app;async.parallel({dvcs:function($callback$$){$result$$.filter($r$$=>$r$$.ma_dvcs).joinModel2($id_app$$,dvcs,[{where:{ma_dvcs:"_id"},fields:[{name:"ten_dvcs",value:"ten_dvcs"}]}],function($kq$$){$callback$$(null,$kq$$)})},vt:function($callback$$){$result$$.filter($r$$=>$r$$.ma_vt).joinModel2($id_app$$,dmvt,[{where:"ma_vt",fields:[{name:"ten_vt",value:"ten_vt"}]}],function($kq$$){$callback$$(null,$kq$$)})},kho:function($callback$$){$result$$.filter($r$$=>$r$$.ma_kho).joinModel2($id_app$$, dmkho,[{where:"ma_kho",fields:[{name:"ten_kho",value:"ten_kho"}]}],function($kq$$){$callback$$(null,$kq$$)})}},function($error$$){if($error$$)return $fn$$($error$$);$fn$$(null,$result$$)})}};module.exports=hanmucton;