增加配置的导入和导出功能
This commit is contained in:
@@ -891,19 +891,28 @@ function exportConfigs() {
|
||||
}
|
||||
}
|
||||
|
||||
// 下载导入模板
|
||||
function downloadTemplate() {
|
||||
try {
|
||||
window.open('/api/config/template', '_blank');
|
||||
} catch (error) {
|
||||
alert('模板下载失败: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 导入配置
|
||||
async function importConfigs(event) {
|
||||
const fileInput = event.target;
|
||||
const file = fileInput.files[0];
|
||||
if (!file) return;
|
||||
|
||||
if (!file.name.endsWith('.json')) {
|
||||
alert('只支持 JSON 格式的配置文件');
|
||||
if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.xls')) {
|
||||
alert('只支持 Excel 格式(.xlsx/.xls)的配置文件');
|
||||
fileInput.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!confirm('确定要导入配置吗?\n导入的配置会自动命名为"原名称_导入",并默认禁用。')) {
|
||||
if (!confirm('确定要导入配置吗?\n导入的配置会自动命名为"原名称_导入",默认禁用,排序号追加到末尾。')) {
|
||||
fileInput.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user