['supplier_id', 'warehouse_id', 'store_id'], '%like' => ['code'], 'between_time' => 'create_time' ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author admin * @date 2025/03/10 11:08 */ public function lists(): array { return OutboundOrder::where($this->searchWhere) ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'type', 'oid', 'admin_id', 'batch', 'order_type', 'code', 'mark', 'nums', 'purchase', 'total_price', 'completed_amount', 'outstanding_amount', 'create_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) { if ($item->store_id) { $item->system_store = SystemStore::where('id', $item->store_id)->value('name'); } else { $item->system_store = ''; } if ($item->admin_id) { $item->admin_name = Admin::where('id', $item->admin_id)->value('name'); } else { $item->admin_name = ''; } if ($item->warehouse_id) { $item->warehouse_name = Warehouse::where('id', $item->warehouse_id)->value('name'); } else { $item->warehouse_name = ''; } if ($item->supplier_id) { $item->supplier_name = Supplier::where('id', $item->supplier_id)->value('name'); }else{ $item->supplier_name = ''; } if (!empty($item['order_type'])) { $item->order_type_name = OrderEnum::getOrderTypeName($item->order_type); } else { $item->order_type_name = ''; } }) ->toArray(); } /** * @notes 获取数量 * @return int * @author admin * @date 2025/03/10 11:08 */ public function count(): int { return OutboundOrder::where($this->searchWhere)->count(); } }