I found the problem, the path definition part cannot be included in the function. It should be placed outside.
I don't know the principle.
//Warning: Be careful of extra spaces in the path
var myScript = app.activeScript;
var styPath = String(myScript.parent.parent + '/StylesLib/样式模板/001-base style.indt');
app.doScript(allStyImport, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'allStyImport')
//allStyImport();
function allStyImport() {
app.activeDocument.importStyles(ImportFormat.CHARACTER_STYLES_FORMAT, File(styPath), GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
app.activeDocument.importStyles(ImportFormat.PARAGRAPH_STYLES_FORMAT, File(styPath), GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
app.activeDocument.importStyles(ImportFormat.CELL_STYLES_FORMAT, File(styPath), GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
app.activeDocument.importStyles(ImportFormat.TABLE_STYLES_FORMAT, File(styPath), GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
app.activeDocument.importStyles(ImportFormat.TABLE_AND_CELL_STYLES_FORMAT, File(styPath), GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
app.activeDocument.importStyles(ImportFormat.OBJECT_STYLES_FORMAT, File(styPath), GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
}