Yes, your emotional state affects how well you perform cognitive tasks. What kind of mood is beneficial or detrimental to job performance? It depends on the particular task at hand.
Cognitive neuroscientists at Washington University in St. Louis investigated the relationship between mood and cognitive performance by showing subjects ten-minute clips from both classic horror films (to elicit anxious feelings) and prime-time sitcoms (to elicit pleasant feelings). They found that the prefrontal cortex, the region of the brain linked to higher-level cognitive functions, is activated by a combination of mood state and cognitive task, but not by either one alone.
While happy moods seemed beneficial to certain cognitive tasks, they were detrimental to other tasks. Similarly, anxiety produced by the horror film clips was detrimental to some cognitive tasks, while beneficial to others. These findings suggest that the prefrontal cortex mediates the interaction between mood and cognition in order to regulate the performance of each mental task.
"Mood Linked To Cognitive Abilities" (Science Daily)