UNPKG

flexbiz-server

Version:

Flexible Server

4 lines (3 loc) 999 B
'use strict';var model=global.getModel("bds_building"),trangthai=global.getModel("trangthai");const controller=require("../../controllers/controller"),async=require("async"),dmdt=global.getModel("dmdt"); var building=function($router$$){(new controller($router$$,model,"building",{sort:{stt:1,building_name:1},unique:["building_code"],notNeedRight:($user$$,$options$$={})=>"view"==($options$$.action||"").toLowerCase()?!0:!1,onView:($user$$,$result$$,$fn$$)=>{async.series({dt:function($callback$$){$result$$.filter($r$$=>$r$$.ma_dt).joinModel2(null,dmdt,{where:{id_app:"id_app",ma_dt:"ma_dt"},fields:["ten_dt","tinh_thanh","quan_huyen","dia_chi"]},function($kq$$){$callback$$(null,$kq$$)})},trangthai:$callback$$=> {$result$$.joinModel2(null,trangthai,[{where:$a$$=>({ma_ct:"BUILDING",ma_trang_thai:$a$$.trang_thai}),fields:["ten_trang_thai","color"]}],function(){$callback$$()})}},function($error$$){if($error$$)return $fn$$($error$$);$fn$$(null,$result$$)})}})).route()};module.exports=building;