first commit
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
const fs = require('fs');
|
||||
|
||||
// 完整的中文文本修复映射
|
||||
const textMap = {
|
||||
// 订单相关
|
||||
'订单状': '订单状态',
|
||||
'待处': '待处理',
|
||||
'生产中': '生产中',
|
||||
'已安': '已安装',
|
||||
'已完': '已完成',
|
||||
'已取': '已取消',
|
||||
'全部状': '全部状态',
|
||||
|
||||
// 客户相关
|
||||
'客户名': '客户名称',
|
||||
'请输入客户名': '请输入客户名称',
|
||||
|
||||
// 金额相关
|
||||
'请输入金': '请输入金额',
|
||||
|
||||
// 产品相关
|
||||
'蜂巢': '蜂巢帘',
|
||||
'梦幻': '梦幻帘',
|
||||
'柔纱': '柔纱帘',
|
||||
'罗马': '罗马帘',
|
||||
'百叶': '百叶帘',
|
||||
'香格里拉': '香格里拉帘',
|
||||
'卷帘': '卷帘',
|
||||
'纱窗': '纱窗',
|
||||
|
||||
// 姓名相关
|
||||
'王十': '王十二',
|
||||
'冯十': '冯十三',
|
||||
'陈十': '陈十四',
|
||||
'褚十': '褚十五',
|
||||
'卫十': '卫十六',
|
||||
'蒋十': '蒋十七',
|
||||
|
||||
// 其他
|
||||
'工具': '工具栏',
|
||||
'上一': '上一页',
|
||||
'下一': '下一页',
|
||||
'搜索和筛': '搜索和筛选',
|
||||
'计算属': '计算属性',
|
||||
'请填写完整信': '请填写完整信息',
|
||||
'订单已更': '订单已更新',
|
||||
'订单已创': '订单已创建',
|
||||
'确定要删除订': '确定要删除订单',
|
||||
'订单已删': '订单已删除',
|
||||
'按钮': '按钮组',
|
||||
'状态徽': '状态徽章',
|
||||
'响应': '响应式',
|
||||
'布艺对开': '布艺对开帘',
|
||||
'日夜蜂巢': '日夜蜂巢帘',
|
||||
|
||||
// 报价相关
|
||||
'报价表管': '报价表管理',
|
||||
'新建报价': '新建报价表',
|
||||
'标签页导': '标签页导航',
|
||||
'报价表生': '报价表生成',
|
||||
'搜索报价单号、客户名': '搜索报价单号、客户名称',
|
||||
'已发': '已发送',
|
||||
'已接': '已接受',
|
||||
'已拒': '已拒绝',
|
||||
'已过': '已过期',
|
||||
'方案A (标准': '方案A (标准型)',
|
||||
'方案B (升级': '方案B (升级型)'
|
||||
};
|
||||
|
||||
function fixFile(filePath) {
|
||||
let content = fs.readFileSync(filePath, 'utf8');
|
||||
let modified = false;
|
||||
|
||||
// 修复破碎的 HTML 标签
|
||||
const tagFixes = [
|
||||
{ pattern: />([^<]+)\/option>/g, replace: '>$1</option>' },
|
||||
{ pattern: />([^<]+)\/th>/g, replace: '>$1</th>' },
|
||||
{ pattern: />([^<]+)\/td>/g, replace: '>$1</td>' },
|
||||
{ pattern: />([^<]+)\/button>/g, replace: '>$1</button>' },
|
||||
{ pattern: />([^<]+)\/label>/g, replace: '>$1</label>' },
|
||||
{ pattern: />([^<]+)\/span>/g, replace: '>$1</span>' },
|
||||
{ pattern: />([^<]+)\/p>/g, replace: '>$1</p>' },
|
||||
{ pattern: />([^<]+)\/div>/g, replace: '>$1</div>' }
|
||||
];
|
||||
|
||||
tagFixes.forEach(fix => {
|
||||
const newContent = content.replace(fix.pattern, fix.replace);
|
||||
if (newContent !== content) {
|
||||
content = newContent;
|
||||
modified = true;
|
||||
}
|
||||
});
|
||||
|
||||
// 修复破碎的属性(缺少闭合引号)
|
||||
const attrFixes = [
|
||||
{ pattern: /placeholder="([^"]*)/g, check: (m) => !m.endsWith('"') },
|
||||
{ pattern: /title="([^"]*)/g, check: (m) => !m.endsWith('"') }
|
||||
];
|
||||
|
||||
attrFixes.forEach(fix => {
|
||||
content = content.replace(fix.pattern, (match) => {
|
||||
if (fix.check(match)) {
|
||||
modified = true;
|
||||
return match + '"';
|
||||
}
|
||||
return match;
|
||||
});
|
||||
});
|
||||
|
||||
// 修复中文文本
|
||||
Object.keys(textMap).forEach(broken => {
|
||||
if (content.includes(broken)) {
|
||||
content = content.split(broken).join(textMap[broken]);
|
||||
modified = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (modified) {
|
||||
fs.writeFileSync(filePath, content, 'utf8');
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const files = [
|
||||
'src/views/order/OrderList.vue',
|
||||
'src/views/order/OrderFollow.vue',
|
||||
'src/views/order/OrderRecheck.vue',
|
||||
'src/views/order/OrderTracking.vue',
|
||||
'src/views/quote/QuoteGenerate.vue'
|
||||
];
|
||||
|
||||
let fixed = 0;
|
||||
files.forEach(file => {
|
||||
if (fixFile(file)) {
|
||||
console.log('Fixed: ' + file);
|
||||
fixed++;
|
||||
} else {
|
||||
console.log('No changes: ' + file);
|
||||
}
|
||||
});
|
||||
|
||||
console.log('\nTotal fixed: ' + fixed + ' files');
|
||||
Reference in New Issue
Block a user