Based on the social cognitive theory, a moderated intermediary model is constructed to verify the mechanism of internal and external emotional factors in managers' self-efficacy and financial flexibility. Based on the data of A-share non-financial listed companies in China from 2013 to 2019, it is found that: Managers' self-efficacy and financial flexibility are significantly negatively correlated, and managers' work attitude plays an intermediary role between managers' self-efficacy and financial flexibility, while the strength of the intermediary role is affected by institutional investor sentiment and individual investor sentiment, and the influence degree of institutional investor sentiment is more obvious. Further research on the samples divided into state-owned enterprises and non-state-owned enterprises shows that the work attitude of managers in state-owned enterprises is more significantly affected by their sense of self-efficacy, and the intermediary role of work attitude is stronger. In state-owned enterprises, the influence of institutional investor sentiment on intermediary path is more obvious.