Phase-field approach to surface-induced phase transformations and dislocations