feat: 完善采购申请流程 - 添加审批、执行、列表筛选排序功能

This commit is contained in:
System Administrator
2026-03-28 00:34:32 +07:00
parent 841f19e3f8
commit d437580500
306 changed files with 42669 additions and 27143 deletions
@@ -0,0 +1,29 @@
const db = require('./db-sqlite');
// 更新商品数据,将code字段中的原始型号信息提取出来存储到model字段
async function updateProducts() {
try {
// 获取所有商品
const result = await db.query('SELECT id, code FROM products');
const products = result.rows;
// 遍历商品,更新model字段
for (const product of products) {
// 提取code字段中第一个下划线之前的部分作为model
const underscoreIndex = product.code.indexOf('_');
if (underscoreIndex > 0) {
const model = product.code.substring(0, underscoreIndex);
await db.query('UPDATE products SET model = ? WHERE id = ?', [model, product.id]);
}
}
console.log('商品数据更新成功');
} catch (error) {
console.error('更新商品数据失败:', error);
} finally {
// 关闭数据库连接
db.db.close();
}
}
updateProducts();