json.data do json.array! @data do |d| json.id d.id json.staff d.staff.user.real_name json.clazz EducodeSales::SalePlan::CLAZZ_NAME.invert[d.clazz] json.year d.year json.business_name d.business.name json.department d.business.department&.name json.school d.business.department&.school&.name json.stage d.business.last_follow_up&.stage&.name json.staff_manages d.business.last_follow_up&.assign_follow_ups.present? ? (d.business.last_follow_up.assign_follow_ups.map{ |d| d.staff.user.real_name}.join("、")) : d.business.staff&.user&.real_name json.created_at d.created_at.to_s json.sale_way d.business.last_follow_up&.place&.name.present? ? '渠道' : '直销' json.budget_amount d.business&.last_follow_up ? d.business.last_follow_up.budget_amount.to_f.round(2) : 0 json.plan_bid_on d.plan_bid_on json.plan_sign_on d.plan_sign_on json.bidded_amount d.bidded_amount json.plan_sign_on d.plan_sign_on json.actual_sign_on d.actual_sign_on json.sign_amount d.sign_amount json.plan_deploy_on d.plan_deploy_on json.actual_deploy_on d.actual_deploy_on json.plan_check_on d.plan_check_on json.actual_check_on d.actual_check_on json.prepayment_plan_on d.prepayment_plan_on json.prepayment_actual_on d.prepayment_actual_on json.prepayment_amount d.prepayment_amount json.check_fee_plan_on d.check_fee_plan_on json.check_fee_actual_on d.check_fee_actual_on json.check_fee d.check_fee json.qa_plan_on d.qa_plan_on json.qa_actual_on d.qa_actual_on json.qa_amount d.qa_amount json.account_receivable d.account_receivable json.account_receivable_clazz d.account_receivable_clazz json.invoice_amount d.invoice_amount json.business_clazz d.business.clazz&.name || "" if d.business&.department&.school json.property d.business.department.school.school_tags.where(for_missions: true).pluck(:name).join("、") else json.property '' end end end json.code 0 json.count @data.total_count