- 更新公司支付账户模态框中的账户列表过滤逻辑 - 修改经销商支付账户列表中账户ID参数为可选类型 - 优化经销商搜索组件的状态管理和副作用处理 - 在支付记录列表中使用账户类别映射替代硬编码值枚举 - 为支付任务支付组件添加支付时间日期选择器 - 扩展对账单相关组件导出并新增发票选择功能 - 更新对账单发票列表的数据结构和初始化逻辑 - 在对账单列表中调整完成状态检查和发票上传按钮显示条件 - 重构对账单支付列表的列配置和表单字段定义 - 更新对账单搜索组件的状态管理逻辑 - 本地化文件中更新对账单相关字段标签和占位符文本 - 服务类型定义中更新账户类别和类型的枚举值 - 添加类型修复脚本用于处理数字数组类型转换问题 - 新增对账单发票表单项和模态框组件实现
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
function processFile(filePath) {
|
|
try {
|
|
let content = fs.readFileSync(filePath, "utf8");
|
|
const original = content;
|
|
|
|
// 替换所有 number[] 为 string[]
|
|
content = content.replace(/number\[\]/g, "string[]");
|
|
|
|
// 可选:替换其他相关类型
|
|
content = content.replace(/Array<number>/g, "Array<string>");
|
|
content = content.replace(
|
|
/ReadonlyArray<number>/g,
|
|
"ReadonlyArray<string>",
|
|
);
|
|
|
|
if (content !== original) {
|
|
fs.writeFileSync(filePath, content, "utf8");
|
|
console.log(`✓ Updated: ${path.relative(process.cwd(), filePath)}`);
|
|
return true;
|
|
}
|
|
return false;
|
|
} catch (error) {
|
|
console.error(`✗ Error processing ${filePath}:`, error.message);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function processDirectory(dirPath) {
|
|
let updatedCount = 0;
|
|
|
|
function walk(dir) {
|
|
const items = fs.readdirSync(dir);
|
|
|
|
for (const item of items) {
|
|
const fullPath = path.join(dir, item);
|
|
const stat = fs.statSync(fullPath);
|
|
|
|
if (stat.isDirectory()) {
|
|
walk(fullPath);
|
|
} else if (item.endsWith(".ts") || item.endsWith(".tsx")) {
|
|
if (processFile(fullPath)) {
|
|
updatedCount++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
walk(dirPath);
|
|
return updatedCount;
|
|
}
|
|
|
|
// 主程序
|
|
const targetDir = "src/services";
|
|
if (fs.existsSync(targetDir)) {
|
|
console.log(`Processing directory: ${targetDir}`);
|
|
const updated = processDirectory(targetDir);
|
|
console.log(`\nDone! Updated ${updated} files.`);
|
|
} else {
|
|
console.error(`Directory not found: ${targetDir}`);
|
|
process.exit(1);
|
|
}
|