UNPKG

flexbiz-server

Version:

Flexible Server

6 lines (5 loc) 2.09 kB
const model=global.getModel("kbmbcqt"),customer=global.getModel("customer"),dmkho=global.getModel("dmkho"),dmnv=global.getModel("dmnv"),dmbp=global.getModel("dmbp"),dmdt=global.getModel("dmdt"),contract=global.getModel("contract"),controller=require("../../controllers/controller"),async=require("async"); module.exports=$router$$=>{(new controller($router$$,model,"kbmbcqt",{sort:{stt:1,ma_so:1},unique:["id_rptform","ma_so"],notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,onView:($user$$,$items$$,$next$$)=>{async.parallel({details_kh:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel2($user$$.current_id_app,customer,[{where:"ma_kh",fields:[{name:"ten_kh",value:"ten_kh"}]}],function(){$callback1$$()})},function(){$callback$$()})}, details_kho:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel2($user$$.current_id_app,dmkho,[{where:"ma_kho",fields:[{name:"ten_kho",value:"ten_kho"}]}],function(){$callback1$$()})},function(){$callback$$()})},details_bp:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel2($user$$.current_id_app,dmbp,[{where:"ma_bp",fields:["ten_bp"]}],function(){$callback1$$()})},function(){$callback$$()})},details_nv:function($callback$$){async.mapLimit($items$$, 20,function($r$$,$callback1$$){$r$$.details.joinModel2($user$$.current_id_app,dmnv,[{where:"ma_nv",fields:["ten_nv"]}],function(){$callback1$$()})},function(){$callback$$()})},details_dt:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel2($user$$.current_id_app,dmdt,[{where:"ma_dt",fields:["ten_dt"]}],function(){$callback1$$()})},function(){$callback$$()})},details_hd:function($callback$$){async.mapLimit($items$$,20,function($r$$,$callback1$$){$r$$.details.joinModel2($user$$.current_id_app, contract,[{where:{ma_hd:"so_hd"},fields:["ten_hd"]}],function(){$callback1$$()})},function(){$callback$$()})}},function(){$next$$(null,$items$$)})}})).route()};