Compare commits

...

2 Commits

Author SHA1 Message Date
a05dc15f69 待办事项页面已完成 2025-05-09 11:17:27 +08:00
cc8bd92569 待办事项目前已经可以实现编辑执行人 2025-05-09 09:49:15 +08:00
5 changed files with 1391 additions and 47 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1247,18 +1247,30 @@ function addTodo(todoData) {
// 打开数据库连接 // 打开数据库连接
const db = new Database(dbPath); const db = new Database(dbPath);
// 获取当前本地时间
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const localDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const result = db.prepare(` const result = db.prepare(`
INSERT INTO todos ( INSERT INTO todos (
project, subproject, title, text, adduser, project, subproject, title, text, adduser,
completed, created_at, sche_time exeuser, completed, created_at, sche_time
) VALUES (?, ?, ?, ?, ?, 0, CURRENT_TIMESTAMP, ?) ) VALUES (?, ?, ?, ?, ?, ?, 0, ?, ?)
`).run( `).run(
todoData.project || '其它', todoData.project || '其它',
todoData.subproject || '其它', todoData.subproject || '其它',
todoData.title, todoData.title,
todoData.text || '', todoData.text || '',
todoData.adduser || '系统', todoData.adduser || '系统',
todoData.sche_time || new Date().toISOString() todoData.exeuser || null,
localDateTime,
todoData.sche_time || localDateTime
); );
db.close(); db.close();
@ -1294,6 +1306,16 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
// 打开数据库连接 // 打开数据库连接
const db = new Database(dbPath); const db = new Database(dbPath);
// 获取当前本地时间
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const localDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
const result = db.prepare(` const result = db.prepare(`
UPDATE todos UPDATE todos
SET completed = ?, SET completed = ?,
@ -1301,7 +1323,7 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
title = ?, title = ?,
text = ?, text = ?,
sche_time = ?, sche_time = ?,
complete_time = CASE WHEN ? = 1 THEN CURRENT_TIMESTAMP ELSE complete_time END complete_time = CASE WHEN ? = 1 THEN ? ELSE complete_time END
WHERE id = ? WHERE id = ?
`).run( `).run(
completed ? 1 : 0, completed ? 1 : 0,
@ -1310,6 +1332,7 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
text || '', text || '',
sche_time || null, sche_time || null,
completed ? 1 : 0, completed ? 1 : 0,
completed ? localDateTime : null,
id id
); );