This commit is contained in:
luofei 2023-07-20 17:56:46 +08:00
commit 9140a4d4ea

View File

@ -18,7 +18,7 @@ namespace app\adminapi\lists\contract;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\contract\Contract;
use app\common\lists\ListsSearchInterface;
use think\facade\Db;
/**
* Contract列表
@ -56,10 +56,16 @@ class ContractLists extends BaseAdminDataLists implements ListsSearchInterface
public function lists(): array
{
return Contract::where($this->searchWhere)->with(['companyName','partyA','contractType'])
->field(['id', 'company_id', 'contract_type', 'contract_no', 'status', 'party_a', 'party_b', 'area_manager'])
// ->field(['id', 'company_id', 'contract_type', 'contract_no', 'status', 'party_a', 'party_b', 'area_manager'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->select()->each(function ($item, $key) {
if($item->type==1){
$item->party_b_name=Db::name('company')->where('id',$item->party_b)->value('company_name');
}else{
$item->party_b_name=Db::name('admin')->where('id',$item->party_b)->value('name');
}
})
->toArray();
}