json.data do json.array! @assessments do |assessment| # 目标任务 json.name assessment.staff.user.real_name json.id assessment.id json.annual assessment.annual.to_f json.first_quarter assessment.first_quarter.to_f json.january assessment.january.to_f json.february assessment.february.to_f json.march assessment.march.to_f json.second_quarter assessment.second_quarter.to_f json.april assessment.april.to_f json.may assessment.may.to_f json.june assessment.june.to_f json.third_quarter assessment.third_quarter.to_f json.july assessment.july.to_f json.august assessment.august.to_f json.september assessment.september.to_f json.fourth_quarter assessment.fourth_quarter.to_f json.october assessment.october.to_f json.november assessment.november.to_f json.december assessment.december.to_f # 实际任务 json.annual_progress assessment.annual_progress.to_f json.first_quarter_progress assessment.first_quarter_progress.to_f json.january_progress assessment.january_progress.to_f json.february_progress assessment.february_progress.to_f json.march_progress assessment.march_progress.to_f json.second_quarter_progress assessment.second_quarter_progress.to_f json.april_progress assessment.april_progress.to_f json.may_progress assessment.may_progress.to_f json.june_progress assessment.june_progress.to_f json.third_quarter_progress assessment.third_quarter_progress.to_f json.july_progress assessment.july_progress.to_f json.august_progress assessment.august_progress.to_f json.september_progress assessment.september_progress.to_f json.fourth_quarter_progress assessment.fourth_quarter_progress.to_f json.october_progress assessment.october_progress.to_f json.november_progress assessment.november_progress.to_f json.december_progress assessment.december_progress.to_f # 差值 dif json.annual_dif assessment.annual.to_f - assessment.annual_progress.to_f json.first_quarter_dif assessment.first_quarter.to_f - assessment.first_quarter_progress.to_f json.january_dif assessment.january.to_f - assessment.january_progress.to_f json.february_dif assessment.february.to_f - assessment.february_progress.to_f json.march_dif assessment.march.to_f - assessment.may_progress.to_f json.second_quarter_dif assessment.second_quarter.to_f - assessment.second_quarter_progress.to_f json.april_dif assessment.april.to_f - assessment.april_progress.to_f json.may_dif assessment.may.to_f - assessment.may_progress.to_f json.june_dif assessment.june.to_f - assessment.june_progress.to_f json.third_quarter_dif assessment.third_quarter.to_f - assessment.third_quarter_progress.to_f json.july_dif assessment.july.to_f - assessment.july_progress.to_f json.august_dif assessment.august.to_f - assessment.august_progress.to_f json.september_dif assessment.september.to_f - assessment.september_progress.to_f json.fourth_quarter_dif assessment.fourth_quarter.to_f - assessment.fourth_quarter_progress.to_f json.october_dif assessment.october.to_f - assessment.october_progress.to_f json.november_dif assessment.november.to_f - assessment.november_progress.to_f json.december_dif assessment.december.to_f - assessment.december_progress.to_f # 完成率completion_rate json.annual_rate completion_rate(assessment.annual, assessment.annual_progress) json.first_quarter_rate completion_rate(assessment.first_quarter, assessment.first_quarter_progress) json.january_rate completion_rate(assessment.january,assessment.january_progress) json.february_rate completion_rate(assessment.february,assessment.february_progress) json.march_rate completion_rate(assessment.march, assessment.march_progress) json.second_quarter_rate completion_rate(assessment.second_quarter, assessment.second_quarter_progress) json.april_rate completion_rate(assessment.april, assessment.april_progress) json.may_rate completion_rate(assessment.may, assessment.may_progress) json.june_rate completion_rate(assessment.june, assessment.june_progress) json.third_quarter_rate completion_rate(assessment.third_quarter, assessment.third_quarter_progress) json.july_rate completion_rate(assessment.july,assessment.july_progress) json.august_rate completion_rate(assessment.august,assessment.august_progress) json.september_rate completion_rate(assessment.september,assessment.september_progress) json.fourth_quarter_rate completion_rate(assessment.fourth_quarter,assessment.fourth_quarter_progress) json.october_rate completion_rate(assessment.october,assessment.october_progress) json.november_rate completion_rate(assessment.november,assessment.november_progress) json.december_rate completion_rate(assessment.december,assessment.december_progress) # 得分_score if assessment.assessment == 1 json.assessment '签单金额' json.annual_score signed_amount_score(assessment.annual, assessment.annual_progress) json.first_quarter_score signed_amount_score(assessment.first_quarter, assessment.first_quarter_progress) json.january_score signed_amount_score(assessment.january,assessment.january_progress) json.february_score signed_amount_score(assessment.february,assessment.february_progress) json.march_score signed_amount_score(assessment.march, assessment.march_progress) json.second_quarter_score signed_amount_score(assessment.second_quarter, assessment.second_quarter_progress) json.april_score signed_amount_score(assessment.april, assessment.april_progress) json.may_score signed_amount_score(assessment.may, assessment.may_progress) json.june_score signed_amount_score(assessment.june, assessment.june_progress) json.third_quarter_score signed_amount_score(assessment.third_quarter, assessment.third_quarter_progress) json.july_score signed_amount_score(assessment.july,assessment.july_progress) json.august_score signed_amount_score(assessment.august,assessment.august_progress) json.september_score signed_amount_score(assessment.september,assessment.september_progress) json.fourth_quarter_score signed_amount_score(assessment.fourth_quarter,assessment.fourth_quarter_progress) json.october_score signed_amount_score(assessment.october,assessment.october_progress) json.november_score signed_amount_score(assessment.november,assessment.november_progress) json.december_score signed_amount_score(assessment.december,assessment.december_progress) elsif assessment.assessment == 2 json.assessment '回款金额' json.annual_score collection_amount_score(assessment.annual, assessment.annual_progress) json.first_quarter_score collection_amount_score(assessment.first_quarter, assessment.first_quarter_progress) json.january_score collection_amount_score(assessment.january,assessment.january_progress) json.february_score collection_amount_score(assessment.february,assessment.february_progress) json.march_score collection_amount_score(assessment.march, assessment.march_progress) json.second_quarter_score collection_amount_score(assessment.second_quarter, assessment.second_quarter_progress) json.april_score collection_amount_score(assessment.april, assessment.april_progress) json.may_score collection_amount_score(assessment.may, assessment.may_progress) json.june_score collection_amount_score(assessment.june, assessment.june_progress) json.third_quarter_score collection_amount_score(assessment.third_quarter, assessment.third_quarter_progress) json.july_score collection_amount_score(assessment.july,assessment.july_progress) json.august_score collection_amount_score(assessment.august,assessment.august_progress) json.september_score collection_amount_score(assessment.september,assessment.september_progress) json.fourth_quarter_score collection_amount_score(assessment.fourth_quarter,assessment.fourth_quarter_progress) json.october_score collection_amount_score(assessment.october,assessment.october_progress) json.november_score collection_amount_score(assessment.november,assessment.november_progress) json.december_score collection_amount_score(assessment.december,assessment.december_progress) elsif assessment.assessment == 3 json.assessment '拜访量' json.annual_score visits_score(assessment.annual_progress) json.first_quarter_score visits_score(assessment.first_quarter_progress) json.january_score visits_score(assessment.january_progress) json.february_score visits_score(assessment.february_progress) json.march_score visits_score(assessment.march_progress) json.second_quarter_score visits_score(assessment.second_quarter_progress) json.april_score visits_score(assessment.april_progress) json.may_score visits_score(assessment.may_progress) json.june_score visits_score(assessment.june_progress) json.third_quarter_score visits_score(assessment.third_quarter_progress) json.july_score visits_score(assessment.july_progress) json.august_score visits_score(assessment.august_progress) json.september_score visits_score(assessment.september_progress) json.fourth_quarter_score visits_score(assessment.fourth_quarter_progress) json.october_score visits_score(assessment.october_progress) json.november_score visits_score(assessment.november_progress) json.december_score visits_score(assessment.december_progress) else json.assessment '新增商机数' json.annual_score add_businesses_score(assessment.staff_id,'01-01','12-31') json.first_quarter_score add_businesses_score(assessment.staff_id,'01-01','03-31') json.january_score add_businesses_score(assessment.staff_id,'01-01','01-31') # assessment_year如果时闰年或则平年时的判断----02-28 02-29 json.february_score add_businesses_score(assessment.staff_id,'02-01','02-28') json.march_score add_businesses_score(assessment.staff_id,'03-01','03-31') json.second_quarter_score add_businesses_score(assessment.staff_id,'04-01','06-30') json.april_score add_businesses_score(assessment.staff_id,'04-01','04-30') json.may_score add_businesses_score(assessment.staff_id,'05-01','05-31') json.june_score add_businesses_score(assessment.staff_id,'06-01','06-30') json.third_quarter_score add_businesses_score(assessment.staff_id,'07-01','09-30') json.july_score add_businesses_score(assessment.staff_id,'07-01','07-31') json.august_score add_businesses_score(assessment.staff_id,'08-01','08-31') json.september_score add_businesses_score(assessment.staff_id,'09-01','09-30') json.fourth_quarter_score add_businesses_score(assessment.staff_id,'10-01','12-31') json.october_score add_businesses_score(assessment.staff_id,'10-01','10-31') json.november_score add_businesses_score(assessment.staff_id,'11-01','11-30') json.december_score add_businesses_score(assessment.staff_id,'12-01','12-31') end end end json.code 0 json.count @assessments.count # # # # # # # # #